Merge git://git.denx.de/u-boot-usb
authorTom Rini <trini@konsulko.com>
Tue, 6 Jun 2017 01:05:51 +0000 (21:05 -0400)
committerTom Rini <trini@konsulko.com>
Tue, 6 Jun 2017 01:05:51 +0000 (21:05 -0400)
472 files changed:
Makefile
README
arch/Kconfig
arch/arc/include/asm/u-boot.h
arch/arm/Kconfig
arch/arm/config.mk
arch/arm/cpu/arm920t/Makefile
arch/arm/cpu/arm920t/ep93xx/speed.c
arch/arm/cpu/arm920t/s3c24x0/Makefile [deleted file]
arch/arm/cpu/arm920t/s3c24x0/cpu_info.c [deleted file]
arch/arm/cpu/arm920t/s3c24x0/speed.c [deleted file]
arch/arm/cpu/arm920t/s3c24x0/timer.c [deleted file]
arch/arm/cpu/arm920t/start.S
arch/arm/cpu/armv7/Makefile
arch/arm/cpu/armv7/lowlevel_init.S
arch/arm/cpu/armv7m/start.S
arch/arm/cpu/armv8/fsl-layerscape/Kconfig
arch/arm/cpu/armv8/fsl-layerscape/cpu.c
arch/arm/cpu/armv8/fsl-layerscape/fsl_lsch3_serdes.c
arch/arm/cpu/armv8/fsl-layerscape/lowlevel.S
arch/arm/cpu/armv8/fsl-layerscape/ppa.c
arch/arm/cpu/armv8/fsl-layerscape/soc.c
arch/arm/cpu/armv8/fsl-layerscape/spl.c
arch/arm/cpu/armv8/fwcall.c
arch/arm/cpu/armv8/sec_firmware.c
arch/arm/cpu/armv8/start.S
arch/arm/cpu/armv8/u-boot-spl.lds
arch/arm/dts/Makefile
arch/arm/dts/dm8168-evm.dts [new file with mode: 0644]
arch/arm/dts/dm816x-clocks.dtsi [new file with mode: 0644]
arch/arm/dts/dm816x.dtsi [new file with mode: 0644]
arch/arm/dts/sun50i-a64-bananapi-m64.dts [new file with mode: 0644]
arch/arm/dts/sun50i-a64-pine64-common.dtsi [deleted file]
arch/arm/dts/sun50i-a64-pine64-plus-u-boot.dtsi [new file with mode: 0644]
arch/arm/dts/sun50i-a64-pine64-plus.dts
arch/arm/dts/sun50i-a64-pine64.dts
arch/arm/dts/sun50i-a64.dtsi
arch/arm/dts/sun50i-h5-orangepi-pc2.dts
arch/arm/dts/sun50i-h5-orangepi-prime.dts [new file with mode: 0644]
arch/arm/dts/sun50i-h5.dtsi [new file with mode: 0644]
arch/arm/dts/sun8i-h3-nanopi-m1.dts [new file with mode: 0644]
arch/arm/dts/sun8i-h3-nanopi-neo.dts
arch/arm/dts/sun8i-h3-nanopi.dtsi [new file with mode: 0644]
arch/arm/include/asm/arch-am33xx/clock.h
arch/arm/include/asm/arch-am33xx/clocks_am33xx.h
arch/arm/include/asm/arch-am33xx/ddr_defs.h
arch/arm/include/asm/arch-am33xx/omap.h
arch/arm/include/asm/arch-fsl-layerscape/clock.h
arch/arm/include/asm/arch-fsl-layerscape/config.h
arch/arm/include/asm/arch-fsl-layerscape/cpu.h
arch/arm/include/asm/arch-fsl-layerscape/soc.h
arch/arm/include/asm/arch-imx/cpu.h
arch/arm/include/asm/arch-ls102xa/clock.h
arch/arm/include/asm/arch-ls102xa/soc.h [new file with mode: 0644]
arch/arm/include/asm/arch-s3c24x0/gpio.h [deleted file]
arch/arm/include/asm/arch-s3c24x0/iomux.h [deleted file]
arch/arm/include/asm/arch-s3c24x0/memory.h [deleted file]
arch/arm/include/asm/arch-s3c24x0/s3c2400.h [deleted file]
arch/arm/include/asm/arch-s3c24x0/s3c2410.h [deleted file]
arch/arm/include/asm/arch-s3c24x0/s3c2440.h [deleted file]
arch/arm/include/asm/arch-s3c24x0/s3c24x0.h [deleted file]
arch/arm/include/asm/arch-s3c24x0/s3c24x0_cpu.h [deleted file]
arch/arm/include/asm/bootm.h
arch/arm/include/asm/omap_common.h
arch/arm/include/asm/u-boot-arm.h
arch/arm/include/asm/u-boot.h
arch/arm/lib/Makefile
arch/arm/lib/bootm.c
arch/arm/lib/spl.c
arch/arm/mach-davinci/include/mach/davinci_misc.h
arch/arm/mach-davinci/include/mach/hardware.h
arch/arm/mach-omap2/Kconfig
arch/arm/mach-omap2/am33xx/Kconfig
arch/arm/mach-omap2/am33xx/Makefile
arch/arm/mach-omap2/am33xx/board.c
arch/arm/mach-omap2/am33xx/clock_ti816x.c
arch/arm/mach-omap2/am33xx/ddr.c
arch/arm/mach-omap2/am33xx/emif4.c
arch/arm/mach-omap2/am33xx/ti816x_emif4.c [new file with mode: 0644]
arch/arm/mach-omap2/utils.c
arch/mips/include/asm/u-boot.h
arch/nds32/include/asm/u-boot.h
arch/nds32/lib/bootm.c
arch/powerpc/cpu/ppc4xx/4xx_pci.c
arch/powerpc/cpu/ppc4xx/miiphy.c
arch/powerpc/cpu/ppc4xx/reginfo.c
arch/powerpc/include/asm/4xx_pci.h
arch/powerpc/include/asm/ppc.h [new file with mode: 0644]
arch/powerpc/include/asm/ppc4xx.h
arch/powerpc/include/asm/u-boot.h
arch/sandbox/cpu/cpu.c
arch/sandbox/include/asm/u-boot.h
arch/x86/cpu/baytrail/Kconfig
arch/x86/cpu/baytrail/early_uart.c
arch/x86/cpu/baytrail/fsp_configs.c
arch/x86/dts/bayleybay.dts
arch/x86/dts/baytrail_som-db5800-som-6867.dts
arch/x86/dts/conga-qeval20-qa3-e3845.dts
arch/x86/dts/dfi-bt700.dtsi
arch/x86/dts/minnowmax.dts
arch/x86/include/asm/arch-baytrail/fsp/fsp_configs.h
arch/x86/include/asm/arch-baytrail/fsp/fsp_vpd.h
arch/x86/include/asm/u-boot-x86.h
arch/x86/include/asm/u-boot.h
arch/x86/lib/fsp/fsp_support.c
board/AndesTech/adp-ag101p/adp-ag101p.c
board/Barix/ipam390/ipam390.c
board/LaCie/edminiv2/edminiv2.c
board/LaCie/net2big_v2/net2big_v2.c
board/LaCie/netspace_v2/netspace_v2.c
board/Marvell/aspenite/aspenite.c
board/Marvell/gplugd/gplugd.c
board/Marvell/guruplug/guruplug.c
board/Marvell/openrd/openrd.c
board/Marvell/sheevaplug/sheevaplug.c
board/Seagate/dockstar/dockstar.c
board/Seagate/goflexhome/goflexhome.c
board/Seagate/nas220/nas220.c
board/Synology/ds109/ds109.c
board/amazon/kc1/kc1.c
board/armltd/integrator/integrator.c
board/armltd/vexpress/vexpress_common.c
board/atmel/at91rm9200ek/at91rm9200ek.c
board/atmel/at91sam9261ek/at91sam9261ek.c
board/atmel/at91sam9263ek/at91sam9263ek.c
board/atmel/at91sam9m10g45ek/at91sam9m10g45ek.c
board/atmel/at91sam9rlek/at91sam9rlek.c
board/atmel/at91sam9x5ek/at91sam9x5ek.c
board/bluegiga/apx4devkit/apx4devkit.c
board/bluewater/gurnard/gurnard.c
board/bluewater/snapper9260/snapper9260.c
board/cirrus/edb93xx/edb93xx.c
board/compulab/cl-som-am57x/spl.c
board/compulab/common/common.c
board/compulab/common/eeprom.c
board/davinci/da8xxevm/da850evm.c
board/davinci/da8xxevm/omapl138_lcdk.c
board/davinci/ea20/ea20.c
board/esd/meesc/meesc.c
board/freescale/common/ns_access.c
board/freescale/ls1021aqds/ddr.c
board/freescale/ls1043aqds/ddr.c
board/freescale/ls1043ardb/ddr.c
board/freescale/ls1046aqds/ddr.c
board/freescale/ls1046ardb/ddr.c
board/freescale/ls2080a/ddr.c
board/freescale/ls2080a/ls2080a.c
board/freescale/ls2080aqds/MAINTAINERS
board/freescale/ls2080aqds/README
board/freescale/ls2080aqds/ddr.c
board/freescale/ls2080aqds/eth.c
board/freescale/ls2080aqds/ls2080aqds.c
board/freescale/ls2080ardb/ddr.c
board/freescale/ls2080ardb/eth_ls2080rdb.c
board/freescale/mx35pdk/mx35pdk.c
board/gateworks/gw_ventana/gw_ventana.c
board/gumstix/duovero/duovero.c
board/h2200/h2200.c
board/hisilicon/hikey/README
board/imx31_phycore/imx31_phycore.c
board/lego/ev3/legoev3.c
board/mini-box/picosam9g45/picosam9g45.c
board/nvidia/seaboard/seaboard.c
board/overo/common.c
board/ronetix/pm9261/pm9261.c
board/ronetix/pm9263/pm9263.c
board/ronetix/pm9g45/pm9g45.c
board/samsung/goni/goni.c
board/samsung/smdkc100/smdkc100.c
board/samsung/universal_c210/universal.c
board/siemens/common/board.c
board/spear/spear300/spear300.c
board/spear/spear310/spear310.c
board/spear/spear320/spear320.c
board/spear/spear600/spear600.c
board/spear/x600/x600.c
board/sunxi/MAINTAINERS
board/sunxi/board.c
board/ti/am57xx/board.c
board/ti/common/Kconfig
board/ti/ks2_evm/board_k2g.c
board/ti/omap5_uevm/evm.c
board/ti/panda/panda.c
board/ti/ti816x/evm.c
board/toradex/colibri_pxa270/colibri_pxa270.c
board/toradex/common/tdx-cfg-block.c
board/toradex/common/tdx-common.c
board/zipitz2/zipitz2.c
cmd/Kconfig
cmd/Makefile
cmd/elf.c
cmd/pci.c
common/Kconfig
common/Makefile
common/board_f.c
common/board_r.c
common/bootstage.c
common/dlmalloc.c
common/spl/Kconfig
common/spl/spl.c
configs/Sinlinx_SinA33_defconfig
configs/am335x_baltos_defconfig
configs/am335x_evm_nor_defconfig
configs/am335x_igep003x_defconfig
configs/am335x_shc_defconfig
configs/am335x_shc_ict_defconfig
configs/am335x_shc_netboot_defconfig
configs/am335x_shc_prompt_defconfig
configs/am335x_shc_sdboot_defconfig
configs/am335x_shc_sdboot_prompt_defconfig
configs/am335x_sl50_defconfig
configs/am43xx_evm_ethboot_defconfig
configs/am43xx_evm_qspiboot_defconfig
configs/am43xx_evm_usbhost_boot_defconfig
configs/am57xx_evm_nodt_defconfig
configs/apalis_imx6_defconfig
configs/apalis_imx6_nospl_com_defconfig
configs/apalis_imx6_nospl_it_defconfig
configs/at91sam9m10g45ek_mmc_defconfig
configs/at91sam9n12ek_mmc_defconfig
configs/at91sam9rlek_mmc_defconfig
configs/at91sam9x5ek_mmc_defconfig
configs/bananapi_m64_defconfig [new file with mode: 0644]
configs/bcm958622hr_defconfig
configs/birdland_bav335a_defconfig
configs/birdland_bav335b_defconfig
configs/brppt1_mmc_defconfig
configs/brppt1_nand_defconfig
configs/brppt1_spi_defconfig
configs/brxre1_defconfig
configs/cairo_defconfig
configs/chiliboard_defconfig
configs/cl-som-am57x_defconfig
configs/cm_t335_defconfig
configs/cm_t43_defconfig
configs/cm_t54_defconfig
configs/colibri_imx6_defconfig
configs/colibri_imx6_nospl_defconfig
configs/ds109_defconfig
configs/duovero_defconfig
configs/gurnard_defconfig
configs/hikey_defconfig
configs/igep0020_defconfig
configs/igep0030_defconfig
configs/igep0032_defconfig
configs/kzm9g_defconfig
configs/ls1021aiot_qspi_defconfig
configs/ls1021aiot_sdcard_defconfig
configs/ls1043ardb_sdcard_defconfig
configs/ls1046aqds_nand_defconfig
configs/ls1046aqds_sdcard_ifc_defconfig
configs/ls1046aqds_sdcard_qspi_defconfig
configs/ls1046ardb_emmc_defconfig
configs/ls1046ardb_sdcard_SECURE_BOOT_defconfig
configs/ls1046ardb_sdcard_defconfig
configs/ls2080aqds_nand_defconfig
configs/ls2080aqds_sdcard_defconfig [new file with mode: 0644]
configs/ls2080ardb_nand_defconfig
configs/m28evk_defconfig
configs/m53evk_defconfig
configs/ma5d4evk_defconfig
configs/mx7ulp_evk_defconfig
configs/mx7ulp_evk_plugin_defconfig
configs/nanopi_m1_defconfig [new file with mode: 0644]
configs/novena_defconfig
configs/omap3_beagle_defconfig
configs/omap3_overo_defconfig
configs/omap3_pandora_defconfig
configs/omap3_zoom1_defconfig
configs/omap4_panda_defconfig
configs/omap4_sdp4430_defconfig
configs/omap5_uevm_defconfig
configs/omapl138_lcdk_defconfig
configs/orangepi_prime_defconfig [new file with mode: 0644]
configs/pcm051_rev1_defconfig
configs/pcm051_rev3_defconfig
configs/pengwyn_defconfig
configs/pepper_defconfig
configs/pic32mzdask_defconfig
configs/picosam9g45_defconfig
configs/r8a7795_salvator-x_defconfig
configs/r8a7796_salvator-x_defconfig
configs/s5p_goni_defconfig
configs/sama5d2_ptc_nandflash_defconfig
configs/sama5d2_ptc_spiflash_defconfig
configs/sama5d2_xplained_mmc_defconfig
configs/sama5d36ek_cmp_mmc_defconfig
configs/sama5d36ek_cmp_nandflash_defconfig
configs/sama5d36ek_cmp_spiflash_defconfig
configs/sama5d3_xplained_mmc_defconfig
configs/sama5d3_xplained_nandflash_defconfig
configs/sama5d3xek_mmc_defconfig
configs/sama5d3xek_nandflash_defconfig
configs/sama5d3xek_spiflash_defconfig
configs/sama5d4_xplained_mmc_defconfig
configs/sama5d4ek_mmc_defconfig
configs/sandbox_defconfig
configs/sandbox_flattree_defconfig
configs/sandbox_noblk_defconfig
configs/sandbox_spl_defconfig
configs/ti814x_evm_defconfig
configs/ti816x_evm_defconfig
configs/zynq_zc770_xm011_defconfig
configs/zynq_zc770_xm012_defconfig
configs/zynq_zc770_xm013_defconfig
doc/device-tree-bindings/misc/intel,baytrail-fsp.txt
drivers/ddr/fsl/arm_ddr_gen3.c
drivers/ddr/fsl/ctrl_regs.c
drivers/ddr/fsl/fsl_ddr_gen4.c
drivers/ddr/fsl/options.c
drivers/ddr/fsl/util.c
drivers/gpio/Makefile
drivers/gpio/s3c2440_gpio.c [deleted file]
drivers/i2c/s3c24x0_i2c.c
drivers/mmc/Makefile
drivers/mmc/s3c_sdi.c [deleted file]
drivers/mtd/nand/Makefile
drivers/mtd/nand/s3c2410_nand.c [deleted file]
drivers/net/Kconfig
drivers/net/cpsw.c
drivers/net/designware.c
drivers/net/fm/ls1043.c
drivers/net/fm/ls1046.c
drivers/net/fsl-mc/dpio/qbman_portal.c
drivers/net/fsl-mc/mc.c
drivers/net/macb.c
drivers/net/mvpp2.c
drivers/net/pch_gbe.c
drivers/net/phy/Kconfig
drivers/net/phy/marvell.c
drivers/net/zynq_gem.c
drivers/pci/pcie_layerscape.c
drivers/pci/pcie_layerscape_fixup.c
drivers/qe/qe.c
drivers/ram/stm32_sdram.c
drivers/reset/sti-reset.c
drivers/usb/common/fsl-errata.c
drivers/usb/gadget/gadget_chips.h
drivers/usb/host/Makefile
drivers/usb/host/ehci-mx6.c
drivers/usb/host/ohci-hcd.c
drivers/usb/host/ohci-s3c24xx.c [deleted file]
drivers/usb/host/ohci-s3c24xx.h [deleted file]
drivers/video/sm501.c
fs/fat/Kconfig
include/api.h [new file with mode: 0644]
include/asm-generic/global_data.h
include/bootstage.h
include/common.h
include/config_fallbacks.h
include/configs/am43xx_evm.h
include/configs/apalis-tk1.h
include/configs/apalis_imx6.h
include/configs/apalis_t30.h
include/configs/at91-sama5_common.h
include/configs/at91sam9m10g45ek.h
include/configs/at91sam9n12ek.h
include/configs/at91sam9rlek.h
include/configs/at91sam9x5ek.h
include/configs/bcm23550_w1d.h
include/configs/bcm28155_ap.h
include/configs/bcm_ep_board.h
include/configs/brppt1.h
include/configs/brxre1.h
include/configs/calimain.h
include/configs/cl-som-am57x.h
include/configs/colibri_imx6.h
include/configs/colibri_t20.h
include/configs/colibri_t30.h
include/configs/da850evm.h
include/configs/devkit8000.h
include/configs/dra7xx_evm.h
include/configs/ds109.h
include/configs/ea20.h
include/configs/etamin.h
include/configs/exynos-common.h
include/configs/hikey.h
include/configs/ipam390.h
include/configs/k2e_evm.h
include/configs/k2g_evm.h
include/configs/k2hk_evm.h
include/configs/k2l_evm.h
include/configs/legoev3.h
include/configs/ls1012a_common.h
include/configs/ls1021aiot.h
include/configs/ls1021aqds.h
include/configs/ls1021atwr.h
include/configs/ls1043a_common.h
include/configs/ls1043ardb.h
include/configs/ls1046a_common.h
include/configs/ls2080a_common.h
include/configs/ls2080aqds.h
include/configs/m28evk.h
include/configs/m53evk.h
include/configs/ma5d4evk.h
include/configs/meson-gxbb-common.h
include/configs/mx7ulp_evk.h
include/configs/novena.h
include/configs/omap5_uevm.h
include/configs/omapl138_lcdk.h
include/configs/pic32mzdask.h
include/configs/picosam9g45.h
include/configs/rcar-gen2-common.h
include/configs/rcar-gen3-common.h
include/configs/rk3036_common.h
include/configs/rk3188_common.h
include/configs/rk3288_common.h
include/configs/rk3328_common.h
include/configs/rk3399_common.h
include/configs/rpi.h
include/configs/s5p_goni.h
include/configs/sama5d2_ptc.h
include/configs/sama5d3_xplained.h
include/configs/sama5d3xek.h
include/configs/sandbox.h
include/configs/siemens-am33x-common.h
include/configs/snapper9g45.h
include/configs/socfpga_arria10_socdk.h
include/configs/socfpga_arria5_socdk.h
include/configs/socfpga_cyclone5_socdk.h
include/configs/socfpga_de0_nano_soc.h
include/configs/socfpga_de10_nano.h
include/configs/socfpga_de1_soc.h
include/configs/socfpga_is1.h
include/configs/socfpga_mcvevk.h
include/configs/socfpga_sockit.h
include/configs/socfpga_socrates.h
include/configs/socfpga_sr1500.h
include/configs/socfpga_vining_fpga.h
include/configs/sunxi-common.h
include/configs/tegra-common-post.h
include/configs/tegra-common.h
include/configs/ti814x_evm.h
include/configs/ti816x_evm.h
include/configs/ti_armv7_common.h
include/configs/ti_armv7_keystone2.h
include/configs/uniphier.h
include/configs/xilinx_zynqmp.h
include/configs/zynq-common.h
include/dt-bindings/clock/sun50i-a64-ccu.h [new file with mode: 0644]
include/dt-bindings/reset/sun50i-a64-ccu.h [new file with mode: 0644]
include/environment/ti/dfu.h
include/fat.h
include/fdt.h
include/fsl-mc/fsl_mc.h
include/fsl_ifc.h
include/libfdt.h
lib/fdtdec.c
lib/libfdt/fdt.h [new file with mode: 0644]
lib/libfdt/libfdt.h [new file with mode: 0644]
lib/libfdt/libfdt.swig [deleted file]
lib/libfdt/pylibfdt/libfdt.i [new file with mode: 0644]
lib/libfdt/pylibfdt/setup.py [new file with mode: 0755]
lib/libfdt/setup.py [deleted file]
lib/time.c
net/eth-uclass.c
scripts/Makefile.lib
scripts/Makefile.spl
scripts/config_whitelist.txt
test/py/tests/test_hush_if_test.py
tools/Makefile
tools/binman/binman.py
tools/binman/control.py
tools/binman/etype/u_boot_dtb_with_ucode.py
tools/binman/fdt_test.py
tools/binman/func_test.py
tools/binman/test/45_prop_test.dts [new file with mode: 0644]
tools/dtoc/dtoc.py
tools/dtoc/fdt.py
tools/dtoc/fdt_fallback.py [deleted file]
tools/dtoc/fdt_normal.py [deleted file]
tools/dtoc/fdt_select.py [deleted file]

index 1b7cab212139ff3db9fae3b563b6dec7750326fe..62d0482bcf4a93930b3356342c5143230d54361e 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -3,9 +3,9 @@
 #
 
 VERSION = 2017
-PATCHLEVEL = 05
+PATCHLEVEL = 07
 SUBLEVEL =
-EXTRAVERSION =
+EXTRAVERSION = -rc1
 NAME =
 
 # *DOCUMENTATION*
@@ -1116,7 +1116,7 @@ cmd_ldr = $(LD) $(LDFLAGS_$(@F)) \
 
 u-boot.rom: u-boot-x86-16bit.bin u-boot.bin \
                $(if $(CONFIG_SPL_X86_16BIT_INIT),spl/u-boot-spl.bin) \
-               $(if $(CONFIG_HAVE_REFCODE),refcode.bin) FORCE
+               $(if $(CONFIG_HAVE_REFCODE),refcode.bin) checkbinman FORCE
        $(call if_changed,binman)
 
 OBJCOPYFLAGS_u-boot-x86-16bit.bin := -O binary -j .start16 -j .resetvec
@@ -1125,7 +1125,8 @@ u-boot-x86-16bit.bin: u-boot FORCE
 endif
 
 ifneq ($(CONFIG_ARCH_SUNXI),)
-u-boot-sunxi-with-spl.bin: spl/sunxi-spl.bin u-boot.img u-boot.dtb FORCE
+u-boot-sunxi-with-spl.bin: spl/sunxi-spl.bin u-boot.img u-boot.dtb \
+               checkbinman FORCE
        $(call if_changed,binman)
 endif
 
@@ -1354,6 +1355,18 @@ $(version_h): include/config/uboot.release FORCE
 $(timestamp_h): $(srctree)/Makefile FORCE
        $(call filechk,timestamp.h)
 
+checkbinman: tools
+       @if ! ( echo 'import libfdt' | ( PYTHONPATH=tools python )); then \
+               echo >&2; \
+               echo >&2 '*** binman needs the Python libfdt library.'; \
+               echo >&2 '*** Either install it on your system, or try:'; \
+               echo >&2 '***'; \
+               echo >&2 '*** sudo apt-get install swig libpython-dev'; \
+               echo >&2 '***'; \
+               echo >&2 '*** to have U-Boot build its own version.'; \
+               false; \
+       fi
+
 # ---------------------------------------------------------------------------
 quiet_cmd_cpp_lds = LDS     $@
 cmd_cpp_lds = $(CPP) -Wp,-MD,$(depfile) $(cpp_flags) $(LDPPFLAGS) \
diff --git a/README b/README
index 77d46d2b42e0856d92e8c3280e1172c3f608f4c3..075d919df3fee00e6c486e65344b1c1d61338422 100644 (file)
--- a/README
+++ b/README
@@ -840,7 +840,6 @@ The following options need to be configured:
                                          that work for multiple fs types
                CONFIG_CMD_FS_UUID      * Look up a filesystem UUID
                CONFIG_CMD_SAVEENV        saveenv
-               CONFIG_CMD_FAT          * FAT command support
                CONFIG_CMD_FLASH          flinfo, erase, protect
                CONFIG_CMD_FPGA           FPGA device initialization support
                CONFIG_CMD_GO           * the 'go' command (exec code)
@@ -1065,8 +1064,6 @@ The following options need to be configured:
 - Partition Labels (disklabels) Supported:
                Zero or more of the following:
                CONFIG_MAC_PARTITION   Apple's MacOS partition table.
-               CONFIG_DOS_PARTITION   MS Dos partition table, traditional on the
-                                      Intel architecture, USB sticks, etc.
                CONFIG_ISO_PARTITION   ISO partition table, used on CDROM etc.
                CONFIG_EFI_PARTITION   GPT partition table, common when EFI is the
                                       bootloader.  Note 2TB partition limit; see
@@ -1519,21 +1516,6 @@ The following options need to be configured:
                CONFIG_SYS_JFFS2_FIRST_BANK, CONFIG_SYS_JFFS2_NUM_BANKS
                Define these for a default partition on a NOR device
 
-- FAT(File Allocation Table) filesystem write function support:
-               CONFIG_FAT_WRITE
-
-               Define this to enable support for saving memory data as a
-               file in FAT formatted partition.
-
-               This will also enable the command "fatwrite" enabling the
-               user to write files to FAT.
-
-- FAT(File Allocation Table) filesystem cluster size:
-               CONFIG_FS_FAT_MAX_CLUSTSIZE
-
-               Define the max cluster size for fat operations else
-               a default value of 65536 will be defined.
-
 - Keyboard Support:
                See Kconfig help for available keyboard drivers.
 
@@ -3870,7 +3852,7 @@ but it can not erase, write this NOR flash by SRIO or PCIE interface.
          environment.
 
        - CONFIG_FAT_WRITE:
-         This should be defined. Otherwise it cannot save the environment file.
+         This must be enabled. Otherwise it cannot save the environment file.
 
 - CONFIG_ENV_IS_IN_MMC:
 
index e0e4e8486c067467bfb44d1e044cecf5fe6a0a04..e44767113db2f3d27645acd3e3e7da6601375562 100644 (file)
@@ -70,14 +70,15 @@ config SANDBOX
        select DM_SPI
        select DM_GPIO
        select DM_MMC
-       imply CRC32_VERIFY
        imply CMD_GETTIME
        imply CMD_HASH
        imply CMD_IO
        imply CMD_IOTRACE
-       imply LZMA
        imply CMD_LZMADEC
+       imply CRC32_VERIFY
+       imply FAT_WRITE
        imply HASH_VERIFY
+       imply LZMA
 
 config SH
        bool "SuperH architecture"
index e354edf95de4e56891b67b2a78fb4c729c8690ed..045487278ef0db8927d47ac4618b07d424aeffb6 100644 (file)
@@ -8,6 +8,7 @@
 #define __ASM_ARC_U_BOOT_H__
 
 #include <asm-generic/u-boot.h>
+#include <asm/u-boot-arc.h>
 
 /* For image.h:image_check_target_arch() */
 #define IH_ARCH_DEFAULT IH_ARCH_ARC
index a8118ce0dfbdd0505869e61986dc9806579e9ac2..dce41055619bae5ce28e97970513c69a7f203b73 100644 (file)
@@ -19,6 +19,15 @@ config HAS_VBAR
 config HAS_THUMB2
        bool
 
+# Used for compatibility with asm files copied from the kernel
+config ARM_ASM_UNIFIED
+       bool
+       default y
+
+# Used for compatibility with asm files copied from the kernel
+config THUMB2_KERNEL
+       bool
+
 # If set, the workarounds for these ARM errata are applied early during U-Boot
 # startup. Note that in general these options force the workarounds to be
 # applied; no CPU-type/version detection exists, unlike the similar options in
@@ -128,6 +137,7 @@ config CPU_V7
 config CPU_V7M
        bool
        select HAS_THUMB2
+       select THUMB2_KERNEL
        select SYS_CACHE_SHIFT_5
 
 config CPU_PXA
@@ -477,6 +487,7 @@ config ARCH_BCM283X
        select DM_SERIAL
        select DM_GPIO
        select OF_CONTROL
+       imply FAT_WRITE
 
 config TARGET_VEXPRESS_CA15_TC2
        bool "Support vexpress_ca15_tc2"
@@ -496,17 +507,20 @@ config TARGET_BCM23550_W1D
        bool "Support bcm23550_w1d"
        select CPU_V7
        imply CRC32_VERIFY
+       imply FAT_WRITE
 
 config TARGET_BCM28155_AP
        bool "Support bcm28155_ap"
        select CPU_V7
        imply CRC32_VERIFY
+       imply FAT_WRITE
 
 config TARGET_BCMCYGNUS
        bool "Support bcmcygnus"
        select CPU_V7
        imply CRC32_VERIFY
        imply CMD_HASH
+       imply FAT_WRITE
        imply HASH_VERIFY
 
 config TARGET_BCMNSP
@@ -530,6 +544,7 @@ config ARCH_EXYNOS
        select DM_SPI
        select DM_GPIO
        select DM_KEYBOARD
+       imply FAT_WRITE
 
 config ARCH_S5PC1XX
        bool "Samsung S5PC1XX"
@@ -602,6 +617,7 @@ config ARCH_RMOBILE
        select DM
        select DM_SERIAL
        select BOARD_EARLY_INIT_F
+       imply FAT_WRITE
        imply SYS_THUMB_BUILD
 
 config TARGET_S32V234EVB
@@ -634,6 +650,7 @@ config ARCH_SOCFPGA
        select SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION
        select SYS_THUMB_BUILD
        imply CRC32_VERIFY
+       imply FAT_WRITE
 
 config ARCH_SUNXI
        bool "Support sunxi (Allwinner) SoCs"
@@ -657,6 +674,7 @@ config ARCH_SUNXI
        select USB_STORAGE if DISTRO_DEFAULTS
        select USB_KEYBOARD if DISTRO_DEFAULTS
        select USE_TINY_PRINTF
+       imply FAT_WRITE
        imply PRE_CONSOLE_BUFFER
        imply SPL_GPIO_SUPPORT
        imply SPL_LIBCOMMON_SUPPORT
@@ -700,6 +718,7 @@ config ARCH_ZYNQ
        select SPL_CLK
        select CLK_ZYNQ
        imply CMD_CLK
+       imply FAT_WRITE
 
 config ARCH_ZYNQMP
        bool "Support Xilinx ZynqMP Platform"
@@ -713,9 +732,11 @@ config ARCH_ZYNQMP
        select SPL_BOARD_INIT if SPL
        select SPL_CLK
        select DM_USB if USB
+       imply FAT_WRITE
 
 config TEGRA
        bool "NVIDIA Tegra"
+       imply FAT_WRITE
 
 config TARGET_VEXPRESS64_AEMV8A
        bool "Support vexpress_aemv8a"
@@ -974,6 +995,7 @@ config ARCH_UNIPHIER
        select SPL_OF_CONTROL if SPL
        select SPL_PINCTRL if SPL
        select SUPPORT_SPL
+       imply FAT_WRITE
        help
          Support for UniPhier SoC family developed by Socionext Inc.
          (formerly, System LSI Business Division of Panasonic Corporation)
@@ -1016,6 +1038,7 @@ config ARCH_ROCKCHIP
        select DM_USB if USB
        select DM_PWM
        select DM_REGULATOR
+       imply FAT_WRITE
 
 config TARGET_THUNDERX_88XX
        bool "Support ThunderX 88xx"
index a5eebb95e5c6d58188c21da27cf56f8c61f1da8e..1a77779db4dec99041a639f504e1ec2f363648a1 100644 (file)
@@ -142,9 +142,11 @@ OBJCOPYFLAGS += -j .text -j .secure_text -j .secure_data -j .rodata -j .hash \
                -j .data -j .got -j .got.plt -j .u_boot_list -j .rel.dyn
 endif
 
-ifdef CONFIG_OF_EMBED
+# if a dtb section exists we always have to include it
+# there are only two cases where it is generated
+# 1) OF_EMBEDED is turned on
+# 2) unit tests include device tree blobs
 OBJCOPYFLAGS += -j .dtb.init.rodata
-endif
 
 ifdef CONFIG_EFI_LOADER
 OBJCOPYFLAGS += -j .efi_runtime -j .efi_runtime_rel
index 8faf34b87ec55e954355d820eda5bd3eefd2301e..948b764193c28685de12c9fbbde1caf01fe11907 100644 (file)
@@ -11,7 +11,6 @@ obj-y += cpu.o
 
 obj-$(CONFIG_EP93XX) += ep93xx/
 obj-$(CONFIG_IMX) += imx/
-obj-$(CONFIG_S3C24X0) += s3c24x0/
 
 # some files can only build in ARM mode
 
index 9dc60b6ff27627e7bbf6799675dada6b1a2d158c..f0ab7d4e3d6a953937d562400b320ed8868be3cc 100644 (file)
@@ -39,7 +39,7 @@ static ulong get_PLLCLK(uint32_t *pllreg)
 }
 
 /* return FCLK frequency */
-ulong get_FCLK()
+ulong get_FCLK(void)
 {
        const uint8_t fclk_divisors[] = { 1, 2, 4, 8, 16, 1, 1, 1 };
        struct syscon_regs *syscon = (struct syscon_regs *)SYSCON_BASE;
diff --git a/arch/arm/cpu/arm920t/s3c24x0/Makefile b/arch/arm/cpu/arm920t/s3c24x0/Makefile
deleted file mode 100644 (file)
index e78f8a0..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-#
-# (C) Copyright 2000-2006
-# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
-#
-# SPDX-License-Identifier:     GPL-2.0+
-#
-
-obj-$(CONFIG_DISPLAY_CPUINFO)  += cpu_info.o
-obj-y  += speed.o
-obj-y  += timer.o
diff --git a/arch/arm/cpu/arm920t/s3c24x0/cpu_info.c b/arch/arm/cpu/arm920t/s3c24x0/cpu_info.c
deleted file mode 100644 (file)
index fede51a..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * (C) Copyright 2010
- * David Mueller <d.mueller@elsoft.ch>
- *
- * SPDX-License-Identifier:    GPL-2.0+
- */
-
-#include <common.h>
-#include <asm/io.h>
-#include <asm/arch/s3c24x0_cpu.h>
-
-typedef ulong (*getfreq)(void);
-
-static const getfreq freq_f[] = {
-       get_FCLK,
-       get_HCLK,
-       get_PCLK,
-};
-
-static const char freq_c[] = { 'F', 'H', 'P' };
-
-int print_cpuinfo(void)
-{
-       int i;
-       char buf[32];
-/* the S3C2400 seems to be lacking a CHIP ID register */
-#ifndef CONFIG_S3C2400
-       ulong cpuid;
-       struct s3c24x0_gpio * const gpio = s3c24x0_get_base_gpio();
-
-       cpuid = readl(&gpio->gstatus1);
-       printf("CPUID: %8lX\n", cpuid);
-#endif
-       for (i = 0; i < ARRAY_SIZE(freq_f); i++)
-               printf("%cCLK: %8s MHz\n", freq_c[i], strmhz(buf, freq_f[i]()));
-
-       return 0;
-}
diff --git a/arch/arm/cpu/arm920t/s3c24x0/speed.c b/arch/arm/cpu/arm920t/s3c24x0/speed.c
deleted file mode 100644 (file)
index 3701c5d..0000000
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
- * (C) Copyright 2001-2004
- * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
- *
- * (C) Copyright 2002
- * David Mueller, ELSOFT AG, d.mueller@elsoft.ch
- *
- * SPDX-License-Identifier:    GPL-2.0+
- */
-
-/* This code should work for both the S3C2400 and the S3C2410
- * as they seem to have the same PLL and clock machinery inside.
- * The different address mapping is handled by the s3c24xx.h files below.
- */
-
-#include <common.h>
-#ifdef CONFIG_S3C24X0
-
-#include <asm/io.h>
-#include <asm/arch/s3c24x0_cpu.h>
-
-#define MPLL 0
-#define UPLL 1
-
-/* ------------------------------------------------------------------------- */
-/* NOTE: This describes the proper use of this file.
- *
- * CONFIG_SYS_CLK_FREQ should be defined as the input frequency of the PLL.
- *
- * get_FCLK(), get_HCLK(), get_PCLK() and get_UCLK() return the clock of
- * the specified bus in HZ.
- */
-/* ------------------------------------------------------------------------- */
-
-static ulong get_PLLCLK(int pllreg)
-{
-       struct s3c24x0_clock_power *clk_power = s3c24x0_get_base_clock_power();
-       ulong r, m, p, s;
-
-       if (pllreg == MPLL)
-               r = readl(&clk_power->mpllcon);
-       else if (pllreg == UPLL)
-               r = readl(&clk_power->upllcon);
-       else
-               hang();
-
-       m = ((r & 0xFF000) >> 12) + 8;
-       p = ((r & 0x003F0) >> 4) + 2;
-       s = r & 0x3;
-
-#if defined(CONFIG_S3C2440)
-       if (pllreg == MPLL)
-               return 2 * m * (CONFIG_SYS_CLK_FREQ / (p << s));
-#endif
-       return (CONFIG_SYS_CLK_FREQ * m) / (p << s);
-
-}
-
-/* return FCLK frequency */
-ulong get_FCLK(void)
-{
-       return get_PLLCLK(MPLL);
-}
-
-/* return HCLK frequency */
-ulong get_HCLK(void)
-{
-       struct s3c24x0_clock_power *clk_power = s3c24x0_get_base_clock_power();
-#ifdef CONFIG_S3C2440
-       switch (readl(&clk_power->clkdivn) & 0x6) {
-       default:
-       case 0:
-               return get_FCLK();
-       case 2:
-               return get_FCLK() / 2;
-       case 4:
-               return (readl(&clk_power->camdivn) & (1 << 9)) ?
-                       get_FCLK() / 8 : get_FCLK() / 4;
-       case 6:
-               return (readl(&clk_power->camdivn) & (1 << 8)) ?
-                       get_FCLK() / 6 : get_FCLK() / 3;
-       }
-#else
-       return (readl(&clk_power->clkdivn) & 2) ? get_FCLK() / 2 : get_FCLK();
-#endif
-}
-
-/* return PCLK frequency */
-ulong get_PCLK(void)
-{
-       struct s3c24x0_clock_power *clk_power = s3c24x0_get_base_clock_power();
-
-       return (readl(&clk_power->clkdivn) & 1) ? get_HCLK() / 2 : get_HCLK();
-}
-
-/* return UCLK frequency */
-ulong get_UCLK(void)
-{
-       return get_PLLCLK(UPLL);
-}
-
-#endif /* CONFIG_S3C24X0 */
diff --git a/arch/arm/cpu/arm920t/s3c24x0/timer.c b/arch/arm/cpu/arm920t/s3c24x0/timer.c
deleted file mode 100644 (file)
index ba1e616..0000000
+++ /dev/null
@@ -1,160 +0,0 @@
-/*
- * (C) Copyright 2002
- * Sysgo Real-Time Solutions, GmbH <www.elinos.com>
- * Marius Groeger <mgroeger@sysgo.de>
- *
- * (C) Copyright 2002
- * Sysgo Real-Time Solutions, GmbH <www.elinos.com>
- * Alex Zuepke <azu@sysgo.de>
- *
- * (C) Copyright 2002
- * Gary Jennejohn, DENX Software Engineering, <garyj@denx.de>
- *
- * SPDX-License-Identifier:    GPL-2.0+
- */
-
-#include <common.h>
-#ifdef CONFIG_S3C24X0
-
-#include <asm/io.h>
-#include <asm/arch/s3c24x0_cpu.h>
-
-DECLARE_GLOBAL_DATA_PTR;
-
-int timer_init(void)
-{
-       struct s3c24x0_timers *timers = s3c24x0_get_base_timers();
-       ulong tmr;
-
-       /* use PWM Timer 4 because it has no output */
-       /* prescaler for Timer 4 is 16 */
-       writel(0x0f00, &timers->tcfg0);
-       if (gd->arch.tbu == 0) {
-               /*
-                * for 10 ms clock period @ PCLK with 4 bit divider = 1/2
-                * (default) and prescaler = 16. Should be 10390
-                * @33.25MHz and 15625 @ 50 MHz
-                */
-               gd->arch.tbu = get_PCLK() / (2 * 16 * 100);
-               gd->arch.timer_rate_hz = get_PCLK() / (2 * 16);
-       }
-       /* load value for 10 ms timeout */
-       writel(gd->arch.tbu, &timers->tcntb4);
-       /* auto load, manual update of timer 4 */
-       tmr = (readl(&timers->tcon) & ~0x0700000) | 0x0600000;
-       writel(tmr, &timers->tcon);
-       /* auto load, start timer 4 */
-       tmr = (tmr & ~0x0700000) | 0x0500000;
-       writel(tmr, &timers->tcon);
-       gd->arch.lastinc = 0;
-       gd->arch.tbl = 0;
-
-       return 0;
-}
-
-/*
- * timer without interrupts
- */
-ulong get_timer(ulong base)
-{
-       return get_timer_masked() - base;
-}
-
-void __udelay (unsigned long usec)
-{
-       ulong tmo;
-       ulong start = get_ticks();
-
-       tmo = usec / 1000;
-       tmo *= (gd->arch.tbu * 100);
-       tmo /= 1000;
-
-       while ((ulong) (get_ticks() - start) < tmo)
-               /*NOP*/;
-}
-
-ulong get_timer_masked(void)
-{
-       ulong tmr = get_ticks();
-
-       return tmr / (gd->arch.timer_rate_hz / CONFIG_SYS_HZ);
-}
-
-void udelay_masked(unsigned long usec)
-{
-       ulong tmo;
-       ulong endtime;
-       signed long diff;
-
-       if (usec >= 1000) {
-               tmo = usec / 1000;
-               tmo *= (gd->arch.tbu * 100);
-               tmo /= 1000;
-       } else {
-               tmo = usec * (gd->arch.tbu * 100);
-               tmo /= (1000 * 1000);
-       }
-
-       endtime = get_ticks() + tmo;
-
-       do {
-               ulong now = get_ticks();
-               diff = endtime - now;
-       } while (diff >= 0);
-}
-
-/*
- * This function is derived from PowerPC code (read timebase as long long).
- * On ARM it just returns the timer value.
- */
-unsigned long long get_ticks(void)
-{
-       struct s3c24x0_timers *timers = s3c24x0_get_base_timers();
-       ulong now = readl(&timers->tcnto4) & 0xffff;
-
-       if (gd->arch.lastinc >= now) {
-               /* normal mode */
-               gd->arch.tbl += gd->arch.lastinc - now;
-       } else {
-               /* we have an overflow ... */
-               gd->arch.tbl += gd->arch.lastinc + gd->arch.tbu - now;
-       }
-       gd->arch.lastinc = now;
-
-       return gd->arch.tbl;
-}
-
-/*
- * 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 CONFIG_SYS_HZ;
-}
-
-/*
- * reset the cpu by setting up the watchdog timer and let him time out
- */
-void reset_cpu(ulong ignored)
-{
-       struct s3c24x0_watchdog *watchdog;
-
-       watchdog = s3c24x0_get_base_watchdog();
-
-       /* Disable watchdog */
-       writel(0x0000, &watchdog->wtcon);
-
-       /* Initialize watchdog timer count register */
-       writel(0x0001, &watchdog->wtcnt);
-
-       /* Enable watchdog timer; assert reset at timer timeout */
-       writel(0x0021, &watchdog->wtcon);
-
-       while (1)
-               /* loop forever and wait for reset to happen */;
-
-       /*NOTREACHED*/
-}
-
-#endif /* CONFIG_S3C24X0 */
index 3ada6d026fa9d37036a0bf0978e4f0c22930d9de..3880a402d8ad04a5ab567a327980ddc8ef3129ed 100644 (file)
@@ -50,43 +50,6 @@ copyex:
        bne     copyex
 #endif
 
-#ifdef CONFIG_S3C24X0
-       /* turn off the watchdog */
-
-# if defined(CONFIG_S3C2400)
-#  define pWTCON       0x15300000
-#  define INTMSK       0x14400008      /* Interrupt-Controller base addresses */
-#  define CLKDIVN      0x14800014      /* clock divisor register */
-#else
-#  define pWTCON       0x53000000
-#  define INTMSK       0x4A000008      /* Interrupt-Controller base addresses */
-#  define INTSUBMSK    0x4A00001C
-#  define CLKDIVN      0x4C000014      /* clock divisor register */
-# endif
-
-       ldr     r0, =pWTCON
-       mov     r1, #0x0
-       str     r1, [r0]
-
-       /*
-        * mask all IRQs by setting all bits in the INTMR - default
-        */
-       mov     r1, #0xffffffff
-       ldr     r0, =INTMSK
-       str     r1, [r0]
-# if defined(CONFIG_S3C2410)
-       ldr     r1, =0x3ff
-       ldr     r0, =INTSUBMSK
-       str     r1, [r0]
-# endif
-
-       /* FCLK:HCLK:PCLK = 1:2:4 */
-       /* default FCLK is 120 MHz ! */
-       ldr     r0, =CLKDIVN
-       mov     r1, #3
-       str     r1, [r0]
-#endif /* CONFIG_S3C24X0 */
-
        /*
         * we do sys-critical inits only at reboot,
         * not when booting from ram!
index 5fac252c0e008a497f06627a3c40903bb7b0ecb1..45dd3caec6b316b801afd6810e277b1b7932b1d4 100644 (file)
@@ -12,11 +12,9 @@ obj-y        += cache_v7.o cache_v7_asm.o
 obj-y  += cpu.o cp15.o
 obj-y  += syslib.o
 
-ifneq ($(CONFIG_AM43XX)$(CONFIG_AM33XX)$(CONFIG_OMAP44XX)$(CONFIG_OMAP54XX)$(CONFIG_TEGRA)$(CONFIG_MX6)$(CONFIG_MX7)$(CONFIG_TI81XX)$(CONFIG_AT91FAMILY)$(CONFIG_ARCH_SUNXI)$(CONFIG_ARCH_SOCFPGA)$(CONFIG_ARCH_MX7ULP)$(CONFIG_ARCH_LS1021A),)
 ifneq ($(CONFIG_SKIP_LOWLEVEL_INIT),y)
 obj-y  += lowlevel_init.o
 endif
-endif
 
 obj-$(CONFIG_ARM_SMCCC)                += smccc-call.o
 obj-$(CONFIG_ARMV7_NONSEC)     += nonsec_virt.o virt-v7.o virt-dt.o
index 658934d664a4ab5827169da13aa2728a395bc171..64f105864f874080b669a4dd96f5837c01c3a407 100644 (file)
 #include <config.h>
 #include <linux/linkage.h>
 
-ENTRY(lowlevel_init)
+.pushsection .text.s_init, "ax"
+WEAK(s_init)
+       bx      lr
+ENDPROC(s_init)
+.popsection
+
+.pushsection .text.lowlevel_init, "ax"
+WEAK(lowlevel_init)
        /*
         * Setup a temporary stack. Global data is not available yet.
         */
@@ -61,3 +68,4 @@ ENTRY(lowlevel_init)
        bl      s_init
        pop     {ip, pc}
 ENDPROC(lowlevel_init)
+.popsection
index 49f27201cf8ad09ea78173efac40f7ab52b40123..890c7739635961039eb6fffd0d2655c3836888b5 100644 (file)
@@ -5,10 +5,12 @@
  * SPDX-License-Identifier:    GPL-2.0+
  */
 
+#include <asm/assembler.h>
+
 .globl reset
 .type reset, %function
 reset:
-       b       _main
+       W(b)    _main
 
 .globl c_runtime_cpu_setup
 c_runtime_cpu_setup:
index fa386c6896287b89f8f06731e501875baf5efe17..d8b285dcd7318cdb2ecc69f27be2e0b09404bd3b 100644 (file)
@@ -135,6 +135,19 @@ config FSL_LS_PPA
          which is loaded during boot stage, and then remains resident in RAM
          and runs in the TrustZone after boot.
          Say y to enable it.
+
+config SPL_FSL_LS_PPA
+       bool "FSL Layerscape PPA firmware support for SPL build"
+       depends on !ARMV8_PSCI
+       select SPL_ARMV8_SEC_FIRMWARE_SUPPORT
+       select SEC_FIRMWARE_ARMV8_PSCI
+       select ARMV8_SEC_FIRMWARE_ERET_ADDR_REVERT if FSL_LSCH2
+       help
+         The FSL Primary Protected Application (PPA) is a software component
+         which is loaded during boot stage, and then remains resident in RAM
+         and runs in the TrustZone after boot. This is to load PPA during SPL
+         stage instead of the RAM version of U-Boot. Once PPA is initialized,
+         the rest of U-Boot (including RAM version) runs at EL2.
 choice
        prompt "FSL Layerscape PPA firmware loading-media select"
        depends on FSL_LS_PPA
index cba0095e6a1d92449b46d5fc6ab7cb85a7cf4a1c..c6fede31bab73d06aaf36b35aceda16dd915164e 100644 (file)
@@ -27,6 +27,7 @@
 #ifdef CONFIG_SYS_FSL_DDR
 #include <fsl_ddr.h>
 #endif
+#include <asm/arch/clock.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -244,6 +245,14 @@ u64 get_page_table_size(void)
 
 int arch_cpu_init(void)
 {
+       /*
+        * This function is called before U-Boot relocates itself to speed up
+        * on system running. It is not necessary to run if performance is not
+        * critical. Skip if MMU is already enabled by SPL or other means.
+        */
+       if (get_sctlr() & CR_M)
+               return 0;
+
        icache_enable();
        __asm_invalidate_dcache_all();
        __asm_invalidate_tlb_all();
@@ -464,7 +473,7 @@ int cpu_eth_init(bd_t *bis)
 {
        int error = 0;
 
-#ifdef CONFIG_FSL_MC_ENET
+#if defined(CONFIG_FSL_MC_ENET) && !defined(CONFIG_SPL_BUILD)
        error = fsl_mc_ldpaa_init(bis);
 #endif
 #ifdef CONFIG_FMAN_ENET
@@ -530,7 +539,8 @@ int timer_init(void)
        unsigned long cntfrq = COUNTER_FREQUENCY_REAL;
 
        /* Update with accurate clock frequency */
-       asm volatile("msr cntfrq_el0, %0" : : "r" (cntfrq) : "memory");
+       if (current_el() == 3)
+               asm volatile("msr cntfrq_el0, %0" : : "r" (cntfrq) : "memory");
 #endif
 
 #ifdef CONFIG_FSL_LSCH3
@@ -608,7 +618,7 @@ phys_size_t board_reserve_ram_top(phys_size_t ram_size)
 {
        phys_size_t ram_top = ram_size;
 
-#ifdef CONFIG_FSL_MC_ENET
+#if defined(CONFIG_FSL_MC_ENET) && !defined(CONFIG_SPL_BUILD)
        /* The start address of MC reserved memory needs to be aligned. */
        ram_top -= mc_get_dram_block_size();
        ram_top &= ~(CONFIG_SYS_MC_RSV_MEM_ALIGN - 1);
@@ -723,7 +733,7 @@ int dram_init_banksize(void)
        }
 #endif /* CONFIG_SYS_MEM_RESERVE_SECURE */
 
-#ifdef CONFIG_FSL_MC_ENET
+#if defined(CONFIG_FSL_MC_ENET) && !defined(CONFIG_SPL_BUILD)
        /* Assign memory for MC */
 #ifdef CONFIG_SYS_DDR_BLOCK3_BASE
        if (gd->bd->bi_dram[2].size >=
index 955e0b747854383a1de097f886d7aafae30fbf48..ef97556367c1b055120b573bbeafd43b1a5cf378 100644 (file)
@@ -18,7 +18,7 @@ static u8 serdes1_prtcl_map[SERDES_PRCTL_COUNT];
 static u8 serdes2_prtcl_map[SERDES_PRCTL_COUNT];
 #endif
 
-#ifdef CONFIG_FSL_MC_ENET
+#if defined(CONFIG_FSL_MC_ENET) && !defined(CONFIG_SPL_BUILD)
 int xfi_dpmac[XFI8 + 1];
 int sgmii_dpmac[SGMII16 + 1];
 #endif
@@ -110,7 +110,7 @@ void serdes_init(u32 sd, u32 sd_addr, u32 rcwsr, u32 sd_prctl_mask,
                        debug("Unknown SerDes lane protocol %d\n", lane_prtcl);
                else {
                        serdes_prtcl_map[lane_prtcl] = 1;
-#ifdef CONFIG_FSL_MC_ENET
+#if defined(CONFIG_FSL_MC_ENET) && !defined(CONFIG_SPL_BUILD)
                        switch (lane_prtcl) {
                        case QSGMII_A:
                        case QSGMII_B:
@@ -141,7 +141,7 @@ void serdes_init(u32 sd, u32 sd_addr, u32 rcwsr, u32 sd_prctl_mask,
 
 void fsl_serdes_init(void)
 {
-#ifdef CONFIG_FSL_MC_ENET
+#if defined(CONFIG_FSL_MC_ENET) && !defined(CONFIG_SPL_BUILD)
        int i , j;
 
        for (i = XFI1, j = 1; i <= XFI8; i++, j++)
index f4273561040f9deede84f2c0bb5d99a907b09b3b..619d9b7a0eda718bcb3ab7a5fc44e634e8ac870b 100644 (file)
@@ -73,6 +73,9 @@ ENDPROC(smp_kick_all_cpus)
 ENTRY(lowlevel_init)
        mov     x29, lr                 /* Save LR */
 
+       switch_el x1, 1f, 100f, 100f    /* skip if not in EL3 */
+1:
+
 #ifdef CONFIG_FSL_LSCH3
 
        /* Set Wuo bit for RN-I 20 */
@@ -193,6 +196,7 @@ ENTRY(lowlevel_init)
 #endif
 #endif
 
+100:
        branch_if_master x0, x1, 2f
 
 #if defined(CONFIG_MP) && defined(CONFIG_ARMV8_MULTIENTRY)
@@ -201,6 +205,8 @@ ENTRY(lowlevel_init)
 #endif
 
 2:
+       switch_el x1, 1f, 100f, 100f    /* skip if not in EL3 */
+1:
 #ifdef CONFIG_FSL_TZPC_BP147
        /* Set Non Secure access for all devices protected via TZPC */
        ldr     x1, =TZPCDECPROT_0_SET_BASE /* Decode Protection-0 Set Reg */
@@ -266,8 +272,11 @@ ENTRY(lowlevel_init)
        isb
        dsb     sy
 #endif
+100:
 1:
 #ifdef CONFIG_ARCH_LS1046A
+       switch_el x1, 1f, 100f, 100f    /* skip if not in EL3 */
+1:
        /* Initialize the L2 RAM latency */
        mrs   x1, S3_1_c11_c0_2
        mov   x0, #0x1C7
@@ -279,6 +288,7 @@ ENTRY(lowlevel_init)
        orr   x1,  x1, #0x80
        msr   S3_1_c11_c0_2, x1
        isb
+100:
 #endif
 
 #if defined(CONFIG_FSL_LSCH2) && !defined(CONFIG_SPL_BUILD)
@@ -379,11 +389,14 @@ ENTRY(__asm_flush_l3_dcache)
        /*
         * Return status in x0
         *    success 0
-        *    tmeout 1 for setting SFONLY, 2 for FAM, 3 for both
+        *    timeout 1 for setting SFONLY, 2 for FAM, 3 for both
         */
        mov     x29, lr
        mov     x8, #0
 
+       switch_el x0, 1f, 100f, 100f    /* skip if not in EL3 */
+
+1:
        dsb     sy
        mov     x0, #0x1                /* HNFPSTAT_SFONLY */
        bl      hnf_set_pstate
@@ -401,6 +414,7 @@ ENTRY(__asm_flush_l3_dcache)
        bl      hnf_pstate_poll
        cbz     x0, 1f
        add     x8, x8, #0x2
+100:
 1:
        mov     x0, x8
        mov     lr, x29
index 26c47a183c668c4f8754d7727230704b10646b37..35c612df05181ea7301a578cb7db30d7de202100 100644 (file)
@@ -32,6 +32,7 @@ DECLARE_GLOBAL_DATA_PTR;
 
 int ppa_init(void)
 {
+       unsigned int el = current_el();
        void *ppa_fit_addr;
        u32 *boot_loc_ptr_l, *boot_loc_ptr_h;
        int ret;
@@ -45,6 +46,12 @@ int ppa_init(void)
 #endif
 #endif
 
+       /* Skip if running at lower exception level */
+       if (el < 3) {
+               debug("Skipping PPA init, running at EL%d\n", el);
+               return 0;
+       }
+
 #ifdef CONFIG_SYS_LS_PPA_FW_IN_XIP
        ppa_fit_addr = (void *)CONFIG_SYS_LS_PPA_FW_ADDR;
        debug("%s: PPA image load from XIP\n", __func__);
index 9e3cdd78af5b6f70fffc9298801c69331f599462..0943e833d740a10efed6da9b42b016629e2b26f2 100644 (file)
@@ -134,7 +134,7 @@ void erratum_a009635(void)
 
 static void erratum_rcw_src(void)
 {
-#if defined(CONFIG_SPL)
+#if defined(CONFIG_SPL) && defined(CONFIG_NAND_BOOT)
        u32 __iomem *dcfg_ccsr = (u32 __iomem *)DCFG_BASE;
        u32 __iomem *dcfg_dcsr = (u32 __iomem *)DCFG_DCSR_BASE;
        u32 val;
@@ -288,6 +288,10 @@ static void erratum_a008850_early(void)
        struct ccsr_cci400 __iomem *cci = (void *)CONFIG_SYS_CCI400_ADDR;
        struct ccsr_ddr __iomem *ddr = (void *)CONFIG_SYS_FSL_DDR_ADDR;
 
+       /* Skip if running at lower exception level */
+       if (current_el() < 3)
+               return;
+
        /* disables propagation of barrier transactions to DDRC from CCI400 */
        out_le32(&cci->ctrl_ord, CCI400_CTRLORD_TERM_BARRIER);
 
@@ -304,6 +308,10 @@ void erratum_a008850_post(void)
        struct ccsr_ddr __iomem *ddr = (void *)CONFIG_SYS_FSL_DDR_ADDR;
        u32 tmp;
 
+       /* Skip if running at lower exception level */
+       if (current_el() < 3)
+               return;
+
        /* enable propagation of barrier transactions to DDRC from CCI400 */
        out_le32(&cci->ctrl_ord, CCI400_CTRLORD_EN_BARRIER);
 
@@ -455,8 +463,10 @@ void fsl_lsch2_early_init_f(void)
         * Enable snoop requests and DVM message requests for
         * Slave insterface S4 (A53 core cluster)
         */
-       out_le32(&cci->slave[4].snoop_ctrl,
-                CCI400_DVM_MESSAGE_REQ_EN | CCI400_SNOOP_REQ_EN);
+       if (current_el() == 3) {
+               out_le32(&cci->slave[4].snoop_ctrl,
+                        CCI400_DVM_MESSAGE_REQ_EN | CCI400_SNOOP_REQ_EN);
+       }
 
        /* Erratum */
        erratum_a008850_early(); /* part 1 of 2 */
index eb730e84a46d58b3442eef404a4df4f7d87bfcfb..2776240be38bef1ae93c80861b22d953426c44dc 100644 (file)
@@ -9,6 +9,9 @@
 #include <asm/io.h>
 #include <fsl_ifc.h>
 #include <i2c.h>
+#include <fsl_csu.h>
+#include <asm/arch/fdt.h>
+#include <asm/arch/ppa.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -57,6 +60,12 @@ void spl_board_init(void)
        val = (in_le32(SMMU_NSCR0) | SCR0_CLIENTPD_MASK) & ~(SCR0_USFCFG_MASK);
        out_le32(SMMU_NSCR0, val);
 #endif
+#ifdef CONFIG_LAYERSCAPE_NS_ACCESS
+       enable_layerscape_ns_access();
+#endif
+#ifdef CONFIG_SPL_FSL_LS_PPA
+       ppa_init();
+#endif
 }
 
 void board_init_f(ulong dummy)
@@ -76,5 +85,35 @@ void board_init_f(ulong dummy)
        i2c_init_all();
 #endif
        dram_init();
-}
+#ifdef CONFIG_SPL_FSL_LS_PPA
+#ifndef CONFIG_SYS_MEM_RESERVE_SECURE
+#error Need secure RAM for PPA
 #endif
+       /*
+        * Secure memory location is determined in dram_init_banksize().
+        * gd->ram_size is deducted by the size of secure ram.
+        */
+       dram_init_banksize();
+
+       /*
+        * After dram_init_bank_size(), we know U-Boot only uses the first
+        * memory bank regardless how big the memory is.
+        */
+       gd->ram_top = gd->bd->bi_dram[0].start + gd->bd->bi_dram[0].size;
+
+       /*
+        * If PPA is loaded, U-Boot will resume running at EL2.
+        * Cache and MMU will be enabled. Need a place for TLB.
+        * U-Boot will be relocated to the end of available memory
+        * in first bank. At this point, we cannot know how much
+        * memory U-Boot uses. Put TLB table lower by SPL_TLB_SETBACK
+        * to avoid overlapping. As soon as the RAM version U-Boot sets
+        * up new MMU, this space is no longer needed.
+        */
+       gd->ram_top -= SPL_TLB_SETBACK;
+       gd->arch.tlb_size = PGTABLE_SIZE;
+       gd->arch.tlb_addr = (gd->ram_top - gd->arch.tlb_size) & ~(0x10000 - 1);
+       gd->arch.tlb_allocated = gd->arch.tlb_addr;
+#endif /* CONFIG_SPL_FSL_LS_PPA */
+}
+#endif /* CONFIG_SPL_BUILD */
index 7dfd27002916ffa2d27e02a4d737d486bd102652..c2202675366f37d3853f1ef3e5d4d11d2b4a3e08 100644 (file)
@@ -1,5 +1,6 @@
 /**
  * (C) Copyright 2014, Cavium Inc.
+ * (C) Copyright 2017, Xilinx Inc.
  *
  * SPDX-License-Identifier:    GPL-2.0+
 **/
@@ -114,6 +115,22 @@ void __noreturn __efi_runtime psci_system_off(void)
                ;
 }
 
+#ifdef CONFIG_CMD_POWEROFF
+int do_poweroff(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+{
+       puts("poweroff ...\n");
+
+       udelay(50000); /* wait 50 ms */
+
+       disable_interrupts();
+
+       psci_system_off();
+
+       /*NOTREACHED*/
+       return 0;
+}
+#endif
+
 #ifdef CONFIG_PSCI_RESET
 void reset_misc(void)
 {
index 4afa3ad8b1dcefc6deb6115b464998fd897c9b72..fffce712d38b99d3e739a5970b275d2138aee8e8 100644 (file)
@@ -224,7 +224,7 @@ __weak bool sec_firmware_is_valid(const void *sec_firmware_img)
  */
 unsigned int sec_firmware_support_psci_version(void)
 {
-       if (sec_firmware_addr & SEC_FIRMWARE_RUNNING)
+       if (current_el() == SEC_FIRMWARE_TARGET_EL)
                return _sec_firmware_support_psci_version();
 
        return PSCI_INVALID_VER;
index 354468b9053d5e03d7ca8d513ce33623abd47c32..5c500be51d1f5fb616e04539e5fd2cb9e7287e3b 100644 (file)
@@ -91,9 +91,12 @@ save_boot_params_ret:
         * this bit should be set for A53/A57/A72.
         */
 #ifdef CONFIG_ARMV8_SET_SMPEN
+       switch_el x1, 3f, 1f, 1f
+3:
        mrs     x0, S3_1_c15_c2_1               /* cpuectlr_el1 */
        orr     x0, x0, #0x40
        msr     S3_1_c15_c2_1, x0
+1:
 #endif
 
        /* Apply ARM core specific erratas */
index cc427c3583fd59fdc8865db8c13eef0d8efb53b6..0d1b0c499304f2472bd340c9449e54a3a159639f 100644 (file)
@@ -56,17 +56,17 @@ SECTIONS
 
        _image_binary_end = .;
 
-       .bss_start : {
+       .bss_start (NOLOAD) : {
                . = ALIGN(8);
                KEEP(*(.__bss_start));
        } >.sdram
 
-       .bss : {
+       .bss (NOLOAD) : {
                *(.bss*)
                 . = ALIGN(8);
        } >.sdram
 
-       .bss_end : {
+       .bss_end (NOLOAD) : {
                KEEP(*(.__bss_end));
        } >.sdram
 
index 2b1a4e926e2f6667973bb378469be2a8b030bd43..aceb29ee2de79a1c67032d3cbe8a67bb549340e6 100644 (file)
@@ -146,6 +146,7 @@ dtb-$(CONFIG_AM33XX) += am335x-boneblack.dtb am335x-bone.dtb \
 dtb-$(CONFIG_AM43XX) += am437x-gp-evm.dtb am437x-sk-evm.dtb    \
        am43x-epos-evm.dtb \
        am437x-idk-evm.dtb
+dtb-$(CONFIG_TI816X) += dm8168-evm.dtb
 dtb-$(CONFIG_THUNDERX) += thunderx-88xx.dtb
 
 dtb-$(CONFIG_ARCH_SOCFPGA) +=                          \
@@ -309,6 +310,7 @@ dtb-$(CONFIG_MACH_SUN8I_H3) += \
        sun8i-h3-orangepi-pc-plus.dtb \
        sun8i-h3-orangepi-plus.dtb \
        sun8i-h3-orangepi-plus2e.dtb \
+       sun8i-h3-nanopi-m1.dtb \
        sun8i-h3-nanopi-neo.dtb \
        sun8i-h3-nanopi-neo-air.dtb
 dtb-$(CONFIG_MACH_SUN8I_R40) += \
@@ -316,8 +318,10 @@ dtb-$(CONFIG_MACH_SUN8I_R40) += \
 dtb-$(CONFIG_MACH_SUN8I_V3S) += \
        sun8i-v3s-licheepi-zero.dtb
 dtb-$(CONFIG_MACH_SUN50I_H5) += \
-       sun50i-h5-orangepi-pc2.dtb
+       sun50i-h5-orangepi-pc2.dtb \
+       sun50i-h5-orangepi-prime.dtb
 dtb-$(CONFIG_MACH_SUN50I) += \
+       sun50i-a64-bananapi-m64.dtb \
        sun50i-a64-pine64-plus.dtb \
        sun50i-a64-pine64.dtb
 dtb-$(CONFIG_MACH_SUN9I) += \
diff --git a/arch/arm/dts/dm8168-evm.dts b/arch/arm/dts/dm8168-evm.dts
new file mode 100644 (file)
index 0000000..0bf55fa
--- /dev/null
@@ -0,0 +1,175 @@
+/*
+ * 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 "dm816x.dtsi"
+#include <dt-bindings/interrupt-controller/irq.h>
+
+/ {
+       model = "DM8168 EVM";
+       compatible = "ti,dm8168-evm", "ti,dm8168";
+
+       memory@80000000 {
+               device_type = "memory";
+               reg = <0x80000000 0x40000000    /* 1 GB */
+                      0xc0000000 0x40000000>;  /* 1 GB */
+       };
+
+       /* FDC6331L controlled by SD_POW pin */
+       vmmcsd_fixed: fixedregulator0 {
+               compatible = "regulator-fixed";
+               regulator-name = "vmmcsd_fixed";
+               regulator-min-microvolt = <3300000>;
+               regulator-max-microvolt = <3300000>;
+       };
+};
+
+&dm816x_pinmux {
+       mcspi1_pins: pinmux_mcspi1_pins {
+               pinctrl-single,pins = <
+                       DM816X_IOPAD(0x0a94, MUX_MODE0)                 /* SPI_SCLK */
+                       DM816X_IOPAD(0x0a98, MUX_MODE0)                 /* SPI_SCS0 */
+                       DM816X_IOPAD(0x0aa8, MUX_MODE0)                 /* SPI_D0 */
+                       DM816X_IOPAD(0x0aac, MUX_MODE0)                 /* SPI_D1 */
+               >;
+       };
+
+       mmc_pins: pinmux_mmc_pins {
+               pinctrl-single,pins = <
+                       DM816X_IOPAD(0x0a70, MUX_MODE0)                 /* SD_POW */
+                       DM816X_IOPAD(0x0a74, MUX_MODE0)                 /* SD_CLK */
+                       DM816X_IOPAD(0x0a78, MUX_MODE0)                 /* SD_CMD */
+                       DM816X_IOPAD(0x0a7C, MUX_MODE0)                 /* SD_DAT0 */
+                       DM816X_IOPAD(0x0a80, MUX_MODE0)                 /* SD_DAT1 */
+                       DM816X_IOPAD(0x0a84, MUX_MODE0)                 /* SD_DAT2 */
+                       DM816X_IOPAD(0x0a88, MUX_MODE0)                 /* SD_DAT2 */
+                       DM816X_IOPAD(0x0a8c, MUX_MODE2)                 /* GP1[7] */
+                       DM816X_IOPAD(0x0a90, MUX_MODE2)                 /* GP1[8] */
+               >;
+       };
+
+       usb0_pins: pinmux_usb0_pins {
+               pinctrl-single,pins = <
+                       DM816X_IOPAD(0x0d04, MUX_MODE0)                 /* USB0_DRVVBUS */
+               >;
+       };
+
+       usb1_pins: pinmux_usb1_pins {
+               pinctrl-single,pins = <
+                       DM816X_IOPAD(0x0d08, MUX_MODE0)                 /* USB1_DRVVBUS */
+               >;
+       };
+};
+
+&i2c1 {
+       extgpio0: pcf8575@20 {
+               compatible = "nxp,pcf8575";
+               reg = <0x20>;
+               gpio-controller;
+               #gpio-cells = <2>;
+       };
+};
+
+&i2c2 {
+       extgpio1: pcf8575@20 {
+               compatible = "nxp,pcf8575";
+               reg = <0x20>;
+               gpio-controller;
+               #gpio-cells = <2>;
+       };
+};
+
+&gpmc {
+       ranges = <0 0 0x04000000 0x01000000>;   /* CS0: 16MB for NAND */
+
+       nand@0,0 {
+               compatible = "ti,omap2-nand";
+               linux,mtd-name= "micron,mt29f2g16aadwp";
+               reg = <0 0 4>; /* CS0, offset 0, IO size 4 */
+               interrupt-parent = <&gpmc>;
+               interrupts = <0 IRQ_TYPE_NONE>, /* fifoevent */
+                            <1 IRQ_TYPE_NONE>; /* termcount */
+               #address-cells = <1>;
+               #size-cells = <1>;
+               ti,nand-ecc-opt = "bch8";
+               nand-bus-width = <16>;
+               gpmc,device-width = <2>;
+               gpmc,sync-clk-ps = <0>;
+               gpmc,cs-on-ns = <0>;
+               gpmc,cs-rd-off-ns = <44>;
+               gpmc,cs-wr-off-ns = <44>;
+               gpmc,adv-on-ns = <6>;
+               gpmc,adv-rd-off-ns = <34>;
+               gpmc,adv-wr-off-ns = <44>;
+               gpmc,we-on-ns = <0>;
+               gpmc,we-off-ns = <40>;
+               gpmc,oe-on-ns = <0>;
+               gpmc,oe-off-ns = <54>;
+               gpmc,access-ns = <64>;
+               gpmc,rd-cycle-ns = <82>;
+               gpmc,wr-cycle-ns = <82>;
+               gpmc,bus-turnaround-ns = <0>;
+               gpmc,cycle2cycle-delay-ns = <0>;
+               gpmc,clk-activation-ns = <0>;
+               gpmc,wr-access-ns = <40>;
+               gpmc,wr-data-mux-bus-ns = <0>;
+               partition@0 {
+                       label = "X-Loader";
+                       reg = <0 0x80000>;
+               };
+               partition@0x80000 {
+                       label = "U-Boot";
+                       reg = <0x80000 0x1c0000>;
+               };
+               partition@0x1c0000 {
+                       label = "Environment";
+                       reg = <0x240000 0x40000>;
+               };
+               partition@0x280000 {
+                       label = "Kernel";
+                       reg = <0x280000 0x500000>;
+               };
+               partition@0x780000 {
+                       label = "Filesystem";
+                       reg = <0x780000 0xf880000>;
+               };
+       };
+};
+
+&mcspi1 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&mcspi1_pins>;
+
+       m25p80@0 {
+               compatible = "w25x32";
+               spi-max-frequency = <48000000>;
+               reg = <0>;
+               #address-cells = <1>;
+               #size-cells = <1>;
+       };
+};
+
+&mmc1 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&mmc_pins>;
+       vmmc-supply = <&vmmcsd_fixed>;
+       bus-width = <4>;
+       cd-gpios = <&gpio2 7 GPIO_ACTIVE_LOW>;
+       wp-gpios = <&gpio2 8 GPIO_ACTIVE_LOW>;
+};
+
+/* At least dm8168-evm rev c won't support multipoint, later may */
+&usb0 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&usb0_pins>;
+       mentor,multipoint = <0>;
+};
+
+&usb1 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&usb1_pins>;
+       mentor,multipoint = <0>;
+};
diff --git a/arch/arm/dts/dm816x-clocks.dtsi b/arch/arm/dts/dm816x-clocks.dtsi
new file mode 100644 (file)
index 0000000..51865eb
--- /dev/null
@@ -0,0 +1,250 @@
+/*
+ * 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.
+ */
+
+&scrm {
+       main_fapll: main_fapll {
+               #clock-cells = <1>;
+               compatible = "ti,dm816-fapll-clock";
+               reg = <0x400 0x40>;
+               clocks = <&sys_clkin_ck &sys_clkin_ck>;
+               clock-indices = <1>, <2>, <3>, <4>, <5>,
+                               <6>, <7>;
+               clock-output-names = "main_pll_clk1",
+                                    "main_pll_clk2",
+                                    "main_pll_clk3",
+                                    "main_pll_clk4",
+                                    "main_pll_clk5",
+                                    "main_pll_clk6",
+                                    "main_pll_clk7";
+       };
+
+       ddr_fapll: ddr_fapll {
+               #clock-cells = <1>;
+               compatible = "ti,dm816-fapll-clock";
+               reg = <0x440 0x30>;
+               clocks = <&sys_clkin_ck &sys_clkin_ck>;
+               clock-indices = <1>, <2>, <3>, <4>;
+               clock-output-names = "ddr_pll_clk1",
+                                    "ddr_pll_clk2",
+                                    "ddr_pll_clk3",
+                                    "ddr_pll_clk4";
+       };
+
+       video_fapll: video_fapll {
+               #clock-cells = <1>;
+               compatible = "ti,dm816-fapll-clock";
+               reg = <0x470 0x30>;
+               clocks = <&sys_clkin_ck &sys_clkin_ck>;
+               clock-indices = <1>, <2>, <3>;
+               clock-output-names = "video_pll_clk1",
+                                    "video_pll_clk2",
+                                    "video_pll_clk3";
+       };
+
+       audio_fapll: audio_fapll {
+               #clock-cells = <1>;
+               compatible = "ti,dm816-fapll-clock";
+               reg = <0x4a0 0x30>;
+               clocks = <&main_fapll 7>, < &sys_clkin_ck>;
+               clock-indices = <1>, <2>, <3>, <4>, <5>;
+               clock-output-names = "audio_pll_clk1",
+                                    "audio_pll_clk2",
+                                    "audio_pll_clk3",
+                                    "audio_pll_clk4",
+                                    "audio_pll_clk5";
+       };
+};
+
+&scrm_clocks {
+       secure_32k_ck: secure_32k_ck {
+               #clock-cells = <0>;
+               compatible = "fixed-clock";
+               clock-frequency = <32768>;
+       };
+
+       sys_32k_ck: sys_32k_ck {
+               #clock-cells = <0>;
+               compatible = "fixed-clock";
+               clock-frequency = <32768>;
+       };
+
+       tclkin_ck: tclkin_ck {
+               #clock-cells = <0>;
+               compatible = "fixed-clock";
+               clock-frequency = <32768>;
+       };
+
+       sys_clkin_ck: sys_clkin_ck {
+               #clock-cells = <0>;
+               compatible = "fixed-clock";
+               clock-frequency = <27000000>;
+       };
+};
+
+/* 0x48180000 */
+&prcm_clocks {
+       clkout_pre_ck: clkout_pre_ck@100 {
+               #clock-cells = <0>;
+               compatible = "ti,mux-clock";
+               clocks = <&main_fapll 5 &ddr_fapll 1 &video_fapll 1
+                         &audio_fapll 1>;
+               reg = <0x100>;
+       };
+
+       clkout_div_ck: clkout_div_ck@100 {
+               #clock-cells = <0>;
+               compatible = "ti,divider-clock";
+               clocks = <&clkout_pre_ck>;
+               ti,bit-shift = <3>;
+               ti,max-div = <8>;
+               reg = <0x100>;
+       };
+
+       clkout_ck: clkout_ck@100 {
+               #clock-cells = <0>;
+               compatible = "ti,gate-clock";
+               clocks = <&clkout_div_ck>;
+               ti,bit-shift = <7>;
+               reg = <0x100>;
+       };
+
+       /* CM_DPLL clocks p1795 */
+       sysclk1_ck: sysclk1_ck@300 {
+               #clock-cells = <0>;
+               compatible = "ti,divider-clock";
+               clocks = <&main_fapll 1>;
+               ti,max-div = <7>;
+               reg = <0x0300>;
+       };
+
+       sysclk2_ck: sysclk2_ck@304 {
+               #clock-cells = <0>;
+               compatible = "ti,divider-clock";
+               clocks = <&main_fapll 2>;
+               ti,max-div = <7>;
+               reg = <0x0304>;
+       };
+
+       sysclk3_ck: sysclk3_ck@308 {
+               #clock-cells = <0>;
+               compatible = "ti,divider-clock";
+               clocks = <&main_fapll 3>;
+               ti,max-div = <7>;
+               reg = <0x0308>;
+       };
+
+       sysclk4_ck: sysclk4_ck@30c {
+               #clock-cells = <0>;
+               compatible = "ti,divider-clock";
+               clocks = <&main_fapll 4>;
+               ti,max-div = <1>;
+               reg = <0x030c>;
+       };
+
+       sysclk5_ck: sysclk5_ck@310 {
+               #clock-cells = <0>;
+               compatible = "ti,divider-clock";
+               clocks = <&sysclk4_ck>;
+               ti,max-div = <1>;
+               reg = <0x0310>;
+       };
+
+       sysclk6_ck: sysclk6_ck@314 {
+               #clock-cells = <0>;
+               compatible = "ti,divider-clock";
+               clocks = <&main_fapll 4>;
+               ti,dividers = <2>, <4>;
+               reg = <0x0314>;
+       };
+
+       sysclk10_ck: sysclk10_ck@324 {
+               #clock-cells = <0>;
+               compatible = "ti,divider-clock";
+               clocks = <&ddr_fapll 2>;
+               ti,max-div = <7>;
+               reg = <0x0324>;
+       };
+
+       sysclk24_ck: sysclk24_ck@3b4 {
+               #clock-cells = <0>;
+               compatible = "ti,divider-clock";
+               clocks = <&main_fapll 5>;
+               ti,max-div = <7>;
+               reg = <0x03b4>;
+       };
+
+       mpu_ck: mpu_ck@15dc {
+               #clock-cells = <0>;
+               compatible = "ti,gate-clock";
+               clocks = <&sysclk2_ck>;
+               ti,bit-shift = <1>;
+                reg = <0x15dc>;
+       };
+
+       audio_pll_a_ck: audio_pll_a_ck@35c {
+               #clock-cells = <0>;
+               compatible = "ti,divider-clock";
+               clocks = <&audio_fapll 1>;
+               ti,max-div = <7>;
+               reg = <0x035c>;
+       };
+
+       sysclk18_ck: sysclk18_ck@378 {
+               #clock-cells = <0>;
+               compatible = "ti,mux-clock";
+               clocks = <&sys_32k_ck>, <&audio_pll_a_ck>;
+               reg = <0x0378>;
+       };
+
+       timer1_fck: timer1_fck@390 {
+               #clock-cells = <0>;
+               compatible = "ti,mux-clock";
+               clocks = <&tclkin_ck>, <&sysclk18_ck>, <&sys_clkin_ck>;
+               reg = <0x0390>;
+       };
+
+       timer2_fck: timer2_fck@394 {
+               #clock-cells = <0>;
+               compatible = "ti,mux-clock";
+               clocks = <&tclkin_ck>, <&sysclk18_ck>, <&sys_clkin_ck>;
+               reg = <0x0394>;
+       };
+
+       timer3_fck: timer3_fck@398 {
+               #clock-cells = <0>;
+               compatible = "ti,mux-clock";
+               clocks = <&tclkin_ck>, <&sysclk18_ck>, <&sys_clkin_ck>;
+               reg = <0x0398>;
+       };
+
+       timer4_fck: timer4_fck@39c {
+               #clock-cells = <0>;
+               compatible = "ti,mux-clock";
+               clocks = <&tclkin_ck>, <&sysclk18_ck>, <&sys_clkin_ck>;
+               reg = <0x039c>;
+       };
+
+       timer5_fck: timer5_fck@3a0 {
+               #clock-cells = <0>;
+               compatible = "ti,mux-clock";
+               clocks = <&tclkin_ck>, <&sysclk18_ck>, <&sys_clkin_ck>;
+               reg = <0x03a0>;
+       };
+
+       timer6_fck: timer6_fck@3a4 {
+               #clock-cells = <0>;
+               compatible = "ti,mux-clock";
+               clocks = <&tclkin_ck>, <&sysclk18_ck>, <&sys_clkin_ck>;
+               reg = <0x03a4>;
+       };
+
+       timer7_fck: timer7_fck@3a8 {
+               #clock-cells = <0>;
+               compatible = "ti,mux-clock";
+               clocks = <&tclkin_ck>, <&sysclk18_ck>, <&sys_clkin_ck>;
+               reg = <0x03a8>;
+       };
+};
diff --git a/arch/arm/dts/dm816x.dtsi b/arch/arm/dts/dm816x.dtsi
new file mode 100644 (file)
index 0000000..276211e
--- /dev/null
@@ -0,0 +1,518 @@
+/*
+ * 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 <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/pinctrl/omap.h>
+
+/ {
+       compatible = "ti,dm816";
+       interrupt-parent = <&intc>;
+       #address-cells = <1>;
+       #size-cells = <1>;
+       chosen { };
+
+       aliases {
+               i2c0 = &i2c1;
+               i2c1 = &i2c2;
+               serial0 = &uart1;
+               serial1 = &uart2;
+               serial2 = &uart3;
+               ethernet0 = &eth0;
+               ethernet1 = &eth1;
+       };
+
+       cpus {
+               #address-cells = <1>;
+               #size-cells = <0>;
+               cpu@0 {
+                       compatible = "arm,cortex-a8";
+                       device_type = "cpu";
+                       reg = <0>;
+               };
+       };
+
+       pmu {
+               compatible = "arm,cortex-a8-pmu";
+               interrupts = <3>;
+       };
+
+       /*
+        * The soc node represents the soc top level view. It is used 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 dm816x interconnect.
+        * The real dm816x interconnect network is quite complex. Since
+        * it 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";
+               reg = <0x44000000 0x10000>;
+               interrupts = <9 10>;
+               #address-cells = <1>;
+               #size-cells = <1>;
+               ranges;
+
+               prcm: prcm@48180000 {
+                       compatible = "ti,dm816-prcm";
+                       reg = <0x48180000 0x4000>;
+
+                       prcm_clocks: clocks {
+                               #address-cells = <1>;
+                               #size-cells = <0>;
+                       };
+
+                       prcm_clockdomains: clockdomains {
+                       };
+               };
+
+               scrm: scrm@48140000 {
+                       compatible = "ti,dm816-scrm", "simple-bus";
+                       reg = <0x48140000 0x21000>;
+                       #address-cells = <1>;
+                       #size-cells = <1>;
+                       #pinctrl-cells = <1>;
+                       ranges = <0 0x48140000 0x21000>;
+
+                       dm816x_pinmux: pinmux@800 {
+                               compatible = "pinctrl-single";
+                               reg = <0x800 0x50a>;
+                               #address-cells = <1>;
+                               #size-cells = <0>;
+                               #pinctrl-cells = <1>;
+                               pinctrl-single,register-width = <16>;
+                               pinctrl-single,function-mask = <0xf>;
+                       };
+
+                       /* Device Configuration Registers */
+                       scm_conf: syscon@600 {
+                               compatible = "syscon", "simple-bus";
+                               reg = <0x600 0x110>;
+                               #address-cells = <1>;
+                               #size-cells = <1>;
+                               ranges = <0 0x600 0x110>;
+
+                               usb_phy0: usb-phy@20 {
+                                       compatible = "ti,dm8168-usb-phy";
+                                       reg = <0x20 0x8>;
+                                       reg-names = "phy";
+                                       clocks = <&main_fapll 6>;
+                                       clock-names = "refclk";
+                                       #phy-cells = <0>;
+                                       syscon = <&scm_conf>;
+                               };
+
+                               usb_phy1: usb-phy@28 {
+                                       compatible = "ti,dm8168-usb-phy";
+                                       reg = <0x28 0x8>;
+                                       reg-names = "phy";
+                                       clocks = <&main_fapll 6>;
+                                       clock-names = "refclk";
+                                       #phy-cells = <0>;
+                                       syscon = <&scm_conf>;
+                               };
+                       };
+
+                       scrm_clocks: clocks {
+                               #address-cells = <1>;
+                               #size-cells = <0>;
+                       };
+
+                       scrm_clockdomains: clockdomains {
+                       };
+               };
+
+               edma: edma@49000000 {
+                       compatible = "ti,edma3";
+                       ti,hwmods = "tpcc", "tptc0", "tptc1", "tptc2", "tptc3";
+                       reg =   <0x49000000 0x10000>,
+                               <0x44e10f90 0x40>;
+                       interrupts = <12 13 14>;
+                       #dma-cells = <1>;
+               };
+
+               elm: elm@48080000 {
+                       compatible = "ti,816-elm";
+                       ti,hwmods = "elm";
+                       reg = <0x48080000 0x2000>;
+                       interrupts = <4>;
+               };
+
+               gpio1: gpio@48032000 {
+                       compatible = "ti,omap4-gpio";
+                       ti,hwmods = "gpio1";
+                       ti,gpio-always-on;
+                       reg = <0x48032000 0x1000>;
+                       interrupts = <96>;
+                       gpio-controller;
+                       #gpio-cells = <2>;
+                       interrupt-controller;
+                       #interrupt-cells = <2>;
+               };
+
+               gpio2: gpio@4804c000 {
+                       compatible = "ti,omap4-gpio";
+                       ti,hwmods = "gpio2";
+                       ti,gpio-always-on;
+                       reg = <0x4804c000 0x1000>;
+                       interrupts = <98>;
+                       gpio-controller;
+                       #gpio-cells = <2>;
+                       interrupt-controller;
+                       #interrupt-cells = <2>;
+               };
+
+               gpmc: gpmc@50000000 {
+                       compatible = "ti,am3352-gpmc";
+                       ti,hwmods = "gpmc";
+                       reg = <0x50000000 0x2000>;
+                       #address-cells = <2>;
+                       #size-cells = <1>;
+                       interrupts = <100>;
+                       dmas = <&edma 52>;
+                       dma-names = "rxtx";
+                       gpmc,num-cs = <6>;
+                       gpmc,num-waitpins = <2>;
+                       interrupt-controller;
+                       #interrupt-cells = <2>;
+                       gpio-controller;
+                       #gpio-cells = <2>;
+               };
+
+               i2c1: i2c@48028000 {
+                       compatible = "ti,omap4-i2c";
+                       ti,hwmods = "i2c1";
+                       reg = <0x48028000 0x1000>;
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+                       interrupts = <70>;
+                       dmas = <&edma 58 &edma 59>;
+                       dma-names = "tx", "rx";
+               };
+
+               i2c2: i2c@4802a000 {
+                       compatible = "ti,omap4-i2c";
+                       ti,hwmods = "i2c2";
+                       reg = <0x4802a000 0x1000>;
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+                       interrupts = <71>;
+                       dmas = <&edma 60 &edma 61>;
+                       dma-names = "tx", "rx";
+               };
+
+               intc: interrupt-controller@48200000 {
+                       compatible = "ti,dm816-intc";
+                       interrupt-controller;
+                       #interrupt-cells = <1>;
+                       reg = <0x48200000 0x1000>;
+               };
+
+               rtc: rtc@480c0000 {
+                       compatible = "ti,am3352-rtc", "ti,da830-rtc";
+                       reg = <0x480c0000 0x1000>;
+                       interrupts = <75 76>;
+                       ti,hwmods = "rtc";
+               };
+
+               mailbox: mailbox@480c8000 {
+                       compatible = "ti,omap4-mailbox";
+                       reg = <0x480c8000 0x2000>;
+                       interrupts = <77>;
+                       ti,hwmods = "mailbox";
+                       #mbox-cells = <1>;
+                       ti,mbox-num-users = <4>;
+                       ti,mbox-num-fifos = <12>;
+                       mbox_dsp: mbox_dsp {
+                               ti,mbox-tx = <3 0 0>;
+                               ti,mbox-rx = <0 0 0>;
+                       };
+               };
+
+               spinbox: spinbox@480ca000 {
+                       compatible = "ti,omap4-hwspinlock";
+                       reg = <0x480ca000 0x2000>;
+                       ti,hwmods = "spinbox";
+                       #hwlock-cells = <1>;
+               };
+
+               mdio: mdio@4a100800 {
+                       compatible = "ti,davinci_mdio";
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+                       reg = <0x4a100800 0x100>;
+                       ti,hwmods = "davinci_mdio";
+                       bus_freq = <1000000>;
+                       phy0: ethernet-phy@0 {
+                               reg = <1>;
+                       };
+                       phy1: ethernet-phy@1 {
+                               reg = <2>;
+                       };
+               };
+
+               eth0: ethernet@4a100000 {
+                       compatible = "ti,dm816-emac";
+                       ti,hwmods = "emac0";
+                       reg = <0x4a100000 0x800
+                              0x4a100900 0x3700>;
+                       clocks = <&sysclk24_ck>;
+                       syscon = <&scm_conf>;
+                       ti,davinci-ctrl-reg-offset = <0>;
+                       ti,davinci-ctrl-mod-reg-offset = <0x900>;
+                       ti,davinci-ctrl-ram-offset = <0x2000>;
+                       ti,davinci-ctrl-ram-size = <0x2000>;
+                       interrupts = <40 41 42 43>;
+                       phy-handle = <&phy0>;
+               };
+
+               eth1: ethernet@4a120000 {
+                       compatible = "ti,dm816-emac";
+                       ti,hwmods = "emac1";
+                       reg = <0x4a120000 0x4000>;
+                       clocks = <&sysclk24_ck>;
+                       syscon = <&scm_conf>;
+                       ti,davinci-ctrl-reg-offset = <0>;
+                       ti,davinci-ctrl-mod-reg-offset = <0x900>;
+                       ti,davinci-ctrl-ram-offset = <0x2000>;
+                       ti,davinci-ctrl-ram-size = <0x2000>;
+                       interrupts = <44 45 46 47>;
+                       phy-handle = <&phy1>;
+               };
+
+               mcspi1: spi@48030000 {
+                       compatible = "ti,omap4-mcspi";
+                       reg = <0x48030000 0x1000>;
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+                       interrupts = <65>;
+                       ti,spi-num-cs = <4>;
+                       ti,hwmods = "mcspi1";
+                       dmas = <&edma 16 &edma 17
+                               &edma 18 &edma 19
+                               &edma 20 &edma 21
+                               &edma 22 &edma 23>;
+                       dma-names = "tx0", "rx0", "tx1", "rx1",
+                                   "tx2", "rx2", "tx3", "rx3";
+               };
+
+               mmc1: mmc@48060000 {
+                       compatible = "ti,omap4-hsmmc";
+                       reg = <0x48060000 0x11000>;
+                       ti,hwmods = "mmc1";
+                       interrupts = <64>;
+                       dmas = <&edma 24 &edma 25>;
+                       dma-names = "tx", "rx";
+               };
+
+               timer1: timer@4802e000 {
+                       compatible = "ti,dm816-timer";
+                       reg = <0x4802e000 0x2000>;
+                       interrupts = <67>;
+                       ti,hwmods = "timer1";
+                       ti,timer-alwon;
+               };
+
+               timer2: timer@48040000 {
+                       compatible = "ti,dm816-timer";
+                       reg = <0x48040000 0x2000>;
+                       interrupts = <68>;
+                       ti,hwmods = "timer2";
+               };
+
+               timer3: timer@48042000 {
+                       compatible = "ti,dm816-timer";
+                       reg = <0x48042000 0x2000>;
+                       interrupts = <69>;
+                       ti,hwmods = "timer3";
+               };
+
+               timer4: timer@48044000 {
+                       compatible = "ti,dm816-timer";
+                       reg = <0x48044000 0x2000>;
+                       interrupts = <92>;
+                       ti,hwmods = "timer4";
+                       ti,timer-pwm;
+               };
+
+               timer5: timer@48046000 {
+                       compatible = "ti,dm816-timer";
+                       reg = <0x48046000 0x2000>;
+                       interrupts = <93>;
+                       ti,hwmods = "timer5";
+                       ti,timer-pwm;
+               };
+
+               timer6: timer@48048000 {
+                       compatible = "ti,dm816-timer";
+                       reg = <0x48048000 0x2000>;
+                       interrupts = <94>;
+                       ti,hwmods = "timer6";
+                       ti,timer-pwm;
+               };
+
+               timer7: timer@4804a000 {
+                       compatible = "ti,dm816-timer";
+                       reg = <0x4804a000 0x2000>;
+                       interrupts = <95>;
+                       ti,hwmods = "timer7";
+                       ti,timer-pwm;
+               };
+
+               uart1: uart@48020000 {
+                       compatible = "ti,am3352-uart", "ti,omap3-uart";
+                       ti,hwmods = "uart1";
+                       reg = <0x48020000 0x2000>;
+                       clock-frequency = <48000000>;
+                       interrupts = <72>;
+                       dmas = <&edma 26 &edma 27>;
+                       dma-names = "tx", "rx";
+               };
+
+               uart2: uart@48022000 {
+                       compatible = "ti,am3352-uart", "ti,omap3-uart";
+                       ti,hwmods = "uart2";
+                       reg = <0x48022000 0x2000>;
+                       clock-frequency = <48000000>;
+                       interrupts = <73>;
+                       dmas = <&edma 28 &edma 29>;
+                       dma-names = "tx", "rx";
+               };
+
+               uart3: uart@48024000 {
+                       compatible = "ti,am3352-uart", "ti,omap3-uart";
+                       ti,hwmods = "uart3";
+                       reg = <0x48024000 0x2000>;
+                       clock-frequency = <48000000>;
+                       interrupts = <74>;
+                       dmas = <&edma 30 &edma 31>;
+                       dma-names = "tx", "rx";
+               };
+
+               /* NOTE: USB needs a transceiver driver for phys to work */
+               usb: usb_otg_hs@47401000 {
+                       compatible = "ti,am33xx-usb";
+                       reg = <0x47401000 0x400000>;
+                       ranges;
+                       #address-cells = <1>;
+                       #size-cells = <1>;
+                       ti,hwmods = "usb_otg_hs";
+
+                       usb0: usb@47401000 {
+                               compatible = "ti,musb-dm816";
+                               reg = <0x47401400 0x400
+                                      0x47401000 0x200>;
+                               reg-names = "mc", "control";
+                               interrupts = <18>;
+                               interrupt-names = "mc";
+                               dr_mode = "host";
+                               interface-type = <0>;
+                               phys = <&usb_phy0>;
+                               phy-names = "usb2-phy";
+                               mentor,multipoint = <1>;
+                               mentor,num-eps = <16>;
+                               mentor,ram-bits = <12>;
+                               mentor,power = <500>;
+
+                               dmas = <&cppi41dma  0 0 &cppi41dma  1 0
+                                       &cppi41dma  2 0 &cppi41dma  3 0
+                                       &cppi41dma  4 0 &cppi41dma  5 0
+                                       &cppi41dma  6 0 &cppi41dma  7 0
+                                       &cppi41dma  8 0 &cppi41dma  9 0
+                                       &cppi41dma 10 0 &cppi41dma 11 0
+                                       &cppi41dma 12 0 &cppi41dma 13 0
+                                       &cppi41dma 14 0 &cppi41dma  0 1
+                                       &cppi41dma  1 1 &cppi41dma  2 1
+                                       &cppi41dma  3 1 &cppi41dma  4 1
+                                       &cppi41dma  5 1 &cppi41dma  6 1
+                                       &cppi41dma  7 1 &cppi41dma  8 1
+                                       &cppi41dma  9 1 &cppi41dma 10 1
+                                       &cppi41dma 11 1 &cppi41dma 12 1
+                                       &cppi41dma 13 1 &cppi41dma 14 1>;
+                               dma-names =
+                                       "rx1", "rx2", "rx3", "rx4", "rx5", "rx6", "rx7",
+                                       "rx8", "rx9", "rx10", "rx11", "rx12", "rx13",
+                                       "rx14", "rx15",
+                                       "tx1", "tx2", "tx3", "tx4", "tx5", "tx6", "tx7",
+                                       "tx8", "tx9", "tx10", "tx11", "tx12", "tx13",
+                                       "tx14", "tx15";
+                       };
+
+                       usb1: usb@47401800 {
+                               compatible = "ti,musb-dm816";
+                               reg = <0x47401c00 0x400
+                                      0x47401800 0x200>;
+                               reg-names = "mc", "control";
+                               interrupts = <19>;
+                               interrupt-names = "mc";
+                               dr_mode = "host";
+                               interface-type = <0>;
+                               phys = <&usb_phy1>;
+                               phy-names = "usb2-phy";
+                               mentor,multipoint = <1>;
+                               mentor,num-eps = <16>;
+                               mentor,ram-bits = <12>;
+                               mentor,power = <500>;
+
+                               dmas = <&cppi41dma 15 0 &cppi41dma 16 0
+                                       &cppi41dma 17 0 &cppi41dma 18 0
+                                       &cppi41dma 19 0 &cppi41dma 20 0
+                                       &cppi41dma 21 0 &cppi41dma 22 0
+                                       &cppi41dma 23 0 &cppi41dma 24 0
+                                       &cppi41dma 25 0 &cppi41dma 26 0
+                                       &cppi41dma 27 0 &cppi41dma 28 0
+                                       &cppi41dma 29 0 &cppi41dma 15 1
+                                       &cppi41dma 16 1 &cppi41dma 17 1
+                                       &cppi41dma 18 1 &cppi41dma 19 1
+                                       &cppi41dma 20 1 &cppi41dma 21 1
+                                       &cppi41dma 22 1 &cppi41dma 23 1
+                                       &cppi41dma 24 1 &cppi41dma 25 1
+                                       &cppi41dma 26 1 &cppi41dma 27 1
+                                       &cppi41dma 28 1 &cppi41dma 29 1>;
+                               dma-names =
+                                       "rx1", "rx2", "rx3", "rx4", "rx5", "rx6", "rx7",
+                                       "rx8", "rx9", "rx10", "rx11", "rx12", "rx13",
+                                       "rx14", "rx15",
+                                       "tx1", "tx2", "tx3", "tx4", "tx5", "tx6", "tx7",
+                                       "tx8", "tx9", "tx10", "tx11", "tx12", "tx13",
+                                       "tx14", "tx15";
+                       };
+
+                       cppi41dma: dma-controller@47402000 {
+                               compatible = "ti,am3359-cppi41";
+                               reg =  <0x47400000 0x1000
+                                       0x47402000 0x1000
+                                       0x47403000 0x1000
+                                       0x47404000 0x4000>;
+                               reg-names = "glue", "controller", "scheduler", "queuemgr";
+                               interrupts = <17>;
+                               interrupt-names = "glue";
+                               #dma-cells = <2>;
+                               #dma-channels = <30>;
+                               #dma-requests = <256>;
+                       };
+               };
+
+               wd_timer2: wd_timer@480c2000 {
+                       compatible = "ti,omap3-wdt";
+                       ti,hwmods = "wd_timer";
+                       reg = <0x480c2000 0x1000>;
+                       interrupts = <0>;
+               };
+       };
+};
+
+#include "dm816x-clocks.dtsi"
diff --git a/arch/arm/dts/sun50i-a64-bananapi-m64.dts b/arch/arm/dts/sun50i-a64-bananapi-m64.dts
new file mode 100644 (file)
index 0000000..02db114
--- /dev/null
@@ -0,0 +1,121 @@
+/*
+ * Copyright (c) 2016 ARM Ltd.
+ * Copyright (C) 2017 Jagan Teki <jteki@openedev.com>
+ *
+ * This file is dual-licensed: you can use it either under the terms
+ * of the GPL or the X11 license, at your option. Note that this dual
+ * licensing only applies to this file, and not this project as a
+ * whole.
+ *
+ *  a) This library is free software; you can redistribute it and/or
+ *     modify it under the terms of the GNU General Public License as
+ *     published by the Free Software Foundation; either version 2 of the
+ *     License, or (at your option) any later version.
+ *
+ *     This library is distributed in the hope that it will be useful,
+ *     but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *     GNU General Public License for more details.
+ *
+ * Or, alternatively,
+ *
+ *  b) Permission is hereby granted, free of charge, to any person
+ *     obtaining a copy of this software and associated documentation
+ *     files (the "Software"), to deal in the Software without
+ *     restriction, including without limitation the rights to use,
+ *     copy, modify, merge, publish, distribute, sublicense, and/or
+ *     sell copies of the Software, and to permit persons to whom the
+ *     Software is furnished to do so, subject to the following
+ *     conditions:
+ *
+ *     The above copyright notice and this permission notice shall be
+ *     included in all copies or substantial portions of the Software.
+ *
+ *     THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ *     EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ *     OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ *     NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ *     HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ *     WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ *     FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ *     OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+/dts-v1/;
+
+#include "sun50i-a64.dtsi"
+
+#include <dt-bindings/gpio/gpio.h>
+
+/ {
+       model = "BananaPi-M64";
+       compatible = "sinovoip,bananapi-m64", "allwinner,sun50i-a64";
+
+       aliases {
+               serial0 = &uart0;
+               serial1 = &uart1;
+       };
+
+       chosen {
+               stdout-path = "serial0:115200n8";
+       };
+
+       reg_vcc3v3: vcc3v3 {
+               compatible = "regulator-fixed";
+               regulator-name = "vcc3v3";
+               regulator-min-microvolt = <3300000>;
+               regulator-max-microvolt = <3300000>;
+       };
+};
+
+&i2c1 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&i2c1_pins>;
+       status = "okay";
+};
+
+&i2c1_pins {
+       bias-pull-up;
+};
+
+&mmc0 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&mmc0_pins>;
+       vmmc-supply = <&reg_vcc3v3>;
+       cd-gpios = <&pio 5 6 GPIO_ACTIVE_HIGH>;
+       cd-inverted;
+       disable-wp;
+       bus-width = <4>;
+       status = "okay";
+};
+
+&mmc1 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&mmc1_pins>;
+       vmmc-supply = <&reg_vcc3v3>;
+       bus-width = <4>;
+       non-removable;
+       status = "okay";
+};
+
+&mmc2 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&mmc2_pins>;
+       vmmc-supply = <&reg_vcc3v3>;
+       bus-width = <8>;
+       non-removable;
+       cap-mmc-hw-reset;
+       status = "okay";
+};
+
+&uart0 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&uart0_pins_a>;
+       status = "okay";
+};
+
+&uart1 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&uart1_pins>, <&uart1_rts_cts_pins>;
+       status = "okay";
+};
diff --git a/arch/arm/dts/sun50i-a64-pine64-common.dtsi b/arch/arm/dts/sun50i-a64-pine64-common.dtsi
deleted file mode 100644 (file)
index 9ec81c6..0000000
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * Copyright (c) 2016 ARM Ltd.
- *
- * This file is dual-licensed: you can use it either under the terms
- * of the GPL or the X11 license, at your option. Note that this dual
- * licensing only applies to this file, and not this project as a
- * whole.
- *
- *  a) This library is free software; you can redistribute it and/or
- *     modify it under the terms of the GNU General Public License as
- *     published by the Free Software Foundation; either version 2 of the
- *     License, or (at your option) any later version.
- *
- *     This library is distributed in the hope that it will be useful,
- *     but WITHOUT ANY WARRANTY; without even the implied warranty of
- *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *     GNU General Public License for more details.
- *
- * Or, alternatively,
- *
- *  b) Permission is hereby granted, free of charge, to any person
- *     obtaining a copy of this software and associated documentation
- *     files (the "Software"), to deal in the Software without
- *     restriction, including without limitation the rights to use,
- *     copy, modify, merge, publish, distribute, sublicense, and/or
- *     sell copies of the Software, and to permit persons to whom the
- *     Software is furnished to do so, subject to the following
- *     conditions:
- *
- *     The above copyright notice and this permission notice shall be
- *     included in all copies or substantial portions of the Software.
- *
- *     THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- *     EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- *     OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- *     NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
- *     HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- *     WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- *     FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
- *     OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include "sun50i-a64.dtsi"
-
-/ {
-
-       aliases {
-               serial0 = &uart0;
-               ethernet0 = &emac;
-       };
-
-       soc {
-               reg_vcc3v3: vcc3v3 {
-                       compatible = "regulator-fixed";
-                       regulator-name = "vcc3v3";
-                       regulator-min-microvolt = <3300000>;
-                       regulator-max-microvolt = <3300000>;
-               };
-       };
-};
-
-&mmc0 {
-       pinctrl-names = "default";
-       pinctrl-0 = <&mmc0_pins>, <&mmc0_default_cd_pin>;
-       vmmc-supply = <&reg_vcc3v3>;
-       cd-gpios = <&pio 5 6 0>;
-       cd-inverted;
-       status = "okay";
-};
-
-&uart0 {
-       pinctrl-names = "default";
-       pinctrl-0 = <&uart0_pins_a>;
-       status = "okay";
-};
-
-&i2c1 {
-       pinctrl-names = "default";
-       pinctrl-0 = <&i2c1_pins>;
-       status = "okay";
-};
-
-&usbphy {
-       status = "okay";
-};
-
-&ohci1 {
-       status = "okay";
-};
-
-&ehci1 {
-       status = "okay";
-};
diff --git a/arch/arm/dts/sun50i-a64-pine64-plus-u-boot.dtsi b/arch/arm/dts/sun50i-a64-pine64-plus-u-boot.dtsi
new file mode 100644 (file)
index 0000000..9c61bea
--- /dev/null
@@ -0,0 +1,50 @@
+/ {
+       aliases {
+               ethernet0 = &emac;
+       };
+
+       soc {
+               emac: ethernet@01c30000 {
+                       compatible = "allwinner,sun50i-a64-emac";
+                       reg = <0x01c30000 0x2000>, <0x01c00030 0x4>;
+                       reg-names = "emac", "syscon";
+                       interrupts = <GIC_SPI 82 IRQ_TYPE_LEVEL_HIGH>;
+                       resets = <&ccu RST_BUS_EMAC>;
+                       reset-names = "ahb";
+                       clocks = <&ccu CLK_BUS_EMAC>;
+                       clock-names = "ahb";
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+                       pinctrl-names = "default";
+                       pinctrl-0 = <&rgmii_pins>;
+                       phy-mode = "rgmii";
+                       phy = <&phy1>;
+                       status = "okay";
+
+                       phy1: ethernet-phy@1 {
+                               reg = <1>;
+                       };
+               };
+       };
+};
+
+&pio {
+       rmii_pins: rmii_pins {
+               allwinner,pins = "PD10", "PD11", "PD13", "PD14",
+                                "PD17", "PD18", "PD19", "PD20",
+                                "PD22", "PD23";
+               allwinner,function = "emac";
+               allwinner,drive = <3>;
+               allwinner,pull = <0>;
+       };
+
+       rgmii_pins: rgmii_pins {
+               allwinner,pins = "PD8", "PD9", "PD10", "PD11",
+                                "PD12", "PD13", "PD15",
+                                "PD16", "PD17", "PD18", "PD19",
+                                "PD20", "PD21", "PD22", "PD23";
+               allwinner,function = "emac";
+               allwinner,drive = <3>;
+               allwinner,pull = <0>;
+       };
+};
index 389c6096ca149734af69b9d9549b72073841d475..790d14daaa6a68f2b6ebe40594c5e78baea3f52a 100644 (file)
  *     OTHER DEALINGS IN THE SOFTWARE.
  */
 
-/dts-v1/;
-
-#include "sun50i-a64-pine64-common.dtsi"
+#include "sun50i-a64-pine64.dts"
 
 / {
        model = "Pine64+";
        compatible = "pine64,pine64-plus", "allwinner,sun50i-a64";
 
-       chosen {
-               stdout-path = "serial0:115200n8";
-       };
-
-       /* There is a model with 2GB of DRAM, but U-Boot fixes this for us. */
-       memory {
-               reg = <0x40000000 0x40000000>;
-       };
-};
-
-&emac {
-       pinctrl-names = "default";
-       pinctrl-0 = <&rgmii_pins>;
-       phy-mode = "rgmii";
-       phy = <&phy1>;
-       status = "okay";
-
-       phy1: ethernet-phy@1 {
-       reg = <1>;
-       };
+       /* TODO: Camera, Ethernet PHY, touchscreen, etc. */
 };
-
index ebe029e8a8d77cbe91cb9d714a416d65cb3599ee..c680ed385da3565da0291e325b5429fcb1e3eeec 100644 (file)
 
 /dts-v1/;
 
-#include "sun50i-a64-pine64-common.dtsi"
+#include "sun50i-a64.dtsi"
+
+#include <dt-bindings/gpio/gpio.h>
 
 / {
        model = "Pine64";
        compatible = "pine64,pine64", "allwinner,sun50i-a64";
 
+       aliases {
+               serial0 = &uart0;
+       };
+
        chosen {
                stdout-path = "serial0:115200n8";
        };
 
-       memory {
-               reg = <0x40000000 0x20000000>;
+       reg_vcc3v3: vcc3v3 {
+               compatible = "regulator-fixed";
+               regulator-name = "vcc3v3";
+               regulator-min-microvolt = <3300000>;
+               regulator-max-microvolt = <3300000>;
        };
 };
+
+&ehci1 {
+       status = "okay";
+};
+
+&i2c1 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&i2c1_pins>;
+       status = "okay";
+};
+
+&i2c1_pins {
+       bias-pull-up;
+};
+
+&mmc0 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&mmc0_pins>;
+       vmmc-supply = <&reg_vcc3v3>;
+       cd-gpios = <&pio 5 6 GPIO_ACTIVE_HIGH>;
+       cd-inverted;
+       disable-wp;
+       bus-width = <4>;
+       status = "okay";
+};
+
+&ohci1 {
+       status = "okay";
+};
+
+&uart0 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&uart0_pins_a>;
+       status = "okay";
+};
+
+&usb_otg {
+       dr_mode = "host";
+       status = "okay";
+};
+
+&usbphy {
+       status = "okay";
+};
index bef0d00be8b23e9a4118f4b87d28e81c36d408f5..c7f669f5884f910c6e4be44ac1dd09a216cb97f0 100644 (file)
@@ -42,8 +42,9 @@
  *     OTHER DEALINGS IN THE SOFTWARE.
  */
 
+#include <dt-bindings/clock/sun50i-a64-ccu.h>
 #include <dt-bindings/interrupt-controller/arm-gic.h>
-#include <dt-bindings/pinctrl/sun4i-a10.h>
+#include <dt-bindings/reset/sun50i-a64-ccu.h>
 
 / {
        interrupt-parent = <&gic>;
                #address-cells = <1>;
                #size-cells = <0>;
 
-               cpu@0 {
+               cpu0: cpu@0 {
                        compatible = "arm,cortex-a53", "arm,armv8";
                        device_type = "cpu";
                        reg = <0>;
                        enable-method = "psci";
                };
 
-               cpu@1 {
+               cpu1: cpu@1 {
                        compatible = "arm,cortex-a53", "arm,armv8";
                        device_type = "cpu";
                        reg = <1>;
                        enable-method = "psci";
                };
 
-               cpu@2 {
+               cpu2: cpu@2 {
                        compatible = "arm,cortex-a53", "arm,armv8";
                        device_type = "cpu";
                        reg = <2>;
                        enable-method = "psci";
                };
 
-               cpu@3 {
+               cpu3: cpu@3 {
                        compatible = "arm,cortex-a53", "arm,armv8";
                        device_type = "cpu";
                        reg = <3>;
                };
        };
 
-       psci {
-               compatible = "arm,psci-0.2";
-               method = "smc";
+       osc24M: osc24M_clk {
+               #clock-cells = <0>;
+               compatible = "fixed-clock";
+               clock-frequency = <24000000>;
+               clock-output-names = "osc24M";
+       };
+
+       osc32k: osc32k_clk {
+               #clock-cells = <0>;
+               compatible = "fixed-clock";
+               clock-frequency = <32768>;
+               clock-output-names = "osc32k";
        };
 
-       memory {
-               device_type = "memory";
-               reg = <0x40000000 0>;
+       iosc: internal-osc-clk {
+               #clock-cells = <0>;
+               compatible = "fixed-clock";
+               clock-frequency = <16000000>;
+               clock-accuracy = <300000000>;
+               clock-output-names = "iosc";
        };
 
-       gic: interrupt-controller@1c81000 {
-               compatible = "arm,gic-400";
-               interrupt-controller;
-               #interrupt-cells = <3>;
-               #address-cells = <0>;
-
-               reg = <0x01c81000 0x1000>,
-                     <0x01c82000 0x2000>,
-                     <0x01c84000 0x2000>,
-                     <0x01c86000 0x2000>;
-               interrupts = <GIC_PPI 9
-                     (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_HIGH)>;
+       psci {
+               compatible = "arm,psci-0.2";
+               method = "smc";
        };
 
        timer {
                        (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_HIGH)>;
        };
 
-       clocks {
-               #address-cells = <1>;
-               #size-cells = <1>;
-               ranges;
-
-               osc24M: osc24M_clk {
-                       #clock-cells = <0>;
-                       compatible = "fixed-clock";
-                       clock-frequency = <24000000>;
-                       clock-output-names = "osc24M";
-               };
-
-               osc32k: osc32k_clk {
-                       #clock-cells = <0>;
-                       compatible = "fixed-clock";
-                       clock-frequency = <32768>;
-                       clock-output-names = "osc32k";
-               };
-
-               pll1: pll1_clk@1c20000 {
-                       #clock-cells = <0>;
-                       compatible = "allwinner,sun8i-a23-pll1-clk";
-                       reg = <0x01c20000 0x4>;
-                       clocks = <&osc24M>;
-                       clock-output-names = "pll1";
-               };
-
-               pll6: pll6_clk@1c20028 {
-                       #clock-cells = <1>;
-                       compatible = "allwinner,sun6i-a31-pll6-clk";
-                       reg = <0x01c20028 0x4>;
-                       clocks = <&osc24M>;
-                       clock-output-names = "pll6", "pll6x2";
-               };
-
-               pll6d2: pll6d2_clk {
-                       #clock-cells = <0>;
-                       compatible = "fixed-factor-clock";
-                       clock-div = <2>;
-                       clock-mult = <1>;
-                       clocks = <&pll6 0>;
-                       clock-output-names = "pll6d2";
-               };
-
-               pll7: pll7_clk@1c2002c {
-                       #clock-cells = <1>;
-                       compatible = "allwinner,sun6i-a31-pll6-clk";
-                       reg = <0x01c2002c 0x4>;
-                       clocks = <&osc24M>;
-                       clock-output-names = "pll7", "pll7x2";
-               };
-
-               cpu: cpu_clk@1c20050 {
-                       #clock-cells = <0>;
-                       compatible = "allwinner,sun4i-a10-cpu-clk";
-                       reg = <0x01c20050 0x4>;
-                       clocks = <&osc32k>, <&osc24M>, <&pll1>, <&pll1>;
-                       clock-output-names = "cpu";
-                       critical-clocks = <0>;
-               };
-
-               axi: axi_clk@1c20050 {
-                       #clock-cells = <0>;
-                       compatible = "allwinner,sun4i-a10-axi-clk";
-                       reg = <0x01c20050 0x4>;
-                       clocks = <&cpu>;
-                       clock-output-names = "axi";
-               };
-
-               ahb1: ahb1_clk@1c20054 {
-                       #clock-cells = <0>;
-                       compatible = "allwinner,sun6i-a31-ahb1-clk";
-                       reg = <0x01c20054 0x4>;
-                       clocks = <&osc32k>, <&osc24M>, <&axi>, <&pll6 0>;
-                       clock-output-names = "ahb1";
-               };
-
-               ahb2: ahb2_clk@1c2005c {
-                       #clock-cells = <0>;
-                       compatible = "allwinner,sun8i-h3-ahb2-clk";
-                       reg = <0x01c2005c 0x4>;
-                       clocks = <&ahb1>, <&pll6d2>;
-                       clock-output-names = "ahb2";
-               };
-
-               apb1: apb1_clk@1c20054 {
-                       #clock-cells = <0>;
-                       compatible = "allwinner,sun4i-a10-apb0-clk";
-                       reg = <0x01c20054 0x4>;
-                       clocks = <&ahb1>;
-                       clock-output-names = "apb1";
-               };
-
-               apb2: apb2_clk@1c20058 {
-                       #clock-cells = <0>;
-                       compatible = "allwinner,sun4i-a10-apb1-clk";
-                       reg = <0x01c20058 0x4>;
-                       clocks = <&osc32k>, <&osc24M>, <&pll6 1>, <&pll6 1>;
-                       clock-output-names = "apb2";
-               };
-
-               bus_gates: bus_gates_clk@1c20060 {
-                       #clock-cells = <1>;
-                       compatible = "allwinner,sun50i-a64-bus-gates-clk",
-                                    "allwinner,sunxi-multi-bus-gates-clk";
-                       reg = <0x01c20060 0x14>;
-                       ahb1_parent {
-                               clocks = <&ahb1>;
-                               clock-indices = <1>, <5>,
-                                               <6>, <8>,
-                                               <9>, <10>,
-                                               <13>, <14>,
-                                               <18>, <19>,
-                                               <20>, <21>,
-                                               <23>, <24>,
-                                               <25>, <28>,
-                                               <32>, <35>,
-                                               <36>, <37>,
-                                               <40>, <43>,
-                                               <44>, <52>,
-                                               <53>, <54>,
-                                               <135>;
-                               clock-output-names = "bus_mipidsi", "bus_ce",
-                                               "bus_dma", "bus_mmc0",
-                                               "bus_mmc1", "bus_mmc2",
-                                               "bus_nand", "bus_sdram",
-                                               "bus_ts", "bus_hstimer",
-                                               "bus_spi0", "bus_spi1",
-                                               "bus_otg", "bus_otg_ehci0",
-                                               "bus_ehci0", "bus_otg_ohci0",
-                                               "bus_ve", "bus_lcd0",
-                                               "bus_lcd1", "bus_deint",
-                                               "bus_csi", "bus_hdmi",
-                                               "bus_de", "bus_gpu",
-                                               "bus_msgbox", "bus_spinlock",
-                                               "bus_dbg";
-                       };
-                       ahb2_parent {
-                               clocks = <&ahb2>;
-                               clock-indices = <17>, <29>;
-                               clock-output-names = "bus_gmac", "bus_ohci0";
-                       };
-                       apb1_parent {
-                               clocks = <&apb1>;
-                               clock-indices = <64>, <65>,
-                                               <69>, <72>,
-                                               <76>, <77>,
-                                               <78>;
-                               clock-output-names = "bus_codec", "bus_spdif",
-                                               "bus_pio", "bus_ths",
-                                               "bus_i2s0", "bus_i2s1",
-                                               "bus_i2s2";
-                       };
-                       abp2_parent {
-                               clocks = <&apb2>;
-                               clock-indices = <96>, <97>,
-                                               <98>, <101>,
-                                               <112>, <113>,
-                                               <114>, <115>,
-                                               <116>;
-                               clock-output-names = "bus_i2c0", "bus_i2c1",
-                                               "bus_i2c2", "bus_scr",
-                                               "bus_uart0", "bus_uart1",
-                                               "bus_uart2", "bus_uart3",
-                                               "bus_uart4";
-                       };
-               };
-
-               mmc0_clk: mmc0_clk@1c20088 {
-                       #clock-cells = <0>;
-                       compatible = "allwinner,sun4i-a10-mod0-clk";
-                       reg = <0x01c20088 0x4>;
-                       clocks = <&osc24M>, <&pll6 1>, <&pll7 1>;
-                       clock-output-names = "mmc0";
-                };
-
-               mmc1_clk: mmc1_clk@1c2008c {
-                       #clock-cells = <0>;
-                       compatible = "allwinner,sun4i-a10-mod0-clk";
-                       reg = <0x01c2008c 0x4>;
-                       clocks = <&osc24M>, <&pll6 1>, <&pll7 1>;
-                       clock-output-names = "mmc1";
-               };
-
-               mmc2_clk: mmc2_clk@1c20090 {
-                       #clock-cells = <0>;
-                       compatible = "allwinner,sun4i-a10-mod0-clk";
-                       reg = <0x01c20090 0x4>;
-                       clocks = <&osc24M>, <&pll6 1>, <&pll7 1>;
-                       clock-output-names = "mmc2";
-               };
-       };
-
        soc {
                compatible = "simple-bus";
                #address-cells = <1>;
                ranges;
 
                mmc0: mmc@1c0f000 {
-                       compatible = "allwinner,sun50i-a64-mmc",
-                                    "allwinner,sun5i-a13-mmc";
+                       compatible = "allwinner,sun50i-a64-mmc";
                        reg = <0x01c0f000 0x1000>;
-                       clocks = <&bus_gates 8>, <&mmc0_clk>,
-                                <&mmc0_clk>, <&mmc0_clk>;
-                       clock-names = "ahb", "mmc",
-                                     "output", "sample";
-                       resets = <&ahb_rst 8>;
+                       clocks = <&ccu CLK_BUS_MMC0>, <&ccu CLK_MMC0>;
+                       clock-names = "ahb", "mmc";
+                       resets = <&ccu RST_BUS_MMC0>;
                        reset-names = "ahb";
                        interrupts = <GIC_SPI 60 IRQ_TYPE_LEVEL_HIGH>;
+                       max-frequency = <150000000>;
                        status = "disabled";
                        #address-cells = <1>;
                        #size-cells = <0>;
                };
 
                mmc1: mmc@1c10000 {
-                       compatible = "allwinner,sun50i-a64-mmc",
-                                    "allwinner,sun5i-a13-mmc";
+                       compatible = "allwinner,sun50i-a64-mmc";
                        reg = <0x01c10000 0x1000>;
-                       clocks = <&bus_gates 9>, <&mmc1_clk>,
-                                <&mmc1_clk>, <&mmc1_clk>;
-                       clock-names = "ahb", "mmc",
-                                     "output", "sample";
-                       resets = <&ahb_rst 9>;
+                       clocks = <&ccu CLK_BUS_MMC1>, <&ccu CLK_MMC1>;
+                       clock-names = "ahb", "mmc";
+                       resets = <&ccu RST_BUS_MMC1>;
                        reset-names = "ahb";
                        interrupts = <GIC_SPI 61 IRQ_TYPE_LEVEL_HIGH>;
+                       max-frequency = <150000000>;
                        status = "disabled";
                        #address-cells = <1>;
                        #size-cells = <0>;
                };
 
                mmc2: mmc@1c11000 {
-                       compatible = "allwinner,sun50i-a64-mmc",
-                                    "allwinner,sun5i-a13-mmc";
+                       compatible = "allwinner,sun50i-a64-emmc";
                        reg = <0x01c11000 0x1000>;
-                       clocks = <&bus_gates 10>, <&mmc2_clk>,
-                                <&mmc2_clk>, <&mmc2_clk>;
-                       clock-names = "ahb", "mmc",
-                                     "output", "sample";
-                       resets = <&ahb_rst 10>;
+                       clocks = <&ccu CLK_BUS_MMC2>, <&ccu CLK_MMC2>;
+                       clock-names = "ahb", "mmc";
+                       resets = <&ccu RST_BUS_MMC2>;
                        reset-names = "ahb";
                        interrupts = <GIC_SPI 62 IRQ_TYPE_LEVEL_HIGH>;
+                       max-frequency = <200000000>;
                        status = "disabled";
                        #address-cells = <1>;
                        #size-cells = <0>;
                };
 
+               usb_otg: usb@01c19000 {
+                       compatible = "allwinner,sun8i-a33-musb";
+                       reg = <0x01c19000 0x0400>;
+                       clocks = <&ccu CLK_BUS_OTG>;
+                       resets = <&ccu RST_BUS_OTG>;
+                       interrupts = <GIC_SPI 71 IRQ_TYPE_LEVEL_HIGH>;
+                       interrupt-names = "mc";
+                       phys = <&usbphy 0>;
+                       phy-names = "usb";
+                       extcon = <&usbphy 0>;
+                       status = "disabled";
+               };
+
+               usbphy: phy@01c19400 {
+                       compatible = "allwinner,sun50i-a64-usb-phy";
+                       reg = <0x01c19400 0x14>,
+                             <0x01c1a800 0x4>,
+                             <0x01c1b800 0x4>;
+                       reg-names = "phy_ctrl",
+                                   "pmu0",
+                                   "pmu1";
+                       clocks = <&ccu CLK_USB_PHY0>,
+                                <&ccu CLK_USB_PHY1>;
+                       clock-names = "usb0_phy",
+                                     "usb1_phy";
+                       resets = <&ccu RST_USB_PHY0>,
+                                <&ccu RST_USB_PHY1>;
+                       reset-names = "usb0_reset",
+                                     "usb1_reset";
+                       status = "disabled";
+                       #phy-cells = <1>;
+               };
+
+               ehci1: usb@01c1b000 {
+                       compatible = "allwinner,sun50i-a64-ehci", "generic-ehci";
+                       reg = <0x01c1b000 0x100>;
+                       interrupts = <GIC_SPI 74 IRQ_TYPE_LEVEL_HIGH>;
+                       clocks = <&ccu CLK_BUS_OHCI1>,
+                                <&ccu CLK_BUS_EHCI1>,
+                                <&ccu CLK_USB_OHCI1>;
+                       resets = <&ccu RST_BUS_OHCI1>,
+                                <&ccu RST_BUS_EHCI1>;
+                       phys = <&usbphy 1>;
+                       phy-names = "usb";
+                       status = "disabled";
+               };
+
+               ohci1: usb@01c1b400 {
+                       compatible = "allwinner,sun50i-a64-ohci", "generic-ohci";
+                       reg = <0x01c1b400 0x100>;
+                       interrupts = <GIC_SPI 75 IRQ_TYPE_LEVEL_HIGH>;
+                       clocks = <&ccu CLK_BUS_OHCI1>,
+                                <&ccu CLK_USB_OHCI1>;
+                       resets = <&ccu RST_BUS_OHCI1>;
+                       phys = <&usbphy 1>;
+                       phy-names = "usb";
+                       status = "disabled";
+               };
+
+               ccu: clock@01c20000 {
+                       compatible = "allwinner,sun50i-a64-ccu";
+                       reg = <0x01c20000 0x400>;
+                       clocks = <&osc24M>, <&osc32k>;
+                       clock-names = "hosc", "losc";
+                       #clock-cells = <1>;
+                       #reset-cells = <1>;
+               };
+
                pio: pinctrl@1c20800 {
                        compatible = "allwinner,sun50i-a64-pinctrl";
                        reg = <0x01c20800 0x400>;
                        interrupts = <GIC_SPI 11 IRQ_TYPE_LEVEL_HIGH>,
                                     <GIC_SPI 17 IRQ_TYPE_LEVEL_HIGH>,
                                     <GIC_SPI 21 IRQ_TYPE_LEVEL_HIGH>;
-                       clocks = <&bus_gates 69>;
+                       clocks = <&ccu 58>;
                        gpio-controller;
                        #gpio-cells = <3>;
                        interrupt-controller;
-                       #interrupt-cells = <2>;
-
-                       uart0_pins_a: uart0@0 {
-                               allwinner,pins = "PB8", "PB9";
-                               allwinner,function = "uart0";
-                               allwinner,drive = <SUN4I_PINCTRL_10_MA>;
-                               allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
-                       };
-
-                       uart0_pins_b: uart0@1 {
-                               allwinner,pins = "PF2", "PF3";
-                               allwinner,function = "uart0";
-                               allwinner,drive = <SUN4I_PINCTRL_10_MA>;
-                               allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
-                       };
-
-                       uart1_2pins: uart1_2@0 {
-                               allwinner,pins = "PG6", "PG7";
-                               allwinner,function = "uart1";
-                               allwinner,drive = <SUN4I_PINCTRL_10_MA>;
-                               allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
-                       };
-
-                       uart1_4pins: uart1_4@0 {
-                               allwinner,pins = "PG6", "PG7", "PG8", "PG9";
-                               allwinner,function = "uart1";
-                               allwinner,drive = <SUN4I_PINCTRL_10_MA>;
-                               allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
-                       };
-
-                       uart2_2pins: uart2_2@0 {
-                               allwinner,pins = "PB0", "PB1";
-                               allwinner,function = "uart2";
-                               allwinner,drive = <SUN4I_PINCTRL_10_MA>;
-                               allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
-                       };
-
-                       uart2_4pins: uart2_4@0 {
-                               allwinner,pins = "PB0", "PB1", "PB2", "PB3";
-                               allwinner,function = "uart2";
-                               allwinner,drive = <SUN4I_PINCTRL_10_MA>;
-                               allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
-                       };
-
-                       uart3_pins_a: uart3@0 {
-                               allwinner,pins = "PD0", "PD1";
-                               allwinner,function = "uart3";
-                               allwinner,drive = <SUN4I_PINCTRL_10_MA>;
-                               allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
-                       };
-
-                       uart3_2pins_b: uart3_2@1 {
-                               allwinner,pins = "PH4", "PH5";
-                               allwinner,function = "uart3";
-                               allwinner,drive = <SUN4I_PINCTRL_10_MA>;
-                               allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
-                       };
+                       #interrupt-cells = <3>;
 
-                       uart3_4pins_b: uart3_4@1 {
-                               allwinner,pins = "PH4", "PH5", "PH6", "PH7";
-                               allwinner,function = "uart3";
-                               allwinner,drive = <SUN4I_PINCTRL_10_MA>;
-                               allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
-                       };
-
-                       uart4_2pins: uart4_2@0 {
-                               allwinner,pins = "PD2", "PD3";
-                               allwinner,function = "uart4";
-                               allwinner,drive = <SUN4I_PINCTRL_10_MA>;
-                               allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
-                       };
-
-                       uart4_4pins: uart4_4@0 {
-                               allwinner,pins = "PD2", "PD3", "PD4", "PD5";
-                               allwinner,function = "uart4";
-                               allwinner,drive = <SUN4I_PINCTRL_10_MA>;
-                               allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
-                       };
-
-                       mmc0_pins: mmc0@0 {
-                               allwinner,pins = "PF0", "PF1", "PF2", "PF3",
-                                                "PF4", "PF5";
-                               allwinner,function = "mmc0";
-                               allwinner,drive = <SUN4I_PINCTRL_30_MA>;
-                               allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
-                       };
-
-                       mmc0_default_cd_pin: mmc0_cd_pin@0 {
-                               allwinner,pins = "PF6";
-                               allwinner,function = "gpio_in";
-                               allwinner,drive = <SUN4I_PINCTRL_10_MA>;
-                               allwinner,pull = <SUN4I_PINCTRL_PULL_UP>;
-                       };
-
-                       mmc1_pins: mmc1@0 {
-                               allwinner,pins = "PG0", "PG1", "PG2", "PG3",
-                                                "PG4", "PG5";
-                               allwinner,function = "mmc1";
-                               allwinner,drive = <SUN4I_PINCTRL_30_MA>;
-                               allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
+                       i2c1_pins: i2c1_pins {
+                               pins = "PH2", "PH3";
+                               function = "i2c1";
                        };
 
-                       mmc2_pins: mmc2@0 {
-                               allwinner,pins = "PC1", "PC5", "PC6", "PC8",
-                                                "PC9", "PC10";
-                               allwinner,function = "mmc2";
-                               allwinner,drive = <SUN4I_PINCTRL_30_MA>;
-                               allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
+                       mmc0_pins: mmc0-pins {
+                               pins = "PF0", "PF1", "PF2", "PF3",
+                                      "PF4", "PF5";
+                               function = "mmc0";
+                               drive-strength = <30>;
+                               bias-pull-up;
                        };
 
-                       i2c0_pins: i2c0_pins {
-                               allwinner,pins = "PH0", "PH1";
-                               allwinner,function = "i2c0";
-                               allwinner,drive = <SUN4I_PINCTRL_10_MA>;
-                               allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
+                       mmc1_pins: mmc1-pins {
+                               pins = "PG0", "PG1", "PG2", "PG3",
+                                      "PG4", "PG5";
+                               function = "mmc1";
+                               drive-strength = <30>;
+                               bias-pull-up;
                        };
 
-                       i2c1_pins: i2c1_pins {
-                               allwinner,pins = "PH2", "PH3";
-                               allwinner,function = "i2c1";
-                               allwinner,drive = <SUN4I_PINCTRL_10_MA>;
-                               allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
+                       mmc2_pins: mmc2-pins {
+                               pins = "PC1", "PC5", "PC6", "PC8", "PC9",
+                                      "PC10","PC11", "PC12", "PC13",
+                                      "PC14", "PC15", "PC16";
+                               function = "mmc2";
+                               drive-strength = <30>;
+                               bias-pull-up;
                        };
 
-                       i2c2_pins: i2c2_pins {
-                               allwinner,pins = "PE14", "PE15";
-                               allwinner,function = "i2c2";
-                               allwinner,drive = <SUN4I_PINCTRL_10_MA>;
-                               allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
+                       uart0_pins_a: uart0@0 {
+                               pins = "PB8", "PB9";
+                               function = "uart0";
                        };
 
-                       rmii_pins: rmii_pins {
-                               allwinner,pins = "PD10", "PD11", "PD13", "PD14",
-                                                "PD17", "PD18", "PD19", "PD20",
-                                                "PD22", "PD23";
-                               allwinner,function = "emac";
-                               allwinner,drive = <SUN4I_PINCTRL_40_MA>;
-                               allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
+                       uart1_pins: uart1_pins {
+                               pins = "PG6", "PG7";
+                               function = "uart1";
                        };
 
-                       rgmii_pins: rgmii_pins {
-                               allwinner,pins = "PD8", "PD9", "PD10", "PD11",
-                                                "PD12", "PD13", "PD15",
-                                                "PD16", "PD17", "PD18", "PD19",
-                                                "PD20", "PD21", "PD22", "PD23";
-                               allwinner,function = "emac";
-                               allwinner,drive = <SUN4I_PINCTRL_40_MA>;
-                               allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
+                       uart1_rts_cts_pins: uart1_rts_cts_pins {
+                               pins = "PG8", "PG9";
+                               function = "uart1";
                        };
                };
 
-               ahb_rst: reset@1c202c0 {
-                       #reset-cells = <1>;
-                       compatible = "allwinner,sun6i-a31-clock-reset";
-                       reg = <0x01c202c0 0xc>;
-               };
-
-               apb1_rst: reset@1c202d0 {
-                       #reset-cells = <1>;
-                       compatible = "allwinner,sun6i-a31-clock-reset";
-                       reg = <0x01c202d0 0x4>;
-               };
-
-               apb2_rst: reset@1c202d8 {
-                       #reset-cells = <1>;
-                       compatible = "allwinner,sun6i-a31-clock-reset";
-                       reg = <0x01c202d8 0x4>;
-               };
-
                uart0: serial@1c28000 {
                        compatible = "snps,dw-apb-uart";
                        reg = <0x01c28000 0x400>;
                        interrupts = <GIC_SPI 0 IRQ_TYPE_LEVEL_HIGH>;
                        reg-shift = <2>;
                        reg-io-width = <4>;
-                       clocks = <&bus_gates 112>;
-                       resets = <&apb2_rst 16>;
+                       clocks = <&ccu 67>;
+                       resets = <&ccu 46>;
                        status = "disabled";
                };
 
                        interrupts = <GIC_SPI 1 IRQ_TYPE_LEVEL_HIGH>;
                        reg-shift = <2>;
                        reg-io-width = <4>;
-                       clocks = <&bus_gates 113>;
-                       resets = <&apb2_rst 17>;
+                       clocks = <&ccu 68>;
+                       resets = <&ccu 47>;
                        status = "disabled";
                };
 
                        interrupts = <GIC_SPI 2 IRQ_TYPE_LEVEL_HIGH>;
                        reg-shift = <2>;
                        reg-io-width = <4>;
-                       clocks = <&bus_gates 114>;
-                       resets = <&apb2_rst 18>;
+                       clocks = <&ccu 69>;
+                       resets = <&ccu 48>;
                        status = "disabled";
                };
 
                        interrupts = <GIC_SPI 3 IRQ_TYPE_LEVEL_HIGH>;
                        reg-shift = <2>;
                        reg-io-width = <4>;
-                       clocks = <&bus_gates 115>;
-                       resets = <&apb2_rst 19>;
+                       clocks = <&ccu 70>;
+                       resets = <&ccu 49>;
                        status = "disabled";
                };
 
                        interrupts = <GIC_SPI 4 IRQ_TYPE_LEVEL_HIGH>;
                        reg-shift = <2>;
                        reg-io-width = <4>;
-                       clocks = <&bus_gates 116>;
-                       resets = <&apb2_rst 20>;
+                       clocks = <&ccu 71>;
+                       resets = <&ccu 50>;
                        status = "disabled";
                };
 
-               rtc: rtc@1f00000 {
-                       compatible = "allwinner,sun6i-a31-rtc";
-                       reg = <0x01f00000 0x54>;
-                       interrupts = <GIC_SPI 40 IRQ_TYPE_LEVEL_HIGH>,
-                                    <GIC_SPI 41 IRQ_TYPE_LEVEL_HIGH>;
-               };
-
                i2c0: i2c@1c2ac00 {
                        compatible = "allwinner,sun6i-a31-i2c";
                        reg = <0x01c2ac00 0x400>;
                        interrupts = <GIC_SPI 6 IRQ_TYPE_LEVEL_HIGH>;
-                       clocks = <&bus_gates 96>;
-                       resets = <&apb2_rst 0>;
+                       clocks = <&ccu 63>;
+                       resets = <&ccu 42>;
                        status = "disabled";
                        #address-cells = <1>;
                        #size-cells = <0>;
                        compatible = "allwinner,sun6i-a31-i2c";
                        reg = <0x01c2b000 0x400>;
                        interrupts = <GIC_SPI 7 IRQ_TYPE_LEVEL_HIGH>;
-                       clocks = <&bus_gates 97>;
-                       resets = <&apb2_rst 1>;
+                       clocks = <&ccu 64>;
+                       resets = <&ccu 43>;
                        status = "disabled";
                        #address-cells = <1>;
                        #size-cells = <0>;
                        compatible = "allwinner,sun6i-a31-i2c";
                        reg = <0x01c2b400 0x400>;
                        interrupts = <GIC_SPI 8 IRQ_TYPE_LEVEL_HIGH>;
-                       clocks = <&bus_gates 98>;
-                       resets = <&apb2_rst 2>;
+                       clocks = <&ccu 65>;
+                       resets = <&ccu 44>;
                        status = "disabled";
                        #address-cells = <1>;
                        #size-cells = <0>;
                };
 
-               emac: ethernet@01c30000 {
-                       compatible = "allwinner,sun50i-a64-emac";
-                       reg = <0x01c30000 0x2000>, <0x01c00030 0x4>;
-                       reg-names = "emac", "syscon";
-                       interrupts = <GIC_SPI 82 IRQ_TYPE_LEVEL_HIGH>;
-                       resets = <&ahb_rst 17>;
-                       reset-names = "ahb";
-                       clocks = <&bus_gates 17>;
-                       clock-names = "ahb";
-                       status = "disabled";
-                       #address-cells = <1>;
-                       #size-cells = <0>;
+               gic: interrupt-controller@1c81000 {
+                       compatible = "arm,gic-400";
+                       reg = <0x01c81000 0x1000>,
+                             <0x01c82000 0x2000>,
+                             <0x01c84000 0x2000>,
+                             <0x01c86000 0x2000>;
+                       interrupts = <GIC_PPI 9 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_HIGH)>;
+                       interrupt-controller;
+                       #interrupt-cells = <3>;
                };
 
-               usbphy: phy@1c1b810 {
-                       compatible = "allwinner,sun50i-a64-usb-phy",
-                                    "allwinner,sun8i-a33-usb-phy";
-                       reg = <0x01c1b810 0x14>, <0x01c1b800 0x4>;
-                       reg-names = "phy_ctrl", "pmu1";
-                       status = "disabled";
-                       #phy-cells = <1>;
+               rtc: rtc@1f00000 {
+                       compatible = "allwinner,sun6i-a31-rtc";
+                       reg = <0x01f00000 0x54>;
+                       interrupts = <GIC_SPI 40 IRQ_TYPE_LEVEL_HIGH>,
+                                    <GIC_SPI 41 IRQ_TYPE_LEVEL_HIGH>;
                };
 
-               ehci1: usb@01c1b000 {
-                       compatible = "allwinner,sun50i-a64-ehci",
-                                    "generic-ehci";
-                       reg = <0x01c1b000 0x100>;
-                       interrupts = <GIC_SPI 74 IRQ_TYPE_LEVEL_HIGH>;
-                       phys = <&usbphy 1>;
-                       phy-names = "usb";
-                       status = "disabled";
+               r_ccu: clock@1f01400 {
+                       compatible = "allwinner,sun50i-a64-r-ccu";
+                       reg = <0x01f01400 0x100>;
+                       clocks = <&osc24M>, <&osc32k>, <&iosc>;
+                       clock-names = "hosc", "losc", "iosc";
+                       #clock-cells = <1>;
+                       #reset-cells = <1>;
                };
 
-               ohci1: usb@01c1b400 {
-                       compatible = "allwinner,sun50i-a64-ohci",
-                                    "generic-ohci";
-                       reg = <0x01c1b400 0x100>;
-                       interrupts = <GIC_SPI 75 IRQ_TYPE_LEVEL_HIGH>;
-                       phys = <&usbphy 1>;
-                       phy-names = "usb";
-                       status = "enabled";
+               r_pio: pinctrl@01f02c00 {
+                       compatible = "allwinner,sun50i-a64-r-pinctrl";
+                       reg = <0x01f02c00 0x400>;
+                       interrupts = <GIC_SPI 45 IRQ_TYPE_LEVEL_HIGH>;
+                       clocks = <&r_ccu 3>, <&osc24M>, <&osc32k>;
+                       clock-names = "apb", "hosc", "losc";
+                       gpio-controller;
+                       #gpio-cells = <3>;
+                       interrupt-controller;
+                       #interrupt-cells = <3>;
                };
        };
 };
index de60f783d3a6047c58058c61ef000685e0edcb06..780d59a0960cc9611dbec1c716e29d36e4552f69 100644 (file)
 
 /dts-v1/;
 
-#include "sun8i-h3.dtsi"
+#include "sun50i-h5.dtsi"
+
+#include <dt-bindings/gpio/gpio.h>
 
 / {
        model = "OrangePi PC 2";
        compatible = "xunlong,orangepi-pc-2", "allwinner,sun50i-h5";
 
-       cpus {
-               cpu@0 {
-                       compatible = "arm,cortex-a53", "arm,armv8";
-                       enable-method = "psci";
-               };
-               cpu@1 {
-                       compatible = "arm,cortex-a53", "arm,armv8";
-                       enable-method = "psci";
-               };
-               cpu@2 {
-                       compatible = "arm,cortex-a53", "arm,armv8";
-                       enable-method = "psci";
-               };
-               cpu@3 {
-                       compatible = "arm,cortex-a53", "arm,armv8";
-                       enable-method = "psci";
-               };
-       };
-
-       psci {
-               compatible = "arm,psci-0.2";
-               method = "smc";
-       };
-
-       timer {
-               compatible = "arm,armv8-timer";
-       };
-
        chosen {
                stdout-path = "serial0:115200n8";
        };
        };
 };
 
-&gic {
-       compatible = "arm,gic-400";
-};
-
 &mmc0 {
        compatible = "allwinner,sun50i-h5-mmc",
                     "allwinner,sun50i-a64-mmc",
        pinctrl-0 = <&mmc0_pins_a>, <&mmc0_cd_pin>;
        vmmc-supply = <&reg_vcc3v3>;
        bus-width = <4>;
-       cd-gpios = <&pio 5 6 0>;
+       cd-gpios = <&pio 5 6 GPIO_ACTIVE_HIGH>;
        cd-inverted;
        status = "okay";
 };
diff --git a/arch/arm/dts/sun50i-h5-orangepi-prime.dts b/arch/arm/dts/sun50i-h5-orangepi-prime.dts
new file mode 100644 (file)
index 0000000..67eade7
--- /dev/null
@@ -0,0 +1,104 @@
+/*
+ * Copyright (C) 2017 Jagan Teki <jteki@openedev.com>
+ *
+ * This file is dual-licensed: you can use it either under the terms
+ * of the GPL or the X11 license, at your option. Note that this dual
+ * licensing only applies to this file, and not this project as a
+ * whole.
+ *
+ *  a) This library is free software; you can redistribute it and/or
+ *     modify it under the terms of the GNU General Public License as
+ *     published by the Free Software Foundation; either version 2 of the
+ *     License, or (at your option) any later version.
+ *
+ *     This library is distributed in the hope that it will be useful,
+ *     but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *     GNU General Public License for more details.
+ *
+ * Or, alternatively,
+ *
+ *  b) Permission is hereby granted, free of charge, to any person
+ *     obtaining a copy of this software and associated documentation
+ *     files (the "Software"), to deal in the Software without
+ *     restriction, including without limitation the rights to use,
+ *     copy, modify, merge, publish, distribute, sublicense, and/or
+ *     sell copies of the Software, and to permit persons to whom the
+ *     Software is furnished to do so, subject to the following
+ *     conditions:
+ *
+ *     The above copyright notice and this permission notice shall be
+ *     included in all copies or substantial portions of the Software.
+ *
+ *     THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ *     EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ *     OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ *     NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ *     HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ *     WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ *     FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ *     OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+/dts-v1/;
+
+#include "sun50i-h5.dtsi"
+
+#include <dt-bindings/gpio/gpio.h>
+
+/ {
+       model = "OrangePi Prime";
+       compatible = "xunlong,orangepi-prime", "allwinner,sun50i-h5";
+
+       aliases {
+               serial0 = &uart0;
+       };
+
+       chosen {
+               stdout-path = "serial0:115200n8";
+       };
+
+       memory {
+               reg = <0x40000000 0x80000000>;
+       };
+
+       soc {
+               reg_vcc3v3: vcc3v3 {
+                       compatible = "regulator-fixed";
+                       regulator-name = "vcc3v3";
+                       regulator-min-microvolt = <3300000>;
+                       regulator-max-microvolt = <3300000>;
+               };
+       };
+};
+
+&mmc0 {
+       compatible = "allwinner,sun50i-h5-mmc",
+                    "allwinner,sun50i-a64-mmc",
+                    "allwinner,sun5i-a13-mmc";
+       pinctrl-names = "default";
+       pinctrl-0 = <&mmc0_pins_a>, <&mmc0_cd_pin>;
+       vmmc-supply = <&reg_vcc3v3>;
+       bus-width = <4>;
+       cd-gpios = <&pio 5 6 GPIO_ACTIVE_HIGH>;
+       cd-inverted;
+       status = "okay";
+};
+
+&uart0 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&uart0_pins_a>;
+       status = "okay";
+};
+
+&usbphy {
+       status = "okay";
+};
+
+&ohci1 {
+       status = "okay";
+};
+
+&ehci1 {
+       status = "okay";
+};
diff --git a/arch/arm/dts/sun50i-h5.dtsi b/arch/arm/dts/sun50i-h5.dtsi
new file mode 100644 (file)
index 0000000..4904c18
--- /dev/null
@@ -0,0 +1,77 @@
+/*
+ * Copyright (c) 2016 ARM Ltd.
+ *
+ * This file is dual-licensed: you can use it either under the terms
+ * of the GPL or the X11 license, at your option. Note that this dual
+ * licensing only applies to this file, and not this project as a
+ * whole.
+ *
+ *  a) This library is free software; you can redistribute it and/or
+ *     modify it under the terms of the GNU General Public License as
+ *     published by the Free Software Foundation; either version 2 of the
+ *     License, or (at your option) any later version.
+ *
+ *     This library is distributed in the hope that it will be useful,
+ *     but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *     GNU General Public License for more details.
+ *
+ * Or, alternatively,
+ *
+ *  b) Permission is hereby granted, free of charge, to any person
+ *     obtaining a copy of this software and associated documentation
+ *     files (the "Software"), to deal in the Software without
+ *     restriction, including without limitation the rights to use,
+ *     copy, modify, merge, publish, distribute, sublicense, and/or
+ *     sell copies of the Software, and to permit persons to whom the
+ *     Software is furnished to do so, subject to the following
+ *     conditions:
+ *
+ *     The above copyright notice and this permission notice shall be
+ *     included in all copies or substantial portions of the Software.
+ *
+ *     THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ *     EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ *     OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ *     NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ *     HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ *     WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ *     FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ *     OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+#include "sun8i-h3.dtsi"
+
+/ {
+       cpus {
+               cpu@0 {
+                       compatible = "arm,cortex-a53", "arm,armv8";
+                       enable-method = "psci";
+               };
+               cpu@1 {
+                       compatible = "arm,cortex-a53", "arm,armv8";
+                       enable-method = "psci";
+               };
+               cpu@2 {
+                       compatible = "arm,cortex-a53", "arm,armv8";
+                       enable-method = "psci";
+               };
+               cpu@3 {
+                       compatible = "arm,cortex-a53", "arm,armv8";
+                       enable-method = "psci";
+               };
+       };
+
+       psci {
+               compatible = "arm,psci-0.2";
+               method = "smc";
+       };
+
+       timer {
+               compatible = "arm,armv8-timer";
+       };
+};
+
+&gic {
+       compatible = "arm,gic-400";
+};
diff --git a/arch/arm/dts/sun8i-h3-nanopi-m1.dts b/arch/arm/dts/sun8i-h3-nanopi-m1.dts
new file mode 100644 (file)
index 0000000..ec63d10
--- /dev/null
@@ -0,0 +1,64 @@
+/*
+ * Copyright (C) 2016 Milo Kim <woogyom.kim@gmail.com>
+ *
+ * This file is dual-licensed: you can use it either under the terms
+ * of the GPL or the X11 license, at your option. Note that this dual
+ * licensing only applies to this file, and not this project as a
+ * whole.
+ *
+ *  a) This file is free software; you can redistribute it and/or
+ *     modify it under the terms of the GNU General Public License as
+ *     published by the Free Software Foundation; either version 2 of the
+ *     License, or (at your option) any later version.
+ *
+ *     This file is distributed in the hope that it will be useful,
+ *     but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *     GNU General Public License for more details.
+ *
+ * Or, alternatively,
+ *
+ *  b) Permission is hereby granted, free of charge, to any person
+ *     obtaining a copy of this software and associated documentation
+ *     files (the "Software"), to deal in the Software without
+ *     restriction, including without limitation the rights to use,
+ *     copy, modify, merge, publish, distribute, sublicense, and/or
+ *     sell copies of the Software, and to permit persons to whom the
+ *     Software is furnished to do so, subject to the following
+ *     conditions:
+ *
+ *     The above copyright notice and this permission notice shall be
+ *     included in all copies or substantial portions of the Software.
+ *
+ *     THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ *     EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ *     OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ *     NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ *     HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ *     WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ *     FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ *     OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+#include "sun8i-h3-nanopi.dtsi"
+
+/ {
+       model = "FriendlyArm NanoPi M1";
+       compatible = "friendlyarm,nanopi-m1", "allwinner,sun8i-h3";
+};
+
+&ehci1 {
+       status = "okay";
+};
+
+&ehci2 {
+       status = "okay";
+};
+
+&ohci1 {
+       status = "okay";
+};
+
+&ohci2 {
+       status = "okay";
+};
index 096ff0b5a53a2acdacc57dfe662447bd5836476f..511305909894489ad40677d5fff91246bb946c8e 100644 (file)
  *     OTHER DEALINGS IN THE SOFTWARE.
  */
 
-/dts-v1/;
-#include "sun8i-h3.dtsi"
-#include "sunxi-common-regulators.dtsi"
-
-#include <dt-bindings/gpio/gpio.h>
-#include <dt-bindings/pinctrl/sun4i-a10.h>
+#include "sun8i-h3-nanopi.dtsi"
 
 / {
        model = "FriendlyARM NanoPi NEO";
        compatible = "friendlyarm,nanopi-neo", "allwinner,sun8i-h3";
-
-       aliases {
-               serial0 = &uart0;
-       };
-
-       chosen {
-               stdout-path = "serial0:115200n8";
-       };
-
-       leds {
-               compatible = "gpio-leds";
-               pinctrl-names = "default";
-               pinctrl-0 = <&leds_opc>, <&leds_r_opc>;
-
-               pwr {
-                       label = "nanopi:green:pwr";
-                       gpios = <&r_pio 0 10 GPIO_ACTIVE_HIGH>; /* PL10 */
-                       default-state = "on";
-               };
-
-               status {
-                       label = "nanopi:blue:status";
-                       gpios = <&pio 0 10 GPIO_ACTIVE_HIGH>; /* PA10 */
-               };
-       };
-};
-
-&ehci3 {
-       status = "okay";
-};
-
-&mmc0 {
-       pinctrl-names = "default";
-       pinctrl-0 = <&mmc0_pins_a>, <&mmc0_cd_pin>;
-       vmmc-supply = <&reg_vcc3v3>;
-       bus-width = <4>;
-       cd-gpios = <&pio 5 6 GPIO_ACTIVE_HIGH>; /* PF6 */
-       cd-inverted;
-       status = "okay";
-};
-
-&ohci3 {
-       status = "okay";
-};
-
-&pio {
-       leds_opc: led-pins {
-               allwinner,pins = "PA10";
-               allwinner,function = "gpio_out";
-               allwinner,drive = <SUN4I_PINCTRL_10_MA>;
-               allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
-       };
-};
-
-&r_pio {
-       leds_r_opc: led-pins {
-               allwinner,pins = "PL10";
-               allwinner,function = "gpio_out";
-               allwinner,drive = <SUN4I_PINCTRL_10_MA>;
-               allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
-       };
-};
-
-&uart0 {
-       pinctrl-names = "default";
-       pinctrl-0 = <&uart0_pins_a>;
-       status = "okay";
-};
-
-&usbphy {
-       /* USB VBUS is always on */
-       status = "okay";
 };
 
 &emac {
diff --git a/arch/arm/dts/sun8i-h3-nanopi.dtsi b/arch/arm/dts/sun8i-h3-nanopi.dtsi
new file mode 100644 (file)
index 0000000..c6decee
--- /dev/null
@@ -0,0 +1,137 @@
+/*
+ * Copyright (C) 2016 James Pettigrew <james@innovum.com.au>
+ * Copyright (C) 2016 Milo Kim <woogyom.kim@gmail.com>
+ *
+ * This file is dual-licensed: you can use it either under the terms
+ * of the GPL or the X11 license, at your option. Note that this dual
+ * licensing only applies to this file, and not this project as a
+ * whole.
+ *
+ *  a) This file is free software; you can redistribute it and/or
+ *     modify it under the terms of the GNU General Public License as
+ *     published by the Free Software Foundation; either version 2 of the
+ *     License, or (at your option) any later version.
+ *
+ *     This file is distributed in the hope that it will be useful,
+ *     but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *     GNU General Public License for more details.
+ *
+ * Or, alternatively,
+ *
+ *  b) Permission is hereby granted, free of charge, to any person
+ *     obtaining a copy of this software and associated documentation
+ *     files (the "Software"), to deal in the Software without
+ *     restriction, including without limitation the rights to use,
+ *     copy, modify, merge, publish, distribute, sublicense, and/or
+ *     sell copies of the Software, and to permit persons to whom the
+ *     Software is furnished to do so, subject to the following
+ *     conditions:
+ *
+ *     The above copyright notice and this permission notice shall be
+ *     included in all copies or substantial portions of the Software.
+ *
+ *     THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ *     EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ *     OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ *     NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ *     HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ *     WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ *     FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ *     OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+/dts-v1/;
+#include "sun8i-h3.dtsi"
+#include "sunxi-common-regulators.dtsi"
+
+#include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/input/input.h>
+
+/ {
+       aliases {
+               serial0 = &uart0;
+       };
+
+       chosen {
+               stdout-path = "serial0:115200n8";
+       };
+
+       leds {
+               compatible = "gpio-leds";
+               pinctrl-names = "default";
+               pinctrl-0 = <&leds_npi>, <&leds_r_npi>;
+
+               status {
+                       label = "nanopi:blue:status";
+                       gpios = <&pio 0 10 GPIO_ACTIVE_HIGH>;
+                       linux,default-trigger = "heartbeat";
+               };
+
+               pwr {
+                       label = "nanopi:green:pwr";
+                       gpios = <&r_pio 0 10 GPIO_ACTIVE_HIGH>;
+                       default-state = "on";
+               };
+       };
+
+       r_gpio_keys {
+               compatible = "gpio-keys";
+               input-name = "k1";
+               pinctrl-names = "default";
+               pinctrl-0 = <&sw_r_npi>;
+
+               k1@0 {
+                       label = "k1";
+                       linux,code = <KEY_POWER>;
+                       gpios = <&r_pio 0 3 GPIO_ACTIVE_LOW>;
+               };
+       };
+};
+
+&ehci3 {
+       status = "okay";
+};
+
+&mmc0 {
+       bus-width = <4>;
+       cd-gpios = <&pio 5 6 GPIO_ACTIVE_HIGH>;
+       cd-inverted;
+       pinctrl-names = "default";
+       pinctrl-0 = <&mmc0_pins_a>, <&mmc0_cd_pin>;
+       status = "okay";
+       vmmc-supply = <&reg_vcc3v3>;
+};
+
+&ohci3 {
+       status = "okay";
+};
+
+&pio {
+       leds_npi: led_pins@0 {
+               pins = "PA10";
+               function = "gpio_out";
+       };
+};
+
+&r_pio {
+       leds_r_npi: led_pins@0 {
+               pins = "PL10";
+               function = "gpio_out";
+       };
+
+       sw_r_npi: key_pins@0 {
+               pins = "PL3";
+               function = "gpio_in";
+       };
+};
+
+&uart0 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&uart0_pins_a>;
+       status = "okay";
+};
+
+&usbphy {
+       status = "okay";
+};
index 19ccf5c8dbb18f98900d93365bec4efb6baac602..5399bb81f0bbed6988be3b00d101ea128ad60500 100644 (file)
@@ -14,7 +14,7 @@
 #include <asm/arch/clocks_am33xx.h>
 #include <asm/arch/hardware.h>
 
-#ifdef CONFIG_TI81XX
+#if defined(CONFIG_TI816X) || defined(CONFIG_TI814X)
 #include <asm/arch/clock_ti81xx.h>
 #endif
 
index 653ec1b2394f9d7f483f30cd48d7ecad3cfc945d..bc1dab5b72b29ee98489a50bf14cfd55fdecbfef 100644 (file)
@@ -29,6 +29,7 @@
 #define NUM_OPPS       6
 
 extern void enable_dmm_clocks(void);
+extern void enable_emif_clocks(void);
 extern const struct dpll_params dpll_core_opp100;
 extern struct dpll_params dpll_mpu_opp100;
 
index 43e122e261916cf3f0a2e4d917b5a2f95f59c66f..a97ebb557bcd291a353aa349083968c6f4db6d11 100644 (file)
@@ -354,9 +354,15 @@ struct ddr_ctrl {
        unsigned int ddrckectrl;
 };
 
+#ifdef CONFIG_TI816X
+void config_ddr(const struct ddr_data *data, const struct cmd_control *ctrl,
+               const struct emif_regs *regs,
+               const struct dmm_lisa_map_regs *lisa_regs, int nrs);
+#else
 void config_ddr(unsigned int pll, const struct ctrl_ioregs *ioregs,
                const struct ddr_data *data, const struct cmd_control *ctrl,
                const struct emif_regs *regs, int nr);
+#endif
 void emif_get_ext_phy_ctrl_const_regs(const u32 **regs, u32 *size);
 
 #endif  /* _DDR_DEFS_H */
index 3293caaca4abeedde919762e7cc3333ccd2d8ce9..0dafb9e3270a762141317558fd0cf9773f1d1a15 100644 (file)
@@ -21,7 +21,7 @@
 #define NON_SECURE_SRAM_START  0x402F0400
 #define NON_SECURE_SRAM_END    0x40310000
 #define NON_SECURE_SRAM_IMG_END        0x4030B800
-#elif defined(CONFIG_TI81XX)
+#elif defined(CONFIG_TI816X) || defined(CONFIG_TI814X)
 #define NON_SECURE_SRAM_START  0x40300000
 #define NON_SECURE_SRAM_END    0x40320000
 #define NON_SECURE_SRAM_IMG_END        0x4031B800
index 69359135d59d11ccd4018b5ea1a656ac69927d8b..bf32782d17267ebd6316d721f9e65d4c38f7e31b 100644 (file)
@@ -20,5 +20,7 @@ enum mxc_clock {
 };
 
 unsigned int mxc_get_clock(enum mxc_clock clk);
+ulong get_ddr_freq(ulong);
+uint get_svr(void);
 
 #endif /* __ASM_ARCH_FSL_LAYERSCAPE_CLOCK_H_ */
index 93e6597d9e0fb121011699bf677f59cdd7c07dd2..79e94f9f2c4498b66dfa361e7b4664b139ab85cc 100644 (file)
@@ -17,6 +17,7 @@
  * To be aligned with MMU block size
  */
 #define CONFIG_SYS_MEM_RESERVE_SECURE  (2048 * 1024)   /* 2MB */
+#define SPL_TLB_SETBACK        0x1000000       /* 16MB under effective memory top */
 
 #ifdef CONFIG_ARCH_LS2080A
 #define CONFIG_SYS_FSL_CLUSTER_CLOCKS          { 1, 1, 4, 4 }
index d6a273a2c4f139e4fa05cf6d136411f91e2fa36f..c4e5eccd77b5c3e1107b0ca2b714ef5353fe47ab 100644 (file)
@@ -353,4 +353,5 @@ static struct mm_region final_map[] = {
 
 int fsl_qoriq_core_to_cluster(unsigned int core);
 u32 cpu_mask(void);
+
 #endif /* _FSL_LAYERSCAPE_CPU_H */
index cc3b079bbfb8516ca8014ada369d545004f4b344..497afe7b15e337b2431f94bb09d3acd39cf5ec17 100644 (file)
@@ -8,6 +8,16 @@
 #ifndef _ASM_ARMV8_FSL_LAYERSCAPE_SOC_H_
 #define _ASM_ARMV8_FSL_LAYERSCAPE_SOC_H_
 
+#ifndef __ASSEMBLY__
+#include <linux/types.h>
+#ifdef CONFIG_FSL_LSCH2
+#include <asm/arch/immap_lsch2.h>
+#endif
+#ifdef CONFIG_FSL_LSCH3
+#include <asm/arch/immap_lsch3.h>
+#endif
+#endif
+
 #ifdef CONFIG_SYS_FSL_CCSR_GUR_LE
 #define gur_in32(a)       in_le32(a)
 #define gur_out32(a, v)   out_le32(a, v)
@@ -120,4 +130,5 @@ void erratum_a010315(void);
 bool soc_has_dp_ddr(void);
 bool soc_has_aiop(void);
 #endif
+
 #endif /* _ASM_ARMV8_FSL_LAYERSCAPE_SOC_H_ */
index b0524060b0a9f934209794b35017a982d8f69574..ec5b419e47099343e0f235cb3e7ae449282c97e6 100644 (file)
 #define CS0_32M_CS1_32M_CS2_32M_CS3_32M                3
 
 u32 get_imx_reset_cause(void);
+ulong get_systemPLLCLK(void);
+ulong get_FCLK(void);
+ulong get_HCLK(void);
+ulong get_BCLK(void);
+ulong get_PERCLK1(void);
+ulong get_PERCLK2(void);
+ulong get_PERCLK3(void);
index fd36bb0a501d7eeb2f76644fe6ff328b444f2eaf..a1d6afec9339a49b9a57b1f9f7a0b45d0f50a49c 100644 (file)
@@ -19,5 +19,7 @@ enum mxc_clock {
 };
 
 unsigned int mxc_get_clock(enum mxc_clock clk);
+ulong get_ddr_freq(ulong);
+uint get_svr(void);
 
 #endif /* __ASM_ARCH_LS102XA_CLOCK_H_ */
diff --git a/arch/arm/include/asm/arch-ls102xa/soc.h b/arch/arm/include/asm/arch-ls102xa/soc.h
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/arch/arm/include/asm/arch-s3c24x0/gpio.h b/arch/arm/include/asm/arch-s3c24x0/gpio.h
deleted file mode 100644 (file)
index a749b64..0000000
+++ /dev/null
@@ -1,155 +0,0 @@
-/*
- * Copyright (c) 2012.
- *
- * Gabriel Huau <contact@huau-gabriel.fr>
- *
- * SPDX-License-Identifier:    GPL-2.0+
- */
-
-#ifndef _S3C24X0_GPIO_H_
-#define _S3C24X0_GPIO_H_
-
-enum s3c2440_gpio {
-       GPA0,
-       GPA1,
-       GPA2,
-       GPA3,
-       GPA4,
-       GPA5,
-       GPA6,
-       GPA7,
-       GPA8,
-       GPA9,
-       GPA10,
-       GPA11,
-       GPA12,
-       GPA13,
-       GPA14,
-       GPA15,
-       GPA16,
-       GPA17,
-       GPA18,
-       GPA19,
-       GPA20,
-       GPA21,
-       GPA22,
-       GPA23,
-       GPA24,
-
-       GPB0 = 32,
-       GPB1,
-       GPB2,
-       GPB3,
-       GPB4,
-       GPB5,
-       GPB6,
-       GPB7,
-       GPB8,
-       GPB9,
-       GPB10,
-
-       GPC0 = 64,
-       GPC1,
-       GPC2,
-       GPC3,
-       GPC4,
-       GPC5,
-       GPC6,
-       GPC7,
-       GPC8,
-       GPC9,
-       GPC10,
-       GPC11,
-       GPC12,
-       GPC13,
-       GPC14,
-       GPC15,
-
-       GPD0 = 96,
-       GPD1,
-       GPD2,
-       GPD3,
-       GPD4,
-       GPD5,
-       GPD6,
-       GPD7,
-       GPD8,
-       GPD9,
-       GPD10,
-       GPD11,
-       GPD12,
-       GPD13,
-       GPD14,
-       GPD15,
-
-       GPE0 = 128,
-       GPE1,
-       GPE2,
-       GPE3,
-       GPE4,
-       GPE5,
-       GPE6,
-       GPE7,
-       GPE8,
-       GPE9,
-       GPE10,
-       GPE11,
-       GPE12,
-       GPE13,
-       GPE14,
-       GPE15,
-
-       GPF0 = 160,
-       GPF1,
-       GPF2,
-       GPF3,
-       GPF4,
-       GPF5,
-       GPF6,
-       GPF7,
-
-       GPG0 = 192,
-       GPG1,
-       GPG2,
-       GPG3,
-       GPG4,
-       GPG5,
-       GPG6,
-       GPG7,
-       GPG8,
-       GPG9,
-       GPG10,
-       GPG11,
-       GPG12,
-       GPG13,
-       GPG14,
-       GPG15,
-
-       GPH0 = 224,
-       GPH1,
-       GPH2,
-       GPH3,
-       GPH4,
-       GPH5,
-       GPH6,
-       GPH7,
-       GPH8,
-       GPH9,
-       GPH10,
-
-       GPJ0 = 256,
-       GPJ1,
-       GPJ2,
-       GPJ3,
-       GPJ4,
-       GPJ5,
-       GPJ6,
-       GPJ7,
-       GPJ8,
-       GPJ9,
-       GPJ10,
-       GPJ11,
-       GPJ12,
-};
-
-#endif
diff --git a/arch/arm/include/asm/arch-s3c24x0/iomux.h b/arch/arm/include/asm/arch-s3c24x0/iomux.h
deleted file mode 100644 (file)
index 9811644..0000000
+++ /dev/null
@@ -1,184 +0,0 @@
-/*
- * Copyright (c) 2012
- *
- * Gabriel Huau <contact@huau-gabriel.fr>
- *
- * SPDX-License-Identifier:    GPL-2.0+
- */
-
-#ifndef _S3C24X0_IOMUX_H_
-#define _S3C24X0_IOMUX_H_
-
-enum s3c2440_iomux_func {
-       /* PORT A */
-       IOMUXA_ADDR0    = 1,
-       IOMUXA_ADDR16   = (1 << 1),
-       IOMUXA_ADDR17   = (1 << 2),
-       IOMUXA_ADDR18   = (1 << 3),
-       IOMUXA_ADDR19   = (1 << 4),
-       IOMUXA_ADDR20   = (1 << 5),
-       IOMUXA_ADDR21   = (1 << 6),
-       IOMUXA_ADDR22   = (1 << 7),
-       IOMUXA_ADDR23   = (1 << 8),
-       IOMUXA_ADDR24   = (1 << 9),
-       IOMUXA_ADDR25   = (1 << 10),
-       IOMUXA_ADDR26   = (1 << 11),
-       IOMUXA_nGCS1    = (1 << 12),
-       IOMUXA_nGCS2    = (1 << 13),
-       IOMUXA_nGCS3    = (1 << 14),
-       IOMUXA_nGCS4    = (1 << 15),
-       IOMUXA_nGCS5    = (1 << 16),
-       IOMUXA_CLE      = (1 << 17),
-       IOMUXA_ALE      = (1 << 18),
-       IOMUXA_nFWE     = (1 << 19),
-       IOMUXA_nFRE     = (1 << 20),
-       IOMUXA_nRSTOUT  = (1 << 21),
-       IOMUXA_nFCE             = (1 << 22),
-
-       /* PORT B */
-       IOMUXB_nXDREQ0  = (2 << 20),
-       IOMUXB_nXDACK0  = (2 << 18),
-       IOMUXB_nXDREQ1  = (2 << 16),
-       IOMUXB_nXDACK1  = (2 << 14),
-       IOMUXB_nXBREQ   = (2 << 12),
-       IOMUXB_nXBACK   = (2 << 10),
-       IOMUXB_TCLK0    = (2 << 8),
-       IOMUXB_TOUT3    = (2 << 6),
-       IOMUXB_TOUT2    = (2 << 4),
-       IOMUXB_TOUT1    = (2 << 2),
-       IOMUXB_TOUT0    = 2,
-
-       /* PORT C */
-       IOMUXC_VS7      = (2 << 30),
-       IOMUXC_VS6      = (2 << 28),
-       IOMUXC_VS5      = (2 << 26),
-       IOMUXC_VS4      = (2 << 24),
-       IOMUXC_VS3      = (2 << 22),
-       IOMUXC_VS2      = (2 << 20),
-       IOMUXC_VS1      = (2 << 18),
-       IOMUXC_VS0      = (2 << 16),
-       IOMUXC_LCD_LPCREVB      = (2 << 14),
-       IOMUXC_LCD_LPCREV       = (2 << 12),
-       IOMUXC_LCD_LPCOE        = (2 << 10),
-       IOMUXC_VM               = (2 << 8),
-       IOMUXC_VFRAME   = (2 << 6),
-       IOMUXC_VLINE    = (2 << 4),
-       IOMUXC_VCLK             = (2 << 2),
-       IOMUXC_LEND             = 2,
-       IOMUXC_I2SSDI   = (3 << 8),
-
-       /* PORT D */
-       IOMUXD_VS23     = (2 << 30),
-       IOMUXD_VS22     = (2 << 28),
-       IOMUXD_VS21     = (2 << 26),
-       IOMUXD_VS20     = (2 << 24),
-       IOMUXD_VS19     = (2 << 22),
-       IOMUXD_VS18     = (2 << 20),
-       IOMUXD_VS17     = (2 << 18),
-       IOMUXD_VS16     = (2 << 16),
-       IOMUXD_VS15     = (2 << 14),
-       IOMUXD_VS14     = (2 << 12),
-       IOMUXD_VS13     = (2 << 10),
-       IOMUXD_VS12     = (2 << 8),
-       IOMUXD_VS11     = (2 << 6),
-       IOMUXD_VS10     = (2 << 4),
-       IOMUXD_VS9      = (2 << 2),
-       IOMUXD_VS8      = 2,
-       IOMUXD_nSS0     = (3 << 30),
-       IOMUXD_nSS1     = (3 << 28),
-       IOMUXD_SPICLK1  = (3 << 20),
-       IOMUXD_SPIMOSI1 = (3 << 18),
-       IOMUXD_SPIMISO1 = (3 << 16),
-
-       /* PORT E */
-       IOMUXE_IICSDA   = (2 << 30),
-       IOMUXE_IICSCL   = (2 << 28),
-       IOMUXE_SPICLK0  = (2 << 26),
-       IOMUXE_SPIMOSI0 = (2 << 24),
-       IOMUXE_SPIMISO0 = (2 << 22),
-       IOMUXE_SDDAT3   = (2 << 20),
-       IOMUXE_SDDAT2   = (2 << 18),
-       IOMUXE_SDDAT1   = (2 << 16),
-       IOMUXE_SDDAT0   = (2 << 14),
-       IOMUXE_SDCMD    = (2 << 12),
-       IOMUXE_SDCLK    = (2 << 10),
-       IOMUXE_I2SDO    = (2 << 8),
-       IOMUXE_I2SDI    = (2 << 6),
-       IOMUXE_CDCLK    = (2 << 4),
-       IOMUXE_I2SSCLK  = (2 << 2),
-       IOMUXE_I2SLRCK  = 2,
-       IOMUXE_AC_SDATA_OUT     = (3 << 8),
-       IOMUXE_AC_SDATA_IN      = (3 << 6),
-       IOMUXE_AC_nRESET        = (3 << 4),
-       IOMUXE_AC_BIT_CLK       = (3 << 2),
-       IOMUXE_AC_SYNC          = 3,
-
-       /* PORT F */
-       IOMUXF_EINT7    = (2 << 14),
-       IOMUXF_EINT6    = (2 << 12),
-       IOMUXF_EINT5    = (2 << 10),
-       IOMUXF_EINT4    = (2 << 8),
-       IOMUXF_EINT3    = (2 << 6),
-       IOMUXF_EINT2    = (2 << 4),
-       IOMUXF_EINT1    = (2 << 2),
-       IOMUXF_EINT0    = 2,
-
-       /* PORT G */
-       IOMUXG_EINT23   = (2 << 30),
-       IOMUXG_EINT22   = (2 << 28),
-       IOMUXG_EINT21   = (2 << 26),
-       IOMUXG_EINT20   = (2 << 24),
-       IOMUXG_EINT19   = (2 << 22),
-       IOMUXG_EINT18   = (2 << 20),
-       IOMUXG_EINT17   = (2 << 18),
-       IOMUXG_EINT16   = (2 << 16),
-       IOMUXG_EINT15   = (2 << 14),
-       IOMUXG_EINT14   = (2 << 12),
-       IOMUXG_EINT13   = (2 << 10),
-       IOMUXG_EINT12   = (2 << 8),
-       IOMUXG_EINT11   = (2 << 6),
-       IOMUXG_EINT10   = (2 << 4),
-       IOMUXG_EINT9    = (2 << 2),
-       IOMUXG_EINT8    = 2,
-       IOMUXG_TCLK1    = (3 << 22),
-       IOMUXG_nCTS1    = (3 << 20),
-       IOMUXG_nRTS1    = (3 << 18),
-       IOMUXG_SPICLK1  = (3 << 14),
-       IOMUXG_SPIMOSI1 = (3 << 12),
-       IOMUXG_SPIMISO1 = (3 << 10),
-       IOMUXG_LCD_PWRDN        = (3 << 8),
-       IOMUXG_nSS1                     = (3 << 6),
-       IOMUXG_nSS0                     = (3 << 4),
-
-       /* PORT H */
-       IOMUXH_CLKOUT1  = (2 << 20),
-       IOMUXH_CLKOUT0  = (2 << 18),
-       IOMUXH_UEXTCLK  = (2 << 16),
-       IOMUXH_RXD2             = (2 << 14),
-       IOMUXH_TXD2             = (2 << 12),
-       IOMUXH_RXD1             = (2 << 10),
-       IOMUXH_TXD1             = (2 << 8),
-       IOMUXH_RXD0             = (2 << 6),
-       IOMUXH_TXD0             = (2 << 4),
-       IOMUXH_nRTS0    = (2 << 2),
-       IOMUXH_nCTS0    = 2,
-       IOMUXH_nCTS1    = (3 << 14),
-       IOMUXH_nRTS1    = (3 << 12),
-
-       /* PORT J */
-       IOMUXJ_CAMRESET         = (2 << 24),
-       IOMUXJ_CAMCLKOUT        = (2 << 22),
-       IOMUXJ_CAMHREF          = (2 << 20),
-       IOMUXJ_CAMVSYNC         = (2 << 18),
-       IOMUXJ_CAMPCLK          = (2 << 16),
-       IOMUXJ_CAMDATA7         = (2 << 14),
-       IOMUXJ_CAMDATA6         = (2 << 12),
-       IOMUXJ_CAMDATA5         = (2 << 10),
-       IOMUXJ_CAMDATA4         = (2 << 8),
-       IOMUXJ_CAMDATA3         = (2 << 6),
-       IOMUXJ_CAMDATA2         = (2 << 4),
-       IOMUXJ_CAMDATA1         = (2 << 2),
-       IOMUXJ_CAMDATA0         = 2
-};
-
-#endif
diff --git a/arch/arm/include/asm/arch-s3c24x0/memory.h b/arch/arm/include/asm/arch-s3c24x0/memory.h
deleted file mode 100644 (file)
index d6a787b..0000000
+++ /dev/null
@@ -1,159 +0,0 @@
-/*
- * linux/include/asm-arm/arch-s3c2400/memory.h by garyj@denx.de
- * based on
- * linux/include/asm-arm/arch-sa1100/memory.h
- *
- * Copyright (c) 1999 Nicolas Pitre <nico@visuaide.com>
- */
-
-#ifndef __ASM_ARCH_MEMORY_H
-#define __ASM_ARCH_MEMORY_H
-
-
-/*
- * Task size: 3GB
- */
-#define TASK_SIZE       (0xc0000000UL)
-#define TASK_SIZE_26   (0x04000000UL)
-
-/*
- * This decides where the kernel will search for a free chunk of vm
- * space during mmap's.
- */
-#define TASK_UNMAPPED_BASE (TASK_SIZE / 3)
-
-/*
- * Page offset: 3GB
- */
-#define PAGE_OFFSET     (0xc0000000UL)
-
-/*
- * Physical DRAM offset is 0x0c000000 on the S3C2400
- */
-#define PHYS_OFFSET    (0x0c000000UL)
-
-/* Modified for S3C2400, by chc, 20010509 */
-#define RAM_IN_BANK_0  32*1024*1024
-#define RAM_IN_BANK_1  0
-#define RAM_IN_BANK_2  0
-#define RAM_IN_BANK_3  0
-
-#define MEM_SIZE  (RAM_IN_BANK_0+RAM_IN_BANK_1+RAM_IN_BANK_2+RAM_IN_BANK_3)
-
-
-/* translation macros */
-#define __virt_to_phys__is_a_macro
-#define __phys_to_virt__is_a_macro
-
-#if (RAM_IN_BANK_1 + RAM_IN_BANK_2 + RAM_IN_BANK_3 == 0)
-
-#define __virt_to_phys(x) ( (x) - PAGE_OFFSET + 0x0c000000 )
-#define __phys_to_virt(x) ( (x) - 0x0c000000 + PAGE_OFFSET )
-
-#elif (RAM_IN_BANK_0 == RAM_IN_BANK_1) && \
-      (RAM_IN_BANK_2 + RAM_IN_BANK_3 == 0)
-
-/* Two identical banks */
-#define __virt_to_phys(x) \
-         ( ((x) < PAGE_OFFSET+RAM_IN_BANK_0) ? \
-           ((x) - PAGE_OFFSET + _DRAMBnk0) : \
-           ((x) - PAGE_OFFSET - RAM_IN_BANK_0 + _DRAMBnk1) )
-#define __phys_to_virt(x) \
-         ( ((x)&0x07ffffff) + \
-           (((x)&0x08000000) ? PAGE_OFFSET+RAM_IN_BANK_0 : PAGE_OFFSET) )
-#else
-
-/* It's more efficient for all other cases to use the function call */
-#undef __virt_to_phys__is_a_macro
-#undef __phys_to_virt__is_a_macro
-extern unsigned long __virt_to_phys(unsigned long vpage);
-extern unsigned long __phys_to_virt(unsigned long ppage);
-
-#endif
-
-/*
- * Virtual view <-> DMA view memory address translations
- * virt_to_bus: Used to translate the virtual address to an
- *              address suitable to be passed to set_dma_addr
- * bus_to_virt: Used to convert an address for DMA operations
- *              to an address that the kernel can use.
- *
- * On the SA1100, bus addresses are equivalent to physical addresses.
- */
-#define __virt_to_bus__is_a_macro
-#define __virt_to_bus(x)        __virt_to_phys(x)
-#define __bus_to_virt__is_a_macro
-#define __bus_to_virt(x)        __phys_to_virt(x)
-
-
-#ifdef CONFIG_DISCONTIGMEM
-#error "CONFIG_DISCONTIGMEM will not work on S3C2400"
-/*
- * Because of the wide memory address space between physical RAM banks on the
- * SA1100, it's much more convenient to use Linux's NUMA support to implement
- * our memory map representation.  Assuming all memory nodes have equal access
- * characteristics, we then have generic discontiguous memory support.
- *
- * Of course, all this isn't mandatory for SA1100 implementations with only
- * one used memory bank.  For those, simply undefine CONFIG_DISCONTIGMEM.
- *
- * The nodes are matched with the physical memory bank addresses which are
- * incidentally the same as virtual addresses.
- *
- *     node 0:  0xc0000000 - 0xc7ffffff
- *     node 1:  0xc8000000 - 0xcfffffff
- *     node 2:  0xd0000000 - 0xd7ffffff
- *     node 3:  0xd8000000 - 0xdfffffff
- */
-
-#define NR_NODES       4
-
-/*
- * Given a kernel address, find the home node of the underlying memory.
- */
-#define KVADDR_TO_NID(addr) \
-               (((unsigned long)(addr) - 0xc0000000) >> 27)
-
-/*
- * Given a physical address, convert it to a node id.
- */
-#define PHYS_TO_NID(addr) KVADDR_TO_NID(__phys_to_virt(addr))
-
-/*
- * Given a kaddr, ADDR_TO_MAPBASE finds the owning node of the memory
- * and returns the mem_map of that node.
- */
-#define ADDR_TO_MAPBASE(kaddr) \
-                       NODE_MEM_MAP(KVADDR_TO_NID((unsigned long)(kaddr)))
-
-/*
- * Given a kaddr, LOCAL_MEM_MAP finds the owning node of the memory
- * and returns the index corresponding to the appropriate page in the
- * node's mem_map.
- */
-#define LOCAL_MAP_NR(kvaddr) \
-       (((unsigned long)(kvaddr) & 0x07ffffff) >> PAGE_SHIFT)
-
-/*
- * Given a kaddr, virt_to_page returns a pointer to the corresponding
- * mem_map entry.
- */
-#define virt_to_page(kaddr) \
-       (ADDR_TO_MAPBASE(kaddr) + LOCAL_MAP_NR(kaddr))
-
-/*
- * VALID_PAGE returns a non-zero value if given page pointer is valid.
- * This assumes all node's mem_maps are stored within the node they refer to.
- */
-#define VALID_PAGE(page) \
-({ unsigned int node = KVADDR_TO_NID(page); \
-   ( (node < NR_NODES) && \
-     ((unsigned)((page) - NODE_MEM_MAP(node)) < NODE_DATA(node)->node_size) ); \
-})
-
-#else
-
-#define PHYS_TO_NID(addr)      (0)
-
-#endif
-#endif /* __ASM_ARCH_MEMORY_H */
diff --git a/arch/arm/include/asm/arch-s3c24x0/s3c2400.h b/arch/arm/include/asm/arch-s3c24x0/s3c2400.h
deleted file mode 100644 (file)
index 2389118..0000000
+++ /dev/null
@@ -1,136 +0,0 @@
-/*
- * (C) Copyright 2003
- * David Müller ELSOFT AG Switzerland. d.mueller@elsoft.ch
- *
- * SPDX-License-Identifier:    GPL-2.0+
- */
-
-/************************************************
- * NAME            : s3c2400.h
- * Version  : 31.3.2003
- *
- * Based on S3C2400X User's manual Rev 1.1
- ************************************************/
-
-#ifndef __S3C2400_H__
-#define __S3C2400_H__
-
-#define S3C24X0_UART_CHANNELS  2
-#define S3C24X0_SPI_CHANNELS   1
-#define PALETTE                        (0x14A00400)    /* SJS */
-
-enum s3c24x0_uarts_nr {
-       S3C24X0_UART0,
-       S3C24X0_UART1,
-};
-
-/*S3C2400 device base addresses */
-#define S3C24X0_MEMCTL_BASE            0x14000000
-#define S3C24X0_USB_HOST_BASE          0x14200000
-#define S3C24X0_INTERRUPT_BASE         0x14400000
-#define S3C24X0_DMA_BASE               0x14600000
-#define S3C24X0_CLOCK_POWER_BASE       0x14800000
-#define S3C24X0_LCD_BASE               0x14A00000
-#define S3C24X0_UART_BASE              0x15000000
-#define S3C24X0_TIMER_BASE             0x15100000
-#define S3C24X0_USB_DEVICE_BASE                0x15200140
-#define S3C24X0_WATCHDOG_BASE          0x15300000
-#define S3C24X0_I2C_BASE               0x15400000
-#define S3C24X0_I2S_BASE               0x15508000
-#define S3C24X0_GPIO_BASE              0x15600000
-#define S3C24X0_RTC_BASE               0x15700000
-#define S3C24X0_ADC_BASE               0x15800000
-#define S3C24X0_SPI_BASE               0x15900000
-#define S3C2400_MMC_BASE               0x15A00000
-
-/* include common stuff */
-#include <asm/arch/s3c24x0.h>
-
-
-static inline struct s3c24x0_memctl *s3c24x0_get_base_memctl(void)
-{
-       return (struct s3c24x0_memctl *)S3C24X0_MEMCTL_BASE;
-}
-
-static inline struct s3c24x0_usb_host *s3c24x0_get_base_usb_host(void)
-{
-       return (struct s3c24x0_usb_host *)S3C24X0_USB_HOST_BASE;
-}
-
-static inline struct s3c24x0_interrupt *s3c24x0_get_base_interrupt(void)
-{
-       return (struct s3c24x0_interrupt *)S3C24X0_INTERRUPT_BASE;
-}
-
-static inline struct s3c24x0_dmas *s3c24x0_get_base_dmas(void)
-{
-       return (struct s3c24x0_dmas *)S3C24X0_DMA_BASE;
-}
-
-static inline struct s3c24x0_clock_power *s3c24x0_get_base_clock_power(void)
-{
-       return (struct s3c24x0_clock_power *)S3C24X0_CLOCK_POWER_BASE;
-}
-
-static inline struct s3c24x0_lcd *s3c24x0_get_base_lcd(void)
-{
-       return (struct s3c24x0_lcd *)S3C24X0_LCD_BASE;
-}
-
-static inline struct s3c24x0_uart
-       *s3c24x0_get_base_uart(enum s3c24x0_uarts_nr n)
-{
-       return (struct s3c24x0_uart *)(S3C24X0_UART_BASE + (n * 0x4000));
-}
-
-static inline struct s3c24x0_timers *s3c24x0_get_base_timers(void)
-{
-       return (struct s3c24x0_timers *)S3C24X0_TIMER_BASE;
-}
-
-static inline struct s3c24x0_usb_device *s3c24x0_get_base_usb_device(void)
-{
-       return (struct s3c24x0_usb_device *)S3C24X0_USB_DEVICE_BASE;
-}
-
-static inline struct s3c24x0_watchdog *s3c24x0_get_base_watchdog(void)
-{
-       return (struct s3c24x0_watchdog *)S3C24X0_WATCHDOG_BASE;
-}
-
-static inline struct s3c24x0_i2c *s3c24x0_get_base_i2c(void)
-{
-       return (struct s3c24x0_i2c *)S3C24X0_I2C_BASE;
-}
-
-static inline struct s3c24x0_i2s *s3c24x0_get_base_i2s(void)
-{
-       return (struct s3c24x0_i2s *)S3C24X0_I2S_BASE;
-}
-
-static inline struct s3c24x0_gpio *s3c24x0_get_base_gpio(void)
-{
-       return (struct s3c24x0_gpio *)S3C24X0_GPIO_BASE;
-}
-
-static inline struct s3c24x0_rtc *s3c24x0_get_base_rtc(void)
-{
-       return (struct s3c24x0_rtc *)S3C24X0_RTC_BASE;
-}
-
-static inline struct s3c2400_adc *s3c2400_get_base_adc(void)
-{
-       return (struct s3c2400_adc *)S3C24X0_ADC_BASE;
-}
-
-static inline struct s3c24x0_spi *s3c24x0_get_base_spi(void)
-{
-       return (struct s3c24x0_spi *)S3C24X0_SPI_BASE;
-}
-
-static inline struct s3c2400_mmc *s3c2400_get_base_mmc(void)
-{
-       return (struct s3c2400_mmc *)S3C2400_MMC_BASE;
-}
-
-#endif /*__S3C2400_H__*/
diff --git a/arch/arm/include/asm/arch-s3c24x0/s3c2410.h b/arch/arm/include/asm/arch-s3c24x0/s3c2410.h
deleted file mode 100644 (file)
index 8773ce3..0000000
+++ /dev/null
@@ -1,147 +0,0 @@
-/*
- * (C) Copyright 2003
- * David Müller ELSOFT AG Switzerland. d.mueller@elsoft.ch
- *
- * SPDX-License-Identifier:    GPL-2.0+
- */
-
-/************************************************
- * NAME            : s3c2410.h
- * Version  : 31.3.2003
- *
- * Based on S3C2410X User's manual Rev 1.1
- ************************************************/
-
-#ifndef __S3C2410_H__
-#define __S3C2410_H__
-
-#define S3C24X0_UART_CHANNELS  3
-#define S3C24X0_SPI_CHANNELS   2
-
-/* S3C2410 only supports 512 Byte HW ECC */
-#define S3C2410_ECCSIZE                512
-#define S3C2410_ECCBYTES       3
-
-enum s3c24x0_uarts_nr {
-       S3C24X0_UART0,
-       S3C24X0_UART1,
-       S3C24X0_UART2
-};
-
-/* S3C2410 device base addresses */
-#define S3C24X0_MEMCTL_BASE            0x48000000
-#define S3C24X0_USB_HOST_BASE          0x49000000
-#define S3C24X0_INTERRUPT_BASE         0x4A000000
-#define S3C24X0_DMA_BASE               0x4B000000
-#define S3C24X0_CLOCK_POWER_BASE       0x4C000000
-#define S3C24X0_LCD_BASE               0x4D000000
-#define S3C2410_NAND_BASE              0x4E000000
-#define S3C24X0_UART_BASE              0x50000000
-#define S3C24X0_TIMER_BASE             0x51000000
-#define S3C24X0_USB_DEVICE_BASE                0x52000140
-#define S3C24X0_WATCHDOG_BASE          0x53000000
-#define S3C24X0_I2C_BASE               0x54000000
-#define S3C24X0_I2S_BASE               0x55000000
-#define S3C24X0_GPIO_BASE              0x56000000
-#define S3C24X0_RTC_BASE               0x57000000
-#define S3C2410_ADC_BASE               0x58000000
-#define S3C24X0_SPI_BASE               0x59000000
-#define S3C2410_SDI_BASE               0x5A000000
-
-
-/* include common stuff */
-#include <asm/arch/s3c24x0.h>
-
-
-static inline struct s3c24x0_memctl *s3c24x0_get_base_memctl(void)
-{
-       return (struct s3c24x0_memctl *)S3C24X0_MEMCTL_BASE;
-}
-
-static inline struct s3c24x0_usb_host *s3c24x0_get_base_usb_host(void)
-{
-       return (struct s3c24x0_usb_host *)S3C24X0_USB_HOST_BASE;
-}
-
-static inline struct s3c24x0_interrupt *s3c24x0_get_base_interrupt(void)
-{
-       return (struct s3c24x0_interrupt *)S3C24X0_INTERRUPT_BASE;
-}
-
-static inline struct s3c24x0_dmas *s3c24x0_get_base_dmas(void)
-{
-       return (struct s3c24x0_dmas *)S3C24X0_DMA_BASE;
-}
-
-static inline struct s3c24x0_clock_power *s3c24x0_get_base_clock_power(void)
-{
-       return (struct s3c24x0_clock_power *)S3C24X0_CLOCK_POWER_BASE;
-}
-
-static inline struct s3c24x0_lcd *s3c24x0_get_base_lcd(void)
-{
-       return (struct s3c24x0_lcd *)S3C24X0_LCD_BASE;
-}
-
-static inline struct s3c24x0_nand *s3c24x0_get_base_nand(void)
-{
-       return (struct s3c24x0_nand *)S3C2410_NAND_BASE;
-}
-
-static inline struct s3c24x0_uart
-       *s3c24x0_get_base_uart(enum s3c24x0_uarts_nr n)
-{
-       return (struct s3c24x0_uart *)(S3C24X0_UART_BASE + (n * 0x4000));
-}
-
-static inline struct s3c24x0_timers *s3c24x0_get_base_timers(void)
-{
-       return (struct s3c24x0_timers *)S3C24X0_TIMER_BASE;
-}
-
-static inline struct s3c24x0_usb_device *s3c24x0_get_base_usb_device(void)
-{
-       return (struct s3c24x0_usb_device *)S3C24X0_USB_DEVICE_BASE;
-}
-
-static inline struct s3c24x0_watchdog *s3c24x0_get_base_watchdog(void)
-{
-       return (struct s3c24x0_watchdog *)S3C24X0_WATCHDOG_BASE;
-}
-
-static inline struct s3c24x0_i2c *s3c24x0_get_base_i2c(void)
-{
-       return (struct s3c24x0_i2c *)S3C24X0_I2C_BASE;
-}
-
-static inline struct s3c24x0_i2s *s3c24x0_get_base_i2s(void)
-{
-       return (struct s3c24x0_i2s *)S3C24X0_I2S_BASE;
-}
-
-static inline struct s3c24x0_gpio *s3c24x0_get_base_gpio(void)
-{
-       return (struct s3c24x0_gpio *)S3C24X0_GPIO_BASE;
-}
-
-static inline struct s3c24x0_rtc *s3c24x0_get_base_rtc(void)
-{
-       return (struct s3c24x0_rtc *)S3C24X0_RTC_BASE;
-}
-
-static inline struct s3c2410_adc *s3c2410_get_base_adc(void)
-{
-       return (struct s3c2410_adc *)S3C2410_ADC_BASE;
-}
-
-static inline struct s3c24x0_spi *s3c24x0_get_base_spi(void)
-{
-       return (struct s3c24x0_spi *)S3C24X0_SPI_BASE;
-}
-
-static inline struct s3c24x0_sdi *s3c24x0_get_base_sdi(void)
-{
-       return (struct s3c24x0_sdi *)S3C2410_SDI_BASE;
-}
-
-#endif /*__S3C2410_H__*/
diff --git a/arch/arm/include/asm/arch-s3c24x0/s3c2440.h b/arch/arm/include/asm/arch-s3c24x0/s3c2440.h
deleted file mode 100644 (file)
index 7a525f2..0000000
+++ /dev/null
@@ -1,145 +0,0 @@
-/*
- * (C) Copyright 2003
- * David Mueller ELSOFT AG Switzerland. d.mueller@elsoft.ch
- *
- * SPDX-License-Identifier:    GPL-2.0+
- */
-
-/************************************************
- * NAME            : s3c2440.h
- * Version  : 31.3.2003
- *
- * Based on S3C2440 User's manual Rev x.x
- ************************************************/
-
-#ifndef __S3C2440_H__
-#define __S3C2440_H__
-
-#define S3C24X0_UART_CHANNELS  3
-#define S3C24X0_SPI_CHANNELS   2
-
-/* S3C2440 only supports 512 Byte HW ECC */
-#define S3C2440_ECCSIZE                512
-#define S3C2440_ECCBYTES       3
-
-enum s3c24x0_uarts_nr {
-       S3C24X0_UART0,
-       S3C24X0_UART1,
-       S3C24X0_UART2
-};
-
-/* S3C2440 device base addresses */
-#define S3C24X0_MEMCTL_BASE            0x48000000
-#define S3C24X0_USB_HOST_BASE          0x49000000
-#define S3C24X0_INTERRUPT_BASE         0x4A000000
-#define S3C24X0_DMA_BASE               0x4B000000
-#define S3C24X0_CLOCK_POWER_BASE       0x4C000000
-#define S3C24X0_LCD_BASE               0x4D000000
-#define S3C2440_NAND_BASE              0x4E000000
-#define S3C24X0_UART_BASE              0x50000000
-#define S3C24X0_TIMER_BASE             0x51000000
-#define S3C24X0_USB_DEVICE_BASE                0x52000140
-#define S3C24X0_WATCHDOG_BASE          0x53000000
-#define S3C24X0_I2C_BASE               0x54000000
-#define S3C24X0_I2S_BASE               0x55000000
-#define S3C24X0_GPIO_BASE              0x56000000
-#define S3C24X0_RTC_BASE               0x57000000
-#define S3C2440_ADC_BASE               0x58000000
-#define S3C24X0_SPI_BASE               0x59000000
-#define S3C2440_SDI_BASE               0x5A000000
-
-/* include common stuff */
-#include <asm/arch/s3c24x0.h>
-
-static inline struct s3c24x0_memctl *s3c24x0_get_base_memctl(void)
-{
-       return (struct s3c24x0_memctl *)S3C24X0_MEMCTL_BASE;
-}
-
-static inline struct s3c24x0_usb_host *s3c24x0_get_base_usb_host(void)
-{
-       return (struct s3c24x0_usb_host *)S3C24X0_USB_HOST_BASE;
-}
-
-static inline struct s3c24x0_interrupt *s3c24x0_get_base_interrupt(void)
-{
-       return (struct s3c24x0_interrupt *)S3C24X0_INTERRUPT_BASE;
-}
-
-static inline struct s3c24x0_dmas *s3c24x0_get_base_dmas(void)
-{
-       return (struct s3c24x0_dmas *)S3C24X0_DMA_BASE;
-}
-
-static inline struct s3c24x0_clock_power *s3c24x0_get_base_clock_power(void)
-{
-       return (struct s3c24x0_clock_power *)S3C24X0_CLOCK_POWER_BASE;
-}
-
-static inline struct s3c24x0_lcd *s3c24x0_get_base_lcd(void)
-{
-       return (struct s3c24x0_lcd *)S3C24X0_LCD_BASE;
-}
-
-static inline struct s3c24x0_nand *s3c24x0_get_base_nand(void)
-{
-       return (struct s3c24x0_nand *)S3C2440_NAND_BASE;
-}
-
-static inline struct s3c24x0_uart
-       *s3c24x0_get_base_uart(enum s3c24x0_uarts_nr n)
-{
-       return (struct s3c24x0_uart *)(S3C24X0_UART_BASE + (n * 0x4000));
-}
-
-static inline struct s3c24x0_timers *s3c24x0_get_base_timers(void)
-{
-       return (struct s3c24x0_timers *)S3C24X0_TIMER_BASE;
-}
-
-static inline struct s3c24x0_usb_device *s3c24x0_get_base_usb_device(void)
-{
-       return (struct s3c24x0_usb_device *)S3C24X0_USB_DEVICE_BASE;
-}
-
-static inline struct s3c24x0_watchdog *s3c24x0_get_base_watchdog(void)
-{
-       return (struct s3c24x0_watchdog *)S3C24X0_WATCHDOG_BASE;
-}
-
-static inline struct s3c24x0_i2c *s3c24x0_get_base_i2c(void)
-{
-       return (struct s3c24x0_i2c *)S3C24X0_I2C_BASE;
-}
-
-static inline struct s3c24x0_i2s *s3c24x0_get_base_i2s(void)
-{
-       return (struct s3c24x0_i2s *)S3C24X0_I2S_BASE;
-}
-
-static inline struct s3c24x0_gpio *s3c24x0_get_base_gpio(void)
-{
-       return (struct s3c24x0_gpio *)S3C24X0_GPIO_BASE;
-}
-
-static inline struct s3c24x0_rtc *s3c24x0_get_base_rtc(void)
-{
-       return (struct s3c24x0_rtc *)S3C24X0_RTC_BASE;
-}
-
-static inline struct s3c2440_adc *s3c2440_get_base_adc(void)
-{
-       return (struct s3c2440_adc *)S3C2440_ADC_BASE;
-}
-
-static inline struct s3c24x0_spi *s3c24x0_get_base_spi(void)
-{
-       return (struct s3c24x0_spi *)S3C24X0_SPI_BASE;
-}
-
-static inline struct s3c24x0_sdi *s3c24x0_get_base_sdi(void)
-{
-       return (struct s3c24x0_sdi *)S3C2440_SDI_BASE;
-}
-
-#endif /*__S3C2440_H__*/
diff --git a/arch/arm/include/asm/arch-s3c24x0/s3c24x0.h b/arch/arm/include/asm/arch-s3c24x0/s3c24x0.h
deleted file mode 100644 (file)
index 2dae9fc..0000000
+++ /dev/null
@@ -1,708 +0,0 @@
-/*
- * (C) Copyright 2003
- * David Müller ELSOFT AG Switzerland. d.mueller@elsoft.ch
- *
- * SPDX-License-Identifier:    GPL-2.0+
- */
-
-/************************************************
- * NAME            : s3c24x0.h
- * Version  : 31.3.2003
- *
- * common stuff for SAMSUNG S3C24X0 SoC
- ************************************************/
-
-#ifndef __S3C24X0_H__
-#define __S3C24X0_H__
-
-/* Memory controller (see manual chapter 5) */
-struct s3c24x0_memctl {
-       u32     bwscon;
-       u32     bankcon[8];
-       u32     refresh;
-       u32     banksize;
-       u32     mrsrb6;
-       u32     mrsrb7;
-};
-
-
-/* USB HOST (see manual chapter 12) */
-struct s3c24x0_usb_host {
-       u32     HcRevision;
-       u32     HcControl;
-       u32     HcCommonStatus;
-       u32     HcInterruptStatus;
-       u32     HcInterruptEnable;
-       u32     HcInterruptDisable;
-       u32     HcHCCA;
-       u32     HcPeriodCuttendED;
-       u32     HcControlHeadED;
-       u32     HcControlCurrentED;
-       u32     HcBulkHeadED;
-       u32     HcBuldCurrentED;
-       u32     HcDoneHead;
-       u32     HcRmInterval;
-       u32     HcFmRemaining;
-       u32     HcFmNumber;
-       u32     HcPeriodicStart;
-       u32     HcLSThreshold;
-       u32     HcRhDescriptorA;
-       u32     HcRhDescriptorB;
-       u32     HcRhStatus;
-       u32     HcRhPortStatus1;
-       u32     HcRhPortStatus2;
-};
-
-
-/* INTERRUPT (see manual chapter 14) */
-struct s3c24x0_interrupt {
-       u32     srcpnd;
-       u32     intmod;
-       u32     intmsk;
-       u32     priority;
-       u32     intpnd;
-       u32     intoffset;
-#if defined(CONFIG_S3C2410) || defined(CONFIG_S3C2440)
-       u32     subsrcpnd;
-       u32     intsubmsk;
-#endif
-};
-
-
-/* DMAS (see manual chapter 8) */
-struct s3c24x0_dma {
-       u32     disrc;
-#if defined(CONFIG_S3C2410) || defined(CONFIG_S3C2440)
-       u32     disrcc;
-#endif
-       u32     didst;
-#if defined(CONFIG_S3C2410) || defined(CONFIG_S3C2440)
-       u32     didstc;
-#endif
-       u32     dcon;
-       u32     dstat;
-       u32     dcsrc;
-       u32     dcdst;
-       u32     dmasktrig;
-#if defined(CONFIG_S3C2400) || defined(CONFIG_S3C2410) \
-               || defined(CONFIG_S3C2440)
-       u32     res[1];
-#endif
-};
-
-struct s3c24x0_dmas {
-       struct s3c24x0_dma      dma[4];
-};
-
-
-/* CLOCK & POWER MANAGEMENT (see S3C2400 manual chapter 6) */
-/*                          (see S3C2410 manual chapter 7) */
-struct s3c24x0_clock_power {
-       u32     locktime;
-       u32     mpllcon;
-       u32     upllcon;
-       u32     clkcon;
-       u32     clkslow;
-       u32     clkdivn;
-#if defined(CONFIG_S3C2440)
-       u32     camdivn;
-#endif
-};
-
-
-/* LCD CONTROLLER (see manual chapter 15) */
-struct s3c24x0_lcd {
-       u32     lcdcon1;
-       u32     lcdcon2;
-       u32     lcdcon3;
-       u32     lcdcon4;
-       u32     lcdcon5;
-       u32     lcdsaddr1;
-       u32     lcdsaddr2;
-       u32     lcdsaddr3;
-       u32     redlut;
-       u32     greenlut;
-       u32     bluelut;
-       u32     res[8];
-       u32     dithmode;
-       u32     tpal;
-#if defined(CONFIG_S3C2410) || defined(CONFIG_S3C2440)
-       u32     lcdintpnd;
-       u32     lcdsrcpnd;
-       u32     lcdintmsk;
-       u32     lpcsel;
-#endif
-};
-
-
-/* NAND FLASH (see manual chapter 6) */
-struct s3c24x0_nand {
-       u32     nfconf;
-#ifndef CONFIG_S3C2410
-       u32     nfcont;
-#endif
-       u32     nfcmd;
-       u32     nfaddr;
-       u32     nfdata;
-#ifndef CONFIG_S3C2410
-       u32     nfeccd0;
-       u32     nfeccd1;
-       u32     nfeccd;
-#endif
-       u32     nfstat;
-#ifdef CONFIG_S3C2410
-       u32     nfecc;
-#else
-       u32     nfstat0;
-       u32     nfstat1;
-       u32     nfmecc0;
-       u32     nfmecc1;
-       u32     nfsecc;
-       u32     nfsblk;
-       u32     nfeblk;
-#endif
-};
-
-/* UART (see manual chapter 11) */
-struct s3c24x0_uart {
-       u32     ulcon;
-       u32     ucon;
-       u32     ufcon;
-       u32     umcon;
-       u32     utrstat;
-       u32     uerstat;
-       u32     ufstat;
-       u32     umstat;
-#ifdef __BIG_ENDIAN
-       u8      res1[3];
-       u8      utxh;
-       u8      res2[3];
-       u8      urxh;
-#else /* Little Endian */
-       u8      utxh;
-       u8      res1[3];
-       u8      urxh;
-       u8      res2[3];
-#endif
-       u32     ubrdiv;
-};
-
-
-/* PWM TIMER (see manual chapter 10) */
-struct s3c24x0_timer {
-       u32     tcntb;
-       u32     tcmpb;
-       u32     tcnto;
-};
-
-struct s3c24x0_timers {
-       u32     tcfg0;
-       u32     tcfg1;
-       u32     tcon;
-       struct s3c24x0_timer    ch[4];
-       u32     tcntb4;
-       u32     tcnto4;
-};
-
-
-/* USB DEVICE (see manual chapter 13) */
-struct s3c24x0_usb_dev_fifos {
-#ifdef __BIG_ENDIAN
-       u8      res[3];
-       u8      ep_fifo_reg;
-#else /*  little endian */
-       u8      ep_fifo_reg;
-       u8      res[3];
-#endif
-};
-
-struct s3c24x0_usb_dev_dmas {
-#ifdef __BIG_ENDIAN
-       u8      res1[3];
-       u8      ep_dma_con;
-       u8      res2[3];
-       u8      ep_dma_unit;
-       u8      res3[3];
-       u8      ep_dma_fifo;
-       u8      res4[3];
-       u8      ep_dma_ttc_l;
-       u8      res5[3];
-       u8      ep_dma_ttc_m;
-       u8      res6[3];
-       u8      ep_dma_ttc_h;
-#else /*  little endian */
-       u8      ep_dma_con;
-       u8      res1[3];
-       u8      ep_dma_unit;
-       u8      res2[3];
-       u8      ep_dma_fifo;
-       u8      res3[3];
-       u8      ep_dma_ttc_l;
-       u8      res4[3];
-       u8      ep_dma_ttc_m;
-       u8      res5[3];
-       u8      ep_dma_ttc_h;
-       u8      res6[3];
-#endif
-};
-
-struct s3c24x0_usb_device {
-#ifdef __BIG_ENDIAN
-       u8      res1[3];
-       u8      func_addr_reg;
-       u8      res2[3];
-       u8      pwr_reg;
-       u8      res3[3];
-       u8      ep_int_reg;
-       u8      res4[15];
-       u8      usb_int_reg;
-       u8      res5[3];
-       u8      ep_int_en_reg;
-       u8      res6[15];
-       u8      usb_int_en_reg;
-       u8      res7[3];
-       u8      frame_num1_reg;
-       u8      res8[3];
-       u8      frame_num2_reg;
-       u8      res9[3];
-       u8      index_reg;
-       u8      res10[7];
-       u8      maxp_reg;
-       u8      res11[3];
-       u8      ep0_csr_in_csr1_reg;
-       u8      res12[3];
-       u8      in_csr2_reg;
-       u8      res13[7];
-       u8      out_csr1_reg;
-       u8      res14[3];
-       u8      out_csr2_reg;
-       u8      res15[3];
-       u8      out_fifo_cnt1_reg;
-       u8      res16[3];
-       u8      out_fifo_cnt2_reg;
-#else /*  little endian */
-       u8      func_addr_reg;
-       u8      res1[3];
-       u8      pwr_reg;
-       u8      res2[3];
-       u8      ep_int_reg;
-       u8      res3[15];
-       u8      usb_int_reg;
-       u8      res4[3];
-       u8      ep_int_en_reg;
-       u8      res5[15];
-       u8      usb_int_en_reg;
-       u8      res6[3];
-       u8      frame_num1_reg;
-       u8      res7[3];
-       u8      frame_num2_reg;
-       u8      res8[3];
-       u8      index_reg;
-       u8      res9[7];
-       u8      maxp_reg;
-       u8      res10[7];
-       u8      ep0_csr_in_csr1_reg;
-       u8      res11[3];
-       u8      in_csr2_reg;
-       u8      res12[3];
-       u8      out_csr1_reg;
-       u8      res13[7];
-       u8      out_csr2_reg;
-       u8      res14[3];
-       u8      out_fifo_cnt1_reg;
-       u8      res15[3];
-       u8      out_fifo_cnt2_reg;
-       u8      res16[3];
-#endif /*  __BIG_ENDIAN */
-       struct s3c24x0_usb_dev_fifos    fifo[5];
-       struct s3c24x0_usb_dev_dmas     dma[5];
-};
-
-
-/* WATCH DOG TIMER (see manual chapter 18) */
-struct s3c24x0_watchdog {
-       u32     wtcon;
-       u32     wtdat;
-       u32     wtcnt;
-};
-
-/* IIS (see manual chapter 21) */
-struct s3c24x0_i2s {
-#ifdef __BIG_ENDIAN
-       u16     res1;
-       u16     iiscon;
-       u16     res2;
-       u16     iismod;
-       u16     res3;
-       u16     iispsr;
-       u16     res4;
-       u16     iisfcon;
-       u16     res5;
-       u16     iisfifo;
-#else /*  little endian */
-       u16     iiscon;
-       u16     res1;
-       u16     iismod;
-       u16     res2;
-       u16     iispsr;
-       u16     res3;
-       u16     iisfcon;
-       u16     res4;
-       u16     iisfifo;
-       u16     res5;
-#endif
-};
-
-
-/* I/O PORT (see manual chapter 9) */
-struct s3c24x0_gpio {
-#ifdef CONFIG_S3C2400
-       u32     pacon;
-       u32     padat;
-
-       u32     pbcon;
-       u32     pbdat;
-       u32     pbup;
-
-       u32     pccon;
-       u32     pcdat;
-       u32     pcup;
-
-       u32     pdcon;
-       u32     pddat;
-       u32     pdup;
-
-       u32     pecon;
-       u32     pedat;
-       u32     peup;
-
-       u32     pfcon;
-       u32     pfdat;
-       u32     pfup;
-
-       u32     pgcon;
-       u32     pgdat;
-       u32     pgup;
-
-       u32     opencr;
-
-       u32     misccr;
-       u32     extint;
-#endif
-#ifdef CONFIG_S3C2410
-       u32     gpacon;
-       u32     gpadat;
-       u32     res1[2];
-       u32     gpbcon;
-       u32     gpbdat;
-       u32     gpbup;
-       u32     res2;
-       u32     gpccon;
-       u32     gpcdat;
-       u32     gpcup;
-       u32     res3;
-       u32     gpdcon;
-       u32     gpddat;
-       u32     gpdup;
-       u32     res4;
-       u32     gpecon;
-       u32     gpedat;
-       u32     gpeup;
-       u32     res5;
-       u32     gpfcon;
-       u32     gpfdat;
-       u32     gpfup;
-       u32     res6;
-       u32     gpgcon;
-       u32     gpgdat;
-       u32     gpgup;
-       u32     res7;
-       u32     gphcon;
-       u32     gphdat;
-       u32     gphup;
-       u32     res8;
-
-       u32     misccr;
-       u32     dclkcon;
-       u32     extint0;
-       u32     extint1;
-       u32     extint2;
-       u32     eintflt0;
-       u32     eintflt1;
-       u32     eintflt2;
-       u32     eintflt3;
-       u32     eintmask;
-       u32     eintpend;
-       u32     gstatus0;
-       u32     gstatus1;
-       u32     gstatus2;
-       u32     gstatus3;
-       u32     gstatus4;
-#endif
-#if defined(CONFIG_S3C2440)
-       u32     gpacon;
-       u32     gpadat;
-       u32     res1[2];
-       u32     gpbcon;
-       u32     gpbdat;
-       u32     gpbup;
-       u32     res2;
-       u32     gpccon;
-       u32     gpcdat;
-       u32     gpcup;
-       u32     res3;
-       u32     gpdcon;
-       u32     gpddat;
-       u32     gpdup;
-       u32     res4;
-       u32     gpecon;
-       u32     gpedat;
-       u32     gpeup;
-       u32     res5;
-       u32     gpfcon;
-       u32     gpfdat;
-       u32     gpfup;
-       u32     res6;
-       u32     gpgcon;
-       u32     gpgdat;
-       u32     gpgup;
-       u32     res7;
-       u32     gphcon;
-       u32     gphdat;
-       u32     gphup;
-       u32     res8;
-
-       u32     misccr;
-       u32     dclkcon;
-       u32     extint0;
-       u32     extint1;
-       u32     extint2;
-       u32     eintflt0;
-       u32     eintflt1;
-       u32     eintflt2;
-       u32     eintflt3;
-       u32     eintmask;
-       u32     eintpend;
-       u32     gstatus0;
-       u32     gstatus1;
-       u32     gstatus2;
-       u32     gstatus3;
-       u32     gstatus4;
-
-       u32     res9;
-       u32     dsc0;
-       u32     dsc1;
-       u32     mslcon;
-       u32     gpjcon;
-       u32     gpjdat;
-       u32     gpjup;
-       u32     res10;
-#endif
-};
-
-
-/* RTC (see manual chapter 17) */
-struct s3c24x0_rtc {
-#ifdef __BIG_ENDIAN
-       u8      res1[67];
-       u8      rtccon;
-       u8      res2[3];
-       u8      ticnt;
-       u8      res3[11];
-       u8      rtcalm;
-       u8      res4[3];
-       u8      almsec;
-       u8      res5[3];
-       u8      almmin;
-       u8      res6[3];
-       u8      almhour;
-       u8      res7[3];
-       u8      almdate;
-       u8      res8[3];
-       u8      almmon;
-       u8      res9[3];
-       u8      almyear;
-       u8      res10[3];
-       u8      rtcrst;
-       u8      res11[3];
-       u8      bcdsec;
-       u8      res12[3];
-       u8      bcdmin;
-       u8      res13[3];
-       u8      bcdhour;
-       u8      res14[3];
-       u8      bcddate;
-       u8      res15[3];
-       u8      bcdday;
-       u8      res16[3];
-       u8      bcdmon;
-       u8      res17[3];
-       u8      bcdyear;
-#else /*  little endian */
-       u8      res0[64];
-       u8      rtccon;
-       u8      res1[3];
-       u8      ticnt;
-       u8      res2[11];
-       u8      rtcalm;
-       u8      res3[3];
-       u8      almsec;
-       u8      res4[3];
-       u8      almmin;
-       u8      res5[3];
-       u8      almhour;
-       u8      res6[3];
-       u8      almdate;
-       u8      res7[3];
-       u8      almmon;
-       u8      res8[3];
-       u8      almyear;
-       u8      res9[3];
-       u8      rtcrst;
-       u8      res10[3];
-       u8      bcdsec;
-       u8      res11[3];
-       u8      bcdmin;
-       u8      res12[3];
-       u8      bcdhour;
-       u8      res13[3];
-       u8      bcddate;
-       u8      res14[3];
-       u8      bcdday;
-       u8      res15[3];
-       u8      bcdmon;
-       u8      res16[3];
-       u8      bcdyear;
-       u8      res17[3];
-#endif
-};
-
-
-/* ADC (see manual chapter 16) */
-struct s3c2400_adc {
-       u32     adccon;
-       u32     adcdat;
-};
-
-
-/* ADC (see manual chapter 16) */
-struct s3c2410_adc {
-       u32     adccon;
-       u32     adctsc;
-       u32     adcdly;
-       u32     adcdat0;
-       u32     adcdat1;
-};
-
-
-/* SPI (see manual chapter 22) */
-struct s3c24x0_spi_channel {
-       u8      spcon;
-       u8      res1[3];
-       u8      spsta;
-       u8      res2[3];
-       u8      sppin;
-       u8      res3[3];
-       u8      sppre;
-       u8      res4[3];
-       u8      sptdat;
-       u8      res5[3];
-       u8      sprdat;
-       u8      res6[3];
-       u8      res7[16];
-};
-
-struct s3c24x0_spi {
-       struct s3c24x0_spi_channel      ch[S3C24X0_SPI_CHANNELS];
-};
-
-
-/* MMC INTERFACE (see S3C2400 manual chapter 19) */
-struct s3c2400_mmc {
-#ifdef __BIG_ENDIAN
-       u8      res1[3];
-       u8      mmcon;
-       u8      res2[3];
-       u8      mmcrr;
-       u8      res3[3];
-       u8      mmfcon;
-       u8      res4[3];
-       u8      mmsta;
-       u16     res5;
-       u16     mmfsta;
-       u8      res6[3];
-       u8      mmpre;
-       u16     res7;
-       u16     mmlen;
-       u8      res8[3];
-       u8      mmcr7;
-       u32     mmrsp[4];
-       u8      res9[3];
-       u8      mmcmd0;
-       u32     mmcmd1;
-       u16     res10;
-       u16     mmcr16;
-       u8      res11[3];
-       u8      mmdat;
-#else
-       u8      mmcon;
-       u8      res1[3];
-       u8      mmcrr;
-       u8      res2[3];
-       u8      mmfcon;
-       u8      res3[3];
-       u8      mmsta;
-       u8      res4[3];
-       u16     mmfsta;
-       u16     res5;
-       u8      mmpre;
-       u8      res6[3];
-       u16     mmlen;
-       u16     res7;
-       u8      mmcr7;
-       u8      res8[3];
-       u32     mmrsp[4];
-       u8      mmcmd0;
-       u8      res9[3];
-       u32     mmcmd1;
-       u16     mmcr16;
-       u16     res10;
-       u8      mmdat;
-       u8      res11[3];
-#endif
-};
-
-
-/* SD INTERFACE (see S3C2410 manual chapter 19) */
-struct s3c24x0_sdi {
-       u32     sdicon;
-       u32     sdipre;
-       u32     sdicarg;
-       u32     sdiccon;
-       u32     sdicsta;
-       u32     sdirsp0;
-       u32     sdirsp1;
-       u32     sdirsp2;
-       u32     sdirsp3;
-       u32     sdidtimer;
-       u32     sdibsize;
-       u32     sdidcon;
-       u32     sdidcnt;
-       u32     sdidsta;
-       u32     sdifsta;
-#ifdef CONFIG_S3C2410
-       u32     sdidat;
-       u32     sdiimsk;
-#else
-       u32     sdiimsk;
-       u32     sdidat;
-#endif
-};
-
-#ifdef CONFIG_CMD_MMC
-#include <mmc.h>
-int s3cmmc_initialize(bd_t *bis, int (*getcd)(struct mmc *),
-                     int (*getwp)(struct mmc *));
-#endif
-
-#endif /*__S3C24X0_H__*/
diff --git a/arch/arm/include/asm/arch-s3c24x0/s3c24x0_cpu.h b/arch/arm/include/asm/arch-s3c24x0/s3c24x0_cpu.h
deleted file mode 100644 (file)
index 393cc9d..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-/*
- * (C) Copyright 2009
- * Kevin Morfitt, Fearnside Systems Ltd, <kevin.morfitt@fearnside-systems.co.uk>
- *
- * SPDX-License-Identifier:    GPL-2.0+
- */
-
-#ifdef CONFIG_S3C2400
-       #include <asm/arch/s3c2400.h>
-#elif defined CONFIG_S3C2410
-       #include <asm/arch/s3c2410.h>
-#elif defined CONFIG_S3C2440
-       #include <asm/arch/s3c2440.h>
-#else
-       #error Please define the s3c24x0 cpu type
-#endif
index 436c35a6dc439c9d51eb82ff3ea7c2c1de61a37f..4c9bb863c0f1077b9ecbfd6ce03bafc1bc85178b 100644 (file)
@@ -41,6 +41,7 @@ extern void udc_disconnect(void);
  #define BOOTM_ENABLE_INITRD_TAG       0
 #endif
 
+struct tag_serialnr;
 #ifdef CONFIG_SERIAL_TAG
  #define BOOTM_ENABLE_SERIAL_TAG       1
 void get_board_serial(struct tag_serialnr *serialnr);
index c1a70b15d02ecad1846688ce4af0da3cd1fc558e..f98998343eab2746fa573e123dd2ec07de26513c 100644 (file)
@@ -638,6 +638,8 @@ void abb_setup(u32 fuse, u32 ldovbb, u32 setup, u32 control,
               u32 txdone, u32 txdone_mask, u32 opp);
 s8 abb_setup_ldovbb(u32 fuse, u32 ldovbb);
 
+struct tag_serialnr;
+
 void omap_die_id_serial(void);
 void omap_die_id_get_board_serial(struct tag_serialnr *serialnr);
 void omap_die_id_usbethaddr(void);
index b931c22060ec823201ff5d230367de526f3271fa..ef4fca68ee95a14d7a9aa35aefe3f2466d5e2bfd 100644 (file)
@@ -13,6 +13,8 @@
 #ifndef _U_BOOT_ARM_H_
 #define _U_BOOT_ARM_H_ 1
 
+#ifndef __ASSEMBLY__
+
 /* for the following variables, see start.S */
 extern ulong IRQ_STACK_START;  /* top of IRQ stack */
 extern ulong FIQ_STACK_START;  /* top of FIQ stack */
@@ -45,6 +47,8 @@ ulong get_timer_masked        (void);
 void   udelay_masked           (unsigned long usec);
 
 /* calls to c from vectors.S */
+struct pt_regs;
+
 void bad_mode(void);
 void do_undefined_instruction(struct pt_regs *pt_regs);
 void do_software_interrupt(struct pt_regs *pt_regs);
@@ -59,4 +63,6 @@ void do_fiq(struct pt_regs *pt_regs);
 void do_irq(struct pt_regs *pt_regswq);
 #endif
 
+#endif /* __ASSEMBLY__ */
+
 #endif /* _U_BOOT_ARM_H_ */
index ca3abd7d0bbc9f5517c1b10501b0fe2700e6bdb3..ef9196f898b9876503d19b584fc6207685bd1035 100644 (file)
@@ -22,6 +22,7 @@
 
 /* Use the generic board which requires a unified bd_info */
 #include <asm-generic/u-boot.h>
+#include <asm/u-boot-arm.h>
 
 /* For image.h:image_check_target_arch() */
 #ifndef CONFIG_ARM64
index f162c1428c856381a85b1ea26c6d4c698d34e08e..6e1c43693340f3a59b465f24be600b56aa837092 100644 (file)
@@ -72,8 +72,6 @@ ifneq (,$(findstring -mabi=aapcs-linux,$(PLATFORM_CPPFLAGS)))
 extra-y        += eabi_compat.o
 endif
 
-asflags-y += -DCONFIG_ARM_ASM_UNIFIED
-
 # some files can only build in ARM or THUMB2, not THUMB1
 
 ifdef CONFIG_$(SPL_)SYS_THUMB_BUILD
index eb242223b4c0ae87a254522a36f2227f34bac436..704849bd0c7e4dc659ee07c89dc1885be1d845ca 100644 (file)
@@ -31,6 +31,7 @@
 #ifdef CONFIG_ARMV7_NONSEC
 #include <asm/armv7.h>
 #endif
+#include <asm/setup.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
index 8ff2c5065ddeea7bb8d77b3c60bffe5474980da1..27d6682c0bd81c6ce2f111f1a8404ed95c6e5729 100644 (file)
@@ -12,6 +12,7 @@
 #include <spl.h>
 #include <image.h>
 #include <linux/compiler.h>
+#include <asm/mach-types.h>
 
 #ifndef CONFIG_SPL_DM
 /* Pointer to as well as the global data structure for SPL */
index 03be3882f886323ea2fd5ff72da749e271d11eb1..79090e0671fbcca4cff0c7b002586e7c7bb42e46 100644 (file)
@@ -7,6 +7,8 @@
 #ifndef __MISC_H
 #define __MISC_H
 
+#include <asm/arch/hardware.h>
+
 /* pin muxer definitions */
 #define PIN_MUX_NUM_FIELDS     8       /* Per register */
 #define PIN_MUX_FIELD_SIZE     4       /* n in bits */
index c31f38c8a275fe57351f8643ffc64cd378016394..e11099cb932768c7018d6adc73f2dfe537e70208 100644 (file)
 #ifndef __ASM_ARCH_HARDWARE_H
 #define __ASM_ARCH_HARDWARE_H
 
-#include <config.h>
 #include <linux/sizes.h>
 
 #define        REG(addr)       (*(volatile unsigned int *)(addr))
 #define REG_P(addr)    ((volatile unsigned int *)(addr))
 
+#ifndef __ASSEMBLY__
 typedef volatile unsigned int  dv_reg;
 typedef volatile unsigned int *        dv_reg_p;
+#endif
 
 /*
  * Base register addresses
@@ -285,6 +286,7 @@ typedef volatile unsigned int *     dv_reg_p;
 
 #endif /* CONFIG_SOC_DA8XX */
 
+#ifndef __ASSEMBLY__
 void lpsc_on(unsigned int id);
 void lpsc_syncreset(unsigned int id);
 void lpsc_disable(unsigned int id);
@@ -625,5 +627,6 @@ static inline enum davinci_clk_ids get_async3_src(void)
 #define FLAG_FLGOFF            0x00000010
 
 #endif
+#endif /* !__ASSEMBLY__ */
 
 #endif /* __ASM_ARCH_HARDWARE_H */
index 408b62c663af83e29cac4c96100c13eb5db5f9c4..d161b5194640ec464aadaf20c599dff07a659070 100644 (file)
@@ -54,12 +54,6 @@ config TARGET_RUT
        select DM_SERIAL
        select DM_GPIO
 
-config TARGET_TI814X_EVM
-       bool "Support ti814x_evm"
-
-config TARGET_TI816X_EVM
-       bool "Support ti816x_evm"
-
 config OMAP34XX
        bool "OMAP34XX SoC"
        select ARM_ERRATA_430973
@@ -116,6 +110,20 @@ config OMAP54XX
        imply SPL_POWER_SUPPORT
        imply SPL_SERIAL_SUPPORT
 
+config TI814X
+       bool "TI814X SoC"
+       help
+         Support for AM335x SOC from Texas Instruments.
+         The AM335x high performance SOC features a Cortex-A8
+         ARM core and more.
+
+config TI816X
+       bool "TI816X SoC"
+       help
+         Support for AM335x SOC from Texas Instruments.
+         The AM335x high performance SOC features a Cortex-A8
+         ARM core and more.
+
 config AM43XX
        bool "AM43XX SoC"
        imply SPL_DM
index 5c4168fefc08cfcd8cfa9591346187010c211dc7..36ec1341409829c5b21e73c90da784f8b4882e14 100644 (file)
@@ -1,3 +1,23 @@
+if TI816X
+
+config TARGET_TI816X_EVM
+       bool "Support ti816x_evm"
+       help
+         This option specifies support for the TI8168 EVM development platform
+         with PG2.0 silicon and DDR3 DRAM.
+
+endif
+
+if TI814X
+
+config TARGET_TI814X_EVM
+       bool "Support ti814x_evm"
+       help
+         This option specifies support for the TI8148
+         EVM development platform.
+
+endif
+
 if AM33XX
 
 config AM33XX_CHILISOM
index 05cc8a11c5cbf644bd1d2c7ac5753d1c3559fedb..1e4c04e7a65b8e1fd88ddff47653307b75090b65 100644 (file)
@@ -15,7 +15,10 @@ endif
 obj-$(CONFIG_TI816X)   += clock_ti816x.o
 obj-y  += sys_info.o
 obj-y  += ddr.o
+ifeq ($(CONFIG_TI816X)$(CONFIG_SKIP_LOWLEVEL_INIT),)
 obj-y  += emif4.o
+endif
+obj-$(CONFIG_TI816X)   += ti816x_emif4.o
 obj-y  += board.o
 obj-y  += mux.o
 
index a8b5d13238a220a0ec012afe30f6bbd4d90c9b90..faf7d07a03308c5c7badba97171dea62c500c69a 100644 (file)
 
 DECLARE_GLOBAL_DATA_PTR;
 
+int dram_init(void)
+{
+#ifndef CONFIG_SKIP_LOWLEVEL_INIT
+       sdram_init();
+#endif
+
+       /* 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;
+}
+
+int dram_init_banksize(void)
+{
+       gd->bd->bi_dram[0].start = CONFIG_SYS_SDRAM_BASE;
+       gd->bd->bi_dram[0].size = gd->ram_size;
+
+       return 0;
+}
+
 #if !CONFIG_IS_ENABLED(OF_CONTROL)
 static const struct ns16550_platdata am33xx_serial[] = {
        { .base = CONFIG_SYS_NS16550_COM1, .reg_shift = 2,
index 079ddd7eb9fc12afaed8ab4e5138dd114375e681..967623d467b03ff1a4e9dfcc1f48eef30cd17b9b 100644 (file)
 #define MAIN_MDIV7             0x4
 
 /* DDR PLL */
-#if defined(CONFIG_TI816X_DDR_PLL_400) /* 400 MHz */
-#define DDR_N                  59
-#define DDR_P                  0x1
-#define DDR_MDIV1              0x4
-#define DDR_INTFREQ2           0x8
-#define DDR_FRACFREQ2          0xD99999
-#define DDR_MDIV2              0x1E
-#define DDR_INTFREQ3           0x8
-#define DDR_FRACFREQ3          0x0
-#define DDR_MDIV3              0x4
-#define DDR_INTFREQ4           0xE /* Expansion DDR clk */
-#define DDR_FRACFREQ4          0x0
-#define DDR_MDIV4              0x4
-#define DDR_INTFREQ5           0xE /* Expansion DDR clk */
-#define DDR_FRACFREQ5          0x0
-#define DDR_MDIV5              0x4
-#elif defined(CONFIG_TI816X_DDR_PLL_531) /* 531 MHz */
-#define DDR_N                  59
-#define DDR_P                  0x1
-#define DDR_MDIV1              0x3
-#define DDR_INTFREQ2           0x8
-#define DDR_FRACFREQ2          0xD99999
-#define DDR_MDIV2              0x1E
-#define DDR_INTFREQ3           0x8
-#define DDR_FRACFREQ3          0x0
-#define DDR_MDIV3              0x4
-#define DDR_INTFREQ4           0xE /* Expansion DDR clk */
-#define DDR_FRACFREQ4          0x0
-#define DDR_MDIV4              0x4
-#define DDR_INTFREQ5           0xE /* Expansion DDR clk */
-#define DDR_FRACFREQ5          0x0
-#define DDR_MDIV5              0x4
-#elif defined(CONFIG_TI816X_DDR_PLL_675) /* 675 MHz */
-#define DDR_N                  50
-#define DDR_P                  0x1
-#define DDR_MDIV1              0x2
-#define DDR_INTFREQ2           0x9
-#define DDR_FRACFREQ2          0x0
-#define DDR_MDIV2              0x19
-#define DDR_INTFREQ3           0x13
-#define DDR_FRACFREQ3          0x800000
-#define DDR_MDIV3              0x2
-#define DDR_INTFREQ4           0xE /* Expansion DDR clk */
-#define DDR_FRACFREQ4          0x0
-#define DDR_MDIV4              0x4
-#define DDR_INTFREQ5           0xE /* Expansion DDR clk */
-#define DDR_FRACFREQ5          0x0
-#define DDR_MDIV5              0x4
-#elif defined(CONFIG_TI816X_DDR_PLL_796) /* 796 MHz */
 #define DDR_N                  59
 #define DDR_P                  0x1
 #define DDR_MDIV1              0x2
 #define DDR_INTFREQ5           0xE /* Expansion DDR clk */
 #define DDR_FRACFREQ5          0x0
 #define DDR_MDIV5              0x4
-#endif
 
 #define CONTROL_STATUS                 (CTRL_BASE + 0x40)
 #define DDR_RCD                                (CTRL_BASE + 0x070C)
 #define CM_TIMER1_CLKSEL               (PRCM_BASE + 0x390)
-#define DMM_PAT_BASE_ADDR              (DMM_BASE + 0x420)
 #define CM_ALWON_CUST_EFUSE_CLKCTRL    (PRCM_BASE + 0x1628)
 
 #define INTCPS_SYSCONFIG       0x48200010
@@ -187,6 +136,15 @@ const struct wd_timer *wdtimer = (struct wd_timer *)WDT_BASE;
 
 void enable_dmm_clocks(void)
 {
+       writel(PRCM_MOD_EN, &cmdef->dmmclkctrl);
+       /* Wait for dmm to be fully functional, including OCP */
+       while (((readl(&cmdef->dmmclkctrl) >> 17) & 0x3) != 0)
+               ;
+}
+
+void enable_emif_clocks(void)
+{
+       writel(PRCM_MOD_EN, &cmdef->fwclkctrl);
        writel(PRCM_MOD_EN, &cmdef->l3fastclkstctrl);
        writel(PRCM_MOD_EN, &cmdef->emif0clkctrl);
        writel(PRCM_MOD_EN, &cmdef->emif1clkctrl);
@@ -200,14 +158,6 @@ void enable_dmm_clocks(void)
        /* Wait for emif1 to be fully functional, including OCP */
        while (((readl(&cmdef->emif1clkctrl) >> 17) & 0x3) != 0)
                ;
-
-       writel(PRCM_MOD_EN, &cmdef->dmmclkctrl);
-       /* Wait for dmm to be fully functional, including OCP */
-       while (((readl(&cmdef->dmmclkctrl) >> 17) & 0x3) != 0)
-               ;
-
-       /* Enable Tiled Access */
-       writel(0x80000000, DMM_PAT_BASE_ADDR);
 }
 
 /* assume delay is aprox at least 1us */
index 690487e7c38b5a5581eee9479b50c162ed396a17..7bf19ed9665f1b40ab98d2aa997f4a656989fc73 100644 (file)
@@ -163,6 +163,14 @@ void config_sdram_emif4d5(const struct emif_regs *regs, int nr)
  */
 void config_sdram(const struct emif_regs *regs, int nr)
 {
+#ifdef CONFIG_TI816X
+       writel(regs->sdram_config, &emif_reg[nr]->emif_sdram_config);
+       writel(regs->emif_ddr_phy_ctlr_1, &emif_reg[nr]->emif_ddr_phy_ctrl_1);
+       writel(regs->emif_ddr_phy_ctlr_1, &emif_reg[nr]->emif_ddr_phy_ctrl_1_shdw);
+       writel(0x0000613B, &emif_reg[nr]->emif_sdram_ref_ctrl);   /* initially a large refresh period */
+       writel(0x1000613B, &emif_reg[nr]->emif_sdram_ref_ctrl);   /* trigger initialization           */
+       writel(regs->ref_ctrl, &emif_reg[nr]->emif_sdram_ref_ctrl);
+#else
        if (regs->zq_config) {
                writel(regs->zq_config, &emif_reg[nr]->emif_zq_config);
                writel(regs->sdram_config, &cstat->secure_emif_sdram_config);
@@ -184,6 +192,7 @@ void config_sdram(const struct emif_regs *regs, int nr)
        /* Write REG_COS_COUNT_1, REG_COS_COUNT_2, and REG_PR_OLD_COUNT. */
        if (regs->ocp_config)
                writel(regs->ocp_config, &emif_reg[nr]->emif_l3_config);
+#endif
 }
 
 /**
index 3a110f2845707d14c9f5f4f7c39e6f6af1e93a9d..68c7705178710804b16fa4814c7b53b1d5ad8268 100644 (file)
 #include <asm/io.h>
 #include <asm/emif.h>
 
-DECLARE_GLOBAL_DATA_PTR;
-
-int dram_init(void)
-{
-#ifndef CONFIG_SKIP_LOWLEVEL_INIT
-       sdram_init();
-#endif
-
-       /* 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;
-}
-
-int dram_init_banksize(void)
-{
-       gd->bd->bi_dram[0].start = CONFIG_SYS_SDRAM_BASE;
-       gd->bd->bi_dram[0].size = gd->ram_size;
-
-       return 0;
-}
-
-
-#ifndef CONFIG_SKIP_LOWLEVEL_INIT
-#ifdef CONFIG_TI81XX
-static struct dmm_lisa_map_regs *hw_lisa_map_regs =
-                               (struct dmm_lisa_map_regs *)DMM_BASE;
-#endif
-#ifndef CONFIG_TI816X
 static struct vtp_reg *vtpreg[2] = {
                                (struct vtp_reg *)VTP0_CTRL_ADDR,
                                (struct vtp_reg *)VTP1_CTRL_ADDR};
-#endif
 #ifdef CONFIG_AM33XX
 static struct ddr_ctrl *ddrctrl = (struct ddr_ctrl *)DDR_CTRL_ADDR;
 #endif
@@ -60,9 +29,12 @@ static struct cm_device_inst *cm_device =
                                (struct cm_device_inst *)CM_DEVICE_INST;
 #endif
 
-#ifdef CONFIG_TI81XX
+#ifdef CONFIG_TI814X
 void config_dmm(const struct dmm_lisa_map_regs *regs)
 {
+       struct dmm_lisa_map_regs *hw_lisa_map_regs =
+                               (struct dmm_lisa_map_regs *)DMM_BASE;
+
        enable_dmm_clocks();
 
        writel(0, &hw_lisa_map_regs->dmm_lisa_map_3);
@@ -77,7 +49,6 @@ void config_dmm(const struct dmm_lisa_map_regs *regs)
 }
 #endif
 
-#ifndef CONFIG_TI816X
 static void config_vtp(int nr)
 {
        writel(readl(&vtpreg[nr]->vtp0ctrlreg) | VTP_CTRL_ENABLE,
@@ -92,7 +63,6 @@ static void config_vtp(int nr)
                        VTP_CTRL_READY)
                ;
 }
-#endif
 
 void __weak ddr_pll_config(unsigned int ddrpll_m)
 {
@@ -103,9 +73,7 @@ void config_ddr(unsigned int pll, const struct ctrl_ioregs *ioregs,
                const struct emif_regs *regs, int nr)
 {
        ddr_pll_config(pll);
-#ifndef CONFIG_TI816X
        config_vtp(nr);
-#endif
        config_cmd_ctrl(ctrl, nr);
 
        config_ddr_data(data, nr);
@@ -139,4 +107,3 @@ void config_ddr(unsigned int pll, const struct ctrl_ioregs *ioregs,
        else
                config_sdram(regs, nr);
 }
-#endif
diff --git a/arch/arm/mach-omap2/am33xx/ti816x_emif4.c b/arch/arm/mach-omap2/am33xx/ti816x_emif4.c
new file mode 100644 (file)
index 0000000..2e7ea90
--- /dev/null
@@ -0,0 +1,165 @@
+/*
+ * ti816x_emif4.c
+ *
+ * TI816x emif4 configuration file
+ *
+ * Copyright (C) 2017, Konsulko Group
+ *
+ * SPDX-License-Identifier:    GPL-2.0+
+ */
+
+#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/arch/sys_proto.h>
+#include <asm/io.h>
+#include <asm/emif.h>
+
+/*********************************************************************
+ * Init DDR3 on TI816X EVM
+ *********************************************************************/
+static void ddr_init_settings(const struct cmd_control *ctrl, int emif)
+{
+       /*
+        * setup use_rank_delays to 1.  This is only necessary when
+        * multiple ranks are in use.  Though the EVM does not have
+        * multiple ranks, this is a good value to set.
+        */
+       writel(1, DDRPHY_CONFIG_BASE + 0x134); // DATA0_REG_PHY_USE_RANK0_DELAYS
+       writel(1, DDRPHY_CONFIG_BASE + 0x1d8); // DATA1_REG_PHY_USE_RANK0_DELAYS
+       writel(1, DDRPHY_CONFIG_BASE + 0x27c); // DATA2_REG_PHY_USE_RANK0_DELAYS
+       writel(1, DDRPHY_CONFIG_BASE + 0x320); // DATA3_REG_PHY_USE_RANK0_DELAYS
+
+       config_cmd_ctrl(ctrl, emif);
+
+       /* for ddr3 this needs to be set to 1 */
+       writel(0x1, DDRPHY_CONFIG_BASE + 0x0F8); /* init mode */
+       writel(0x1, DDRPHY_CONFIG_BASE + 0x104);
+       writel(0x1, DDRPHY_CONFIG_BASE + 0x19C);
+       writel(0x1, DDRPHY_CONFIG_BASE + 0x1A8);
+       writel(0x1, DDRPHY_CONFIG_BASE + 0x240);
+       writel(0x1, DDRPHY_CONFIG_BASE + 0x24C);
+       writel(0x1, DDRPHY_CONFIG_BASE + 0x2E4);
+       writel(0x1, DDRPHY_CONFIG_BASE + 0x2F0);
+
+       /*
+        * 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.
+        */
+       writel((0x20 << 10) | 0x20, DDRPHY_CONFIG_BASE + 0x0F0); /*  data0 writelvl init ratio */
+       writel(0x0, DDRPHY_CONFIG_BASE + 0x0F4);   /*   */
+       writel((0x20 << 10) | 0x20, DDRPHY_CONFIG_BASE + 0x194); /*  data1 writelvl init ratio */
+       writel(0x0, DDRPHY_CONFIG_BASE + 0x198);   /*   */
+       writel((0x20 << 10) | 0x20, DDRPHY_CONFIG_BASE + 0x238); /*  data2 writelvl init ratio */
+       writel(0x0, DDRPHY_CONFIG_BASE + 0x23c);   /*   */
+       writel((0x20 << 10) | 0x20, DDRPHY_CONFIG_BASE + 0x2dc); /*  data3 writelvl init ratio */
+       writel(0x0, DDRPHY_CONFIG_BASE + 0x2e0);   /*   */
+
+
+       writel((0x20 << 10) | 0x20, DDRPHY_CONFIG_BASE + 0x0FC); /*  data0 gatelvl init ratio */
+       writel(0x0, DDRPHY_CONFIG_BASE + 0x100);
+       writel((0x20 << 10) | 0x20, DDRPHY_CONFIG_BASE + 0x1A0); /*  data1 gatelvl init ratio */
+       writel(0x0, DDRPHY_CONFIG_BASE + 0x1A4);
+       writel((0x20 << 10) | 0x20, DDRPHY_CONFIG_BASE + 0x244); /*  data2 gatelvl init ratio */
+       writel(0x0, DDRPHY_CONFIG_BASE + 0x248);
+       writel((0x20 << 10) | 0x20, DDRPHY_CONFIG_BASE + 0x2E8); /*  data3 gatelvl init ratio */
+       writel(0x0, DDRPHY_CONFIG_BASE + 0x2EC);
+
+       writel(0x5, DDRPHY_CONFIG_BASE + 0x00C);     /* cmd0 io config - output impedance of pad */
+       writel(0x5, DDRPHY_CONFIG_BASE + 0x010);     /* cmd0 io clk config - output impedance of pad */
+       writel(0x5, DDRPHY_CONFIG_BASE + 0x040);     /* cmd1 io config - output impedance of pad */
+       writel(0x5, DDRPHY_CONFIG_BASE + 0x044);     /* cmd1 io clk config - output impedance of pad */
+       writel(0x5, DDRPHY_CONFIG_BASE + 0x074);     /* cmd2 io config - output impedance of pad */
+       writel(0x5, DDRPHY_CONFIG_BASE + 0x078);     /* cmd2 io clk config - output impedance of pad */
+       writel(0x4, DDRPHY_CONFIG_BASE + 0x0A8);     /* data0 io config - output impedance of pad */
+       writel(0x4, DDRPHY_CONFIG_BASE + 0x0AC);     /* data0 io clk config - output impedance of pad */
+       writel(0x4, DDRPHY_CONFIG_BASE + 0x14C);     /* data1 io config - output impedance of pa     */
+       writel(0x4, DDRPHY_CONFIG_BASE + 0x150);     /* data1 io clk config - output impedance of pad */
+       writel(0x4, DDRPHY_CONFIG_BASE + 0x1F0);     /* data2 io config - output impedance of pa */
+       writel(0x4, DDRPHY_CONFIG_BASE + 0x1F4);     /* data2 io clk config - output impedance of pad */
+       writel(0x4, DDRPHY_CONFIG_BASE + 0x294);     /* data3 io config - output impedance of pa */
+       writel(0x4, DDRPHY_CONFIG_BASE + 0x298);     /* data3 io clk config - output impedance of pad */
+}
+
+static void ddr3_sw_levelling(const struct ddr_data *data, int emif)
+{
+       /* Set the correct value to DDR_VTP_CTRL_0 */
+       writel(0x6, (DDRPHY_CONFIG_BASE + 0x358));
+
+       writel(data->datafwsratio0, (DDRPHY_CONFIG_BASE + 0x108));
+       writel(data->datafwsratio0, (DDRPHY_CONFIG_BASE + 0x1AC));
+       writel(data->datafwsratio0, (DDRPHY_CONFIG_BASE + 0x250));
+       writel(data->datafwsratio0, (DDRPHY_CONFIG_BASE + 0x2F4));
+
+       writel(data->datawdsratio0, (DDRPHY_CONFIG_BASE + 0x0DC));
+       writel(data->datawdsratio0, (DDRPHY_CONFIG_BASE + 0x180));
+       writel(data->datawdsratio0, (DDRPHY_CONFIG_BASE + 0x224));
+       writel(data->datawdsratio0, (DDRPHY_CONFIG_BASE + 0x2C8));
+
+       writel(data->datawrsratio0, (DDRPHY_CONFIG_BASE + 0x120));
+       writel(data->datawrsratio0, (DDRPHY_CONFIG_BASE + 0x1C4));
+       writel(data->datawrsratio0, (DDRPHY_CONFIG_BASE + 0x268));
+       writel(data->datawrsratio0, (DDRPHY_CONFIG_BASE + 0x30C));
+
+       writel(data->datardsratio0, (DDRPHY_CONFIG_BASE + 0x0C8));
+       writel(data->datardsratio0, (DDRPHY_CONFIG_BASE + 0x16C));
+       writel(data->datardsratio0, (DDRPHY_CONFIG_BASE + 0x210));
+       writel(data->datardsratio0, (DDRPHY_CONFIG_BASE + 0x2B4));
+}
+
+static struct dmm_lisa_map_regs *hw_lisa_map_regs =
+                               (struct dmm_lisa_map_regs *)DMM_BASE;
+
+#define DMM_PAT_BASE_ADDR              (DMM_BASE + 0x420)
+void config_dmm(const struct dmm_lisa_map_regs *regs)
+{
+       writel(0, &hw_lisa_map_regs->dmm_lisa_map_3);
+       writel(0, &hw_lisa_map_regs->dmm_lisa_map_2);
+       writel(0, &hw_lisa_map_regs->dmm_lisa_map_1);
+       writel(0, &hw_lisa_map_regs->dmm_lisa_map_0);
+
+       writel(regs->dmm_lisa_map_3, &hw_lisa_map_regs->dmm_lisa_map_3);
+       writel(regs->dmm_lisa_map_2, &hw_lisa_map_regs->dmm_lisa_map_2);
+       writel(regs->dmm_lisa_map_1, &hw_lisa_map_regs->dmm_lisa_map_1);
+       writel(regs->dmm_lisa_map_0, &hw_lisa_map_regs->dmm_lisa_map_0);
+
+       /* Enable Tiled Access */
+       writel(0x80000000, DMM_PAT_BASE_ADDR);
+}
+
+void config_ddr(const struct ddr_data *data, const struct cmd_control *ctrl,
+               const struct emif_regs *regs,
+               const struct dmm_lisa_map_regs *lisa_regs, int nrs)
+{
+       int i;
+
+       enable_emif_clocks();
+
+       for (i = 0; i < nrs; i++)
+               ddr_init_settings(ctrl, i);
+
+       enable_dmm_clocks();
+
+       /* Program the DMM to for non-interleaved configuration */
+       config_dmm(lisa_regs);
+
+       /* Program EMIF CFG Registers */
+       for (i = 0; i < nrs; i++) {
+               set_sdram_timings(regs, i);
+               config_sdram(regs, i);
+       }
+
+       udelay(1000);
+       for (i = 0; i < nrs; i++)
+               ddr3_sw_levelling(data, i);
+
+       udelay(50000);  /* Some delay needed */
+}
index 2d03ebfbd3da42c2fca1c723fe71f943a5cc2de3..e0e32123dcddee36b5ccedc48b42d6282501b944 100644 (file)
@@ -5,6 +5,7 @@
  * SPDX-License-Identifier:    GPL-2.0+
  */
 #include <common.h>
+#include <asm/setup.h>
 #include <asm/arch/sys_proto.h>
 static void do_cancel_out(u32 *num, u32 *den, u32 factor)
 {
index af03e8d5bee877310b63cf57652dd691287170fb..68985af4b9dda0fbfdfeae1a7e734596d3c96603 100644 (file)
@@ -17,6 +17,7 @@
 
 /* Use the generic board which requires a unified bd_info */
 #include <asm-generic/u-boot.h>
+#include <asm/u-boot-mips.h>
 
 /* For image.h:image_check_target_arch() */
 #define IH_ARCH_DEFAULT IH_ARCH_MIPS
index 2efdeb1243b80bc5437c8d65c0071e26a6d4fd60..4378ebf44b952ca16bd31b9216ae3af3d73be66f 100644 (file)
@@ -20,6 +20,8 @@
 #ifndef _U_BOOT_H_
 #define _U_BOOT_H_     1
 
+#include <asm/u-boot-nds32.h>
+
 #include <environment.h>
 
 typedef struct bd_info {
index 4c95a418a8e9c5598086297f6ab4de299cb9aec9..21aadf284f11843d74b104ac4f0f0e074fe2dcf9 100644 (file)
@@ -12,6 +12,7 @@
 #include <u-boot/zlib.h>
 #include <asm/byteorder.h>
 #include <asm/bootm.h>
+#include <asm/setup.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
index bfe48a2ad324d215923cf063b21e2a6065c46b56..0227a72ae989c1722b82688fcf2e7f1534999a3c 100644 (file)
@@ -56,6 +56,7 @@
 #include <asm/processor.h>
 #include <asm/io.h>
 #include <pci.h>
+#include <asm/ppc4xx.h>
 
 #ifdef CONFIG_PCI
 
index f0fc098059e5c156c78a64a14858c63d29d82c65..aef267e0a2bf008cc6dc57a03120a00f7b3c558f 100644 (file)
@@ -22,6 +22,7 @@
 #include <asm/io.h>
 #include <ppc_asm.tmpl>
 #include <commproc.h>
+#include <asm/ppc4xx.h>
 #include <asm/ppc4xx-emac.h>
 #include <asm/ppc4xx-mal.h>
 #include <miiphy.h>
index a42327eb3dab7045e1ecc89105a33f2d21bc2aff..59de04a2d8a42c5d0273cd1d3fa3ff17dc36ab86 100644 (file)
@@ -14,6 +14,7 @@
 #include <command.h>
 #include <asm/processor.h>
 #include <asm/io.h>
+#include <asm/ppc4xx.h>
 #include <asm/ppc4xx-uic.h>
 #include <asm/ppc4xx-emac.h>
 
index f686e7cb07b26a891b2a4017ee88015762ca4111..276a78077dfb34ac6a1a4fedb69a22516dededa6 100644 (file)
@@ -56,5 +56,7 @@ int pci_arbiter_enabled(void);
 int __pci_pre_init(struct pci_controller *hose);
 void __pci_target_init(struct pci_controller *hose);
 void __pci_master_init(struct pci_controller *hose);
+void pci_target_init(struct pci_controller *);
+void pcie_setup_hoses(int busno);
 
 #endif
diff --git a/arch/powerpc/include/asm/ppc.h b/arch/powerpc/include/asm/ppc.h
new file mode 100644 (file)
index 0000000..4e1c596
--- /dev/null
@@ -0,0 +1,164 @@
+/*
+ * Ugly header containing required header files. This could  be adjusted
+ * so that including asm/arch/hardware includes the correct file.
+ *
+ * (C) Copyright 2000-2009
+ * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
+ *
+ * SPDX-License-Identifier:    GPL-2.0+
+ */
+
+#ifndef __ASM_PPC_H
+#define __ASM_PPC_H
+
+#ifndef __ASSEMBLY__
+
+#if defined(CONFIG_8xx)
+#include <asm/8xx_immap.h>
+#if defined(CONFIG_MPC859) || defined(CONFIG_MPC859T) || \
+       defined(CONFIG_MPC866) ||  defined(CONFIG_MPC866P)
+# define CONFIG_MPC866_FAMILY 1
+#elif defined(CONFIG_MPC885)
+# define CONFIG_MPC885_FAMILY   1
+#endif
+#if defined(CONFIG_MPC860) || defined(CONFIG_MPC860T) || \
+       defined(CONFIG_MPC866_FAMILY) || defined(CONFIG_MPC885_FAMILY)
+# define CONFIG_MPC86x 1
+#endif
+#elif defined(CONFIG_5xx)
+#include <asm/5xx_immap.h>
+#elif defined(CONFIG_MPC5xxx)
+#include <mpc5xxx.h>
+#elif defined(CONFIG_MPC512X)
+#include <asm/immap_512x.h>
+#elif defined(CONFIG_MPC8260)
+#if defined(CONFIG_MPC8247) || defined(CONFIG_MPC8272)
+#define CONFIG_MPC8272_FAMILY  1
+#endif
+#include <asm/immap_8260.h>
+#endif
+#ifdef CONFIG_MPC86xx
+#include <mpc86xx.h>
+#include <asm/immap_86xx.h>
+#endif
+#ifdef CONFIG_MPC85xx
+#include <mpc85xx.h>
+#include <asm/immap_85xx.h>
+#endif
+#ifdef CONFIG_MPC83xx
+#include <mpc83xx.h>
+#include <asm/immap_83xx.h>
+#endif
+#ifdef CONFIG_4xx
+#include <asm/ppc4xx.h>
+#endif
+#ifdef CONFIG_SOC_DA8XX
+#include <asm/arch/hardware.h>
+#endif
+#ifdef CONFIG_FSL_LSCH3
+#include <asm/arch/immap_lsch3.h>
+#endif
+#ifdef CONFIG_FSL_LSCH2
+#include <asm/arch/immap_lsch2.h>
+#endif
+
+/*
+ * enable common handling for all TQM8xxL/M boards:
+ * - CONFIG_TQM8xxM will be defined for all TQM8xxM boards
+ * - CONFIG_TQM8xxL will be defined for all TQM8xxL _and_ TQM8xxM boards
+ *                  and for the TQM885D board
+ */
+#if defined(CONFIG_TQM823M) || defined(CONFIG_TQM850M) || \
+       defined(CONFIG_TQM855M) || defined(CONFIG_TQM860M) || \
+       defined(CONFIG_TQM862M) || defined(CONFIG_TQM866M)
+# ifndef CONFIG_TQM8xxM
+#  define CONFIG_TQM8xxM
+# endif
+#endif
+#if defined(CONFIG_TQM823L) || defined(CONFIG_TQM850L) || \
+       defined(CONFIG_TQM855L) || defined(CONFIG_TQM860L) || \
+       defined(CONFIG_TQM862L) || defined(CONFIG_TQM8xxM) || \
+       defined(CONFIG_TQM885D)
+# ifndef CONFIG_TQM8xxL
+#  define CONFIG_TQM8xxL
+# endif
+#endif
+
+#if defined(CONFIG_5xx) || defined(CONFIG_8xx)
+uint get_immr(uint);
+#endif
+#if defined(CONFIG_MPC5xxx)
+uint get_svr(void);
+#endif
+uint get_pvr(void);
+uint get_svr(void);
+uint rd_ic_cst(void);
+void wr_ic_cst(uint);
+void wr_ic_adr(uint);
+uint rd_dc_cst(void);
+void wr_dc_cst(uint);
+void wr_dc_adr(uint);
+
+#if defined(CONFIG_4xx)        || \
+       defined(CONFIG_MPC5xxx) || \
+       defined(CONFIG_MPC85xx) || \
+       defined(CONFIG_MPC86xx) || \
+       defined(CONFIG_MPC83xx)
+unsigned char  in8(unsigned int);
+void           out8(unsigned int, unsigned char);
+unsigned short in16(unsigned int);
+unsigned short in16r(unsigned int);
+void           out16(unsigned int, unsigned short value);
+void           out16r(unsigned int, unsigned short value);
+unsigned long  in32(unsigned int);
+unsigned long  in32r(unsigned int);
+void           out32(unsigned int, unsigned long value);
+void           out32r(unsigned int, unsigned long value);
+void           ppcDcbf(unsigned long value);
+void           ppcDcbi(unsigned long value);
+void           ppcSync(void);
+void           ppcDcbz(unsigned long value);
+#endif
+#if defined(CONFIG_MPC83xx)
+void           ppcDWload(unsigned int *addr, unsigned int *ret);
+void           ppcDWstore(unsigned int *addr, unsigned int *value);
+void disable_addr_trans(void);
+void enable_addr_trans(void);
+#if defined(CONFIG_DDR_ECC) && !defined(CONFIG_ECC_INIT_VIA_DDRCONTROLLER)
+void ddr_enable_ecc(unsigned int dram_size);
+#endif
+#endif
+
+#if defined(CONFIG_MPC5xxx)
+int    prt_mpc5xxx_clks(void);
+#endif
+
+#if defined(CONFIG_MPC85xx)
+typedef MPC85xx_SYS_INFO sys_info_t;
+void get_sys_info(sys_info_t *);
+void ft_fixup_cpu(void *, u64);
+void ft_fixup_num_cores(void *);
+#endif
+#if defined(CONFIG_MPC86xx)
+ulong get_bus_freq(ulong);
+typedef MPC86xx_SYS_INFO sys_info_t;
+void   get_sys_info(sys_info_t *);
+static inline ulong get_ddr_freq(ulong dummy)
+{
+       return get_bus_freq(dummy);
+}
+#else
+ulong get_ddr_freq(ulong);
+#endif
+
+#endif /* !__ASSEMBLY__ */
+
+#ifdef CONFIG_PPC
+/*
+ * Has to be included outside of the #ifndef __ASSEMBLY__ section.
+ * Otherwise might lead to compilation errors in assembler files.
+ */
+#include <asm/cache.h>
+#endif
+
+#endif
index b8b0ff9f25bb2d148f6f6458a30e771dae059681..45ff5dbacd9243e83bb2f6551e2dd64a7e544bf5 100644 (file)
@@ -289,6 +289,13 @@ static inline void set_mcsr(u32 val)
 
 int ppc4xx_pci_sync_clock_config(u32 async);
 
+unsigned long get_OPB_freq(void);
+unsigned long get_PCI_freq(void);
+
+typedef PPC4xx_SYS_INFO sys_info_t;
+int ppc440spe_revB(void);
+void get_sys_info(sys_info_t *);
+
 #endif /* __ASSEMBLY__ */
 
 /* for multi-cpu support */
index 74b620294ef475a44dcf85bda743aefdc4c7bbde..34e44e18c2f51ef8f276f0a761f96113adde5934 100644 (file)
@@ -16,6 +16,7 @@
 
 /* Use the generic board which requires a unified bd_info */
 #include <asm-generic/u-boot.h>
+#include <asm/ppc.h>
 
 /* For image.h:image_check_target_arch() */
 #define IH_ARCH_DEFAULT IH_ARCH_PPC
index 3fe99b853d573bce6a81394c22c7c5655250d9ec..eefed2ebd9617c41558764111531d2288b6354d5 100644 (file)
@@ -139,3 +139,14 @@ done:
 
        return 0;
 }
+
+ulong timer_get_boot_us(void)
+{
+       static uint64_t base_count;
+       uint64_t count = os_get_nsec();
+
+       if (!base_count)
+               base_count = count;
+
+       return (count - base_count) / 1000;
+}
index 8279894eeca9709ae79947b736afe67c7351c8cd..ddcd6fb397e608f5f28d1a0a549daf991e1d6631 100644 (file)
@@ -22,6 +22,7 @@
 
 /* Use the generic board which requires a unified bd_info */
 #include <asm-generic/u-boot.h>
+#include <asm/u-boot-sandbox.h>
 
 /* For image.h:image_check_target_arch() */
 #define IH_ARCH_DEFAULT IH_ARCH_SANDBOX
index 1c8ac370b30b7920ebb38bc13abd3f97411ca300..6c851864861bcb6eadfb9a44ee3adb27b91225d8 100644 (file)
@@ -17,4 +17,8 @@ config INTERNAL_UART
          reason, it is recommended that the UART port be used for
          debug purposes only, eg: U-Boot console.
 
+config DEBUG_UART
+       bool
+       select DEBUG_UART_BOARD_INIT
+
 endif
index 471d592b49fddb45ed215bcf177311fdcec73a13..afab21f1dd0887901aa14174226fcc7080a4276d 100644 (file)
@@ -80,3 +80,8 @@ int setup_internal_uart(int enable)
 
        return 0;
 }
+
+void board_debug_uart_init(void)
+{
+       setup_internal_uart(1);
+}
index d49b8d27371b2afccc17713d957eddfd63a3c4ac..45f9bf95da54af7240c0a537f4050e81adff3a53 100644 (file)
@@ -148,10 +148,10 @@ void update_fsp_configs(struct fsp_config_data *config,
 
        fsp_upd->mrc_init_tseg_size = fdtdec_get_int(blob, node,
                                                     "fsp,mrc-init-tseg-size",
-                                                    0);
+                                                    MRC_INIT_TSEG_SIZE_1MB);
        fsp_upd->mrc_init_mmio_size = fdtdec_get_int(blob, node,
                                                     "fsp,mrc-init-mmio-size",
-                                                    0x800);
+                                                    MRC_INIT_MMIO_SIZE_2048MB);
        fsp_upd->mrc_init_spd_addr1 = fdtdec_get_int(blob, node,
                                                     "fsp,mrc-init-spd-addr1",
                                                     0xa0);
@@ -159,7 +159,8 @@ void update_fsp_configs(struct fsp_config_data *config,
                                                     "fsp,mrc-init-spd-addr2",
                                                     0xa2);
        fsp_upd->emmc_boot_mode = fdtdec_get_int(blob, node,
-                                                "fsp,emmc-boot-mode", 2);
+                                                "fsp,emmc-boot-mode",
+                                                EMMC_BOOT_MODE_EMMC41);
        fsp_upd->enable_sdio = fdtdec_get_bool(blob, node, "fsp,enable-sdio");
        fsp_upd->enable_sdcard = fdtdec_get_bool(blob, node,
                                                 "fsp,enable-sdcard");
@@ -169,13 +170,15 @@ void update_fsp_configs(struct fsp_config_data *config,
                                                  "fsp,enable-hsuart1");
        fsp_upd->enable_spi = fdtdec_get_bool(blob, node, "fsp,enable-spi");
        fsp_upd->enable_sata = fdtdec_get_bool(blob, node, "fsp,enable-sata");
-       fsp_upd->sata_mode = fdtdec_get_int(blob, node, "fsp,sata-mode", 1);
+       fsp_upd->sata_mode = fdtdec_get_int(blob, node, "fsp,sata-mode",
+                                           SATA_MODE_AHCI);
        fsp_upd->enable_azalia = fdtdec_get_bool(blob, node,
                                                 "fsp,enable-azalia");
        fsp_upd->enable_xhci = fdtdec_get_bool(blob, node, "fsp,enable-xhci");
-       fsp_upd->enable_lpe = fdtdec_get_bool(blob, node, "fsp,enable-lpe");
-       fsp_upd->lpss_sio_enable_pci_mode = fdtdec_get_bool(blob, node,
-                       "fsp,lpss-sio-enable-pci-mode");
+       fsp_upd->lpe_mode = fdtdec_get_int(blob, node, "fsp,lpe-mode",
+                                          LPE_MODE_PCI);
+       fsp_upd->lpss_sio_mode = fdtdec_get_int(blob, node, "fsp,lpss-sio-mode",
+                                          LPSS_SIO_MODE_PCI);
        fsp_upd->enable_dma0 = fdtdec_get_bool(blob, node, "fsp,enable-dma0");
        fsp_upd->enable_dma1 = fdtdec_get_bool(blob, node, "fsp,enable-dma1");
        fsp_upd->enable_i2_c0 = fdtdec_get_bool(blob, node, "fsp,enable-i2c0");
@@ -189,25 +192,22 @@ void update_fsp_configs(struct fsp_config_data *config,
        fsp_upd->enable_pwm1 = fdtdec_get_bool(blob, node, "fsp,enable-pwm1");
        fsp_upd->enable_hsi = fdtdec_get_bool(blob, node, "fsp,enable-hsi");
        fsp_upd->igd_dvmt50_pre_alloc = fdtdec_get_int(blob, node,
-                       "fsp,igd-dvmt50-pre-alloc", 2);
+                       "fsp,igd-dvmt50-pre-alloc", IGD_DVMT50_PRE_ALLOC_64MB);
        fsp_upd->aperture_size = fdtdec_get_int(blob, node, "fsp,aperture-size",
-                                               2);
-       fsp_upd->gtt_size = fdtdec_get_int(blob, node, "fsp,gtt-size", 2);
-       fsp_upd->serial_debug_port_address = fdtdec_get_int(blob, node,
-                       "fsp,serial-debug-port-address", 0x3f8);
-       fsp_upd->serial_debug_port_type = fdtdec_get_int(blob, node,
-                       "fsp,serial-debug-port-type", 1);
+                                               APERTURE_SIZE_256MB);
+       fsp_upd->gtt_size = fdtdec_get_int(blob, node, "fsp,gtt-size",
+                                          GTT_SIZE_2MB);
        fsp_upd->mrc_debug_msg = fdtdec_get_bool(blob, node,
                                                 "fsp,mrc-debug-msg");
        fsp_upd->isp_enable = fdtdec_get_bool(blob, node, "fsp,isp-enable");
-       fsp_upd->scc_enable_pci_mode = fdtdec_get_bool(blob, node,
-                       "fsp,scc-enable-pci-mode");
+       fsp_upd->scc_mode = fdtdec_get_int(blob, node, "fsp,scc-mode",
+                                          SCC_MODE_PCI);
        fsp_upd->igd_render_standby = fdtdec_get_bool(blob, node,
                                                      "fsp,igd-render-standby");
        fsp_upd->txe_uma_enable = fdtdec_get_bool(blob, node,
                                                  "fsp,txe-uma-enable");
        fsp_upd->os_selection = fdtdec_get_int(blob, node, "fsp,os-selection",
-                                              4);
+                                              OS_SELECTION_LINUX);
        fsp_upd->emmc45_ddr50_enabled = fdtdec_get_bool(blob, node,
                        "fsp,emmc45-ddr50-enabled");
        fsp_upd->emmc45_hs200_enabled = fdtdec_get_bool(blob, node,
@@ -228,30 +228,32 @@ void update_fsp_configs(struct fsp_config_data *config,
                } else {
                        mem->dram_speed = fdtdec_get_int(blob, node,
                                                         "fsp,dram-speed",
-                                                        0x02);
+                                                        DRAM_SPEED_1333MTS);
                        mem->dram_type = fdtdec_get_int(blob, node,
-                                                       "fsp,dram-type", 0x01);
+                                                       "fsp,dram-type",
+                                                       DRAM_TYPE_DDR3L);
                        mem->dimm_0_enable = fdtdec_get_bool(blob, node,
                                        "fsp,dimm-0-enable");
                        mem->dimm_1_enable = fdtdec_get_bool(blob, node,
                                        "fsp,dimm-1-enable");
                        mem->dimm_width = fdtdec_get_int(blob, node,
                                                         "fsp,dimm-width",
-                                                        0x00);
+                                                        DIMM_WIDTH_X8);
                        mem->dimm_density = fdtdec_get_int(blob, node,
                                                           "fsp,dimm-density",
-                                                          0x01);
+                                                          DIMM_DENSITY_2GBIT);
                        mem->dimm_bus_width = fdtdec_get_int(blob, node,
-                                       "fsp,dimm-bus-width", 0x03);
+                                       "fsp,dimm-bus-width",
+                                       DIMM_BUS_WIDTH_64BITS);
                        mem->dimm_sides = fdtdec_get_int(blob, node,
                                                         "fsp,dimm-sides",
-                                                        0x00);
+                                                        DIMM_SIDES_1RANKS);
                        mem->dimm_tcl = fdtdec_get_int(blob, node,
                                                       "fsp,dimm-tcl", 0x09);
                        mem->dimm_trpt_rcd = fdtdec_get_int(blob, node,
                                        "fsp,dimm-trpt-rcd", 0x09);
                        mem->dimm_twr = fdtdec_get_int(blob, node,
-                                                      "fsp,dimm-twr", 0x0A);
+                                                      "fsp,dimm-twr", 0x0a);
                        mem->dimm_twtr = fdtdec_get_int(blob, node,
                                                        "fsp,dimm-twtr", 0x05);
                        mem->dimm_trrd = fdtdec_get_int(blob, node,
index 1ae058d7a94f5b609f2f2920460accea3a736185..0c314e068875e8901193c23e4af64904f3b7ae18 100644 (file)
@@ -6,6 +6,7 @@
 
 /dts-v1/;
 
+#include <asm/arch-baytrail/fsp/fsp_configs.h>
 #include <dt-bindings/gpio/x86-gpio.h>
 #include <dt-bindings/interrupt-router/intel-irq.h>
 
 
        fsp {
                compatible = "intel,baytrail-fsp";
-               fsp,mrc-init-tseg-size = <0>;
-               fsp,mrc-init-mmio-size = <0x800>;
+               fsp,mrc-init-tseg-size = <MRC_INIT_TSEG_SIZE_1MB>;
+               fsp,mrc-init-mmio-size = <MRC_INIT_MMIO_SIZE_2048MB>;
                fsp,mrc-init-spd-addr1 = <0xa0>;
                fsp,mrc-init-spd-addr2 = <0xa2>;
-               fsp,emmc-boot-mode = <1>;
+               fsp,emmc-boot-mode = <EMMC_BOOT_MODE_AUTO>;
                fsp,enable-sdio;
                fsp,enable-sdcard;
                fsp,enable-hsuart1;
                fsp,enable-spi;
                fsp,enable-sata;
-               fsp,sata-mode = <1>;
-               fsp,enable-lpe;
-               fsp,lpss-sio-enable-pci-mode;
+               fsp,sata-mode = <SATA_MODE_AHCI>;
+               fsp,lpe-mode = <LPE_MODE_PCI>;
+               fsp,lpss-sio-mode = <LPSS_SIO_MODE_PCI>;
                fsp,enable-dma0;
                fsp,enable-dma1;
                fsp,enable-i2c0;
                fsp,enable-i2c6;
                fsp,enable-pwm0;
                fsp,enable-pwm1;
-               fsp,igd-dvmt50-pre-alloc = <2>;
-               fsp,aperture-size = <2>;
-               fsp,gtt-size = <2>;
-               fsp,serial-debug-port-address = <0x3f8>;
-               fsp,serial-debug-port-type = <1>;
-               fsp,scc-enable-pci-mode;
-               fsp,os-selection = <4>;
+               fsp,igd-dvmt50-pre-alloc = <IGD_DVMT50_PRE_ALLOC_64MB>;
+               fsp,aperture-size = <APERTURE_SIZE_256MB>;
+               fsp,gtt-size = <GTT_SIZE_2MB>;
+               fsp,scc-mode = <SCC_MODE_PCI>;
+               fsp,os-selection = <OS_SELECTION_LINUX>;
                fsp,emmc45-ddr50-enabled;
                fsp,emmc45-retune-timer-value = <8>;
                fsp,enable-igd;
index aa8bfb86513c4fa9571a548058616e911b445c45..171e7ffee63f49176985c7f9fce7cfa44c93a7cc 100644 (file)
@@ -7,6 +7,7 @@
 
 /dts-v1/;
 
+#include <asm/arch-baytrail/fsp/fsp_configs.h>
 #include <dt-bindings/gpio/x86-gpio.h>
 #include <dt-bindings/interrupt-router/intel-irq.h>
 
 
        fsp {
                compatible = "intel,baytrail-fsp";
-               fsp,mrc-init-tseg-size = <0>;
-               fsp,mrc-init-mmio-size = <0x800>;
+               fsp,mrc-init-tseg-size = <MRC_INIT_TSEG_SIZE_1MB>;
+               fsp,mrc-init-mmio-size = <MRC_INIT_MMIO_SIZE_2048MB>;
                fsp,mrc-init-spd-addr1 = <0xa0>;
                fsp,mrc-init-spd-addr2 = <0xa2>;
                fsp,enable-spi;
                fsp,enable-sata;
-               fsp,sata-mode = <1>;
+               fsp,sata-mode = <SATA_MODE_AHCI>;
                fsp,enable-azalia;
-               fsp,lpss-sio-enable-pci-mode;
+               fsp,lpss-sio-mode = <LPSS_SIO_MODE_PCI>;
                fsp,enable-dma0;
                fsp,enable-dma1;
                fsp,enable-i2c0;
                fsp,enable-i2c6;
                fsp,enable-pwm0;
                fsp,enable-pwm1;
-               fsp,igd-dvmt50-pre-alloc = <2>;
-               fsp,aperture-size = <2>;
-               fsp,gtt-size = <2>;
-               fsp,scc-enable-pci-mode;
-               fsp,os-selection = <4>;
+               fsp,igd-dvmt50-pre-alloc = <IGD_DVMT50_PRE_ALLOC_64MB>;
+               fsp,aperture-size = <APERTURE_SIZE_256MB>;
+               fsp,gtt-size = <GTT_SIZE_2MB>;
+               fsp,scc-mode = <SCC_MODE_PCI>;
+               fsp,os-selection = <OS_SELECTION_LINUX>;
                fsp,enable-igd;
-               fsp,serial-debug-port-address = <0x3f8>;
-               fsp,serial-debug-port-type = <1>;
        };
 
        microcode {
index 898e9c9b5f7537dae2e7fe8822f3307b9430e6c5..ae11ccc25ab0ac7e7aaaf7833023ae0b6b873a43 100644 (file)
@@ -7,6 +7,7 @@
 
 /dts-v1/;
 
+#include <asm/arch-baytrail/fsp/fsp_configs.h>
 #include <dt-bindings/gpio/x86-gpio.h>
 #include <dt-bindings/interrupt-router/intel-irq.h>
 
 
        fsp {
                compatible = "intel,baytrail-fsp";
-               fsp,mrc-init-tseg-size = <0>;
-               fsp,mrc-init-mmio-size = <0x800>;
+               fsp,mrc-init-tseg-size = <MRC_INIT_TSEG_SIZE_1MB>;
+               fsp,mrc-init-mmio-size = <MRC_INIT_MMIO_SIZE_2048MB>;
                fsp,mrc-init-spd-addr1 = <0xa0>;
                fsp,mrc-init-spd-addr2 = <0xa2>;
-               fsp,emmc-boot-mode = <1>;
+               fsp,emmc-boot-mode = <EMMC_BOOT_MODE_AUTO>;
                fsp,enable-sdio;
                fsp,enable-sdcard;
                fsp,enable-hsuart1;
                fsp,enable-spi;
                fsp,enable-sata;
-               fsp,sata-mode = <1>;
-               fsp,enable-lpe;
-               fsp,lpss-sio-enable-pci-mode;
+               fsp,sata-mode = <SATA_MODE_AHCI>;
+               fsp,lpe-mode = <LPE_MODE_PCI>;
+               fsp,lpss-sio-mode = <LPSS_SIO_MODE_PCI>;
                fsp,enable-dma0;
                fsp,enable-dma1;
                fsp,enable-pwm0;
                fsp,enable-pwm1;
-               fsp,igd-dvmt50-pre-alloc = <2>;
-               fsp,aperture-size = <2>;
-               fsp,gtt-size = <2>;
-               fsp,scc-enable-pci-mode;
-               fsp,os-selection = <4>;
+               fsp,igd-dvmt50-pre-alloc = <IGD_DVMT50_PRE_ALLOC_64MB>;
+               fsp,aperture-size = <APERTURE_SIZE_256MB>;
+               fsp,gtt-size = <GTT_SIZE_2MB>;
+               fsp,scc-mode = <SCC_MODE_PCI>;
+               fsp,os-selection = <OS_SELECTION_LINUX>;
                fsp,emmc45-ddr50-enabled;
                fsp,emmc45-retune-timer-value = <8>;
                fsp,enable-igd;
                fsp,enable-memory-down;
                fsp,memory-down-params {
                        compatible = "intel,baytrail-fsp-mdp";
-                       fsp,dram-speed = <2>;           /* 2=1333MHz */
-                       fsp,dram-type = <1>;            /* 1=DDR3L */
+                       fsp,dram-speed = <DRAM_SPEED_1333MTS>;
+                       fsp,dram-type = <DRAM_TYPE_DDR3L>;
                        fsp,dimm-0-enable;
                        fsp,dimm-1-enable;
-                       fsp,dimm-width = <1>;           /* 1=x16, 2=x32 */
-                       fsp,dimm-density = <2>;         /* 2=4Gbit */
-                       fsp,dimm-bus-width = <3>;       /* 3=64bits */
-                       fsp,dimm-sides = <0>;           /* 0=1 ranks -> 0x2b */
+                       fsp,dimm-width = <DIMM_WIDTH_X16>;
+                       fsp,dimm-density = <DIMM_DENSITY_4GBIT>;
+                       fsp,dimm-bus-width = <DIMM_BUS_WIDTH_64BITS>;
+                       fsp,dimm-sides = <DIMM_SIDES_1RANKS>;
 
                        /* These following values might need a re-visit */
                        fsp,dimm-tcl = <8>;
index 546981a9ac1c38bd96756889a3a2ec314f096bba..04aa95ad52f0018800e952ca2aa276f67926154a 100644 (file)
@@ -5,6 +5,7 @@
  * SPDX-License-Identifier:    GPL-2.0+
  */
 
+#include <asm/arch-baytrail/fsp/fsp_configs.h>
 #include <dt-bindings/gpio/x86-gpio.h>
 #include <dt-bindings/interrupt-router/intel-irq.h>
 
 
        fsp {
                compatible = "intel,baytrail-fsp";
-               fsp,mrc-init-tseg-size = <0>;
-               fsp,mrc-init-mmio-size = <0x800>;
+               fsp,mrc-init-tseg-size = <MRC_INIT_TSEG_SIZE_1MB>;
+               fsp,mrc-init-mmio-size = <MRC_INIT_MMIO_SIZE_2048MB>;
                fsp,mrc-init-spd-addr1 = <0xa0>;
                fsp,mrc-init-spd-addr2 = <0xa2>;
-               fsp,emmc-boot-mode = <1>;
+               fsp,emmc-boot-mode = <EMMC_BOOT_MODE_AUTO>;
                fsp,enable-sdio;
                fsp,enable-sdcard;
                fsp,enable-hsuart0;
                fsp,enable-hsuart1;
                fsp,enable-spi;
                fsp,enable-sata;
-               fsp,sata-mode = <1>;
-               fsp,enable-lpe;
-               fsp,lpss-sio-enable-pci-mode;
+               fsp,sata-mode = <SATA_MODE_AHCI>;
+               fsp,lpe-mode = <LPE_MODE_PCI>;
+               fsp,lpss-sio-mode = <LPSS_SIO_MODE_PCI>;
                fsp,enable-dma0;
                fsp,enable-dma1;
                fsp,enable-i2c0;
                fsp,enable-i2c6;
                fsp,enable-pwm0;
                fsp,enable-pwm1;
-               fsp,igd-dvmt50-pre-alloc = <2>;
-               fsp,aperture-size = <2>;
-               fsp,gtt-size = <2>;
-               fsp,scc-enable-pci-mode;
-               fsp,os-selection = <4>;
+               fsp,igd-dvmt50-pre-alloc = <IGD_DVMT50_PRE_ALLOC_64MB>;
+               fsp,aperture-size = <APERTURE_SIZE_256MB>;
+               fsp,gtt-size = <GTT_SIZE_2MB>;
+               fsp,scc-mode = <SCC_MODE_PCI>;
+               fsp,os-selection = <OS_SELECTION_LINUX>;
                fsp,emmc45-ddr50-enabled;
                fsp,emmc45-retune-timer-value = <8>;
                fsp,enable-igd;
                fsp,enable-memory-down;
                fsp,memory-down-params {
                        compatible = "intel,baytrail-fsp-mdp";
-                       fsp,dram-speed = <2>;           /* 2=1333MHz */
-                       fsp,dram-type = <1>;            /* 1=DDR3L */
+                       fsp,dram-speed = <DRAM_SPEED_1333MTS>;
+                       fsp,dram-type = <DRAM_TYPE_DDR3L>;
                        fsp,dimm-0-enable;
-                       fsp,dimm-width = <1>;           /* 1=x16, 2=x32 */
-                       fsp,dimm-density = <3>;         /* 3=8Gbit */
-                       fsp,dimm-bus-width = <3>;       /* 3=64bits */
-                       fsp,dimm-sides = <0>;           /* 0=1 ranks -> 0x2b */
+                       fsp,dimm-width = <DIMM_WIDTH_X16>;
+                       fsp,dimm-density = <DIMM_DENSITY_8GBIT>;
+                       fsp,dimm-bus-width = <DIMM_BUS_WIDTH_64BITS>;
+                       fsp,dimm-sides = <DIMM_SIDES_1RANKS>;
 
                        /* These following values might need a re-visit */
                        fsp,dimm-tcl = <8>;
index af64c6859ce77ccfcce20daf42745da00e577173..4c0a8fe26f2df8ee2b20788cdd4e5f81d423fa94 100644 (file)
@@ -6,6 +6,7 @@
 
 /dts-v1/;
 
+#include <asm/arch-baytrail/fsp/fsp_configs.h>
 #include <dt-bindings/gpio/x86-gpio.h>
 #include <dt-bindings/interrupt-router/intel-irq.h>
 
 
        fsp {
                compatible = "intel,baytrail-fsp";
-               fsp,mrc-init-tseg-size = <0>;
-               fsp,mrc-init-mmio-size = <0x800>;
+               fsp,mrc-init-tseg-size = <MRC_INIT_TSEG_SIZE_1MB>;
+               fsp,mrc-init-mmio-size = <MRC_INIT_MMIO_SIZE_2048MB>;
                fsp,mrc-init-spd-addr1 = <0xa0>;
                fsp,mrc-init-spd-addr2 = <0xa2>;
-               fsp,emmc-boot-mode = <1>;
+               fsp,emmc-boot-mode = <EMMC_BOOT_MODE_AUTO>;
                fsp,enable-sdio;
                fsp,enable-sdcard;
                fsp,enable-hsuart1;
                fsp,enable-spi;
                fsp,enable-sata;
-               fsp,sata-mode = <1>;
-               fsp,enable-lpe;
-               fsp,lpss-sio-enable-pci-mode;
+               fsp,sata-mode = <SATA_MODE_AHCI>;
+               fsp,lpe-mode = <LPE_MODE_PCI>;
+               fsp,lpss-sio-mode = <LPSS_SIO_MODE_PCI>;
                fsp,enable-dma0;
                fsp,enable-dma1;
                fsp,enable-i2c0;
                fsp,enable-i2c6;
                fsp,enable-pwm0;
                fsp,enable-pwm1;
-               fsp,igd-dvmt50-pre-alloc = <2>;
-               fsp,aperture-size = <2>;
-               fsp,gtt-size = <2>;
-               fsp,serial-debug-port-address = <0x3f8>;
-               fsp,serial-debug-port-type = <1>;
-               fsp,scc-enable-pci-mode;
-               fsp,os-selection = <4>;
+               fsp,igd-dvmt50-pre-alloc = <IGD_DVMT50_PRE_ALLOC_64MB>;
+               fsp,aperture-size = <APERTURE_SIZE_256MB>;
+               fsp,gtt-size = <GTT_SIZE_2MB>;
+               fsp,scc-mode = <SCC_MODE_PCI>;
+               fsp,os-selection = <OS_SELECTION_LINUX>;
                fsp,emmc45-ddr50-enabled;
                fsp,emmc45-retune-timer-value = <8>;
                fsp,enable-igd;
                fsp,enable-memory-down;
                fsp,memory-down-params {
                        compatible = "intel,baytrail-fsp-mdp";
-                       fsp,dram-speed = <1>;
-                       fsp,dram-type = <1>;
+                       fsp,dram-speed = <DRAM_SPEED_1066MTS>;
+                       fsp,dram-type = <DRAM_TYPE_DDR3L>;
                        fsp,dimm-0-enable;
-                       fsp,dimm-width = <1>;
-                       fsp,dimm-density = <2>;
-                       fsp,dimm-bus-width = <3>;
-                       fsp,dimm-sides = <0>;
+                       fsp,dimm-width = <DIMM_WIDTH_X16>;
+                       fsp,dimm-density = <DIMM_DENSITY_4GBIT>;
+                       fsp,dimm-bus-width = <DIMM_BUS_WIDTH_64BITS>;
+                       fsp,dimm-sides = <DIMM_SIDES_1RANKS>;
                        fsp,dimm-tcl = <0xb>;
                        fsp,dimm-trpt-rcd = <0xb>;
                        fsp,dimm-twr = <0xc>;
index e539890c337c13f681d3a58ebd69225adea1c362..1c6c2479f0872c25cf307eff2d1f41de53b60a1d 100644 (file)
@@ -7,6 +7,7 @@
 #ifndef __FSP_CONFIGS_H__
 #define __FSP_CONFIGS_H__
 
+#ifndef __ASSEMBLY__
 struct fsp_config_data {
        struct fsp_cfg_common   common;
        struct upd_region       fsp_upd;
@@ -15,5 +16,91 @@ struct fsp_config_data {
 struct fspinit_rtbuf {
        struct common_buf       common; /* FSP common runtime data structure */
 };
+#endif
+
+/* FSP user configuration settings */
+
+#define MRC_INIT_TSEG_SIZE_1MB         1
+#define MRC_INIT_TSEG_SIZE_2MB         2
+#define MRC_INIT_TSEG_SIZE_4MB         4
+#define MRC_INIT_TSEG_SIZE_8MB         8
+
+#define MRC_INIT_MMIO_SIZE_1024MB      0x400
+#define MRC_INIT_MMIO_SIZE_1536MB      0x600
+#define MRC_INIT_MMIO_SIZE_2048MB      0x800
+
+#define EMMC_BOOT_MODE_DISABLED                0
+#define EMMC_BOOT_MODE_AUTO            1
+#define EMMC_BOOT_MODE_EMMC41          2
+#define EMMC_BOOT_MODE_EMCC45          3
+
+#define SATA_MODE_IDE                  0
+#define SATA_MODE_AHCI                 1
+
+#define IGD_DVMT50_PRE_ALLOC_32MB      0x01
+#define IGD_DVMT50_PRE_ALLOC_64MB      0x02
+#define IGD_DVMT50_PRE_ALLOC_96MB      0x03
+#define IGD_DVMT50_PRE_ALLOC_128MB     0x04
+#define IGD_DVMT50_PRE_ALLOC_160MB     0x05
+#define IGD_DVMT50_PRE_ALLOC_192MB     0x06
+#define IGD_DVMT50_PRE_ALLOC_224MB     0x07
+#define IGD_DVMT50_PRE_ALLOC_256MB     0x08
+#define IGD_DVMT50_PRE_ALLOC_288MB     0x09
+#define IGD_DVMT50_PRE_ALLOC_320MB     0x0a
+#define IGD_DVMT50_PRE_ALLOC_352MB     0x0b
+#define IGD_DVMT50_PRE_ALLOC_384MB     0x0c
+#define IGD_DVMT50_PRE_ALLOC_416MB     0x0d
+#define IGD_DVMT50_PRE_ALLOC_448MB     0x0e
+#define IGD_DVMT50_PRE_ALLOC_480MB     0x0f
+#define IGD_DVMT50_PRE_ALLOC_512MB     0x10
+
+#define APERTURE_SIZE_128MB            1
+#define APERTURE_SIZE_256MB            2
+#define APERTURE_SIZE_512MB            3
+
+#define GTT_SIZE_1MB                   1
+#define GTT_SIZE_2MB                   2
+
+#define OS_SELECTION_ANDROID           1
+#define OS_SELECTION_LINUX             4
+
+#define DRAM_SPEED_800MTS              0
+#define DRAM_SPEED_1066MTS             1
+#define DRAM_SPEED_1333MTS             2
+#define DRAM_SPEED_1600MTS             3
+
+#define DRAM_TYPE_DDR3                 0
+#define DRAM_TYPE_DDR3L                        1
+#define DRAM_TYPE_DDR3ECC              2
+#define DRAM_TYPE_LPDDR2               4
+#define DRAM_TYPE_LPDDR3               5
+#define DRAM_TYPE_DDR4                 6
+
+#define DIMM_WIDTH_X8                  0
+#define DIMM_WIDTH_X16                 1
+#define DIMM_WIDTH_X32                 2
+
+#define DIMM_DENSITY_1GBIT             0
+#define DIMM_DENSITY_2GBIT             1
+#define DIMM_DENSITY_4GBIT             2
+#define DIMM_DENSITY_8GBIT             3
+
+#define DIMM_BUS_WIDTH_8BITS           0
+#define DIMM_BUS_WIDTH_16BITS          1
+#define DIMM_BUS_WIDTH_32BITS          2
+#define DIMM_BUS_WIDTH_64BITS          3
+
+#define DIMM_SIDES_1RANKS              0
+#define DIMM_SIDES_2RANKS              1
+
+#define LPE_MODE_DISABLED              0
+#define LPE_MODE_PCI                   1
+#define LPE_MODE_ACPI                  2
+
+#define LPSS_SIO_MODE_ACPI             0
+#define LPSS_SIO_MODE_PCI              1
+
+#define SCC_MODE_ACPI                  0
+#define SCC_MODE_PCI                   1
 
 #endif /* __FSP_CONFIGS_H__ */
index 3c782a86e33e41c01670114f82c53eb06b831ffb..8c07b3747fae0a07e03489715a784d68e60f5b41 100644 (file)
@@ -47,8 +47,8 @@ struct __packed upd_region {
        uint8_t enable_azalia;                  /* Offset 0x002f */
        uint32_t azalia_config_ptr;             /* Offset 0x0030 */
        uint8_t enable_xhci;                    /* Offset 0x0034 */
-       uint8_t enable_lpe;                     /* Offset 0x0035 */
-       uint8_t lpss_sio_enable_pci_mode;       /* Offset 0x0036 */
+       uint8_t lpe_mode;                       /* Offset 0x0035 */
+       uint8_t lpss_sio_mode;                  /* Offset 0x0036 */
        uint8_t enable_dma0;                    /* Offset 0x0037 */
        uint8_t enable_dma1;                    /* Offset 0x0038 */
        uint8_t enable_i2_c0;                   /* Offset 0x0039 */
@@ -64,11 +64,10 @@ struct __packed upd_region {
        uint8_t igd_dvmt50_pre_alloc;           /* Offset 0x0043 */
        uint8_t aperture_size;                  /* Offset 0x0044 */
        uint8_t gtt_size;                       /* Offset 0x0045 */
-       uint32_t serial_debug_port_address;     /* Offset 0x0046 */
-       uint8_t serial_debug_port_type;         /* Offset 0x004a */
+       uint8_t reserved2[5];                   /* Offset 0x0046 */
        uint8_t mrc_debug_msg;                  /* Offset 0x004b */
        uint8_t isp_enable;                     /* Offset 0x004c */
-       uint8_t scc_enable_pci_mode;            /* Offset 0x004d */
+       uint8_t scc_mode;                       /* Offset 0x004d */
        uint8_t igd_render_standby;             /* Offset 0x004e */
        uint8_t txe_uma_enable;                 /* Offset 0x004f */
        uint8_t os_selection;                   /* Offset 0x0050 */
index d55455f2d09a022c0cd000fd22ab30eeb3acb5d4..187fe5fd8cf46f8909ebf0476e1fc84225e3810a 100644 (file)
@@ -8,13 +8,15 @@
 #ifndef _U_BOOT_I386_H_
 #define _U_BOOT_I386_H_        1
 
+struct global_data;
+
 extern char gdt_rom[];
 
 /* cpu/.../cpu.c */
 int arch_cpu_init(void);
 int x86_cpu_init_f(void);
 int cpu_init_f(void);
-void setup_gdt(gd_t *id, u64 *gdt_addr);
+void setup_gdt(struct global_data *id, u64 *gdt_addr);
 /*
  * Setup FSP execution environment GDT to use the one we used in
  * arch/x86/cpu/start16.S and reload the segment registers.
index 623771a39a1f10133a1e7ff88006baf29bfdc422..4c4527eb38cdc45e23472c0e25b8e39b5964021a 100644 (file)
@@ -22,6 +22,7 @@
 
 /* Use the generic board which requires a unified bd_info */
 #include <asm-generic/u-boot.h>
+#include <asm/u-boot-x86.h>
 
 /* For image.h:image_check_target_arch() */
 #define IH_ARCH_DEFAULT IH_ARCH_I386
index a48036121119a27699f6dc2415c017044f4cf4be..ab8340c8715ac411c4ee246d86db69059ce1da27 100644 (file)
@@ -110,10 +110,6 @@ void fsp_init(u32 stack_top, u32 boot_mode, void *nvs_buf)
        struct upd_region *fsp_upd;
 #endif
 
-#ifdef CONFIG_INTERNAL_UART
-       setup_internal_uart(1);
-#endif
-
        fsp_hdr = find_fsp_header();
        if (fsp_hdr == NULL) {
                /* No valid FSP info header was found */
index a462941448b1a8c3348f8fd32c147ed73ed8d52b..79608f4efe861e9fceedfc050e0965a0f7acacf1 100644 (file)
@@ -11,6 +11,8 @@
 #include <netdev.h>
 #endif
 #include <linux/io.h>
+#include <asm/io.h>
+#include <asm/mach-types.h>
 
 #include <faraday/ftsdc010.h>
 #include <faraday/ftsmc020.h>
index fd1965d9f50bc084cd08554a07a5e250c743730d..3a584021ac71dc5225c33f75defa481638fdbff9 100644 (file)
@@ -29,6 +29,7 @@
 #include <asm/gpio.h>
 #include <hwconfig.h>
 #include <bootstage.h>
+#include <asm/mach-types.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
index edf6281797bff412a1918101e4cacf880264cf76..736d65caa16b63df32ef80295881164d6263c1e8 100644 (file)
@@ -14,6 +14,7 @@
 #include "../common/common.h"
 #include <spl.h>
 #include <ns16550.h>
+#include <asm/mach-types.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
index 263bb5426c0d1a7086b9ed28ea7085e7ee0a96ed..2e6e9ef916676e4370f68d98bcf05ce0a4063385 100644 (file)
@@ -12,6 +12,7 @@
 #include <common.h>
 #include <command.h>
 #include <i2c.h>
+#include <asm/mach-types.h>
 #include <asm/arch/cpu.h>
 #include <asm/arch/soc.h>
 #include <asm/arch/mpp.h>
index 17e629622ff733487303611f58730835e1317246..16d694716f78c7901aa14e52a8e53e3309b4ed0a 100644 (file)
@@ -11,6 +11,7 @@
 
 #include <common.h>
 #include <command.h>
+#include <asm/mach-types.h>
 #include <asm/arch/cpu.h>
 #include <asm/arch/soc.h>
 #include <asm/arch/mpp.h>
index 24ee6791a6287dfd1d83eb34a8f417dc4b9aaebb..0ef63b7b7cb5e2b0dbc349f9d3a64d5228385bd9 100644 (file)
@@ -9,6 +9,7 @@
 
 #include <common.h>
 #include <mvmfp.h>
+#include <asm/mach-types.h>
 #include <asm/arch/cpu.h>
 #include <asm/arch/mfp.h>
 #include <asm/arch/armada100.h>
index 16040e19d79f813a1f8b3f6720726de00c8cf0ec..05ce98bb614d3c750aab63863a48928ba07e09b7 100644 (file)
@@ -19,6 +19,7 @@
 #include <asm/arch/armada100.h>
 #include <asm/gpio.h>
 #include <miiphy.h>
+#include <asm/mach-types.h>
 
 #ifdef CONFIG_ARMADA100_FEC
 #include <net.h>
index b0d5f1e10f4ddf46a4f21371a3f5edaaa22af10f..af0c491632e131d77abca6e1b9e79fef1c029c79 100644 (file)
@@ -8,6 +8,7 @@
 
 #include <common.h>
 #include <miiphy.h>
+#include <asm/mach-types.h>
 #include <asm/arch/cpu.h>
 #include <asm/arch/soc.h>
 #include <asm/arch/mpp.h>
index 17a65600e4ea6c55617be3badeb1e45c4ab951e7..f6cffc8cbbc9e24d37d903574f82150fcac91876 100644 (file)
@@ -13,6 +13,7 @@
 
 #include <common.h>
 #include <miiphy.h>
+#include <asm/mach-types.h>
 #include <asm/arch/cpu.h>
 #include <asm/arch/soc.h>
 #include <asm/arch/mpp.h>
index 8907fb58ff80f90f48c14545e7bbb04c93ae705f..c7dfaa276c74d7bfa40975b6a96f0d041c3ff23b 100644 (file)
@@ -8,6 +8,7 @@
 
 #include <common.h>
 #include <miiphy.h>
+#include <asm/mach-types.h>
 #include <asm/arch/cpu.h>
 #include <asm/arch/soc.h>
 #include <asm/arch/mpp.h>
index 83ab1bc32d307dc16b3e5017dcb169d31b32b8d2..f444c1628d9c1ee24e2a26aa7908e60ba7cd67f4 100644 (file)
@@ -15,6 +15,7 @@
 #include <asm/arch/mpp.h>
 #include <asm/arch/cpu.h>
 #include <asm/io.h>
+#include <asm/mach-types.h>
 #include "dockstar.h"
 
 DECLARE_GLOBAL_DATA_PTR;
index 1f4fb924942a4c65a9833fd660eb6847853b90a7..5d0a4242a8ab31bc27ab1c532a6f5804c66dde81 100644 (file)
@@ -14,6 +14,7 @@
 
 #include <common.h>
 #include <miiphy.h>
+#include <asm/mach-types.h>
 #include <asm/arch/soc.h>
 #include <asm/arch/mpp.h>
 #include <asm/arch/cpu.h>
index c5349b900e8c0851753443a8d2dc3fe2bb640a81..18c2895993d032c3282ae3508a481ff030171828 100644 (file)
@@ -11,6 +11,7 @@
 
 #include <common.h>
 #include <miiphy.h>
+#include <asm/mach-types.h>
 #include <asm/arch/soc.h>
 #include <asm/arch/mpp.h>
 #include <asm/arch/cpu.h>
index b46c09d648b1f0073dd62849f8a7efa11b5a353a..0c2f5258e990dcfdf8e336c8ee9a87bbddd971d8 100644 (file)
@@ -8,6 +8,7 @@
 
 #include <common.h>
 #include <miiphy.h>
+#include <asm/setup.h>
 #include <asm/arch/cpu.h>
 #include <asm/arch/soc.h>
 #include <asm/arch/mpp.h>
index b3fa7896c5fb6bb84da38bcc697a57ba464caa1c..13a9c6a0fe10e5b314ca98a0e09a125e98238afc 100644 (file)
@@ -17,6 +17,7 @@
 #include <asm/emif.h>
 #include <twl6030.h>
 #include "kc1.h"
+#include <asm/mach-types.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
index fabb8b1c571c83e06358c904cbe0269fd0903ec9..c3bafd453ebea8956631550bfbd2d8389a4dccd4 100644 (file)
@@ -24,6 +24,7 @@
 #include <dm/platform_data/serial_pl01x.h>
 #include "arm-ebi.h"
 #include "integrator-sc.h"
+#include <asm/mach-types.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
index 458f1d81483489b63e68189cafbaa55978a97e36..89ab8f7a5974bbca1d77d3413a20f164f42a3d49 100644 (file)
@@ -21,6 +21,7 @@
 #include <errno.h>
 #include <netdev.h>
 #include <asm/io.h>
+#include <asm/mach-types.h>
 #include <asm/arch/systimer.h>
 #include <asm/arch/sysctrl.h>
 #include <asm/arch/wdt.h>
index 98d76a6fa71a2d1f8aee9840febd6b1937cdb0d6..36f147b44de0f5b46de364877e18f7171e1e4b8f 100644 (file)
@@ -12,6 +12,7 @@
 
 #include <common.h>
 #include <netdev.h>
+#include <asm/mach-types.h>
 #include <asm/arch/hardware.h>
 #include <asm/arch/at91_pio.h>
 #include <asm/arch/at91_common.h>
index 6398bcbc9ea8b9adef2c0fab8aa0ca7043f2df60..b4acb742b3b2fdd1fc1cab6ddf469ef5d760a324 100644 (file)
@@ -21,6 +21,7 @@
 #include <net.h>
 #include <netdev.h>
 #endif
+#include <asm/mach-types.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
index 3de978311de4502e4e599dcad882f0bc552d5d9d..b37e9d3c7ad0be09ba483c45779a8fd15a10a924 100644 (file)
@@ -20,6 +20,7 @@
 #include <asm/arch/hardware.h>
 #include <lcd.h>
 #include <atmel_lcdc.h>
+#include <asm/mach-types.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
index d3bc5c69d4f2d369f8450ec67adc6f6384f7714c..8e377593ef085d29b311e9e56fd026647fb4f7df 100644 (file)
@@ -18,6 +18,7 @@
 #include <lcd.h>
 #include <linux/mtd/nand.h>
 #include <atmel_lcdc.h>
+#include <asm/mach-types.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
index 0b603ed13a7f140d97ec97d8776a330f551acaa1..7966269ff350d8f7fdd2deea756519535ed4e14d 100644 (file)
@@ -9,6 +9,7 @@
 #include <common.h>
 #include <debug_uart.h>
 #include <asm/io.h>
+#include <asm/mach-types.h>
 #include <asm/arch/at91sam9rl.h>
 #include <asm/arch/at91sam9rl_matrix.h>
 #include <asm/arch/at91sam9_smc.h>
index 81c2aad1a52df0aa68c422618a9dfa5dff0569e7..1e4a4a2acf0256ef1e77c3206191d9884b054d5e 100644 (file)
@@ -19,6 +19,7 @@
 #include <nand.h>
 #include <version.h>
 #endif
+#include <asm/mach-types.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
index 08e79bd7ac48a2ef78bd7f6ff0871dc085330c4b..2215c29c9c625c1ffddb4508b86ddc8b740eff37 100644 (file)
@@ -17,6 +17,7 @@
 #include <common.h>
 #include <asm/gpio.h>
 #include <asm/io.h>
+#include <asm/setup.h>
 #include <asm/arch/imx-regs.h>
 #include <asm/arch/iomux-mx28.h>
 #include <asm/arch/clock.h>
index 08b1401372c9fb2034db9e2f47d44b9bc3a88c56..e82c6918414088fbc53691f09eedf05ea1ee1295 100644 (file)
@@ -21,6 +21,7 @@
 #include <spi.h>
 #include <asm/gpio.h>
 #include <asm/io.h>
+#include <asm/mach-types.h>
 #include <asm/arch/at91sam9g45_matrix.h>
 #include <asm/arch/at91sam9_smc.h>
 #include <asm/arch/at91_common.h>
index 2d1a89e102afd347dbfeb23a9ecf1572dfbf04d1..7e9da4e7b70c658605d1a41c095bc8f0c85393cd 100644 (file)
@@ -12,6 +12,7 @@
 #include <dm.h>
 #include <asm/io.h>
 #include <asm/gpio.h>
+#include <asm/mach-types.h>
 #include <asm/arch/at91sam9260_matrix.h>
 #include <asm/arch/at91sam9_smc.h>
 #include <asm/arch/at91_common.h>
index 720b490f2b7ba9e114e8f7a7b0a7d9cc3d0b7b09..02e2896fa7e0a3ca089bdddf804efe79dfe1fc7f 100644 (file)
@@ -18,6 +18,7 @@
 #include <common.h>
 #include <netdev.h>
 #include <asm/io.h>
+#include <asm/mach-types.h>
 #include <asm/arch/ep93xx.h>
 
 DECLARE_GLOBAL_DATA_PTR;
index 855678fd5f45da4a7d3a07c8ef0ecaf3e000a492..de2dadc517593856bcda5a3b2a2da6ec94e92645 100644 (file)
@@ -19,7 +19,12 @@ static const struct dmm_lisa_map_regs cl_som_am57x_lisa_regs = {
 
 void emif_get_dmm_regs(const struct dmm_lisa_map_regs **dmm_lisa_regs)
 {
+       /* Disable SDRAM controller EMIF2 for single core SOC */
        *dmm_lisa_regs = &cl_som_am57x_lisa_regs;
+       if (omap_revision() == DRA722_ES1_0) {
+               ((struct dmm_lisa_map_regs *) *dmm_lisa_regs)->dmm_lisa_map_3 =
+                 0x80640100;
+       }
 }
 
 static const struct emif_regs cl_som_am57x_emif1_ddr3_532mhz_emif_regs = {
index b25d9a20b40321e2c9e91f7c3627e6076c6f3d1c..bf2ac7bd7f9c46446e2405e531e23ebdf4058576 100644 (file)
@@ -9,6 +9,7 @@
 #include <common.h>
 #include <asm/bootm.h>
 #include <asm/gpio.h>
+#include <asm/setup.h>
 
 #include "common.h"
 #include "eeprom.h"
index b5f1aa61cb8dd135ee10165c847fa555f9908a9e..bb4c9e9740ce574dd9bd85978ab270bdf69266f2 100644 (file)
@@ -11,6 +11,7 @@
 #include <i2c.h>
 #include <eeprom_layout.h>
 #include <eeprom_field.h>
+#include <asm/setup.h>
 #include <linux/kernel.h>
 #include "eeprom.h"
 
index 9e17eb865d0a8280d67fb13be860134eaff88556..11ea52f24048d743a0e09fe58e08e7635f329c65 100644 (file)
@@ -23,6 +23,7 @@
 #include <asm/arch/davinci_misc.h>
 #include <linux/errno.h>
 #include <hwconfig.h>
+#include <asm/mach-types.h>
 
 #ifdef CONFIG_MMC_DAVINCI
 #include <mmc.h>
index d94128597760f3e38e6dd7cb5b738ba1089f0d62..52bb7363a7e279903242ca33c49699ee8380336f 100644 (file)
@@ -19,6 +19,7 @@
 #include <asm/ti-common/davinci_nand.h>
 #include <asm/io.h>
 #include <linux/errno.h>
+#include <asm/mach-types.h>
 #include <asm/arch/davinci_misc.h>
 #ifdef CONFIG_MMC_DAVINCI
 #include <mmc.h>
index 6edfa17a9119f5803d09f6c9e8bc2759a10c6873..2a187f1900a60c23bceca917d06047e8f01a14a5 100644 (file)
@@ -18,6 +18,7 @@
 #include <i2c.h>
 #include <net.h>
 #include <netdev.h>
+#include <asm/mach-types.h>
 #include <asm/arch/hardware.h>
 #include <asm/ti-common/davinci_nand.h>
 #include <asm/arch/emac_defs.h>
index 19b673e6d216a289d5d4d8075331e5fee9c61039..e4bda7909ac879349d8695cfd8556b30eb842954 100644 (file)
@@ -13,6 +13,8 @@
 #include <common.h>
 #include <asm/io.h>
 #include <asm/gpio.h>
+#include <asm/mach-types.h>
+#include <asm/setup.h>
 #include <asm/arch/at91sam9_smc.h>
 #include <asm/arch/at91_common.h>
 #include <asm/arch/at91_pmc.h>
index 81c921122e8f65053e7e581426fc8083a62b44e1..1c2287d22a352d023bd28ef7cec12005bc62b10f 100644 (file)
@@ -39,7 +39,10 @@ static void enable_devices_ns_access(struct csu_ns_dev *ns_dev, uint32_t num)
 
 void enable_layerscape_ns_access(void)
 {
-       enable_devices_ns_access(ns_dev, ARRAY_SIZE(ns_dev));
+#ifdef CONFIG_ARM64
+       if (current_el() == 3)
+#endif
+               enable_devices_ns_access(ns_dev, ARRAY_SIZE(ns_dev));
 }
 
 void set_pcie_ns_access(int pcie, u16 val)
index d16a69fc981fcc6fa8fe11e88fc5ad7c39d79381..2ee8749f36432faa49d4526877712c062494649c 100644 (file)
@@ -8,6 +8,7 @@
 #include <fsl_ddr_sdram.h>
 #include <fsl_ddr_dimm_params.h>
 #include <asm/io.h>
+#include <asm/arch/clock.h>
 #include "ddr.h"
 
 DECLARE_GLOBAL_DATA_PTR;
index b22d3784dce60dd2af32898bc664eb3e98c6e00a..f219a77e9814c8fd14c4e84b4e529c2c7a71f31b 100644 (file)
@@ -10,6 +10,7 @@
 #ifdef CONFIG_FSL_DEEP_SLEEP
 #include <fsl_sleep.h>
 #endif
+#include <asm/arch/clock.h>
 #include "ddr.h"
 
 DECLARE_GLOBAL_DATA_PTR;
index 36d27ecfae79295ae13c58661062df0e3c330da4..354b864eb97a10ddbd599b2c603976e2b54a590c 100644 (file)
@@ -11,6 +11,7 @@
 #ifdef CONFIG_FSL_DEEP_SLEEP
 #include <fsl_sleep.h>
 #endif
+#include <asm/arch/clock.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
index 5fcfa0f701882f5a57c5357aec4021c84defa660..e1858d606066b99de1501c8ab2948a830724e04e 100644 (file)
@@ -10,6 +10,7 @@
 #ifdef CONFIG_FSL_DEEP_SLEEP
 #include <fsl_sleep.h>
 #endif
+#include <asm/arch/clock.h>
 #include "ddr.h"
 
 DECLARE_GLOBAL_DATA_PTR;
index ae5046cab6940563d4bf452701880d70dac9c38b..fb4f6abe0b34b50da96690a34093bf1eae8191ce 100644 (file)
@@ -11,6 +11,7 @@
 #ifdef CONFIG_FSL_DEEP_SLEEP
 #include <fsl_sleep.h>
 #endif
+#include <asm/arch/clock.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
index 9d176d385128bd37c68f059fdbb2bf4343cf7947..025e5aa8d08afe0c3815e722398b3d49db15af6e 100644 (file)
@@ -8,6 +8,7 @@
 #include <fsl_ddr_sdram.h>
 #include <fsl_ddr_dimm_params.h>
 #include <asm/arch/soc.h>
+#include <asm/arch/clock.h>
 #include "ddr.h"
 
 DECLARE_GLOBAL_DATA_PTR;
index 9e7701d81ff517edddacf08e046b204e62393bbe..41417e9dc6914aed4b9a2f1b12b3f696702eec35 100644 (file)
@@ -64,13 +64,13 @@ int board_eth_init(bd_t *bis)
        error = smc91111_initialize(0, CONFIG_SMC91111_BASE);
 #endif
 
-#ifdef CONFIG_FSL_MC_ENET
+#if defined(CONFIG_FSL_MC_ENET) && !defined(CONFIG_SPL_BUILD)
        error = cpu_eth_init(bis);
 #endif
        return error;
 }
 
-#ifdef CONFIG_FSL_MC_ENET
+#if defined(CONFIG_FSL_MC_ENET) && !defined(CONFIG_SPL_BUILD)
 void fdt_fixup_board_enet(void *fdt)
 {
        int offset;
@@ -128,10 +128,16 @@ int ft_board_setup(void *blob, bd_t *bd)
 
        fdt_fixup_memory_banks(blob, base, size, 2);
 
-#ifdef CONFIG_FSL_MC_ENET
+#if defined(CONFIG_FSL_MC_ENET) && !defined(CONFIG_SPL_BUILD)
        fdt_fixup_board_enet(blob);
 #endif
 
        return 0;
 }
 #endif
+
+#if defined(CONFIG_RESET_PHY_R)
+void reset_phy(void)
+{
+}
+#endif
index 79877d7774244e21d250029f4c1e6793592deb9f..62c8fac09c694f40e9fb066716680f5fd6d41495 100644 (file)
@@ -7,6 +7,7 @@ F:      include/configs/ls2080aqds.h
 F:     configs/ls2080aqds_defconfig
 F:     configs/ls2080aqds_nand_defconfig
 F:     configs/ls2080aqds_qspi_defconfig
+F:     configs/ls2080aqds_sdcard_defconfig
 
 LS2080A_SECURE_BOOT BOARD
 M:     Saksham Jain <saksham.jain@nxp.freescale.com>
index cad860eac2008fe93055a6caa006364b2486fe61..8e31e9e41e3e18744d93b6778924b10b9aa3a41b 100644 (file)
@@ -102,6 +102,19 @@ DPAA2 DPL                  0x00D00000
 DPAA2 DPC                      0x00E00000
 Kernel.itb                     0x01000000
 
+Memory map for SD boot
+-------------------------
+Image                          Flash Offset    SD Card
+                                               Start Block No.
+RCW+PBI                                0x00000000      0x00008
+Boot firmware (U-Boot)         0x00100000      0x00800
+Boot firmware Environment      0x00300000      0x01800
+PPA firmware                   0x00400000      0x02000
+DPAA2 MC                       0x00A00000      0x05000
+DPAA2 DPL                      0x00D00000      0x06800
+DPAA2 DPC                      0x00E00000      0x07000
+Kernel.itb                     0x01000000      0x08000
+
 Environment Variables
 ---------------------
 - mcboottimeout: MC boot timeout in milliseconds. If this variable is not defined
index 22a2676a95ad6b17c92433dbf48e1667f9aa477b..20b8c1fef78e22de9b1e7dbaab2de725b021a171 100644 (file)
@@ -8,6 +8,7 @@
 #include <fsl_ddr_sdram.h>
 #include <fsl_ddr_dimm_params.h>
 #include <asm/arch/soc.h>
+#include <asm/arch/clock.h>
 #include "ddr.h"
 
 DECLARE_GLOBAL_DATA_PTR;
index 59361e9111f5382b528911a97319a712c8b65bed..defcac52634fac2be3f595b935673df1b17560f5 100644 (file)
@@ -14,6 +14,7 @@
 #include <fm_eth.h>
 #include <i2c.h>
 #include <miiphy.h>
+#include <fsl-mc/fsl_mc.h>
 #include <fsl-mc/ldpaa_wriop.h>
 
 #include "../common/qixis.h"
@@ -22,7 +23,7 @@
 
 #define MC_BOOT_ENV_VAR "mcinitcmd"
 
-#ifdef CONFIG_FSL_MC_ENET
+#if defined(CONFIG_FSL_MC_ENET) && !defined(CONFIG_SPL_BUILD)
  /* - In LS2080A there are only 16 SERDES lanes, spread across 2 SERDES banks.
  *   Bank 1 -> Lanes A, B, C, D, E, F, G, H
  *   Bank 2 -> Lanes A,B, C, D, E, F, G, H
@@ -834,8 +835,7 @@ void ls2080a_handle_phy_interface_xsgmii(int i)
 int board_eth_init(bd_t *bis)
 {
        int error;
-       char *mc_boot_env_var;
-#ifdef CONFIG_FSL_MC_ENET
+#if defined(CONFIG_FSL_MC_ENET) && !defined(CONFIG_SPL_BUILD)
        struct ccsr_gur __iomem *gur = (void *)CONFIG_SYS_FSL_GUTS_ADDR;
        int serdes1_prtcl = (in_le32(&gur->rcwsr[28]) &
                                FSL_CHASSIS3_RCWSR28_SRDS1_PRTCL_MASK)
@@ -902,9 +902,6 @@ int board_eth_init(bd_t *bis)
                }
        }
 
-       mc_boot_env_var = getenv(MC_BOOT_ENV_VAR);
-       if (mc_boot_env_var)
-               run_command_list(mc_boot_env_var, -1, 0);
        error = cpu_eth_init(bis);
 
        if (hwconfig_f("xqsgmii", env_hwconfig)) {
@@ -919,6 +916,9 @@ int board_eth_init(bd_t *bis)
        return error;
 }
 
-#ifdef CONFIG_FSL_MC_ENET
-
-#endif
+#if defined(CONFIG_RESET_PHY_R)
+void reset_phy(void)
+{
+       mc_env_boot();
+}
+#endif /* CONFIG_RESET_PHY_R */
index 6da9c6cfe8313d4445d6153cb266f6f844c1fa98..f36fb9810bd2d7a365fd540a24a3560a63a73f90 100644 (file)
@@ -280,7 +280,7 @@ int arch_misc_init(void)
 }
 #endif
 
-#ifdef CONFIG_FSL_MC_ENET
+#if defined(CONFIG_FSL_MC_ENET) && !defined(CONFIG_SPL_BUILD)
 void fdt_fixup_board_enet(void *fdt)
 {
        int offset;
@@ -336,7 +336,7 @@ int ft_board_setup(void *blob, bd_t *bd)
 
        fsl_fdt_fixup_dr_usb(blob, bd);
 
-#ifdef CONFIG_FSL_MC_ENET
+#if defined(CONFIG_FSL_MC_ENET) && !defined(CONFIG_SPL_BUILD)
        fdt_fixup_board_enet(blob);
 #endif
 
index 7002dfb236f0b6328020046475547cc02b3c11bd..01f7d82fb6b08adbfded8f11f65ac18009c0e389 100644 (file)
@@ -8,6 +8,7 @@
 #include <fsl_ddr_sdram.h>
 #include <fsl_ddr_dimm_params.h>
 #include <asm/arch/soc.h>
+#include <asm/arch/clock.h>
 #include "ddr.h"
 
 DECLARE_GLOBAL_DATA_PTR;
index ba584c8a76874684ad9a9db1ce73af4f2f382631..32677f7ae1b466f4d6e3f65b615d3f3e6c51c235 100644 (file)
 #include <asm/io.h>
 #include <exports.h>
 #include <asm/arch/fsl_serdes.h>
+#include <fsl-mc/fsl_mc.h>
 #include <fsl-mc/ldpaa_wriop.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
-#define MC_BOOT_ENV_VAR "mcinitcmd"
 int board_eth_init(bd_t *bis)
 {
 #if defined(CONFIG_FSL_MC_ENET)
-       char *mc_boot_env_var;
        int i, interface;
        struct memac_mdio_info mdio_info;
        struct mii_dev *dev;
@@ -98,11 +97,8 @@ int board_eth_init(bd_t *bis)
                }
        }
 
-       mc_boot_env_var = getenv(MC_BOOT_ENV_VAR);
-       if (mc_boot_env_var)
-               run_command_list(mc_boot_env_var, -1, 0);
        cpu_eth_init(bis);
-#endif /* CONFIG_FMAN_ENET */
+#endif /* CONFIG_FSL_MC_ENET */
 
 #ifdef CONFIG_PHY_AQUANTIA
        /*
@@ -118,3 +114,10 @@ int board_eth_init(bd_t *bis)
 #endif
        return pci_eth_init(bis);
 }
+
+#if defined(CONFIG_RESET_PHY_R)
+void reset_phy(void)
+{
+       mc_env_boot();
+}
+#endif /* CONFIG_RESET_PHY_R */
index 123fb11f42831db24a0914117a35dc38f0eaddcc..ea0bd8f30a316dd7f4b73645196e4737028ef4b8 100644 (file)
@@ -24,6 +24,7 @@
 #include <asm/gpio.h>
 #include <asm/arch/sys_proto.h>
 #include <netdev.h>
+#include <asm/mach-types.h>
 
 #ifndef CONFIG_BOARD_LATE_INIT
 #error "CONFIG_BOARD_LATE_INIT must be set for this board"
index a68ec69f1886d05e2739cfe65c373d7fa1bc9a71..6b950eeb218a288b29f2d5503a6af3e02f651781 100644 (file)
@@ -19,6 +19,7 @@
 #include <asm/imx-common/spi.h>
 #include <asm/imx-common/video.h>
 #include <asm/io.h>
+#include <asm/setup.h>
 #include <dm.h>
 #include <dm/platform_data/serial_mxc.h>
 #include <hwconfig.h>
index fefcde87aec1569c82b78280e3801d9123eadc8f..849224efda4385abcbc1327231bf09b7bc365735 100644 (file)
@@ -14,6 +14,7 @@
 #include <asm/arch/clock.h>
 #include <asm/arch/gpio.h>
 #include <asm/gpio.h>
+#include <asm/mach-types.h>
 
 #include "duovero_mux_data.h"
 
index 01f8e67be1456325358ded26ed1757be12cbb33c..2a2b7979f1ca06bc6654bfcaae0e6385ea86707e 100644 (file)
@@ -11,6 +11,7 @@
 #include <asm/arch/pxa-regs.h>
 #include <asm/io.h>
 #include <usb.h>
+#include <asm/mach-types.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
index 0f6aab717c4ea80f7d741c7a32fa713282a26f59..4c2021f5097ab797b1024649f59d9477f2f0b2aa 100644 (file)
@@ -56,7 +56,7 @@ Compile U-Boot
 Compile ARM Trusted Firmware (ATF)
 ==================================
 
-  > cd ~/hikey/src/atf
+  > cd ~/hikey/src/arm-trusted-firmware
   > make CROSS_COMPILE=aarch64-linux-gnu- all fip \
     BL30=~/hikey/bin/mcuimage.bin \
     BL33=~/hikey/bin/u-boot.bin DEBUG=1 PLAT=hikey
@@ -67,10 +67,10 @@ Copy resulting binaries
 
 Compile l-loader
 ===============
-  > cd ~/hikey/l-loader
+  > cd ~/hikey/src/l-loader
   > make BL1=~/hikey/bin/bl1.bin all
   > cp *.img ~/hikey/bin
-  > cp l-loader.bin ~/hikey.bin
+  > cp l-loader.bin ~/hikey/bin
 
 These instructions are adapted from
 https://github.com/96boards/documentation/wiki/HiKeyUEFI
@@ -82,7 +82,7 @@ FLASHING
 the hisi-idt.py utility.
 
 The command below assumes HiKey enumerated as the first USB serial port
-  > sudo ~/hikey/burn_boot/hisi-idt.py -d /dev/ttyUSB0 --img1=~/hikey/bin/l-loader.bin
+  > sudo ~/hikey/src/burn-boot/hisi-idt.py -d /dev/ttyUSB0 --img1=~/hikey/bin/l-loader.bin
 
 2. Once LED 0 comes on solid, HiKey board should be detected as a fastboot device by plugging a USB A to mini B
    cable from your PC to the USB OTG port of HiKey (on some boards I've found this to be unreliable).
index 3f45e4e4b81df6c0c0294a481fbee41e87200f03..653246615fd97fd1d61bcc9e1ee9310bdf3ba009 100644 (file)
@@ -11,6 +11,7 @@
 #include <netdev.h>
 #include <asm/arch/clock.h>
 #include <asm/arch/imx-regs.h>
+#include <asm/mach-types.h>
 #include <asm/arch/sys_proto.h>
 
 DECLARE_GLOBAL_DATA_PTR;
index 0ad33eaeae05b9885e426c1895b692293b5cee89..26534394aba5ced9514f1dab5ee323f13f6a459d 100644 (file)
@@ -25,6 +25,8 @@
 #include <asm/arch/davinci_misc.h>
 #include <linux/errno.h>
 #include <hwconfig.h>
+#include <asm/mach-types.h>
+#include <asm/setup.h>
 
 #ifdef CONFIG_MMC_DAVINCI
 #include <mmc.h>
index 5eb2ad77ca98a7acec2c49663566a65a11d17ebd..09ec24766333293bac0ea6f7c54414ee8f099b2a 100644 (file)
@@ -27,6 +27,7 @@
 #include <net.h>
 #endif
 #include <netdev.h>
+#include <asm/mach-types.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
index b56bc529d1a6963e2739fb3ed281c6415a873f96..0d5eec9dd82dafcd85bb980c872113c3e80304dd 100644 (file)
@@ -7,6 +7,7 @@
 
 #include <common.h>
 #include <asm/io.h>
+#include <asm/mach-types.h>
 #include <asm/arch/tegra.h>
 #include <asm/arch-tegra/board.h>
 #include <asm/arch/clock.h>
index f6f6792d0950855df0da86839f74225e45b4b1bf..5656e2d17f0287c2456393a4d832dac3c8d9fa24 100644 (file)
@@ -18,6 +18,7 @@
 #include <asm/arch/mux.h>
 #include <asm/arch/sys_proto.h>
 #include <asm/gpio.h>
+#include <asm/mach-types.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
index 79073d8aaaf15191ac430d6dbcb9397fed589712..f60dddac7b8fa315763d035c1b4d13196f607189 100644 (file)
@@ -26,6 +26,7 @@
 #include <net.h>
 #endif
 #include <netdev.h>
+#include <asm/mach-types.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
index accf16f1519501f54162480b8fc789aecbed5075..146913629514ffbb31ec91c81dd5315b432217bf 100644 (file)
@@ -25,6 +25,7 @@
 #include <net.h>
 #endif
 #include <netdev.h>
+#include <asm/mach-types.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
index c1225800a9bc3e91ac48f4474b1ed93ba104c1e3..e2620e3c0484bbe6823dd1dd888557a38475bd68 100644 (file)
@@ -25,6 +25,7 @@
 #include <net.h>
 #endif
 #include <netdev.h>
+#include <asm/mach-types.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
index 12593830e99ebea95bc3f12df5efcc9940a7e991..d0247ac2571ae864254975110d59712197b6bb68 100644 (file)
@@ -17,6 +17,7 @@
 #include <samsung/misc.h>
 #include <usb.h>
 #include <usb_mass_storage.h>
+#include <asm/mach-types.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
index 79e127d99abff27031b82a691d24778a1810c3e0..5d23844458a0dc9ba15c9668c8e0e964ed01cc5b 100644 (file)
@@ -11,6 +11,7 @@
 #include <asm/io.h>
 #include <asm/arch/sromc.h>
 #include <netdev.h>
+#include <asm/mach-types.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
index feb8a341bef3ee9f03c7328aa4a55c6b5e7839c4..cc6eaf7ad0fe33e9b1b5b8bdde64d0d1250db77c 100644 (file)
@@ -23,6 +23,7 @@
 #include <libtizen.h>
 #include <samsung/misc.h>
 #include <usb_mass_storage.h>
+#include <asm/mach-types.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
index 9cafcea53a3c7ea87d07cc8829710164e4f6af86..b9672274117d38574ca988e61504cfa94b920577 100644 (file)
@@ -28,6 +28,7 @@
 #include <miiphy.h>
 #include <cpsw.h>
 #include <watchdog.h>
+#include <asm/mach-types.h>
 #include "../common/factoryset.h"
 
 DECLARE_GLOBAL_DATA_PTR;
index 396b5bdf60ab00087106b500a8786c6eda5594ed..8f8132a31a7d396d7263eb87faf8c1710fb24b58 100644 (file)
@@ -11,6 +11,7 @@
 #include <nand.h>
 #include <asm/io.h>
 #include <linux/mtd/fsmc_nand.h>
+#include <asm/mach-types.h>
 #include <asm/arch/hardware.h>
 #include <asm/arch/spr_defs.h>
 #include <asm/arch/spr_misc.h>
index 6f39ef1b407af9ffa5d2fb66f655d80f762d63b4..d07dda34e900e54747dcec52242e39e5ce3db074 100644 (file)
@@ -12,6 +12,7 @@
 #include <nand.h>
 #include <asm/io.h>
 #include <linux/mtd/fsmc_nand.h>
+#include <asm/mach-types.h>
 #include <asm/arch/hardware.h>
 #include <asm/arch/spr_defs.h>
 #include <asm/arch/spr_misc.h>
index 52196afd1745084dea121a38cd3a1dfefa75e20a..66073f3715c7fa874a6689308f6f12f5b574b72f 100644 (file)
@@ -12,6 +12,7 @@
 #include <nand.h>
 #include <asm/io.h>
 #include <linux/mtd/fsmc_nand.h>
+#include <asm/mach-types.h>
 #include <asm/arch/hardware.h>
 #include <asm/arch/spr_defs.h>
 #include <asm/arch/spr_misc.h>
index 858a9cae76ab5eb9874b530a0b632f3f04f9e777..2a54b8b3234b1cf6a4baa4d7ec0250ce8cc112d1 100644 (file)
@@ -11,6 +11,7 @@
 #include <nand.h>
 #include <asm/io.h>
 #include <linux/mtd/fsmc_nand.h>
+#include <asm/mach-types.h>
 #include <asm/arch/hardware.h>
 #include <asm/arch/spr_defs.h>
 #include <asm/arch/spr_misc.h>
index f8e9fddb0fb2849ac32b20c4cc40ce856ebe78c7..2c34ea1ad1b9be11c9c97b11e4a1726b380c2c5d 100644 (file)
@@ -14,6 +14,7 @@
 #include <phy.h>
 #include <rtc.h>
 #include <asm/io.h>
+#include <asm/mach-types.h>
 #include <asm/arch/hardware.h>
 #include <asm/arch/spr_defs.h>
 #include <asm/arch/spr_misc.h>
index a512a201d0183923cc72fc289711fb4253a9cd50..0f1290acc02ea0a3b39cec8ec858133aa8e6db60 100644 (file)
@@ -114,6 +114,11 @@ S: Maintained
 F:     configs/Bananapi_M2_Ultra_defconfig
 F:     arch/arm/dts/sun8i-r40-bananapi-m2-ultra.dts
 
+BANANAPI M64
+M:     Jagan Teki <jagan@amarulasolutions.com>
+S:     Maintained
+F:     configs/bananapi_m64_defconfig
+
 COLOMBUS BOARD
 M:     Maxime Ripard <maxime.ripard@free-electrons.com>
 S:     Maintained
@@ -237,6 +242,11 @@ M: Siarhei Siamashka <siarhei.siamashka@gmail.com>
 S:     Maintained
 F:     configs/MSI_Primo81_defconfig
 
+NANOPI-M1 BOARD
+M:     Mylène Josserand <mylene.josserand@free-electrons.com>
+S:     Maintained
+F:     configs/nanopi_m1_defconfig
+
 NANOPI-NEO BOARD
 M:     Jelle van der Waa <jelle@vdwaa.nl>
 S:     Maintained
@@ -262,6 +272,11 @@ M: Andre Przywara <andre.przywara@arm.com>
 S:     Maintained
 F:     configs/orangepi_pc2_defconfig
 
+ORANGEPI PRIME BOARD
+M:     Jagan Teki <jagan@amarulasolutions.com>
+S:     Maintained
+F:     configs/orangepi_prime_defconfig
+
 PINE64 BOARDS
 M:     Andre Przywara <andre.przywara@arm.com>
 S:     Maintained
index f79bd5c62c193b3034e69eb2d9463e1689c2e116..800f412b383ddf9ac90972e50a684c534d40fea4 100644 (file)
@@ -33,6 +33,7 @@
 #include <nand.h>
 #include <net.h>
 #include <sy8106a.h>
+#include <asm/setup.h>
 
 #if defined CONFIG_VIDEO_LCD_PANEL_I2C && !(defined CONFIG_SPL_BUILD)
 /* So that we can use pin names in Kconfig and sunxi_name_to_gpio() */
index 3be697a6eaadd4c8dd85f4ac90ad2df5586d41c3..6d9ee206c7e396e947663bea484ea8bea90c4d96 100644 (file)
@@ -343,6 +343,54 @@ struct vcores_data am572x_idk_volts = {
        .iva.abb_tx_done_mask   = OMAP_ABB_IVA_TXDONE_MASK,
 };
 
+struct vcores_data am571x_idk_volts = {
+       .mpu.value[OPP_NOM]     = VDD_MPU_DRA7_NOM,
+       .mpu.efuse.reg[OPP_NOM] = STD_FUSE_OPP_VMIN_MPU_NOM,
+       .mpu.efuse.reg_bits     = DRA752_EFUSE_REGBITS,
+       .mpu.addr               = TPS659038_REG_ADDR_SMPS12,
+       .mpu.pmic               = &tps659038,
+       .mpu.abb_tx_done_mask = OMAP_ABB_MPU_TXDONE_MASK,
+
+       .eve.value[OPP_NOM]     = VDD_EVE_DRA7_NOM,
+       .eve.value[OPP_OD]      = VDD_EVE_DRA7_OD,
+       .eve.value[OPP_HIGH]    = VDD_EVE_DRA7_HIGH,
+       .eve.efuse.reg[OPP_NOM] = STD_FUSE_OPP_VMIN_DSPEVE_NOM,
+       .eve.efuse.reg[OPP_OD]  = STD_FUSE_OPP_VMIN_DSPEVE_OD,
+       .eve.efuse.reg[OPP_HIGH]        = STD_FUSE_OPP_VMIN_DSPEVE_HIGH,
+       .eve.efuse.reg_bits     = DRA752_EFUSE_REGBITS,
+       .eve.addr               = TPS659038_REG_ADDR_SMPS45,
+       .eve.pmic               = &tps659038,
+       .eve.abb_tx_done_mask   = OMAP_ABB_EVE_TXDONE_MASK,
+
+       .gpu.value[OPP_NOM]     = VDD_GPU_DRA7_NOM,
+       .gpu.value[OPP_OD]      = VDD_GPU_DRA7_OD,
+       .gpu.value[OPP_HIGH]    = VDD_GPU_DRA7_HIGH,
+       .gpu.efuse.reg[OPP_NOM] = STD_FUSE_OPP_VMIN_GPU_NOM,
+       .gpu.efuse.reg[OPP_OD]  = STD_FUSE_OPP_VMIN_GPU_OD,
+       .gpu.efuse.reg[OPP_HIGH]        = STD_FUSE_OPP_VMIN_GPU_HIGH,
+       .gpu.efuse.reg_bits     = DRA752_EFUSE_REGBITS,
+       .gpu.addr               = TPS659038_REG_ADDR_SMPS6,
+       .gpu.pmic               = &tps659038,
+       .gpu.abb_tx_done_mask   = OMAP_ABB_GPU_TXDONE_MASK,
+
+       .core.value[OPP_NOM]    = VDD_CORE_DRA7_NOM,
+       .core.efuse.reg[OPP_NOM]        = STD_FUSE_OPP_VMIN_CORE_NOM,
+       .core.efuse.reg_bits    = DRA752_EFUSE_REGBITS,
+       .core.addr              = TPS659038_REG_ADDR_SMPS7,
+       .core.pmic              = &tps659038,
+
+       .iva.value[OPP_NOM]     = VDD_IVA_DRA7_NOM,
+       .iva.value[OPP_OD]      = VDD_IVA_DRA7_OD,
+       .iva.value[OPP_HIGH]    = VDD_IVA_DRA7_HIGH,
+       .iva.efuse.reg[OPP_NOM] = STD_FUSE_OPP_VMIN_IVA_NOM,
+       .iva.efuse.reg[OPP_OD]  = STD_FUSE_OPP_VMIN_IVA_OD,
+       .iva.efuse.reg[OPP_HIGH]        = STD_FUSE_OPP_VMIN_IVA_HIGH,
+       .iva.efuse.reg_bits     = DRA752_EFUSE_REGBITS,
+       .iva.addr               = TPS659038_REG_ADDR_SMPS45,
+       .iva.pmic               = &tps659038,
+       .iva.abb_tx_done_mask   = OMAP_ABB_IVA_TXDONE_MASK,
+};
+
 int get_voltrail_opp(int rail_offset)
 {
        int opp;
@@ -452,6 +500,8 @@ void vcores_init(void)
 {
        if (board_is_am572x_idk())
                *omap_vcores = &am572x_idk_volts;
+       else if (board_is_am571x_idk())
+               *omap_vcores = &am571x_idk_volts;
        else
                *omap_vcores = &beagle_x15_volts;
 }
index e35afa0e512d8a160cff05eb014d0b3da9a590f6..c21eb8c2d2e39c9d17c8ec3616a1faa8c0fbf413 100644 (file)
@@ -27,6 +27,7 @@ config TI_COMMON_CMD_OPTIONS
        imply CMD_EXT4_WRITE
        imply CMD_FASTBOOT if FASTBOOT
        imply CMD_FAT
+       imply FAT_WRITE if CMD_FAT
        imply CMD_FS_GENERIC
        imply CMD_GPIO
        imply CMD_GPT
index 21aec8f065627dd91a0b3b82a0e790cb233905b2..f0bd31d6f7521c399b9b9e46b0837e62f68b7783 100644 (file)
@@ -79,29 +79,29 @@ static struct pll_init_data main_pll_config[MAX_SYSCLK][NUM_SPDS] = {
                [SPD400]        = {MAIN_PLL, 125, 3, 2},
                [SPD600]        = {MAIN_PLL, 125, 2, 2},
                [SPD800]        = {MAIN_PLL, 250, 3, 2},
-               [SPD900]        = {TETRIS_PLL, 187, 2, 2},
-               [SPD1000]       = {TETRIS_PLL, 104, 1, 2},
+               [SPD900]        = {MAIN_PLL, 187, 2, 2},
+               [SPD1000]       = {MAIN_PLL, 104, 1, 2},
        },
        [SYSCLK_24MHz] = {
                [SPD400]        = {MAIN_PLL, 100, 3, 2},
                [SPD600]        = {MAIN_PLL, 300, 6, 2},
                [SPD800]        = {MAIN_PLL, 200, 3, 2},
-               [SPD900]        = {TETRIS_PLL, 75, 1, 2},
-               [SPD1000]       = {TETRIS_PLL, 250, 3, 2},
+               [SPD900]        = {MAIN_PLL, 75, 1, 2},
+               [SPD1000]       = {MAIN_PLL, 250, 3, 2},
        },
        [SYSCLK_25MHz] = {
                [SPD400]        = {MAIN_PLL, 32, 1, 2},
                [SPD600]        = {MAIN_PLL, 48, 1, 2},
                [SPD800]        = {MAIN_PLL, 64, 1, 2},
-               [SPD900]        = {TETRIS_PLL, 72, 1, 2},
-               [SPD1000]       = {TETRIS_PLL, 80, 1, 2},
+               [SPD900]        = {MAIN_PLL, 72, 1, 2},
+               [SPD1000]       = {MAIN_PLL, 80, 1, 2},
        },
        [SYSCLK_26MHz] = {
                [SPD400]        = {MAIN_PLL, 400, 13, 2},
                [SPD600]        = {MAIN_PLL, 230, 5, 2},
                [SPD800]        = {MAIN_PLL, 123, 2, 2},
-               [SPD900]        = {TETRIS_PLL, 69, 1, 2},
-               [SPD1000]       = {TETRIS_PLL, 384, 5, 2},
+               [SPD900]        = {MAIN_PLL, 69, 1, 2},
+               [SPD1000]       = {MAIN_PLL, 384, 5, 2},
        },
 };
 
index b6cc417333854981d495c8f6204993c48bca92f0..4b25cc2d7c3cec8ce3c85dfcdf46695b36d570f3 100644 (file)
@@ -24,6 +24,7 @@
 #include <sata.h>
 #include <usb.h>
 #include <asm/gpio.h>
+#include <asm/mach-types.h>
 #include <asm/arch/clock.h>
 #include <asm/arch/ehci.h>
 #include <asm/ehci-omap.h>
index 72aabb242c8117c44f3f7106060a753319c6f3f7..6ffb53c4c618d55cd4a602e75f5e4f1f8dd14642 100644 (file)
@@ -6,6 +6,7 @@
  * SPDX-License-Identifier:    GPL-2.0+
  */
 #include <common.h>
+#include <asm/mach-types.h>
 #include <asm/arch/sys_proto.h>
 #include <asm/arch/mmc_host_def.h>
 #include <asm/arch/clock.h>
index b6bf16236f408aadc2003fcc880a747c608c5f6f..577e60f875f4d27d2dd38d6751ec434c6a67e267 100644 (file)
@@ -24,12 +24,14 @@ DECLARE_GLOBAL_DATA_PTR;
 
 int board_init(void)
 {
-       gd->bd->bi_boot_params = PHYS_DRAM_1 + 0x100;
+       gd->bd->bi_boot_params = CONFIG_SYS_SDRAM_BASE + 0x100;
+#if defined(CONFIG_NAND)
+       gpmc_init();
+#endif
        return 0;
 }
 
 #ifdef CONFIG_SPL_BUILD
-
 static struct module_pin_mux mmc_pin_mux[] = {
        { OFFSET(pincntl157), PULLDOWN_EN | PULLUDDIS | MODE(0x0) },
        { OFFSET(pincntl158), PULLDOWN_EN | PULLUDEN | MODE(0x0) },
@@ -41,176 +43,68 @@ static struct module_pin_mux mmc_pin_mux[] = {
        { -1 },
 };
 
-const struct dmm_lisa_map_regs evm_lisa_map_regs = {
-       .dmm_lisa_map_0 = 0x00000000,
-       .dmm_lisa_map_1 = 0x00000000,
-       .dmm_lisa_map_2 = 0x80640300,
-       .dmm_lisa_map_3 = 0xC0640320,
-};
-
-/*
- * DDR2 related definitions
- */
-#ifdef CONFIG_TI816X_EVM_DDR2
-static struct ddr_data ddr2_data = {
-       .datardsratio0          = ((0x40<<10) | (0x40<<0)),
-       .datawdsratio0          = ((0x4A<<10) | (0x4A<<0)),
-       .datawiratio0           = ((0x0<<10) | (0x0<<0)),
-       .datagiratio0           = ((0x0<<10) | (0x0<<0)),
-       .datafwsratio0          = ((0x13A<<10) | (0x13A<<0)),
-       .datawrsratio0          = ((0x8A<<10) | (0x8A<<0)),
-};
-
-static struct cmd_control ddr2_ctrl = {
-       .cmd0csratio    = 0x80,
-       .cmd0iclkout    = 0x00,
-
-       .cmd1csratio    = 0x80,
-       .cmd1iclkout    = 0x00,
-
-       .cmd2csratio    = 0x80,
-       .cmd2iclkout    = 0x00,
-
-};
-
-static struct emif_regs ddr2_emif0_regs = {
-       .sdram_config           = 0x43801A3A,
-       .ref_ctrl               = 0x10000C30,
-       .sdram_tim1             = 0x0AAB15E2,
-       .sdram_tim2             = 0x423631D2,
-       .sdram_tim3             = 0x0080032F,
-       .emif_ddr_phy_ctlr_1    = 0x0, /* depend on cpu rev, set later */
-};
+void set_uart_mux_conf(void) {}
 
-static struct emif_regs ddr2_emif1_regs = {
-       .sdram_config           = 0x43801A3A,
-       .ref_ctrl               = 0x10000C30,
-       .sdram_tim1             = 0x0AAB15E2,
-       .sdram_tim2             = 0x423631D2,
-       .sdram_tim3             = 0x0080032F,
-       .emif_ddr_phy_ctlr_1    = 0x0, /* depend on cpu rev, set later */
-};
-#endif
+void set_mux_conf_regs(void)
+{
+       configure_module_pin_mux(mmc_pin_mux);
+}
 
 /*
- * DDR3 related definitions
+ * EMIF Paramters.  Refer the EMIF register documentation and the
+ * memory datasheet for details.  This is for 796 MHz.
  */
-
-#if defined(CONFIG_TI816X_DDR_PLL_400)
-#define RD_DQS         0x03B
-#define WR_DQS         0x0A6
-#define RD_DQS_GATE    0x12A
-#define EMIF_SDCFG     0x62A41032
-#define EMIF_SDREF     0x10000C30
-#define EMIF_TIM1      0x0CCCE524
-#define EMIF_TIM2      0x30308023
-#define EMIF_TIM3      0x009F82CF
-#define EMIF_PHYCFG    0x0000010B
-#elif defined(CONFIG_TI816X_DDR_PLL_531)
-#define RD_DQS         0x039
-#define WR_DQS         0x0B4
-#define RD_DQS_GATE    0x13D
-#define EMIF_SDCFG     0x62A51832
-#define EMIF_SDREF     0x1000102E
-#define EMIF_TIM1      0x0EF136AC
-#define EMIF_TIM2      0x30408063
-#define EMIF_TIM3      0x009F83AF
-#define EMIF_PHYCFG    0x0000010C
-#elif defined(CONFIG_TI816X_DDR_PLL_675)
-#define RD_DQS         0x039
-#define WR_DQS         0x091
-#define RD_DQS_GATE    0x196
-#define EMIF_SDCFG     0x62A63032
-#define EMIF_SDREF     0x10001491
-#define EMIF_TIM1      0x13358875
-#define EMIF_TIM2      0x5051806C
-#define EMIF_TIM3      0x009F84AF
-#define EMIF_PHYCFG    0x0000010F
-#elif defined(CONFIG_TI816X_DDR_PLL_796)
-#define RD_DQS         0x035
-#define WR_DQS         0x093
-#define RD_DQS_GATE    0x1B3
-#define EMIF_SDCFG     0x62A73832
-#define EMIF_SDREF     0x10001841
-#define EMIF_TIM1      0x1779C9FE
-#define EMIF_TIM2      0x50608074
-#define EMIF_TIM3      0x009F857F
-#define EMIF_PHYCFG    0x00000110
-#endif
-
-static struct ddr_data ddr3_data = {
-       .datardsratio0          = ((RD_DQS<<10) | (RD_DQS<<0)),
-       .datawdsratio0          = ((WR_DQS<<10) | (WR_DQS<<0)),
-       .datawiratio0           = ((0x20<<10) | 0x20<<0),
-       .datagiratio0           = ((0x20<<10) | 0x20<<0),
-       .datafwsratio0          = ((RD_DQS_GATE<<10) | (RD_DQS_GATE<<0)),
-       .datawrsratio0          = (((WR_DQS+0x40)<<10) | ((WR_DQS+0x40)<<0)),
+#define EMIF_TIM1   0x1779C9FE
+#define EMIF_TIM2   0x50608074
+#define EMIF_TIM3   0x009F857F
+#define EMIF_SDREF  0x10001841
+#define EMIF_SDCFG  0x62A73832
+#define EMIF_PHYCFG 0x00000110
+static const struct emif_regs ddr3_emif_regs = {
+       .sdram_config           = EMIF_SDCFG,
+       .ref_ctrl               = EMIF_SDREF,
+       .sdram_tim1             = EMIF_TIM1,
+       .sdram_tim2             = EMIF_TIM2,
+       .sdram_tim3             = EMIF_TIM3,
+       .emif_ddr_phy_ctlr_1    = EMIF_PHYCFG,
 };
 
 static const struct cmd_control ddr3_ctrl = {
        .cmd0csratio    = 0x100,
        .cmd0iclkout    = 0x001,
-
        .cmd1csratio    = 0x100,
        .cmd1iclkout    = 0x001,
-
        .cmd2csratio    = 0x100,
        .cmd2iclkout    = 0x001,
 };
 
-static const struct emif_regs ddr3_emif0_regs = {
-       .sdram_config           = EMIF_SDCFG,
-       .ref_ctrl               = EMIF_SDREF,
-       .sdram_tim1             = EMIF_TIM1,
-       .sdram_tim2             = EMIF_TIM2,
-       .sdram_tim3             = EMIF_TIM3,
-       .emif_ddr_phy_ctlr_1    = EMIF_PHYCFG,
+/* These values are obtained from the CCS app */
+#define RD_DQS_GATE    (0x1B3)
+#define RD_DQS         (0x35)
+#define WR_DQS         (0x93)
+static struct ddr_data ddr3_data = {
+       .datardsratio0          = ((RD_DQS<<10) | (RD_DQS<<0)),
+       .datawdsratio0          = ((WR_DQS<<10) | (WR_DQS<<0)),
+       .datawiratio0           = ((0x20<<10) | 0x20<<0),
+       .datagiratio0           = ((0x20<<10) | 0x20<<0),
+       .datafwsratio0          = ((RD_DQS_GATE<<10) | (RD_DQS_GATE<<0)),
+       .datawrsratio0          = (((WR_DQS+0x40)<<10) | ((WR_DQS+0x40)<<0)),
 };
 
-static const struct emif_regs ddr3_emif1_regs = {
-       .sdram_config           = EMIF_SDCFG,
-       .ref_ctrl               = EMIF_SDREF,
-       .sdram_tim1             = EMIF_TIM1,
-       .sdram_tim2             = EMIF_TIM2,
-       .sdram_tim3             = EMIF_TIM3,
-       .emif_ddr_phy_ctlr_1    = EMIF_PHYCFG,
+static const struct dmm_lisa_map_regs evm_lisa_map_regs = {
+       .dmm_lisa_map_0 = 0x00000000,
+       .dmm_lisa_map_1 = 0x00000000,
+       .dmm_lisa_map_2 = 0x80640300,
+       .dmm_lisa_map_3 = 0xC0640320,
 };
 
-void set_uart_mux_conf(void) {}
-
-void set_mux_conf_regs(void)
-{
-       configure_module_pin_mux(mmc_pin_mux);
-}
-
 void sdram_init(void)
 {
-       config_dmm(&evm_lisa_map_regs);
-
-#ifdef CONFIG_TI816X_EVM_DDR2
-       if (CONFIG_TI816X_USE_EMIF0) {
-               ddr2_emif0_regs.emif_ddr_phy_ctlr_1 =
-                       (get_cpu_rev() == 0x1 ? 0x0000010B : 0x0000030B);
-               config_ddr(0, NULL, &ddr2_data, &ddr2_ctrl, &ddr2_emif0_regs,
-                          0);
-       }
-
-       if (CONFIG_TI816X_USE_EMIF1) {
-               ddr2_emif1_regs.emif_ddr_phy_ctlr_1 =
-                       (get_cpu_rev() == 0x1 ? 0x0000010B : 0x0000030B);
-               config_ddr(1, NULL, &ddr2_data, &ddr2_ctrl, &ddr2_emif1_regs,
-                          1);
-       }
-#endif
-
-#ifdef CONFIG_TI816X_EVM_DDR3
-       if (CONFIG_TI816X_USE_EMIF0)
-               config_ddr(0, NULL, &ddr3_data, &ddr3_ctrl, &ddr3_emif0_regs,
-                          0);
-
-       if (CONFIG_TI816X_USE_EMIF1)
-               config_ddr(1, NULL, &ddr3_data, &ddr3_ctrl, &ddr3_emif1_regs,
-                          1);
-#endif
+       /*
+        * Pass in our DDR3 config information and that we have 2 EMIFs to
+        * configure.
+        */
+       config_ddr(&ddr3_data, &ddr3_ctrl, &ddr3_emif_regs,
+                       &evm_lisa_map_regs, 2);
 }
 #endif /* CONFIG_SPL_BUILD */
index 5d62e66495b5826bc2269d861fe09855fba3dd9c..85afecff944f9416ca1642036270ffb099713263 100644 (file)
@@ -19,6 +19,7 @@
 #include <netdev.h>
 #include <serial.h>
 #include <usb.h>
+#include <asm/mach-types.h>
 #include "../common/tdx-common.h"
 
 DECLARE_GLOBAL_DATA_PTR;
index 2a810c89aa4c99b39760c12dba28bba1c42819d9..68ec4369ad7e01ae11d987adca77679f8790b474 100644 (file)
@@ -23,6 +23,7 @@
 #include <malloc.h>
 #include <mmc.h>
 #include <nand.h>
+#include <asm/mach-types.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
index 2c6fc409c109c023b5f9afd0eb66160ddaa361ab..0d267877fa4f38ba3b8b8a67cb70855d956a8cef 100644 (file)
@@ -9,6 +9,7 @@
 #include <libfdt.h>
 
 #include "tdx-cfg-block.h"
+#include <asm/setup.h>
 #include "tdx-common.h"
 
 #ifdef CONFIG_TDX_CFG_BLOCK
index e81d6ff18d9a2250703416671f5531a89e0c9fc2..8a15c30c0b6dee846dd1ea4d5fdf37cf56e48e72 100644 (file)
@@ -16,6 +16,7 @@
 #include <spi.h>
 #include <asm/io.h>
 #include <usb.h>
+#include <asm/mach-types.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
index 6f75b86e255626ebc7a86052f4e8fe3d76f4300d..270cff6297d96db67e98210ef6e88ae65a394d8c 100644 (file)
@@ -1166,6 +1166,7 @@ config CMD_EXT4_WRITE
 
 config CMD_FAT
        bool "FAT command support"
+       select FS_FAT
        help
          Support for the FAT fs
 
index 9ea56e99778a04ccb0eefe1ad96313b60b0231d4..b92e42df32e6dd1806433f6043c19a96c3a05dea 100644 (file)
@@ -192,3 +192,5 @@ $(obj)/license_data_gz.h: $(obj)/license_data.gz FORCE
 targets += license_data_size.h
 $(obj)/license_data_size.h: $(srctree)/Licenses/gpl-2.0.txt FORCE
        $(call filechk,data_size)
+
+CFLAGS_ethsw.o := -Wno-enum-conversion
index e4c65351118a5f5144e7b8debee93ea7dc21592a..ed9625b221fe1d76abf424840e80dc6ab920b0ab 100644 (file)
--- a/cmd/elf.c
+++ b/cmd/elf.c
@@ -147,25 +147,25 @@ int do_bootelf(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 {
        unsigned long addr; /* Address of the ELF image */
        unsigned long rc; /* Return value from user code */
-       char *sload, *saddr;
+       char *sload = NULL;
        const char *ep = getenv("autostart");
-
        int rcode = 0;
 
-       sload = saddr = NULL;
-       if (argc == 3) {
-               sload = argv[1];
-               saddr = argv[2];
-       } else if (argc == 2) {
-               if (argv[1][0] == '-')
-                       sload = argv[1];
-               else
-                       saddr = argv[1];
-       }
+       /* Consume 'bootelf' */
+       argc--; argv++;
 
-       if (saddr)
-               addr = simple_strtoul(saddr, NULL, 16);
-       else
+       /* Check for flag. */
+       if (argc >= 1 && (argv[0][0] == '-' && \
+                               (argv[0][1] == 'p' || argv[0][1] == 's'))) {
+               sload = argv[0];
+               /* Consume flag. */
+               argc--; argv++;
+       }
+       /* Check for address. */
+       if (argc >= 1 && strict_strtoul(argv[0], 16, &addr) != -EINVAL) {
+               /* Consume address */
+               argc--; argv++;
+       } else
                addr = load_addr;
 
        if (!valid_elf_image(addr))
@@ -185,7 +185,7 @@ int do_bootelf(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
         * pass address parameter as argv[0] (aka command name),
         * and all remaining args
         */
-       rc = do_bootelf_exec((void *)addr, argc - 1, argv + 1);
+       rc = do_bootelf_exec((void *)addr, argc, argv);
        if (rc != 0)
                rcode = 1;
 
@@ -385,7 +385,7 @@ int do_bootvx(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 }
 
 U_BOOT_CMD(
-       bootelf, 3, 0, do_bootelf,
+       bootelf, CONFIG_SYS_MAXARGS, 0, do_bootelf,
        "Boot from an ELF image in memory",
        "[-p|-s] [address]\n"
        "\t- load ELF image at [address] via program headers (-p)\n"
index 41b4fffcf9e42b7dd28fd7ee9e8b366bf52b0067..fe27b4f761ad9310a00ceeb837a5b3f352a59fb6 100644 (file)
--- a/cmd/pci.c
+++ b/cmd/pci.c
@@ -150,7 +150,8 @@ int pci_bar_show(struct udevice *dev)
                if ((!is_64 && size_low) || (is_64 && size)) {
                        size = ~size + 1;
                        printf(" %d   %#016llx  %#016llx  %d     %s   %s\n",
-                              bar_id, base, size, is_64 ? 64 : 32,
+                              bar_id, (unsigned long long)base,
+                              (unsigned long long)size, is_64 ? 64 : 32,
                               is_io ? "I/O" : "MEM",
                               prefetchable ? "Prefetchable" : "");
                }
index 5c39663f56a87db11155632f0fa1033c42961f20..c49199bb1a66fc421a75a20eb056496e2abb19b5 100644 (file)
@@ -18,6 +18,15 @@ config BOOTSTAGE
          Calls to show_boot_progress() will also result in log entries but
          these will not have names.
 
+config SPL_BOOTSTAGE
+       bool "Boot timing and reported in SPL"
+       depends on BOOTSTAGE
+       help
+         Enable recording of boot time in SPL. To make this visible to U-Boot
+         proper, enable BOOTSTAGE_STASH as well. This will stash the timing
+         information when SPL finishes and load it when U-Boot proper starts
+         up.
+
 config BOOTSTAGE_REPORT
        bool "Display a detailed boot timing report before booting the OS"
        depends on BOOTSTAGE
@@ -38,7 +47,7 @@ config BOOTSTAGE_REPORT
                 30,361,327    445,160  start_kernel
 
 config BOOTSTAGE_USER_COUNT
-       hex "Number of boot ID numbers available for user use"
+       int "Number of boot ID numbers available for user use"
        default 20
        help
          This is the number of available user bootstage records.
@@ -46,6 +55,13 @@ config BOOTSTAGE_USER_COUNT
          a new ID will be allocated from this stash. If you exceed
          the limit, recording will stop.
 
+config BOOTSTAGE_RECORD_COUNT
+       int "Number of boot stage records to store"
+       default 30
+       help
+         This is the size of the bootstage record list and is the maximum
+         number of bootstage records that can be recorded.
+
 config BOOTSTAGE_FDT
        bool "Store boot timing information in the OS device tree"
        depends on BOOTSTAGE
index c7c8ea42c6ece400cbf5f232938b81771cda2d4f..539cf98e19f35b8742454d1188e4110e12affcba 100644 (file)
@@ -65,7 +65,6 @@ obj-$(CONFIG_USB_STORAGE) += usb_storage.o
 endif
 
 # others
-obj-$(CONFIG_BOOTSTAGE) += bootstage.o
 obj-$(CONFIG_CONSOLE_MUX) += iomux.o
 obj-$(CONFIG_MTD_NOR_FLASH) += flash.o
 obj-$(CONFIG_CMD_KGDB) += kgdb.o kgdb_stubs.o
@@ -89,6 +88,8 @@ obj-$(CONFIG_CMDLINE) += cli_readline.o cli_simple.o
 
 endif # !CONFIG_SPL_BUILD
 
+obj-$(CONFIG_$(SPL_)BOOTSTAGE) += bootstage.o
+
 ifdef CONFIG_SPL_BUILD
 obj-$(CONFIG_SPL_DFU_SUPPORT) += dfu.o
 obj-$(CONFIG_SPL_DFU_SUPPORT) += cli_hush.o
index a212f2b53921356f730c4bd28d8515b2182385b2..46e52849fb80f9a5a12a1b8ed0182d6fc02e9b75 100644 (file)
@@ -31,6 +31,9 @@
 #include <trace.h>
 #include <video.h>
 #include <watchdog.h>
+#ifdef CONFIG_MACH_TYPE
+#include <asm/mach-types.h>
+#endif
 #if defined(CONFIG_MP) && defined(CONFIG_PPC)
 #include <asm/mp.h>
 #endif
@@ -488,6 +491,20 @@ static int reserve_fdt(void)
        return 0;
 }
 
+static int reserve_bootstage(void)
+{
+#ifdef CONFIG_BOOTSTAGE
+       int size = bootstage_get_size();
+
+       gd->start_addr_sp -= size;
+       gd->new_bootstage = map_sysmem(gd->start_addr_sp, size);
+       debug("Reserving %#x Bytes for bootstage at: %08lx\n", size,
+             gd->start_addr_sp);
+#endif
+
+       return 0;
+}
+
 int arch_reserve_stacks(void)
 {
        return 0;
@@ -602,6 +619,24 @@ static int reloc_fdt(void)
        return 0;
 }
 
+static int reloc_bootstage(void)
+{
+#ifdef CONFIG_BOOTSTAGE
+       if (gd->flags & GD_FLG_SKIP_RELOC)
+               return 0;
+       if (gd->new_bootstage) {
+               int size = bootstage_get_size();
+
+               debug("Copying bootstage from %p to %p, size %x\n",
+                     gd->bootstage, gd->new_bootstage, size);
+               memcpy(gd->new_bootstage, gd->bootstage, size);
+               gd->bootstage = gd->new_bootstage;
+       }
+#endif
+
+       return 0;
+}
+
 static int setup_reloc(void)
 {
        if (gd->flags & GD_FLG_SKIP_RELOC) {
@@ -670,8 +705,29 @@ static int jump_to_copy(void)
 #endif
 
 /* Record the board_init_f() bootstage (after arch_cpu_init()) */
-static int mark_bootstage(void)
+static int initf_bootstage(void)
 {
+#if defined(CONFIG_SPL_BOOTSTAGE) && defined(CONFIG_BOOTSTAGE_STASH)
+       bool from_spl = true;
+#else
+       bool from_spl = false;
+#endif
+       int ret;
+
+       ret = bootstage_init(!from_spl);
+       if (ret)
+               return ret;
+       if (from_spl) {
+               const void *stash = map_sysmem(CONFIG_BOOTSTAGE_STASH_ADDR,
+                                              CONFIG_BOOTSTAGE_STASH_SIZE);
+
+               ret = bootstage_unstash(stash, CONFIG_BOOTSTAGE_STASH_SIZE);
+               if (ret && ret != -ENOENT) {
+                       debug("Failed to unstash bootstage: err=%d\n", ret);
+                       return ret;
+               }
+       }
+
        bootstage_mark_name(BOOTSTAGE_ID_START_UBOOT_F, "board_init_f");
 
        return 0;
@@ -691,7 +747,9 @@ static int initf_dm(void)
 #if defined(CONFIG_DM) && defined(CONFIG_SYS_MALLOC_F_LEN)
        int ret;
 
+       bootstage_start(BOOTSTATE_ID_ACCUM_DM_F, "dm_f");
        ret = dm_init_and_scan(true);
+       bootstage_accum(BOOTSTATE_ID_ACCUM_DM_F);
        if (ret)
                return ret;
 #endif
@@ -724,6 +782,7 @@ static const init_fnc_t init_sequence_f[] = {
        trace_early_init,
 #endif
        initf_malloc,
+       initf_bootstage,        /* uses its own timer, so does not need DM */
        initf_console_record,
 #if defined(CONFIG_HAVE_FSP)
        arch_fsp_init,
@@ -732,7 +791,6 @@ static const init_fnc_t init_sequence_f[] = {
        mach_cpu_init,          /* SoC/machine dependent CPU setup */
        initf_dm,
        arch_cpu_init_dm,
-       mark_bootstage,         /* need timer, go after init dm */
 #if defined(CONFIG_BOARD_EARLY_INIT_F)
        board_early_init_f,
 #endif
@@ -819,6 +877,7 @@ static const init_fnc_t init_sequence_f[] = {
        setup_machine,
        reserve_global_data,
        reserve_fdt,
+       reserve_bootstage,
        reserve_arch,
        reserve_stacks,
        dram_init_banksize,
@@ -840,6 +899,7 @@ static const init_fnc_t init_sequence_f[] = {
 #endif
        INIT_FUNC_WATCHDOG_RESET
        reloc_fdt,
+       reloc_bootstage,
        setup_reloc,
 #if defined(CONFIG_X86) || defined(CONFIG_ARC)
        copy_uboot_to_ram,
index 00ba319ca77ba16434a71a29b57febb01acedf4d..15977e4bcaef417b21a60c61a196e4bbfa13793a 100644 (file)
@@ -11,6 +11,7 @@
  */
 
 #include <common.h>
+#include <api.h>
 /* TODO: can we just include all these headers whether needed or not? */
 #if defined(CONFIG_CMD_BEDBUG)
 #include <bedbug/type.h>
@@ -296,8 +297,15 @@ static int initr_noncached(void)
 #ifdef CONFIG_OF_LIVE
 static int initr_of_live(void)
 {
-       return of_live_build(gd->fdt_blob,
-                             (struct device_node **)&gd->of_root);
+       int ret;
+
+       bootstage_start(BOOTSTAGE_ID_ACCUM_OF_LIVE, "of_live");
+       ret = of_live_build(gd->fdt_blob, (struct device_node **)&gd->of_root);
+       bootstage_accum(BOOTSTAGE_ID_ACCUM_OF_LIVE);
+       if (ret)
+               return ret;
+
+       return 0;
 }
 #endif
 
@@ -312,7 +320,9 @@ static int initr_dm(void)
 #ifdef CONFIG_TIMER
        gd->timer = NULL;
 #endif
+       bootstage_start(BOOTSTATE_ID_ACCUM_DM_R, "dm_r");
        ret = dm_init_and_scan(false);
+       bootstage_accum(BOOTSTATE_ID_ACCUM_DM_R);
        if (ret)
                return ret;
 #ifdef CONFIG_TIMER_EARLY
@@ -327,7 +337,6 @@ static int initr_dm(void)
 
 static int initr_bootstage(void)
 {
-       /* We cannot do this before initr_dm() */
        bootstage_mark_name(BOOTSTAGE_ID_START_UBOOT_R, "board_init_r");
 
        return 0;
@@ -726,6 +735,7 @@ static init_fnc_t init_sequence_r[] = {
 #endif
        initr_barrier,
        initr_malloc,
+       initr_bootstage,        /* Needs malloc() but has its own timer */
        initr_console_record,
 #ifdef CONFIG_SYS_NONCACHED_MEMORY
        initr_noncached,
@@ -737,7 +747,6 @@ static init_fnc_t init_sequence_r[] = {
 #ifdef CONFIG_DM
        initr_dm,
 #endif
-       initr_bootstage,
 #if defined(CONFIG_ARM) || defined(CONFIG_NDS32)
        board_init,     /* Setup chipselects */
 #endif
index 35bce3d881a5b4151bc68382feae60d0fb2720f5..61479d7f07925ab604bfe605c2e13cd978a8fb09 100644 (file)
@@ -8,8 +8,6 @@
 /*
  * This module records the progress of boot and arbitrary commands, and
  * permits accurate timestamping of each.
- *
- * TBD: Pass timings to kernel in the FDT
  */
 
 #include <common.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
+enum {
+       RECORD_COUNT = CONFIG_BOOTSTAGE_RECORD_COUNT,
+};
+
 struct bootstage_record {
        ulong time_us;
        uint32_t start_us;
@@ -27,8 +29,11 @@ struct bootstage_record {
        enum bootstage_id id;
 };
 
-static struct bootstage_record record[BOOTSTAGE_ID_COUNT] = { {1} };
-static int next_id = BOOTSTAGE_ID_USER;
+struct bootstage_data {
+       uint rec_count;
+       uint next_id;
+       struct bootstage_record record[RECORD_COUNT];
+};
 
 enum {
        BOOTSTAGE_VERSION       = 0,
@@ -45,41 +50,72 @@ struct bootstage_hdr {
 
 int bootstage_relocate(void)
 {
+       struct bootstage_data *data = gd->bootstage;
        int i;
 
        /*
         * Duplicate all strings.  They may point to an old location in the
         * program .text section that can eventually get trashed.
         */
-       for (i = 0; i < BOOTSTAGE_ID_COUNT; i++)
-               if (record[i].name)
-                       record[i].name = strdup(record[i].name);
+       debug("Relocating %d records\n", data->rec_count);
+       for (i = 0; i < data->rec_count; i++)
+               data->record[i].name = strdup(data->record[i].name);
 
        return 0;
 }
 
+struct bootstage_record *find_id(struct bootstage_data *data,
+                                enum bootstage_id id)
+{
+       struct bootstage_record *rec;
+       struct bootstage_record *end;
+
+       for (rec = data->record, end = rec + data->rec_count; rec < end;
+            rec++) {
+               if (rec->id == id)
+                       return rec;
+       }
+
+       return NULL;
+}
+
+struct bootstage_record *ensure_id(struct bootstage_data *data,
+                                  enum bootstage_id id)
+{
+       struct bootstage_record *rec;
+
+       rec = find_id(data, id);
+       if (!rec && data->rec_count < RECORD_COUNT) {
+               rec = &data->record[data->rec_count++];
+               rec->id = id;
+               return rec;
+       }
+
+       return rec;
+}
+
 ulong bootstage_add_record(enum bootstage_id id, const char *name,
                           int flags, ulong mark)
 {
+       struct bootstage_data *data = gd->bootstage;
        struct bootstage_record *rec;
 
        if (flags & BOOTSTAGEF_ALLOC)
-               id = next_id++;
-
-       if (id < BOOTSTAGE_ID_COUNT) {
-               rec = &record[id];
-
-               /* Only record the first event for each */
-               if (!rec->time_us) {
-                       rec->time_us = mark;
-                       rec->name = name;
-                       rec->flags = flags;
-                       rec->id = id;
-               }
+               id = data->next_id++;
+
+       /* Only record the first event for each */
+       rec = find_id(data, id);
+       if (!rec && data->rec_count < RECORD_COUNT) {
+               rec = &data->record[data->rec_count++];
+               rec->time_us = mark;
+               rec->name = name;
+               rec->flags = flags;
+               rec->id = id;
        }
 
        /* Tell the board about this progress */
        show_boot_progress(flags & BOOTSTAGEF_ERROR ? -id : id);
+
        return mark;
 }
 
@@ -101,6 +137,7 @@ ulong bootstage_mark_name(enum bootstage_id id, const char *name)
 
        if (id == BOOTSTAGE_ID_ALLOC)
                flags = BOOTSTAGEF_ALLOC;
+
        return bootstage_add_record(id, name, flags, timer_get_boot_us());
 }
 
@@ -133,20 +170,29 @@ ulong bootstage_mark_code(const char *file, const char *func, int linenum)
 
 uint32_t bootstage_start(enum bootstage_id id, const char *name)
 {
-       struct bootstage_record *rec = &record[id];
+       struct bootstage_data *data = gd->bootstage;
+       struct bootstage_record *rec = ensure_id(data, id);
+       ulong start_us = timer_get_boot_us();
+
+       if (rec) {
+               rec->start_us = start_us;
+               rec->name = name;
+       }
 
-       rec->start_us = timer_get_boot_us();
-       rec->name = name;
-       return rec->start_us;
+       return start_us;
 }
 
 uint32_t bootstage_accum(enum bootstage_id id)
 {
-       struct bootstage_record *rec = &record[id];
+       struct bootstage_data *data = gd->bootstage;
+       struct bootstage_record *rec = ensure_id(data, id);
        uint32_t duration;
 
+       if (!rec)
+               return 0;
        duration = (uint32_t)timer_get_boot_us() - rec->start_us;
        rec->time_us += duration;
+
        return duration;
 }
 
@@ -159,7 +205,7 @@ uint32_t bootstage_accum(enum bootstage_id id)
  * @return pointer to name, either from the record or pointing to buf.
  */
 static const char *get_record_name(char *buf, int len,
-                                  struct bootstage_record *rec)
+                                  const struct bootstage_record *rec)
 {
        if (rec->name)
                return rec->name;
@@ -171,8 +217,7 @@ static const char *get_record_name(char *buf, int len,
        return buf;
 }
 
-static uint32_t print_time_record(enum bootstage_id id,
-                       struct bootstage_record *rec, uint32_t prev)
+static uint32_t print_time_record(struct bootstage_record *rec, uint32_t prev)
 {
        char buf[20];
 
@@ -204,9 +249,10 @@ static int h_compare_record(const void *r1, const void *r2)
  */
 static int add_bootstages_devicetree(struct fdt_header *blob)
 {
+       struct bootstage_data *data = gd->bootstage;
        int bootstage;
        char buf[20];
-       int id;
+       int recnum;
        int i;
 
        if (!blob)
@@ -218,17 +264,17 @@ static int add_bootstages_devicetree(struct fdt_header *blob)
         */
        bootstage = fdt_add_subnode(blob, 0, "bootstage");
        if (bootstage < 0)
-               return -1;
+               return -EINVAL;
 
        /*
         * Insert the timings to the device tree in the reverse order so
         * that they can be printed in the Linux kernel in the right order.
         */
-       for (id = BOOTSTAGE_ID_COUNT - 1, i = 0; id >= 0; id--, i++) {
-               struct bootstage_record *rec = &record[id];
+       for (recnum = data->rec_count - 1, i = 0; recnum >= 0; recnum--, i++) {
+               struct bootstage_record *rec = &data->record[recnum];
                int node;
 
-               if (id != BOOTSTAGE_ID_AWAKE && rec->time_us == 0)
+               if (rec->id != BOOTSTAGE_ID_AWAKE && rec->time_us == 0)
                        continue;
 
                node = fdt_add_subnode(blob, bootstage, simple_itoa(i));
@@ -237,14 +283,14 @@ static int add_bootstages_devicetree(struct fdt_header *blob)
 
                /* add properties to the node. */
                if (fdt_setprop_string(blob, node, "name",
-                               get_record_name(buf, sizeof(buf), rec)))
-                       return -1;
+                                      get_record_name(buf, sizeof(buf), rec)))
+                       return -EINVAL;
 
                /* Check if this is a 'mark' or 'accum' record */
                if (fdt_setprop_cell(blob, node,
                                rec->start_us ? "accum" : "mark",
                                rec->time_us))
-                       return -1;
+                       return -EINVAL;
        }
 
        return 0;
@@ -261,54 +307,36 @@ int bootstage_fdt_add_report(void)
 
 void bootstage_report(void)
 {
-       struct bootstage_record *rec = record;
-       int id;
+       struct bootstage_data *data = gd->bootstage;
+       struct bootstage_record *rec = data->record;
        uint32_t prev;
+       int i;
 
-       puts("Timer summary in microseconds:\n");
+       printf("Timer summary in microseconds (%d records):\n",
+              data->rec_count);
        printf("%11s%11s  %s\n", "Mark", "Elapsed", "Stage");
 
-       /* Fake the first record - we could get it from early boot */
-       rec->name = "reset";
-       rec->time_us = 0;
-       prev = print_time_record(BOOTSTAGE_ID_AWAKE, rec, 0);
+       prev = print_time_record(rec, 0);
 
        /* Sort records by increasing time */
-       qsort(record, ARRAY_SIZE(record), sizeof(*rec), h_compare_record);
+       qsort(data->record, data->rec_count, sizeof(*rec), h_compare_record);
 
-       for (id = 0; id < BOOTSTAGE_ID_COUNT; id++, rec++) {
-               if (rec->time_us != 0 && !rec->start_us)
-                       prev = print_time_record(rec->id, rec, prev);
+       for (i = 1, rec++; i < data->rec_count; i++, rec++) {
+               if (rec->id && !rec->start_us)
+                       prev = print_time_record(rec, prev);
        }
-       if (next_id > BOOTSTAGE_ID_COUNT)
-               printf("(Overflowed internal boot id table by %d entries\n"
-                       "- please increase CONFIG_BOOTSTAGE_USER_COUNT\n",
-                      next_id - BOOTSTAGE_ID_COUNT);
+       if (data->rec_count > RECORD_COUNT)
+               printf("Overflowed internal boot id table by %d entries\n"
+                      "- please increase CONFIG_BOOTSTAGE_RECORD_COUNT\n",
+                      data->rec_count - RECORD_COUNT);
 
        puts("\nAccumulated time:\n");
-       for (id = 0, rec = record; id < BOOTSTAGE_ID_COUNT; id++, rec++) {
+       for (i = 0, rec = data->record; i < data->rec_count; i++, rec++) {
                if (rec->start_us)
-                       prev = print_time_record(id, rec, -1);
+                       prev = print_time_record(rec, -1);
        }
 }
 
-ulong __timer_get_boot_us(void)
-{
-       static ulong base_time;
-
-       /*
-        * We can't implement this properly. Return 0 on the first call and
-        * larger values after that.
-        */
-       if (base_time)
-               return get_timer(base_time) * 1000;
-       base_time = get_timer(0);
-       return 0;
-}
-
-ulong timer_get_boot_us(void)
-       __attribute__((weak, alias("__timer_get_boot_us")));
-
 /**
  * Append data to a memory buffer
  *
@@ -333,25 +361,26 @@ static void append_data(char **ptrp, char *end, const void *data, int size)
 
 int bootstage_stash(void *base, int size)
 {
+       const struct bootstage_data *data = gd->bootstage;
        struct bootstage_hdr *hdr = (struct bootstage_hdr *)base;
-       struct bootstage_record *rec;
+       const struct bootstage_record *rec;
        char buf[20];
        char *ptr = base, *end = ptr + size;
        uint32_t count;
-       int id;
+       int i;
 
        if (hdr + 1 > (struct bootstage_hdr *)end) {
                debug("%s: Not enough space for bootstage hdr\n", __func__);
-               return -1;
+               return -ENOSPC;
        }
 
        /* Write an arbitrary version number */
        hdr->version = BOOTSTAGE_VERSION;
 
        /* Count the number of records, and write that value first */
-       for (rec = record, id = count = 0; id < BOOTSTAGE_ID_COUNT;
-                       id++, rec++) {
-               if (rec->time_us != 0)
+       for (rec = data->record, i = count = 0; i < data->rec_count;
+            i++, rec++) {
+               if (rec->id != 0)
                        count++;
        }
        hdr->count = count;
@@ -360,89 +389,88 @@ int bootstage_stash(void *base, int size)
        ptr += sizeof(*hdr);
 
        /* Write the records, silently stopping when we run out of space */
-       for (rec = record, id = 0; id < BOOTSTAGE_ID_COUNT; id++, rec++) {
-               if (rec->time_us != 0)
-                       append_data(&ptr, end, rec, sizeof(*rec));
+       for (rec = data->record, i = 0; i < data->rec_count; i++, rec++) {
+               append_data(&ptr, end, rec, sizeof(*rec));
        }
 
        /* Write the name strings */
-       for (rec = record, id = 0; id < BOOTSTAGE_ID_COUNT; id++, rec++) {
-               if (rec->time_us != 0) {
-                       const char *name;
+       for (rec = data->record, i = 0; i < data->rec_count; i++, rec++) {
+               const char *name;
 
-                       name = get_record_name(buf, sizeof(buf), rec);
-                       append_data(&ptr, end, name, strlen(name) + 1);
-               }
+               name = get_record_name(buf, sizeof(buf), rec);
+               append_data(&ptr, end, name, strlen(name) + 1);
        }
 
        /* Check for buffer overflow */
        if (ptr > end) {
                debug("%s: Not enough space for bootstage stash\n", __func__);
-               return -1;
+               return -ENOSPC;
        }
 
        /* Update total data size */
        hdr->size = ptr - (char *)base;
-       printf("Stashed %d records\n", hdr->count);
+       debug("Stashed %d records\n", hdr->count);
 
        return 0;
 }
 
-int bootstage_unstash(void *base, int size)
+int bootstage_unstash(const void *base, int size)
 {
-       struct bootstage_hdr *hdr = (struct bootstage_hdr *)base;
+       const struct bootstage_hdr *hdr = (struct bootstage_hdr *)base;
+       struct bootstage_data *data = gd->bootstage;
+       const char *ptr = base, *end = ptr + size;
        struct bootstage_record *rec;
-       char *ptr = base, *end = ptr + size;
        uint rec_size;
-       int id;
+       int i;
 
        if (size == -1)
                end = (char *)(~(uintptr_t)0);
 
        if (hdr + 1 > (struct bootstage_hdr *)end) {
                debug("%s: Not enough space for bootstage hdr\n", __func__);
-               return -1;
+               return -EPERM;
        }
 
        if (hdr->magic != BOOTSTAGE_MAGIC) {
                debug("%s: Invalid bootstage magic\n", __func__);
-               return -1;
+               return -ENOENT;
        }
 
        if (ptr + hdr->size > end) {
                debug("%s: Bootstage data runs past buffer end\n", __func__);
-               return -1;
+               return -ENOSPC;
        }
 
        if (hdr->count * sizeof(*rec) > hdr->size) {
                debug("%s: Bootstage has %d records needing %lu bytes, but "
                        "only %d bytes is available\n", __func__, hdr->count,
                      (ulong)hdr->count * sizeof(*rec), hdr->size);
-               return -1;
+               return -ENOSPC;
        }
 
        if (hdr->version != BOOTSTAGE_VERSION) {
                debug("%s: Bootstage data version %#0x unrecognised\n",
                      __func__, hdr->version);
-               return -1;
+               return -EINVAL;
        }
 
-       if (next_id + hdr->count > BOOTSTAGE_ID_COUNT) {
+       if (data->rec_count + hdr->count > RECORD_COUNT) {
                debug("%s: Bootstage has %d records, we have space for %d\n"
                        "- please increase CONFIG_BOOTSTAGE_USER_COUNT\n",
-                     __func__, hdr->count, BOOTSTAGE_ID_COUNT - next_id);
-               return -1;
+                     __func__, hdr->count, RECORD_COUNT - data->rec_count);
+               return -ENOSPC;
        }
 
        ptr += sizeof(*hdr);
 
        /* Read the records */
-       rec_size = hdr->count * sizeof(*record);
-       memcpy(record + next_id, ptr, rec_size);
+       rec_size = hdr->count * sizeof(*data->record);
+       memcpy(data->record + data->rec_count, ptr, rec_size);
 
        /* Read the name strings */
        ptr += rec_size;
-       for (rec = record + next_id, id = 0; id < hdr->count; id++, rec++) {
+       for (rec = data->record + data->next_id, i = 0; i < hdr->count;
+            i++, rec++) {
                rec->name = ptr;
 
                /* Assume no data corruption here */
@@ -450,8 +478,31 @@ int bootstage_unstash(void *base, int size)
        }
 
        /* Mark the records as read */
-       next_id += hdr->count;
-       printf("Unstashed %d records\n", hdr->count);
+       data->rec_count += hdr->count;
+       debug("Unstashed %d records\n", hdr->count);
+
+       return 0;
+}
+
+int bootstage_get_size(void)
+{
+       return sizeof(struct bootstage_data);
+}
+
+int bootstage_init(bool first)
+{
+       struct bootstage_data *data;
+       int size = sizeof(struct bootstage_data);
+
+       gd->bootstage = (struct bootstage_data *)malloc(size);
+       if (!gd->bootstage)
+               return -ENOMEM;
+       data = gd->bootstage;
+       memset(data, '\0', size);
+       if (first) {
+               data->next_id = BOOTSTAGE_ID_USER;
+               bootstage_add_record(BOOTSTAGE_ID_AWAKE, "reset", 0, 0);
+       }
 
        return 0;
 }
index adc680e95938b7bb6b213f7c691e7de3cad69d1e..fc1e8b391c3cc22a93c1be371252f5c4cafd3171 100644 (file)
@@ -1,6 +1,6 @@
 #include <common.h>
 
-#ifdef CONFIG_SANDBOX
+#if defined(CONFIG_UNIT_TEST)
 #define DEBUG
 #endif
 
index eabb2d02ec44be51d19221ebd2ab50a73318ce21..732690cbc3a6b31b3b1004c6b660958168015262 100644 (file)
@@ -16,8 +16,9 @@ config SPL
        help
          If you want to build SPL as well as the normal image, say Y.
 
+if SPL
+
 config SPL_BOARD_INIT
-       depends on SPL
        bool "Call board-specific initialization in SPL"
        help
          If this option is enabled, U-Boot will call the function
@@ -26,7 +27,6 @@ config SPL_BOARD_INIT
 
 config SPL_RAW_IMAGE_SUPPORT
        bool "Support SPL loading and booting of RAW images"
-       depends on SPL
        default n if (ARCH_MX6 && (SPL_MMC_SUPPORT || SPL_SATA_SUPPORT))
        default y if !TI_SECURE_DEVICE
        help
@@ -44,7 +44,6 @@ config SPL_LEGACY_IMAGE_SUPPORT
 
 config SPL_SYS_MALLOC_SIMPLE
        bool
-       depends on SPL
        prompt "Only use malloc_simple functions in the SPL"
        help
          Say Y here to only use the *_simple malloc functions from
@@ -53,7 +52,6 @@ config SPL_SYS_MALLOC_SIMPLE
          usage as the *_simple malloc functions do not re-use free-ed mem.
 
 config SPL_STACK_R
-       depends on SPL
        bool "Enable SDRAM location for SPL stack"
        help
          SPL starts off execution in SRAM and thus typically has only a small
@@ -81,7 +79,6 @@ config SPL_STACK_R_MALLOC_SIMPLE_LEN
          SRAM which is limited to SYS_MALLOC_F_LEN bytes.
 
 config SPL_SEPARATE_BSS
-       depends on SPL
        bool "BSS section is in a different memory region from text"
        help
          Some platforms need a large BSS region in SPL and can provide this
@@ -91,7 +88,6 @@ config SPL_SEPARATE_BSS
          but with this option enabled, it goes at _image_binary_end.
 
 config SPL_DISPLAY_PRINT
-       depends on SPL
        bool "Display a board-specific message in SPL"
        help
          If this option is enabled, U-Boot will call the function
@@ -101,7 +97,6 @@ config SPL_DISPLAY_PRINT
 
 config SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR
        bool "MMC raw mode: by sector"
-       depends on SPL
        default y if ARCH_SUNXI || ARCH_DAVINCI || ARCH_UNIPHIER ||ARCH_MX6 || \
                     ARCH_ROCKCHIP || ARCH_MVEBU ||  ARCH_SOCFPGA || \
                     ARCH_AT91 || ARCH_ZYNQ || ARCH_KEYSTONE || OMAP34XX || \
@@ -112,7 +107,7 @@ config SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR
 
 config SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR
        hex "Address on the MMC to load U-Boot from"
-       depends on SPL && SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR
+       depends on SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR
        default 0x50 if ARCH_SUNXI
        default 0x75 if ARCH_DAVINCI
        default 0x8a if ARCH_MX6
@@ -127,13 +122,12 @@ config SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR
 
 config SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION
        bool "MMC Raw mode: by partition"
-       depends on SPL
        help
          Use a partition for loading U-Boot when using MMC/SD in raw mode.
 
 config SYS_MMCSD_RAW_MODE_U_BOOT_PARTITION
        hex "Partition to use to load U-Boot from"
-       depends on SPL && SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION
+       depends on SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION
        default 1
        help
          Partition on the MMC to load U-Boot from when the MMC is being
@@ -141,8 +135,7 @@ config SYS_MMCSD_RAW_MODE_U_BOOT_PARTITION
 
 config SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION_TYPE
        bool "MMC raw mode: by partition type"
-       depends on SPL && DOS_PARTITION && \
-               SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION
+       depends on DOS_PARTITION && SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION
        help
          Use partition type for specifying U-Boot partition on MMC/SD in
          raw mode. U-Boot will be loaded from the first partition of this
@@ -150,18 +143,11 @@ config SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION_TYPE
 
 config SYS_MMCSD_RAW_MODE_U_BOOT_PARTITION_TYPE
        hex "Partition Type on the MMC to load U-Boot from"
-       depends on SPL && SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION_TYPE
+       depends on SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION_TYPE
        help
          Partition Type on the MMC to load U-Boot from, when the MMC is being
          used in raw mode.
 
-config TPL
-       bool
-       depends on SPL && SUPPORT_TPL
-       prompt "Enable TPL"
-       help
-         If you want to build TPL as well as the normal image and SPL, say Y.
-
 config SPL_CRC32_SUPPORT
        bool "Support CRC32"
        depends on SPL_FIT
@@ -212,7 +198,6 @@ config SPL_SHA256_SUPPORT
 
 config SPL_CPU_SUPPORT
        bool "Support CPU drivers"
-       depends on SPL
        help
          Enable this to support CPU drivers in SPL. These drivers can set
          up CPUs and provide information about them such as the model and
@@ -222,7 +207,6 @@ config SPL_CPU_SUPPORT
 
 config SPL_CRYPTO_SUPPORT
        bool "Support crypto drivers"
-       depends on SPL
        help
          Enable crypto drivers in SPL. These drivers can be used to
          accelerate secure boot processing in secure applications. Enable
@@ -233,7 +217,6 @@ config SPL_HASH_SUPPORT
        bool "Support hashing drivers"
        select SHA1
        select SHA256
-       depends on SPL
        help
          Enable hashing drivers in SPL. These drivers can be used to
          accelerate secure boot processing in secure applications. Enable
@@ -242,7 +225,6 @@ config SPL_HASH_SUPPORT
 
 config SPL_DMA_SUPPORT
        bool "Support DMA drivers"
-       depends on SPL
        help
          Enable DMA (direct-memory-access) drivers in SPL. These drivers
          can be used to handle memory-to-peripheral data transfer without
@@ -251,7 +233,6 @@ config SPL_DMA_SUPPORT
 
 config SPL_DRIVERS_MISC_SUPPORT
        bool "Support misc drivers"
-       depends on SPL
        help
          Enable miscellaneous drivers in SPL. These drivers perform various
          tasks that don't fall nicely into other categories, Enable this
@@ -260,7 +241,6 @@ config SPL_DRIVERS_MISC_SUPPORT
 
 config SPL_ENV_SUPPORT
        bool "Support an environment"
-       depends on SPL
        help
          Enable environment support in SPL. The U-Boot environment provides
          a number of settings (essentially name/value pairs) which can
@@ -273,7 +253,7 @@ config SPL_ENV_SUPPORT
 
 config SPL_SAVEENV
        bool "Support save environment"
-       depends on SPL && SPL_ENV_SUPPORT
+       depends on SPL_ENV_SUPPORT
        help
          Enable save environment support in SPL after setenv. By default
          the saveenv option is not provided in SPL, but some boards need
@@ -296,7 +276,6 @@ config SPL_ETH_SUPPORT
 
 config SPL_EXT_SUPPORT
        bool "Support EXT filesystems"
-       depends on SPL
        help
          Enable support for EXT2/3/4 filesystems with SPL. This permits
          U-Boot (or Linux in Falcon mode) to be loaded from an EXT
@@ -305,7 +284,7 @@ config SPL_EXT_SUPPORT
 
 config SPL_FAT_SUPPORT
        bool "Support FAT filesystems"
-       depends on SPL
+       select FS_FAT
        help
          Enable support for FAT and VFAT filesystems with SPL. This
          permits U-Boot (or Linux in Falcon mode) to be loaded from a FAT
@@ -314,7 +293,6 @@ config SPL_FAT_SUPPORT
 
 config SPL_FPGA_SUPPORT
        bool "Support FPGAs"
-       depends on SPL
        help
          Enable support for FPGAs in SPL. Field-programmable Gate Arrays
          provide software-configurable hardware which is typically used to
@@ -326,7 +304,6 @@ config SPL_FPGA_SUPPORT
 
 config SPL_GPIO_SUPPORT
        bool "Support GPIO"
-       depends on SPL
        help
          Enable support for GPIOs (General-purpose Input/Output) in SPL.
          GPIOs allow U-Boot to read the state of an input line (high or
@@ -338,7 +315,6 @@ config SPL_GPIO_SUPPORT
 
 config SPL_I2C_SUPPORT
        bool "Support I2C"
-       depends on SPL
        help
          Enable support for the I2C (Inter-Integrated Circuit) bus in SPL.
          I2C works with a clock and data line which can be driven by a
@@ -352,7 +328,6 @@ config SPL_I2C_SUPPORT
 
 config SPL_LIBCOMMON_SUPPORT
        bool "Support common libraries"
-       depends on SPL
        help
          Enable support for common U-Boot libraries within SPL. These
          libraries include common code to deal with U-Boot images,
@@ -362,7 +337,6 @@ config SPL_LIBCOMMON_SUPPORT
 
 config SPL_LIBDISK_SUPPORT
        bool "Support disk paritions"
-       depends on SPL
        help
          Enable support for disk partitions within SPL. 'Disk' is something
          of a misnomer as it includes non-spinning media such as flash (as
@@ -376,7 +350,6 @@ config SPL_LIBDISK_SUPPORT
 
 config SPL_LIBGENERIC_SUPPORT
        bool "Support generic libraries"
-       depends on SPL
        help
          Enable support for generic U-Boot libraries within SPL. These
          libraries include generic code to deal with device tree, hashing,
@@ -386,7 +359,7 @@ config SPL_LIBGENERIC_SUPPORT
 
 config SPL_MMC_SUPPORT
        bool "Support MMC"
-       depends on SPL && MMC
+       depends on MMC
        help
          Enable support for MMC (Multimedia Card) within SPL. This enables
          the MMC protocol implementation and allows any enabled drivers to
@@ -397,7 +370,6 @@ config SPL_MMC_SUPPORT
 
 config SPL_MPC8XXX_INIT_DDR_SUPPORT
        bool "Support MPC8XXX DDR init"
-       depends on SPL
        help
          Enable support for DDR-SDRAM (double-data-rate synchronous dynamic
          random-access memory) on the MPC8XXX family within SPL. This
@@ -406,7 +378,6 @@ config SPL_MPC8XXX_INIT_DDR_SUPPORT
 
 config SPL_MTD_SUPPORT
        bool "Support MTD drivers"
-       depends on SPL
        help
          Enable support for MTD (Memory Technology Device) within SPL. MTD
          provides a block interface over raw NAND and can also be used with
@@ -416,7 +387,6 @@ config SPL_MTD_SUPPORT
 
 config SPL_MUSB_NEW_SUPPORT
        bool "Support new Mentor Graphics USB"
-       depends on SPL
        help
          Enable support for Mentor Graphics USB in SPL. This is a new
          driver used by some boards. Enable this option to build
@@ -425,7 +395,6 @@ config SPL_MUSB_NEW_SUPPORT
 
 config SPL_NAND_SUPPORT
        bool "Support NAND flash"
-       depends on SPL
        help
          Enable support for NAND (Negative AND) flash in SPL. NAND flash
          can be used to allow SPL to load U-Boot from supported devices.
@@ -434,7 +403,6 @@ config SPL_NAND_SUPPORT
 
 config SPL_NET_SUPPORT
        bool "Support networking"
-       depends on SPL
        help
          Enable support for network devices (such as Ethernet) in SPL.
          This permits SPL to load U-Boot over a network link rather than
@@ -455,7 +423,6 @@ endif   # if SPL_NET_SUPPORT
 
 config SPL_NO_CPU_SUPPORT
        bool "Drop CPU code in SPL"
-       depends on SPL
        help
          This is specific to the ARM926EJ-S CPU. It disables the standard
          start.S start-up code, presumably so that a replacement can be
@@ -464,7 +431,6 @@ config SPL_NO_CPU_SUPPORT
 
 config SPL_NOR_SUPPORT
        bool "Support NOR flash"
-       depends on SPL
        help
          Enable support for loading U-Boot from memory-mapped NOR (Negative
          OR) flash in SPL. NOR flash is slow to write but fast to read, and
@@ -473,7 +439,6 @@ config SPL_NOR_SUPPORT
 
 config SPL_ONENAND_SUPPORT
        bool "Support OneNAND flash"
-       depends on SPL
        help
          Enable support for OneNAND (Negative AND) flash in SPL. OneNAND is
          a type of NAND flash and therefore can be used to allow SPL to
@@ -482,7 +447,7 @@ config SPL_ONENAND_SUPPORT
 
 config SPL_OS_BOOT
        bool "Activate Falcon Mode"
-       depends on SPL && !TI_SECURE_DEVICE
+       depends on !TI_SECURE_DEVICE
        default n
        help
          Enable booting directly to an OS from SPL.
@@ -491,7 +456,7 @@ config SPL_OS_BOOT
 if SPL_OS_BOOT
 config SYS_OS_BASE
        hex "addr, where OS is found"
-       depends on SPL && SPL_NOR_SUPPORT
+       depends on SPL_NOR_SUPPORT
        help
          Specify the address, where the OS image is found, which
          gets booted.
@@ -500,7 +465,6 @@ endif # SPL_OS_BOOT
 
 config SPL_PCI_SUPPORT
        bool "Support PCI drivers"
-       depends on SPL
        help
          Enable support for PCI in SPL. For platforms that need PCI to boot,
          or must perform some init using PCI in SPL, this provides the
@@ -509,7 +473,6 @@ config SPL_PCI_SUPPORT
 
 config SPL_PCH_SUPPORT
        bool "Support PCH drivers"
-       depends on SPL
        help
          Enable support for PCH (Platform Controller Hub) devices in SPL.
          These are used to set up GPIOs and the SPI peripheral early in
@@ -518,7 +481,6 @@ config SPL_PCH_SUPPORT
 
 config SPL_POST_MEM_SUPPORT
        bool "Support POST drivers"
-       depends on SPL
        help
          Enable support for POST (Power-on Self Test) in SPL. POST is a
          procedure that checks that the hardware (CPU or board) appears to
@@ -528,7 +490,6 @@ config SPL_POST_MEM_SUPPORT
 
 config SPL_POWER_SUPPORT
        bool "Support power drivers"
-       depends on SPL
        help
          Enable support for power control in SPL. This includes support
          for PMICs (Power-management Integrated Circuits) and some of the
@@ -541,7 +502,6 @@ config SPL_POWER_SUPPORT
 
 config SPL_RAM_SUPPORT
        bool "Support booting from RAM"
-       depends on SPL
        default y if MICROBLAZE || ARCH_SOCFPGA || TEGRA || ARCH_ZYNQ
        help
          Enable booting of an image in RAM. The image can be preloaded or
@@ -558,7 +518,6 @@ config SPL_RAM_DEVICE
 
 config SPL_RTC_SUPPORT
        bool "Support RTC drivers"
-       depends on SPL
        help
          Enable RTC (Real-time Clock) support in SPL. This includes support
          for reading and setting the time. Some RTC devices also have some
@@ -568,7 +527,6 @@ config SPL_RTC_SUPPORT
 
 config SPL_SATA_SUPPORT
        bool "Support loading from SATA"
-       depends on SPL
        help
          Enable support for SATA (Serial AT attachment) in SPL. This allows
          use of SATA devices such as hard drives and flash drivers for
@@ -579,7 +537,6 @@ config SPL_SATA_SUPPORT
 
 config SPL_SERIAL_SUPPORT
        bool "Support serial"
-       depends on SPL
        help
          Enable support for serial in SPL. This allows use of a serial UART
          for displaying messages while SPL is running. It also brings in
@@ -589,7 +546,6 @@ config SPL_SERIAL_SUPPORT
 
 config SPL_SPI_FLASH_SUPPORT
        bool "Support SPI flash drivers"
-       depends on SPL
        help
          Enable support for using SPI flash in SPL, and loading U-Boot from
          SPI flash. SPI flash (Serial Peripheral Bus flash) is named after
@@ -600,7 +556,6 @@ config SPL_SPI_FLASH_SUPPORT
 
 config SPL_SPI_SUPPORT
        bool "Support SPI drivers"
-       depends on SPL
        help
          Enable support for using SPI in SPL. This is used for connecting
          to SPI flash for loading U-Boot. See SPL_SPI_FLASH_SUPPORT for
@@ -611,7 +566,6 @@ config SPL_SPI_SUPPORT
 
 config SPL_TIMER_SUPPORT
        bool "Support timer drivers"
-       depends on SPL
        help
          Enable support for timer drivers in SPL. These can be used to get
          a timer value when in SPL, or perhaps for implementing a delay
@@ -620,7 +574,6 @@ config SPL_TIMER_SUPPORT
 
 config SPL_USB_HOST_SUPPORT
        bool "Support USB host drivers"
-       depends on SPL
        help
          Enable access to USB (Universal Serial Bus) host devices so that
          SPL can load U-Boot from a connected USB peripheral, such as a USB
@@ -641,7 +594,6 @@ config SPL_USB_SUPPORT
 
 config SPL_USB_GADGET_SUPPORT
        bool "Suppport USB Gadget drivers"
-       depends on SPL
        help
          Enable USB Gadget API which allows to enable USB device functions
          in SPL.
@@ -689,7 +641,6 @@ endif
 
 config SPL_WATCHDOG_SUPPORT
        bool "Support watchdog drivers"
-       depends on SPL
        help
          Enable support for watchdog drivers in SPL. A watchdog is
          typically a hardware peripheral which can reset the system when it
@@ -698,7 +649,6 @@ config SPL_WATCHDOG_SUPPORT
 
 config SPL_YMODEM_SUPPORT
        bool "Support loading using Ymodem"
-       depends on SPL
        help
          While loading from serial is slow it can be a useful backup when
          there is no other option. The Ymodem protocol provides a reliable
@@ -707,7 +657,7 @@ config SPL_YMODEM_SUPPORT
 
 config SPL_ATF_SUPPORT
        bool "Support ARM Trusted Firmware"
-       depends on SPL && ARM64
+       depends on ARM64
        help
          ATF(ARM Trusted Firmware) is a component for ARM arch64 which which
          is loaded by SPL(which is considered as BL2 in ATF terminology).
@@ -719,71 +669,74 @@ config SPL_ATF_TEXT_BASE
        help
          This is the base address in memory for ATF BL31 text and entry point.
 
+config TPL
+       bool
+       depends on SUPPORT_TPL
+       prompt "Enable TPL"
+       help
+         If you want to build TPL as well as the normal image and SPL, say Y.
+
+if TPL
+
 config TPL_ENV_SUPPORT
        bool "Support an environment"
-       depends on TPL
        help
          Enable environment support in TPL. See SPL_ENV_SUPPORT for details.
 
 config TPL_I2C_SUPPORT
        bool "Support I2C"
-       depends on TPL
        help
          Enable support for the I2C bus in SPL. See SPL_I2C_SUPPORT for
          details.
 
 config TPL_LIBCOMMON_SUPPORT
        bool "Support common libraries"
-       depends on TPL
        help
          Enable support for common U-Boot libraries within TPL. See
          SPL_LIBCOMMON_SUPPORT for details.
 
 config TPL_LIBGENERIC_SUPPORT
        bool "Support generic libraries"
-       depends on TPL
        help
          Enable support for generic U-Boot libraries within TPL. See
          SPL_LIBGENERIC_SUPPORT for details.
 
 config TPL_MPC8XXX_INIT_DDR_SUPPORT
        bool "Support MPC8XXX DDR init"
-       depends on TPL
        help
          Enable support for DDR-SDRAM on the MPC8XXX family within TPL. See
          SPL_MPC8XXX_INIT_DDR_SUPPORT for details.
 
 config TPL_MMC_SUPPORT
        bool "Support MMC"
-       depends on TPL && MMC
+       depends on MMC
        help
          Enable support for MMC within TPL. See SPL_MMC_SUPPORT for details.
 
 config TPL_NAND_SUPPORT
        bool "Support NAND flash"
-       depends on TPL
        help
          Enable support for NAND in SPL. See SPL_NAND_SUPPORT for details.
 
 config TPL_SERIAL_SUPPORT
        bool "Support serial"
-       depends on TPL
        help
          Enable support for serial in SPL. See SPL_SERIAL_SUPPORT for
          details.
 
 config TPL_SPI_FLASH_SUPPORT
        bool "Support SPI flash drivers"
-       depends on TPL
        help
          Enable support for using SPI flash in SPL. See SPL_SPI_FLASH_SUPPORT
          for details.
 
 config TPL_SPI_SUPPORT
        bool "Support SPI drivers"
-       depends on TPL
        help
          Enable support for using SPI in SPL. See SPL_SPI_SUPPORT for
          details.
 
+endif # TPL
+
+endif # SPL
 endmenu
index 0a49766f21422c25c2756969bbc41b70b9c9c580..f493a3ad495422a31e490f9d4f12a29d4ba876b4 100644 (file)
@@ -232,6 +232,13 @@ static int spl_common_init(bool setup_malloc)
                gd->malloc_ptr = 0;
        }
 #endif
+       ret = bootstage_init(true);
+       if (ret) {
+               debug("%s: Failed to set up bootstage: ret=%d\n", __func__,
+                     ret);
+               return ret;
+       }
+       bootstage_mark_name(BOOTSTAGE_ID_START_SPL, "spl");
        if (CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA)) {
                ret = fdtdec_setup();
                if (ret) {
@@ -240,8 +247,10 @@ static int spl_common_init(bool setup_malloc)
                }
        }
        if (IS_ENABLED(CONFIG_SPL_DM)) {
+               bootstage_start(BOOTSTATE_ID_ACCUM_DM_SPL, "dm_spl");
                /* With CONFIG_SPL_OF_PLATDATA, bring in all devices */
                ret = dm_init_and_scan(!CONFIG_IS_ENABLED(OF_PLATDATA));
+               bootstage_accum(BOOTSTATE_ID_ACCUM_DM_SPL);
                if (ret) {
                        debug("dm_init_and_scan() returned error %d\n", ret);
                        return ret;
@@ -421,6 +430,15 @@ void board_init_r(gd_t *dummy1, ulong dummy2)
        }
 
        debug("loaded - jumping to U-Boot...\n");
+#ifdef CONFIG_BOOTSTAGE_STASH
+       int ret;
+
+       bootstage_mark_name(BOOTSTAGE_ID_END_SPL, "end_spl");
+       ret = bootstage_stash((void *)CONFIG_BOOTSTAGE_STASH_ADDR,
+                             CONFIG_BOOTSTAGE_STASH_SIZE);
+       if (ret)
+               debug("Failed to stash bootstage: err=%d\n", ret);
+#endif
        spl_board_prepare_for_boot();
        jump_to_image_no_args(&spl_image);
 }
index 8a51bf3d0b246a443844faa5004f1714a36e8750..d1b5b22689f2958734156eb02619525806c12512 100644 (file)
@@ -1,5 +1,6 @@
 CONFIG_ARM=y
 CONFIG_ARCH_SUNXI=y
+CONFIG_CONS_INDEX=1
 CONFIG_MACH_SUN8I_A33=y
 CONFIG_DRAM_CLK=552
 CONFIG_DRAM_ZQ=15291
index 590673b37c1e0ad25f86039f9787722c8cf1dcd7..f210cca87f44684df362708d6a8bdd78177dd358 100644 (file)
@@ -60,4 +60,5 @@ CONFIG_USB_GADGET_DOWNLOAD=y
 CONFIG_G_DNL_MANUFACTURER="Texas Instruments"
 CONFIG_G_DNL_VENDOR_NUM=0x0403
 CONFIG_G_DNL_PRODUCT_NUM=0xbd00
+CONFIG_FAT_WRITE=y
 CONFIG_OF_LIBFDT=y
index 55ed8f36540ced71ee9ba1a36ccc9af38c68b61f..31019e30a0108692c7c2a608e06acc12ee5d1cb0 100644 (file)
@@ -44,4 +44,5 @@ CONFIG_USB_GADGET_DOWNLOAD=y
 CONFIG_G_DNL_MANUFACTURER="Texas Instruments"
 CONFIG_G_DNL_VENDOR_NUM=0x0451
 CONFIG_G_DNL_PRODUCT_NUM=0xd022
+CONFIG_FAT_WRITE=y
 CONFIG_OF_LIBFDT=y
index fa468f05e7fd91d2ce04b7b7ae22b69963fee5f0..651e194ae6c3554dfe72380bca7c1cd9a3e4a124 100644 (file)
@@ -49,6 +49,7 @@ CONFIG_EFI_PARTITION=y
 CONFIG_MMC_OMAP_HS=y
 CONFIG_MTD_UBI_FASTMAP=y
 CONFIG_SYS_NS16550=y
+CONFIG_FAT_WRITE=y
 CONFIG_OF_LIBFDT=y
 CONFIG_FDT_FIXUP_PARTITIONS=y
 # CONFIG_GENERATE_SMBIOS_TABLE is not set
index 1068678a7c7480492164e3ce64d7b83bf9fb7303..ab912bbc53c406e27a7b962735dcc90a69371bde 100644 (file)
@@ -39,4 +39,5 @@ CONFIG_ISO_PARTITION=y
 # CONFIG_SPL_ISO_PARTITION is not set
 CONFIG_MMC_OMAP_HS=y
 CONFIG_SYS_NS16550=y
+CONFIG_FAT_WRITE=y
 CONFIG_OF_LIBFDT=y
index 85b24a548a7a6200db6410584f1fa6eae471a4b6..7d75c5cc7ac20cd74dbef03f125c4664d1906800 100644 (file)
@@ -39,4 +39,5 @@ CONFIG_ISO_PARTITION=y
 # CONFIG_SPL_ISO_PARTITION is not set
 CONFIG_MMC_OMAP_HS=y
 CONFIG_SYS_NS16550=y
+CONFIG_FAT_WRITE=y
 CONFIG_OF_LIBFDT=y
index 9117407065ec75dbfd856bf32f6778cd2892b8da..322a070dea8a1dca3d55706dff9ac11af5f68dc0 100644 (file)
@@ -40,4 +40,5 @@ CONFIG_ISO_PARTITION=y
 # CONFIG_SPL_ISO_PARTITION is not set
 CONFIG_MMC_OMAP_HS=y
 CONFIG_SYS_NS16550=y
+CONFIG_FAT_WRITE=y
 CONFIG_OF_LIBFDT=y
index e71e54b3f5b8b91096dad33151e11de985af45ca..c5d8dcae878ccee9ec634b8809c9b1ed0761da8d 100644 (file)
@@ -37,4 +37,5 @@ CONFIG_ISO_PARTITION=y
 # CONFIG_SPL_ISO_PARTITION is not set
 CONFIG_MMC_OMAP_HS=y
 CONFIG_SYS_NS16550=y
+CONFIG_FAT_WRITE=y
 CONFIG_OF_LIBFDT=y
index bd66fbc7b1a143fe987366630c9005c4df97ab6a..185258de082f9cf79f7c699120e654fa8b12e790 100644 (file)
@@ -39,4 +39,5 @@ CONFIG_ISO_PARTITION=y
 # CONFIG_SPL_ISO_PARTITION is not set
 CONFIG_MMC_OMAP_HS=y
 CONFIG_SYS_NS16550=y
+CONFIG_FAT_WRITE=y
 CONFIG_OF_LIBFDT=y
index bd66fbc7b1a143fe987366630c9005c4df97ab6a..185258de082f9cf79f7c699120e654fa8b12e790 100644 (file)
@@ -39,4 +39,5 @@ CONFIG_ISO_PARTITION=y
 # CONFIG_SPL_ISO_PARTITION is not set
 CONFIG_MMC_OMAP_HS=y
 CONFIG_SYS_NS16550=y
+CONFIG_FAT_WRITE=y
 CONFIG_OF_LIBFDT=y
index bae1dfec2328a942a80627e9f56952e81cd7d569..86035d2897ad0ee0849ba34da18b68dbbc9917b6 100644 (file)
@@ -37,4 +37,5 @@ CONFIG_CMD_GPIO=y
 CONFIG_CMD_EXT4_WRITE=y
 CONFIG_MMC_OMAP_HS=y
 CONFIG_SYS_NS16550=y
+CONFIG_FAT_WRITE=y
 CONFIG_OF_LIBFDT=y
index 6a307066eb91fdea7b943f651d4034289eda55e1..20874dd0bc16633b6aa2c98dbbf4d8e3d854315d 100644 (file)
@@ -58,4 +58,5 @@ CONFIG_USB_GADGET_DOWNLOAD=y
 CONFIG_G_DNL_MANUFACTURER="Texas Instruments"
 CONFIG_G_DNL_VENDOR_NUM=0x0403
 CONFIG_G_DNL_PRODUCT_NUM=0xbd00
+CONFIG_FAT_WRITE=y
 CONFIG_OF_LIBFDT=y
index 84766e86748d7a3b713ad03346aa4845cbedbad0..c0d0bcc66898260533f5cd46a88a7c3eff5dc90f 100644 (file)
@@ -55,4 +55,5 @@ CONFIG_USB_GADGET_DOWNLOAD=y
 CONFIG_G_DNL_MANUFACTURER="Texas Instruments"
 CONFIG_G_DNL_VENDOR_NUM=0x0403
 CONFIG_G_DNL_PRODUCT_NUM=0xbd00
+CONFIG_FAT_WRITE=y
 CONFIG_OF_LIBFDT=y
index a98a97fa427c628cb0d565959e9c2fb7e83dad82..870ed0fb24abc3e186f5442b8338f16e039052bf 100644 (file)
@@ -72,3 +72,4 @@ CONFIG_USB_GADGET_DOWNLOAD=y
 CONFIG_G_DNL_MANUFACTURER="Texas Instruments"
 CONFIG_G_DNL_VENDOR_NUM=0x0403
 CONFIG_G_DNL_PRODUCT_NUM=0xbd00
+CONFIG_FAT_WRITE=y
index 33e7f91e434d803e024509c470d466f3b148285f..6048e6c9112ea66b0b36ef65c0b75c0987590ded 100644 (file)
@@ -62,4 +62,5 @@ CONFIG_USB_GADGET_DOWNLOAD=y
 CONFIG_G_DNL_MANUFACTURER="Texas Instruments"
 CONFIG_G_DNL_VENDOR_NUM=0x0451
 CONFIG_G_DNL_PRODUCT_NUM=0xd022
+CONFIG_FAT_WRITE=y
 CONFIG_OF_LIBFDT=y
index c712cf91dfe85110f39ab0d523324d82158f11cf..d171cf075468653e60db2fa6387b7df4d90072cc 100644 (file)
@@ -49,6 +49,7 @@ CONFIG_USB_GADGET_DOWNLOAD=y
 CONFIG_G_DNL_MANUFACTURER="Toradex"
 CONFIG_G_DNL_VENDOR_NUM=0x1b67
 CONFIG_G_DNL_PRODUCT_NUM=0x4000
+CONFIG_FAT_WRITE=y
 CONFIG_OF_LIBFDT=y
 CONFIG_OF_LIBFDT_OVERLAY=y
 # CONFIG_EFI_LOADER is not set
index f5f4e3de7f4aaed682e804923f3384320bfca8a5..6611c4306daf05b02e44c38b34e7ff3b33ac17d4 100644 (file)
@@ -42,5 +42,6 @@ CONFIG_USB_GADGET_DOWNLOAD=y
 CONFIG_G_DNL_MANUFACTURER="Toradex"
 CONFIG_G_DNL_VENDOR_NUM=0x1b67
 CONFIG_G_DNL_PRODUCT_NUM=0x4020
+CONFIG_FAT_WRITE=y
 CONFIG_OF_LIBFDT=y
 # CONFIG_EFI_LOADER is not set
index 0de47fe360f40e6c49b025a405897358810ffa4f..dba0a7c6700269dc103ac7c0ac8c6990ec3d0dbf 100644 (file)
@@ -42,5 +42,6 @@ CONFIG_USB_GADGET_DOWNLOAD=y
 CONFIG_G_DNL_MANUFACTURER="Toradex"
 CONFIG_G_DNL_VENDOR_NUM=0x1b67
 CONFIG_G_DNL_PRODUCT_NUM=0x4020
+CONFIG_FAT_WRITE=y
 CONFIG_OF_LIBFDT=y
 # CONFIG_EFI_LOADER is not set
index 18b6ddf7cff968125485d9d394f6d9675e9f73de..d8ba087d38dffa7105bfdf464fb60025c49099b0 100644 (file)
@@ -49,3 +49,4 @@ CONFIG_DM_USB=y
 CONFIG_USB_EHCI_HCD=y
 CONFIG_USB_STORAGE=y
 CONFIG_LCD=y
+CONFIG_FAT_WRITE=y
index e7e8a014c6e4aebd58030c2ef3776f05dd10d166..d13eed0c15a6831877b10d02c8b3d16b571d45fa 100644 (file)
@@ -48,3 +48,4 @@ CONFIG_USB=y
 CONFIG_DM_USB=y
 CONFIG_USB_STORAGE=y
 CONFIG_LCD=y
+CONFIG_FAT_WRITE=y
index 9a40c41f361ab89c41525f94a8497bc73fd1a11d..edf98810bf0bfdb2ec349c88feb184e918a5dbfb 100644 (file)
@@ -42,3 +42,4 @@ CONFIG_DEBUG_UART_BOARD_INIT=y
 CONFIG_DEBUG_UART_ANNOUNCE=y
 CONFIG_ATMEL_USART=y
 CONFIG_LCD=y
+CONFIG_FAT_WRITE=y
index ddeeeefa1ea56924eb10c1284f49a9511b6a487d..fbe11ef6cdeddb8b1f398c10ba493b2809634b81 100644 (file)
@@ -54,3 +54,4 @@ CONFIG_DM_USB=y
 CONFIG_USB_EHCI_HCD=y
 CONFIG_USB_STORAGE=y
 CONFIG_LCD=y
+CONFIG_FAT_WRITE=y
diff --git a/configs/bananapi_m64_defconfig b/configs/bananapi_m64_defconfig
new file mode 100644 (file)
index 0000000..3908d42
--- /dev/null
@@ -0,0 +1,17 @@
+CONFIG_ARM=y
+CONFIG_ARCH_SUNXI=y
+CONFIG_MACH_SUN50I=y
+CONFIG_RESERVE_ALLWINNER_BOOT0_HEADER=y
+CONFIG_MMC0_CD_PIN="PH13"
+CONFIG_MMC_SUNXI_SLOT_EXTRA=2
+CONFIG_DEFAULT_DEVICE_TREE="sun50i-a64-bananapi-m64"
+# CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set
+CONFIG_SPL=y
+# CONFIG_CMD_IMLS is not set
+# CONFIG_CMD_FLASH is not set
+# CONFIG_CMD_FPGA is not set
+# CONFIG_SPL_DOS_PARTITION is not set
+# CONFIG_SPL_ISO_PARTITION is not set
+# CONFIG_SPL_EFI_PARTITION is not set
+CONFIG_SUN8I_EMAC=y
+CONFIG_USB_EHCI_HCD=y
index 67e18b6268091f3d32fadc9fe6e3e0e75995abbc..62e50b63f41403ef6aa5a5f5ef21341173b1a0d8 100644 (file)
@@ -19,6 +19,7 @@ CONFIG_HASH_VERIFY=y
 CONFIG_CMD_FAT=y
 # CONFIG_MMC is not set
 CONFIG_SYS_NS16550=y
+CONFIG_FAT_WRITE=y
 CONFIG_SHA1=y
 CONFIG_SHA256=y
 CONFIG_OF_LIBFDT=y
index 7811273e92b16bec6414fe3aa9f948f651f6b1ee..d866b6014f6c69cf9a2ee93c824162be16bdd097 100644 (file)
@@ -63,4 +63,5 @@ CONFIG_USB_GADGET_DOWNLOAD=y
 CONFIG_G_DNL_MANUFACTURER="Texas Instruments"
 CONFIG_G_DNL_VENDOR_NUM=0x0451
 CONFIG_G_DNL_PRODUCT_NUM=0xd022
+CONFIG_FAT_WRITE=y
 CONFIG_OF_LIBFDT=y
index 1765ec4fa95d7a36ac263346283b092fa75ee78a..ef73fbfde16cfc052edfed24328ec744a4a2579e 100644 (file)
@@ -54,6 +54,7 @@ CONFIG_MMC_OMAP_HS=y
 CONFIG_SPI_FLASH=y
 CONFIG_SPI_FLASH_WINBOND=y
 CONFIG_SYS_NS16550=y
+CONFIG_FAT_WRITE=y
 CONFIG_USB=y
 CONFIG_USB_MUSB_HOST=y
 CONFIG_USB_MUSB_GADGET=y
index 1bdbf90495972bd74c4764269b936a021b9e9f5c..356622319071d1730847f9e950645630455bbbea 100644 (file)
@@ -58,4 +58,5 @@ CONFIG_USB_STORAGE=y
 CONFIG_SYS_WHITE_ON_BLACK=y
 CONFIG_LCD=y
 CONFIG_OMAP_WATCHDOG=y
+CONFIG_FAT_WRITE=y
 CONFIG_OF_LIBFDT=y
index ed7432d7f42d330f7b067ccc74adc0c561c66301..f07a46b78ff8be5b037aaab7ac4332310a913031 100644 (file)
@@ -58,4 +58,5 @@ CONFIG_USB_STORAGE=y
 CONFIG_SYS_WHITE_ON_BLACK=y
 CONFIG_LCD=y
 CONFIG_OMAP_WATCHDOG=y
+CONFIG_FAT_WRITE=y
 CONFIG_OF_LIBFDT=y
index 02b5ff60e21de25bdd174674f43a68c3c2f05553..333e2043107fb71f0e7cb66867b2a7892b20a52e 100644 (file)
@@ -66,4 +66,5 @@ CONFIG_USB_STORAGE=y
 CONFIG_SYS_WHITE_ON_BLACK=y
 CONFIG_LCD=y
 CONFIG_OMAP_WATCHDOG=y
+CONFIG_FAT_WRITE=y
 CONFIG_OF_LIBFDT=y
index 940793b5a672166499e9e7c6cbcc0239e2479294..f558886067e5b3839415316acb7335f221548c46 100644 (file)
@@ -57,5 +57,6 @@ CONFIG_USB_MUSB_HOST=y
 CONFIG_USB_STORAGE=y
 CONFIG_SYS_WHITE_ON_BLACK=y
 CONFIG_LCD=y
+CONFIG_FAT_WRITE=y
 CONFIG_OF_LIBFDT=y
 # CONFIG_EFI_LOADER is not set
index da28e13d6ba72a9fdc0e89d4f2883171a96f912c..d96a71a8280a86bcb0228037602fbe614ea09425 100644 (file)
@@ -34,4 +34,5 @@ CONFIG_ISO_PARTITION=y
 CONFIG_EFI_PARTITION=y
 CONFIG_MMC_OMAP_HS=y
 CONFIG_SYS_NS16550=y
+CONFIG_FAT_WRITE=y
 CONFIG_OF_LIBFDT=y
index 2f4c694a0aa25fdac8a5dffd5d426c3bfd4736f1..579df941d43f6fe1297b9d51270fbb38f6bfb946 100644 (file)
@@ -41,4 +41,5 @@ CONFIG_SYS_NS16550=y
 CONFIG_USB=y
 CONFIG_USB_MUSB_HOST=y
 CONFIG_USB_STORAGE=y
+CONFIG_FAT_WRITE=y
 CONFIG_OF_LIBFDT=y
index ef760337797a4e3c3108199c4b08e1147911f593..bf753bc074bd74583397ad9281ea1ca27c57b6bf 100644 (file)
@@ -5,7 +5,9 @@ CONFIG_TARGET_CL_SOM_AM57X=y
 # CONFIG_SPL_NAND_SUPPORT is not set
 CONFIG_VERSION_VARIABLE=y
 CONFIG_SPL=y
+# CONFIG_SPL_EXT_SUPPORT is not set
 CONFIG_HUSH_PARSER=y
+CONFIG_SYS_PROMPT="U-Boot# "
 CONFIG_CMD_BOOTZ=y
 # CONFIG_CMD_IMLS is not set
 CONFIG_CMD_ASKENV=y
@@ -53,4 +55,5 @@ CONFIG_USB=y
 CONFIG_USB_XHCI_HCD=y
 CONFIG_USB_XHCI_DWC3=y
 CONFIG_USB_STORAGE=y
+CONFIG_FAT_WRITE=y
 CONFIG_OF_LIBFDT=y
index dbb1c3b88675d6e85369bcb2088bc7bf2eb7ce25..876e3320b741407638b7b04d53ede729042f4650 100644 (file)
@@ -50,4 +50,5 @@ CONFIG_LED_STATUS_BOOT_ENABLE=y
 CONFIG_LED_STATUS_BOOT=0
 CONFIG_MMC_OMAP_HS=y
 CONFIG_SYS_NS16550=y
+CONFIG_FAT_WRITE=y
 CONFIG_OF_LIBFDT=y
index bec96aec98ba1e0dcf204a9e672f7bf8997a6e9b..d813cc54fb3ed7f6f19422424d4459ed37fe7765 100644 (file)
@@ -68,4 +68,5 @@ CONFIG_USB=y
 CONFIG_USB_XHCI_HCD=y
 CONFIG_USB_XHCI_DWC3=y
 CONFIG_USB_STORAGE=y
+CONFIG_FAT_WRITE=y
 CONFIG_OF_LIBFDT=y
index eef2f89dc306b95a7fc1cd2a0c75962c012b2d36..ec26f999bac25a893806865d306a38c239707d1d 100644 (file)
@@ -43,4 +43,5 @@ CONFIG_SYS_NS16550=y
 CONFIG_USB=y
 CONFIG_USB_EHCI_HCD=y
 CONFIG_USB_STORAGE=y
+CONFIG_FAT_WRITE=y
 CONFIG_OF_LIBFDT=y
index fcb7c537970102ae49f065142b498f4b99d932f4..d8307b0836efbf9324287440643960aaa9073116 100644 (file)
@@ -49,6 +49,7 @@ CONFIG_USB_GADGET_DOWNLOAD=y
 CONFIG_G_DNL_MANUFACTURER="Toradex"
 CONFIG_G_DNL_VENDOR_NUM=0x1b67
 CONFIG_G_DNL_PRODUCT_NUM=0x4000
+CONFIG_FAT_WRITE=y
 CONFIG_OF_LIBFDT=y
 CONFIG_OF_LIBFDT_OVERLAY=y
 # CONFIG_EFI_LOADER is not set
index fbf9306eeb167db7abc5ae1270013b11029304e8..df24f17b2d5c34150cf4c5de96d51d40bb4e67f0 100644 (file)
@@ -42,5 +42,6 @@ CONFIG_USB_GADGET_DOWNLOAD=y
 CONFIG_G_DNL_MANUFACTURER="Toradex"
 CONFIG_G_DNL_VENDOR_NUM=0x1b67
 CONFIG_G_DNL_PRODUCT_NUM=0x4000
+CONFIG_FAT_WRITE=y
 CONFIG_OF_LIBFDT=y
 # CONFIG_EFI_LOADER is not set
index 46ac56797fae00abb34afc27c41599ab9c432cf2..d8f373b492b3dc5a83fccc7ec0f3bf5bce97a630 100644 (file)
@@ -12,7 +12,7 @@ CONFIG_CMD_USB=y
 CONFIG_CMD_DHCP=y
 CONFIG_CMD_PING=y
 CONFIG_CMD_DATE=y
-CONFIG_DOS_PARTITION=y
+CONFIG_CMD_FAT=y
 CONFIG_ISO_PARTITION=y
 # CONFIG_MMC is not set
 CONFIG_SPI_FLASH=y
index 9e0ac20985c4e2b4d571358bd8f634090b44a593..b945875adf5ee5700a1252f6959d8a5dfdeccad2 100644 (file)
@@ -28,4 +28,5 @@ CONFIG_SYS_NS16550=y
 CONFIG_USB=y
 CONFIG_USB_EHCI_HCD=y
 CONFIG_USB_STORAGE=y
+CONFIG_FAT_WRITE=y
 CONFIG_OF_LIBFDT=y
index 2c6f52494a08708689e3c7bde5dc161e973fcb71..d43fd14a8a1649d0816fff6bb3442a5cbcd18e1e 100644 (file)
@@ -18,6 +18,7 @@ CONFIG_CMD_PART=y
 CONFIG_CMD_GPIO=y
 # CONFIG_CMD_SOURCE is not set
 # CONFIG_CMD_SETEXPR is not set
+CONFIG_CMD_FAT=y
 CONFIG_OF_CONTROL=y
 CONFIG_USB=y
 CONFIG_USB_EHCI_HCD=y
index b112be2ef505876731ff3fe2e36a34944dbacfe5..5981d2f530abf2332bd70229812b9a4c05529a81 100644 (file)
@@ -16,3 +16,4 @@ CONFIG_MMC_DW=y
 CONFIG_MMC_DW_K3=y
 CONFIG_USB=y
 CONFIG_USB_STORAGE=y
+CONFIG_FAT_WRITE=y
index c81dfdfbdb8e0945e3375af79af88d6454475045..6e0a5e9812b8da54e92a12ee873d9677395397d5 100644 (file)
@@ -47,5 +47,6 @@ CONFIG_LED_STATUS_BOOT_ENABLE=y
 CONFIG_LED_STATUS_BOOT=0
 CONFIG_MMC_OMAP_HS=y
 CONFIG_SYS_NS16550=y
+CONFIG_FAT_WRITE=y
 CONFIG_OF_LIBFDT=y
 CONFIG_FDT_FIXUP_PARTITIONS=y
index 9098451d84c0482d7d4f69778da8e5bf1f67bb1a..5908a356292a7dedc0ca7ea9cbbba0221ad00e30 100644 (file)
@@ -36,5 +36,6 @@ CONFIG_LED_STATUS_BOOT_ENABLE=y
 CONFIG_LED_STATUS_BOOT=0
 CONFIG_MMC_OMAP_HS=y
 CONFIG_SYS_NS16550=y
+CONFIG_FAT_WRITE=y
 CONFIG_OF_LIBFDT=y
 CONFIG_FDT_FIXUP_PARTITIONS=y
index 56be1a1b23166b12d11461fce3879ca6671786e7..53399e7523b1f48a3b2c2ea464b4317a33ef1386 100644 (file)
@@ -28,5 +28,6 @@ CONFIG_CMD_UBI=y
 CONFIG_NET_RANDOM_ETHADDR=y
 CONFIG_MMC_OMAP_HS=y
 CONFIG_SYS_NS16550=y
+CONFIG_FAT_WRITE=y
 CONFIG_OF_LIBFDT=y
 CONFIG_FDT_FIXUP_PARTITIONS=y
index bc3e5d90918fb4604cf3c16f3c9e4ad2f41fa0f3..a884e5a10c9e3aab0bcd677c2b20d69ad19a5d41 100644 (file)
@@ -13,4 +13,5 @@ CONFIG_CMD_PING=y
 CONFIG_CMD_FAT=y
 # CONFIG_MMC is not set
 CONFIG_MTD_NOR_FLASH=y
+# CONFIG_FAT_WRITE is not set
 CONFIG_OF_LIBFDT=y
index 3deda487ce08b7bdcf1896022fb6b565f63e0e34..3628367df002dfcf5781f78c62b22a74f6578cfb 100644 (file)
@@ -4,7 +4,7 @@ CONFIG_DEFAULT_DEVICE_TREE="ls1021a-iot-duart"
 CONFIG_SYS_EXTRA_OPTIONS="QSPI_BOOT"
 CONFIG_BOARD_EARLY_INIT_F=y
 CONFIG_CMD_GPT=y
-CONFIG_DOS_PARTITION=y
+CONFIG_CMD_FAT=y
 CONFIG_OF_CONTROL=y
 CONFIG_DM=y
 CONFIG_FSL_CAAM=y
index 089ea343348c43ae06c1a30dc29c2678ede0f8a7..e4120243493bb490066178d43ad8b0c2f7e10e37 100644 (file)
@@ -7,7 +7,7 @@ CONFIG_SPL=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0xe8
 CONFIG_CMD_GPT=y
-CONFIG_DOS_PARTITION=y
+CONFIG_CMD_FAT=y
 # CONFIG_SPL_EFI_PARTITION is not set
 CONFIG_OF_CONTROL=y
 CONFIG_DM=y
index 329dd3b0d55b44aaec8b8aab0e2b1f9c4c3e6530..ea674c8b2ced68b2e8c7e035f475d35bbafc0361 100644 (file)
@@ -3,6 +3,7 @@ CONFIG_TARGET_LS1043ARDB=y
 CONFIG_SPL_LIBCOMMON_SUPPORT=y
 CONFIG_SPL_LIBGENERIC_SUPPORT=y
 CONFIG_FSL_LS_PPA=y
+CONFIG_SPL_FSL_LS_PPA=y
 CONFIG_SPL_MMC_SUPPORT=y
 CONFIG_SPL_SERIAL_SUPPORT=y
 CONFIG_SPL_DRIVERS_MISC_SUPPORT=y
index cdcc25d8f91b718445a236e787fb5f3f89cbb415..a3c60651ece6c65e2566a1eb1545f1423e2f6589 100644 (file)
@@ -8,6 +8,7 @@ CONFIG_SYS_EXTRA_OPTIONS="RAMBOOT_PBL,SPL_FSL_PBL"
 CONFIG_NAND_BOOT=y
 CONFIG_BOOTDELAY=10
 CONFIG_SPL=y
+CONFIG_SPL_BOARD_INIT=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x110
 CONFIG_HUSH_PARSER=y
index a35e1be5bed07402f68c3010b7479f8c70d9ad4f..19b80777fbad750f9c49bad82a18c8061ed3f640 100644 (file)
@@ -8,6 +8,7 @@ CONFIG_SYS_EXTRA_OPTIONS="RAMBOOT_PBL,SPL_FSL_PBL"
 CONFIG_SD_BOOT=y
 CONFIG_BOOTDELAY=10
 CONFIG_SPL=y
+CONFIG_SPL_BOARD_INIT=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x110
 CONFIG_HUSH_PARSER=y
index 922f202863a66ec0fbc7807961322132e56dd553..e49de18746b0d273b84c6f11201a2bebb72807ab 100644 (file)
@@ -8,6 +8,7 @@ CONFIG_SYS_EXTRA_OPTIONS="RAMBOOT_PBL,SPL_FSL_PBL,SD_BOOT_QSPI"
 CONFIG_SD_BOOT=y
 CONFIG_BOOTDELAY=10
 CONFIG_SPL=y
+CONFIG_SPL_BOARD_INIT=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x110
 CONFIG_HUSH_PARSER=y
index 94bd8a52e130660e1a84a86489ce406e8654fc18..c50931a3391e6784dc4c97552ac7aa02072caa9a 100644 (file)
@@ -8,6 +8,7 @@ CONFIG_SYS_EXTRA_OPTIONS="RAMBOOT_PBL,SPL_FSL_PBL,EMMC_BOOT"
 CONFIG_SD_BOOT=y
 CONFIG_BOOTDELAY=10
 CONFIG_SPL=y
+CONFIG_SPL_BOARD_INIT=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x110
 CONFIG_HUSH_PARSER=y
index 5162c2cadc30a204032ca35265d0d12ef193e750..1cd19edec578565be60f28a031b1bc20760bd7c7 100644 (file)
@@ -9,6 +9,7 @@ CONFIG_SYS_EXTRA_OPTIONS="RAMBOOT_PBL,SPL_FSL_PBL"
 CONFIG_SD_BOOT=y
 CONFIG_BOOTDELAY=10
 CONFIG_SPL=y
+CONFIG_SPL_BOARD_INIT=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x110
 CONFIG_SPL_CRYPTO_SUPPORT=y
index d70a3870eb476fb3802f220dc8a23e9b81587814..da8c5b815bc3bbf4290e3b73111a9ab5d3b26bc5 100644 (file)
@@ -1,6 +1,7 @@
 CONFIG_ARM=y
 CONFIG_TARGET_LS1046ARDB=y
 CONFIG_FSL_LS_PPA=y
+CONFIG_SPL_FSL_LS_PPA=y
 CONFIG_DEFAULT_DEVICE_TREE="fsl-ls1046a-rdb"
 CONFIG_FIT_VERBOSE=y
 CONFIG_OF_BOARD_SETUP=y
@@ -8,6 +9,7 @@ CONFIG_SYS_EXTRA_OPTIONS="RAMBOOT_PBL,SPL_FSL_PBL"
 CONFIG_SD_BOOT=y
 CONFIG_BOOTDELAY=10
 CONFIG_SPL=y
+CONFIG_SPL_BOARD_INIT=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x110
 CONFIG_HUSH_PARSER=y
index 99df6e0818f196b506946fef5aedeb05fda89109..614660008b991626a804aef5332a4e7f1eb859fa 100644 (file)
@@ -10,6 +10,7 @@ CONFIG_FIT=y
 CONFIG_FIT_VERBOSE=y
 CONFIG_OF_BOARD_SETUP=y
 CONFIG_OF_STDOUT_VIA_ALIAS=y
+CONFIG_NAND_BOOT=y
 CONFIG_SYS_EXTRA_OPTIONS="NAND"
 CONFIG_BOOTDELAY=10
 CONFIG_SPL=y
diff --git a/configs/ls2080aqds_sdcard_defconfig b/configs/ls2080aqds_sdcard_defconfig
new file mode 100644 (file)
index 0000000..a6d2f81
--- /dev/null
@@ -0,0 +1,56 @@
+CONFIG_ARM=y
+CONFIG_TARGET_LS2080AQDS=y
+CONFIG_SPL_LIBCOMMON_SUPPORT=y
+CONFIG_SPL_LIBGENERIC_SUPPORT=y
+CONFIG_SPL_I2C_SUPPORT=y
+CONFIG_SPL_SERIAL_SUPPORT=y
+CONFIG_SPL_ENV_SUPPORT=y
+CONFIG_SPL_DRIVERS_MISC_SUPPORT=y
+CONFIG_DEFAULT_DEVICE_TREE="fsl-ls2080a-qds"
+CONFIG_FIT=y
+CONFIG_FIT_VERBOSE=y
+CONFIG_OF_BOARD_SETUP=y
+CONFIG_OF_STDOUT_VIA_ALIAS=y
+CONFIG_SYS_EXTRA_OPTIONS="SYS_FSL_DDR4"
+CONFIG_SD_BOOT=y
+CONFIG_BOOTDELAY=10
+CONFIG_SPL=y
+CONFIG_FSL_LS_PPA=y
+CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
+CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x8b0
+CONFIG_SPL_MPC8XXX_INIT_DDR_SUPPORT=y
+CONFIG_HUSH_PARSER=y
+CONFIG_CMD_GREPENV=y
+CONFIG_CMD_MMC=y
+CONFIG_CMD_SF=y
+CONFIG_CMD_I2C=y
+CONFIG_SPL_MMC_SUPPORT=y
+CONFIG_CMD_USB=y
+# CONFIG_CMD_SETEXPR is not set
+CONFIG_CMD_DHCP=y
+CONFIG_CMD_MII=y
+CONFIG_CMD_PING=y
+CONFIG_CMD_CACHE=y
+CONFIG_CMD_DATE=y
+CONFIG_CMD_EXT2=y
+CONFIG_CMD_FAT=y
+CONFIG_OF_CONTROL=y
+CONFIG_OF_EMBED=y
+CONFIG_NET_RANDOM_ETHADDR=y
+CONFIG_DM=y
+CONFIG_DM_SPI_FLASH=y
+CONFIG_NETDEVICES=y
+CONFIG_E1000=y
+CONFIG_PCI=y
+CONFIG_DM_PCI=y
+CONFIG_DM_PCI_COMPAT=y
+CONFIG_PCIE_LAYERSCAPE=y
+CONFIG_SYS_NS16550=y
+CONFIG_DM_SPI=y
+CONFIG_FSL_QSPI=y
+CONFIG_USB=y
+CONFIG_DM_USB=y
+CONFIG_USB_XHCI_HCD=y
+CONFIG_USB_XHCI_DWC3=y
+CONFIG_USB_STORAGE=y
+CONFIG_EFI_LOADER_BOUNCE_BUFFER=y
index 5ce37fdfb433d6015b34db2b6d64512f7ec563d7..5800213e41e058b19d36bbbd5645c4851710258b 100644 (file)
@@ -10,6 +10,7 @@ CONFIG_FIT=y
 CONFIG_FIT_VERBOSE=y
 CONFIG_OF_BOARD_SETUP=y
 CONFIG_OF_STDOUT_VIA_ALIAS=y
+CONFIG_NAND_BOOT=y
 CONFIG_SYS_EXTRA_OPTIONS="NAND"
 CONFIG_BOOTDELAY=10
 CONFIG_SPL=y
index fbd106ef92bfef1ef927acdae351f31351470605..944e39dda1c2e45d6218cc1abf99ab91350b1a08 100644 (file)
@@ -41,4 +41,5 @@ CONFIG_SPI_FLASH_STMICRO=y
 CONFIG_USB=y
 CONFIG_USB_EHCI_HCD=y
 CONFIG_USB_STORAGE=y
+CONFIG_FAT_WRITE=y
 CONFIG_OF_LIBFDT=y
index a7bf29731e581103614506fb125af4a769d75376..a33a60123659edb2b160e4c53ccae41a6b8fcf07 100644 (file)
@@ -37,4 +37,5 @@ CONFIG_CMD_UBI=y
 CONFIG_USB=y
 CONFIG_USB_STORAGE=y
 # CONFIG_VIDEO_SW_CURSOR is not set
+CONFIG_FAT_WRITE=y
 CONFIG_OF_LIBFDT=y
index a267c9a55f19b7a22b09035cd548b66d09638243..eca10d3c854bed9baaa5a418d6c046501bf12991 100644 (file)
@@ -40,5 +40,6 @@ CONFIG_USB_EHCI_HCD=y
 CONFIG_USB_STORAGE=y
 CONFIG_USB_GADGET=y
 CONFIG_USB_GADGET_ATMEL_USBA=y
+CONFIG_FAT_WRITE=y
 CONFIG_OF_LIBFDT=y
 # CONFIG_EFI_LOADER is not set
index c457d348d39203ff50f195fb338e1b9faf9f3d93..6ab7cb77e6f09e3e2105b21e7deb5e3948da8dcf 100644 (file)
@@ -7,6 +7,7 @@ CONFIG_HUSH_PARSER=y
 CONFIG_CMD_MMC=y
 CONFIG_CMD_I2C=y
 CONFIG_CMD_GPIO=y
+CONFIG_CMD_FAT=y
 CONFIG_OF_CONTROL=y
 CONFIG_DM=y
 # CONFIG_BLK is not set
index c457d348d39203ff50f195fb338e1b9faf9f3d93..6ab7cb77e6f09e3e2105b21e7deb5e3948da8dcf 100644 (file)
@@ -7,6 +7,7 @@ CONFIG_HUSH_PARSER=y
 CONFIG_CMD_MMC=y
 CONFIG_CMD_I2C=y
 CONFIG_CMD_GPIO=y
+CONFIG_CMD_FAT=y
 CONFIG_OF_CONTROL=y
 CONFIG_DM=y
 # CONFIG_BLK is not set
diff --git a/configs/nanopi_m1_defconfig b/configs/nanopi_m1_defconfig
new file mode 100644 (file)
index 0000000..498496b
--- /dev/null
@@ -0,0 +1,16 @@
+CONFIG_ARM=y
+CONFIG_ARCH_SUNXI=y
+CONFIG_MACH_SUN8I_H3=y
+CONFIG_DRAM_CLK=408
+CONFIG_DRAM_ZQ=3881979
+CONFIG_DRAM_ODT_EN=y
+CONFIG_DEFAULT_DEVICE_TREE="sun8i-h3-nanopi-m1"
+# CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set
+CONFIG_SPL=y
+# CONFIG_CMD_IMLS is not set
+# CONFIG_CMD_FLASH is not set
+# CONFIG_CMD_FPGA is not set
+# CONFIG_SPL_DOS_PARTITION is not set
+# CONFIG_SPL_ISO_PARTITION is not set
+# CONFIG_SPL_EFI_PARTITION is not set
+CONFIG_USB_EHCI_HCD=y
index 49b963c64fa4b8016218909462ad6d9a5b41170d..3c7589bf78bd13e1c6079d595058f1fb53be1fbe 100644 (file)
@@ -39,4 +39,5 @@ CONFIG_USB_KEYBOARD=y
 CONFIG_USB_GADGET=y
 CONFIG_CI_UDC=y
 # CONFIG_VIDEO_SW_CURSOR is not set
+CONFIG_FAT_WRITE=y
 CONFIG_OF_LIBFDT=y
index 64971c139c53361176451479d87ae2efc889c693..eb780ab2239168aba90ddf3ec16db35a57e310a2 100644 (file)
@@ -42,4 +42,5 @@ CONFIG_USB_GADGET_DOWNLOAD=y
 CONFIG_G_DNL_MANUFACTURER="TI"
 CONFIG_G_DNL_VENDOR_NUM=0x0451
 CONFIG_G_DNL_PRODUCT_NUM=0xd022
+CONFIG_FAT_WRITE=y
 CONFIG_OF_LIBFDT=y
index 3be4a1d0b3e857e8263b5b349f7c8d49cf8bc8d0..e360780d253d2aa9be454e8a7c9054a1d804b3a2 100644 (file)
@@ -44,4 +44,5 @@ CONFIG_SYS_NS16550=y
 CONFIG_USB=y
 CONFIG_USB_EHCI_HCD=y
 CONFIG_USB_STORAGE=y
+CONFIG_FAT_WRITE=y
 CONFIG_OF_LIBFDT=y
index 3aa7ba3f589373c98b75d63cd571bff4934bb121..d219ad011f3bb17385a6ae2b01cddbe6256d2d3c 100644 (file)
@@ -24,4 +24,5 @@ CONFIG_CMD_EXT4_WRITE=y
 CONFIG_CMD_UBI=y
 CONFIG_MMC_OMAP_HS=y
 CONFIG_SYS_NS16550=y
+CONFIG_FAT_WRITE=y
 CONFIG_OF_LIBFDT=y
index c985c86d6d1a820a1059e018e49bb97341a50c21..8c0e83004813b38c6921a4be0354c147db635938 100644 (file)
@@ -30,4 +30,5 @@ CONFIG_ISO_PARTITION=y
 CONFIG_EFI_PARTITION=y
 CONFIG_MMC_OMAP_HS=y
 CONFIG_SYS_NS16550=y
+CONFIG_FAT_WRITE=y
 CONFIG_OF_LIBFDT=y
index 8fdf76076c5b4ff0f3ebd408f82bfe693bcc5ae8..3d91f137e875c465121d3de0fdf0d08d0675aae0 100644 (file)
@@ -27,4 +27,5 @@ CONFIG_SYS_NS16550=y
 CONFIG_USB=y
 CONFIG_USB_EHCI_HCD=y
 CONFIG_USB_STORAGE=y
+CONFIG_FAT_WRITE=y
 CONFIG_OF_LIBFDT=y
index 722914289603c22bc2a29f57039b869d2a6a692b..dda4030eccb58734104773c94b3ae7f908705f0e 100644 (file)
@@ -25,4 +25,5 @@ CONFIG_CMD_GPIO=y
 CONFIG_CMD_EXT4_WRITE=y
 CONFIG_MMC_OMAP_HS=y
 CONFIG_SYS_NS16550=y
+CONFIG_FAT_WRITE=y
 CONFIG_OF_LIBFDT=y
index bd799b7dc3974052f2a06394506d7ed40f1f0a87..f5ac38b47c5425b0a91cb33b5d0d7a112d4e3eb7 100644 (file)
@@ -48,4 +48,5 @@ CONFIG_USB_GADGET_DOWNLOAD=y
 CONFIG_G_DNL_MANUFACTURER="Texas Instruments"
 CONFIG_G_DNL_VENDOR_NUM=0x0403
 CONFIG_G_DNL_PRODUCT_NUM=0xbd00
+CONFIG_FAT_WRITE=y
 CONFIG_OF_LIBFDT=y
index 354438e1ef0dbf489309195afc1911902a3598fd..b5d14d2cc45d5f5df84df66ca061750526c8a9d4 100644 (file)
@@ -24,10 +24,12 @@ CONFIG_CRC32_VERIFY=y
 # CONFIG_CMD_SETEXPR is not set
 CONFIG_CMD_DIAG=y
 CONFIG_CMD_UBI=y
+CONFIG_NET_RANDOM_ETHADDR=y
 CONFIG_SYS_NAND_U_BOOT_LOCATIONS=y
 CONFIG_SYS_NAND_U_BOOT_OFFS=0x28000
 CONFIG_SPI_FLASH=y
 CONFIG_SPI_FLASH_STMICRO=y
 CONFIG_SPI_FLASH_WINBOND=y
 CONFIG_SYS_NS16550=y
+# CONFIG_FAT_WRITE is not set
 CONFIG_OF_LIBFDT=y
diff --git a/configs/orangepi_prime_defconfig b/configs/orangepi_prime_defconfig
new file mode 100644 (file)
index 0000000..dc8d59e
--- /dev/null
@@ -0,0 +1,16 @@
+CONFIG_ARM=y
+CONFIG_ARCH_SUNXI=y
+CONFIG_MACH_SUN50I_H5=y
+CONFIG_DRAM_CLK=672
+CONFIG_DRAM_ZQ=3881977
+CONFIG_DEFAULT_DEVICE_TREE="sun50i-h5-orangepi-prime"
+# CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set
+CONFIG_SPL=y
+# CONFIG_CMD_IMLS is not set
+# CONFIG_CMD_FLASH is not set
+# CONFIG_CMD_FPGA is not set
+# CONFIG_SPL_DOS_PARTITION is not set
+# CONFIG_SPL_ISO_PARTITION is not set
+# CONFIG_SPL_EFI_PARTITION is not set
+CONFIG_SUN8I_EMAC=y
+CONFIG_USB_EHCI_HCD=y
index f278075b449d9afcf56367ca06cde0fe82d4b9f3..6b4e229f50517a26757a228baf5153c5cae6a27d 100644 (file)
@@ -57,4 +57,5 @@ CONFIG_USB_MUSB_HOST=y
 CONFIG_USB_MUSB_GADGET=y
 CONFIG_USB_STORAGE=y
 CONFIG_USB_GADGET=y
+CONFIG_FAT_WRITE=y
 CONFIG_OF_LIBFDT=y
index 5fa60b7785eba0c12ecfc84fe816b5494ea609d5..6baca9650bfed838f2ed6eea0ec1d635400eb015 100644 (file)
@@ -57,4 +57,5 @@ CONFIG_USB_MUSB_HOST=y
 CONFIG_USB_MUSB_GADGET=y
 CONFIG_USB_STORAGE=y
 CONFIG_USB_GADGET=y
+CONFIG_FAT_WRITE=y
 CONFIG_OF_LIBFDT=y
index 6d4d8ada49ca42307de915e3465326e1e265a70a..8693dea534e18d39b15a1b46e0ef526ab11ecf4c 100644 (file)
@@ -56,4 +56,5 @@ CONFIG_USB_MUSB_HOST=y
 CONFIG_USB_MUSB_GADGET=y
 CONFIG_USB_STORAGE=y
 CONFIG_USB_GADGET=y
+CONFIG_FAT_WRITE=y
 CONFIG_OF_LIBFDT=y
index a7d67bf472d1e15b46f5d932aeabc2e7e972ee10..4b122d6d8c7c3a4257f217f9ddfbf82b4d94cd06 100644 (file)
@@ -40,4 +40,5 @@ CONFIG_ISO_PARTITION=y
 CONFIG_EFI_PARTITION=y
 CONFIG_MMC_OMAP_HS=y
 CONFIG_SYS_NS16550=y
+CONFIG_FAT_WRITE=y
 CONFIG_OF_LIBFDT=y
index 9eb80766ed41868633fa9b8342fc23daf345da54..688b989419462cfd9dedffec291b0d2b74709522 100644 (file)
@@ -42,5 +42,6 @@ CONFIG_DM_USB=y
 CONFIG_USB_MUSB_HOST=y
 CONFIG_USB_MUSB_PIC32=y
 CONFIG_USB_STORAGE=y
+CONFIG_FAT_WRITE=y
 CONFIG_USE_TINY_PRINTF=y
 CONFIG_CMD_DHRYSTONE=y
index f34dfe9fdb34276cd342c70d6b78fc1221e0600a..aa61e4b65a94bb53207a4933ddee0933250638a9 100644 (file)
@@ -35,4 +35,5 @@ CONFIG_USB=y
 CONFIG_USB_EHCI_HCD=y
 CONFIG_USB_STORAGE=y
 CONFIG_LCD=y
+CONFIG_FAT_WRITE=y
 CONFIG_OF_LIBFDT=y
index 60e0b720bba6d0020a165a0ff82e7ae7cae0f284..1eba2992425a6bbd10986836864a5f68efe91cad 100644 (file)
@@ -16,6 +16,7 @@ CONFIG_CMD_NET=y
 CONFIG_CMD_NFS=y
 CONFIG_CMD_MII=y
 CONFIG_CMD_PING=y
+CONFIG_CMD_FAT=y
 CONFIG_CMD_DHCP=y
 CONFIG_CMD_USB=y
 CONFIG_USB=y
index d6f1840eab111af6afd86230461766dc4c8891b0..5bd762da79029d82b3e33fc15dc374ed9236e4f4 100644 (file)
@@ -16,6 +16,7 @@ CONFIG_CMD_NET=y
 CONFIG_CMD_NFS=y
 CONFIG_CMD_MII=y
 CONFIG_CMD_PING=y
+CONFIG_CMD_FAT=y
 CONFIG_CMD_DHCP=y
 CONFIG_CMD_USB=y
 CONFIG_USB=y
index c3e04573b4f7eae39fb2504835616328cd6334fe..8aeab15bfb7ebf89ef27d4005dbd45260d883edc 100644 (file)
@@ -35,3 +35,4 @@ CONFIG_USB_GADGET_DOWNLOAD=y
 CONFIG_G_DNL_MANUFACTURER="Samsung"
 CONFIG_G_DNL_VENDOR_NUM=0x04e8
 CONFIG_G_DNL_PRODUCT_NUM=0x6601
+CONFIG_FAT_WRITE=y
index 239bfdd66b9648eeec2f67d3b05818a331919f17..66edd31bfe17bdf4defd20ad1680bc062a75c346 100644 (file)
@@ -16,6 +16,7 @@ CONFIG_SPL=y
 # CONFIG_CMD_FLASH is not set
 CONFIG_CMD_SF=y
 # CONFIG_CMD_FPGA is not set
+CONFIG_CMD_FAT=y
 # CONFIG_MMC is not set
 CONFIG_SPI_FLASH=y
 CONFIG_USB=y
index 21014b937c6b124e9e90fea12d302fa20cd84769..8771e0846ce189c4bd5438f9143e8720b7c7cfd3 100644 (file)
@@ -17,6 +17,7 @@ CONFIG_SPL=y
 # CONFIG_CMD_FLASH is not set
 CONFIG_CMD_SF=y
 # CONFIG_CMD_FPGA is not set
+CONFIG_CMD_FAT=y
 # CONFIG_MMC is not set
 CONFIG_SPI_FLASH=y
 CONFIG_USB=y
index f064a43c6bbef4a55896a2dd1231493cf6ef0c55..b60e00ce5af8cabe99c74b428c9dcd08ef4aa5f9 100644 (file)
@@ -74,3 +74,4 @@ CONFIG_USB_EHCI_HCD=y
 CONFIG_USB_STORAGE=y
 CONFIG_USB_GADGET=y
 CONFIG_USB_GADGET_ATMEL_USBA=y
+CONFIG_FAT_WRITE=y
index 32a21f9294d6177a709d98ea17fe53fa12514e98..8c34e64bc50a62029dac1a0b298ad5e32f23bb49 100644 (file)
@@ -49,3 +49,4 @@ CONFIG_ATMEL_USART=y
 CONFIG_DM_SPI=y
 CONFIG_ATMEL_SPI=y
 CONFIG_LCD=y
+CONFIG_FAT_WRITE=y
index 34c4de17b9af49893634311f8f889b3b4f078f7d..9c72a67572d4ec05fac91b6e8d20dd4f83298427 100644 (file)
@@ -49,3 +49,4 @@ CONFIG_ATMEL_USART=y
 CONFIG_DM_SPI=y
 CONFIG_ATMEL_SPI=y
 CONFIG_LCD=y
+CONFIG_FAT_WRITE=y
index 42c31111a1fde6ee3916f32fad0b997835deb47a..10db9c96c6fedb75af066fce694562ecde644af4 100644 (file)
@@ -49,3 +49,4 @@ CONFIG_ATMEL_USART=y
 CONFIG_DM_SPI=y
 CONFIG_ATMEL_SPI=y
 CONFIG_LCD=y
+CONFIG_FAT_WRITE=y
index d28d1d9a331a750164aab99462c29653b9eea5bf..533dbcd00d667440133e9cfde0460796caa5b712 100644 (file)
@@ -65,3 +65,4 @@ CONFIG_USB=y
 CONFIG_DM_USB=y
 CONFIG_USB_EHCI_HCD=y
 CONFIG_USB_STORAGE=y
+CONFIG_FAT_WRITE=y
index 6f2432473ddbb3d9e457867ca20bb7eba7ecae7d..d00ef6a6330374c1416e5a7b46164bcbd83287b1 100644 (file)
@@ -62,3 +62,4 @@ CONFIG_USB=y
 CONFIG_DM_USB=y
 CONFIG_USB_EHCI_HCD=y
 CONFIG_USB_STORAGE=y
+CONFIG_FAT_WRITE=y
index 994bc048bab08bcc03f449e5172c4dff01c88598..74719854a03d71f65a988742e0bb0d184362e7ef 100644 (file)
@@ -74,3 +74,4 @@ CONFIG_USB_STORAGE=y
 CONFIG_USB_GADGET=y
 CONFIG_USB_GADGET_ATMEL_USBA=y
 CONFIG_LCD=y
+CONFIG_FAT_WRITE=y
index dd0263cea2d6a1eb8a93736092cc224647b9f058..a75767be85a0b4346d898511aa242f4b78153c44 100644 (file)
@@ -69,3 +69,4 @@ CONFIG_USB_STORAGE=y
 CONFIG_USB_GADGET=y
 CONFIG_USB_GADGET_ATMEL_USBA=y
 CONFIG_LCD=y
+CONFIG_FAT_WRITE=y
index 069fbcc0a35250524ed27cba716bdce16ddcac12..1d8491cdb737a60c47a52c05ded22a6301e86afc 100644 (file)
@@ -70,3 +70,4 @@ CONFIG_USB_STORAGE=y
 CONFIG_USB_GADGET=y
 CONFIG_USB_GADGET_ATMEL_USBA=y
 CONFIG_LCD=y
+CONFIG_FAT_WRITE=y
index 4fc44e5747856db70585603c8d82e0422ba0f24b..e23df47ce6fbbf8efd27ad6f5e90f8c5b4abc3f5 100644 (file)
@@ -68,3 +68,4 @@ CONFIG_USB_EHCI_HCD=y
 CONFIG_USB_STORAGE=y
 CONFIG_USB_GADGET=y
 CONFIG_USB_GADGET_ATMEL_USBA=y
+CONFIG_FAT_WRITE=y
index 204d128395edc002e90ca8a8a441bb5ccb68df96..68da5f9400cdc86f523cb0f4900116e58df6a825 100644 (file)
@@ -72,3 +72,4 @@ CONFIG_USB_STORAGE=y
 CONFIG_USB_GADGET=y
 CONFIG_USB_GADGET_ATMEL_USBA=y
 CONFIG_LCD=y
+CONFIG_FAT_WRITE=y
index 662606cd7278e30b8521eea0842007f4091a5269..b83c8bc1787640236f6afe426d2e66e6b1bfd6c7 100644 (file)
@@ -7,7 +7,7 @@ CONFIG_FIT_VERBOSE=y
 CONFIG_SPL_LOAD_FIT=y
 CONFIG_BOOTSTAGE=y
 CONFIG_BOOTSTAGE_REPORT=y
-CONFIG_BOOTSTAGE_USER_COUNT=0x20
+CONFIG_BOOTSTAGE_USER_COUNT=32
 CONFIG_BOOTSTAGE_FDT=y
 CONFIG_BOOTSTAGE_STASH=y
 CONFIG_BOOTSTAGE_STASH_ADDR=0x0
index 83efb23dbc40dcd0b4c772c272e0d95994ace781..4fe2318bfd64816a4d4d41a32ed32be03748e2c8 100644 (file)
@@ -7,7 +7,7 @@ CONFIG_FIT_VERBOSE=y
 CONFIG_SPL_LOAD_FIT=y
 CONFIG_BOOTSTAGE=y
 CONFIG_BOOTSTAGE_REPORT=y
-CONFIG_BOOTSTAGE_USER_COUNT=0x20
+CONFIG_BOOTSTAGE_USER_COUNT=32
 CONFIG_BOOTSTAGE_FDT=y
 CONFIG_BOOTSTAGE_STASH=y
 CONFIG_BOOTSTAGE_STASH_ADDR=0x0
index 519e91f6231175ab59aa87a9648a41b6c6a0faf6..7f57915f6e73ac550c1faacabc6d295e48f1478e 100644 (file)
@@ -6,7 +6,7 @@ CONFIG_FIT_VERBOSE=y
 CONFIG_SPL_LOAD_FIT=y
 CONFIG_BOOTSTAGE=y
 CONFIG_BOOTSTAGE_REPORT=y
-CONFIG_BOOTSTAGE_USER_COUNT=0x20
+CONFIG_BOOTSTAGE_USER_COUNT=32
 CONFIG_BOOTSTAGE_FDT=y
 CONFIG_BOOTSTAGE_STASH=y
 CONFIG_BOOTSTAGE_STASH_ADDR=0x0
index 761cfb6f7bdf05ec71fc8f0ca55f04fb2194c480..63b3ffd520ad2d8e50ebed20c70bf60c3f920be8 100644 (file)
@@ -12,7 +12,7 @@ CONFIG_FIT_VERBOSE=y
 CONFIG_SPL_LOAD_FIT=y
 CONFIG_BOOTSTAGE=y
 CONFIG_BOOTSTAGE_REPORT=y
-CONFIG_BOOTSTAGE_USER_COUNT=0x20
+CONFIG_BOOTSTAGE_USER_COUNT=32
 CONFIG_BOOTSTAGE_FDT=y
 CONFIG_BOOTSTAGE_STASH=y
 CONFIG_BOOTSTAGE_STASH_ADDR=0x0
index a72c7642f6010f04b74f8e8e740fe20eef7eaf54..1b127b8609267dcea5ce47f94315fc1e3836a10b 100644 (file)
@@ -3,6 +3,7 @@ CONFIG_ARCH_OMAP2PLUS=y
 CONFIG_SPL_GPIO_SUPPORT=y
 CONFIG_SPL_LIBCOMMON_SUPPORT=y
 CONFIG_SPL_LIBGENERIC_SUPPORT=y
+CONFIG_TI814X=y
 CONFIG_TARGET_TI814X_EVM=y
 CONFIG_SPL_MMC_SUPPORT=y
 CONFIG_SPL_SERIAL_SUPPORT=y
index 8021defb87af53b405ad6886402ce9408ae0f0e5..1c6608218b0034b06e325e202db7bae6f98fc6b1 100644 (file)
@@ -3,27 +3,38 @@ CONFIG_ARCH_OMAP2PLUS=y
 CONFIG_SPL_GPIO_SUPPORT=y
 CONFIG_SPL_LIBCOMMON_SUPPORT=y
 CONFIG_SPL_LIBGENERIC_SUPPORT=y
+CONFIG_TI816X=y
 CONFIG_TARGET_TI816X_EVM=y
 CONFIG_SPL_MMC_SUPPORT=y
 CONFIG_SPL_SERIAL_SUPPORT=y
 CONFIG_SPL_LIBDISK_SUPPORT=y
+CONFIG_SPL_NAND_SUPPORT=y
+CONFIG_SPL_STACK_R_ADDR=0x82000000
 CONFIG_SPL_FAT_SUPPORT=y
+CONFIG_DEFAULT_DEVICE_TREE="dm8168-evm"
+CONFIG_DISTRO_DEFAULTS=y
+CONFIG_SYS_EXTRA_OPTIONS="NAND"
 CONFIG_BOOTDELAY=3
 CONFIG_SYS_CONSOLE_INFO_QUIET=y
 CONFIG_VERSION_VARIABLE=y
 # CONFIG_DISPLAY_BOARDINFO is not set
 CONFIG_SPL=y
+CONFIG_SPL_STACK_R=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x300
-CONFIG_SPL_YMODEM_SUPPORT=y
-CONFIG_HUSH_PARSER=y
-CONFIG_SYS_PROMPT="u-boot/ti816x# "
 # CONFIG_CMD_IMLS is not set
 # CONFIG_CMD_FLASH is not set
 CONFIG_CMD_MMC=y
+CONFIG_CMD_I2C=y
+# CONFIG_CMD_FPGA is not set
 # CONFIG_CMD_SETEXPR is not set
-CONFIG_CMD_EXT2=y
-CONFIG_CMD_FAT=y
+CONFIG_CMD_EXT4_WRITE=y
+# CONFIG_ISO_PARTITION is not set
+# CONFIG_EFI_PARTITION is not set
+CONFIG_OF_CONTROL=y
+CONFIG_DM=y
+CONFIG_DM_GPIO=y
+CONFIG_DM_I2C=y
 CONFIG_MMC_OMAP_HS=y
 CONFIG_SYS_NS16550=y
-CONFIG_OF_LIBFDT=y
+# CONFIG_USE_PRIVATE_LIBGCC is not set
index dc49372e48fba790d9452c9c99b3d7946e2370e7..148f70360bf3f0cd2183a0aea76b39ec3a588910 100644 (file)
@@ -1,6 +1,7 @@
 CONFIG_ARM=y
 CONFIG_ARCH_ZYNQ=y
 CONFIG_SYS_TEXT_BASE=0x4000000
+# CONFIG_SPL_FAT_SUPPORT is not set
 CONFIG_DEFAULT_DEVICE_TREE="zynq-zc770-xm011"
 CONFIG_FIT=y
 CONFIG_FIT_SIGNATURE=y
index 16cd61311009e47564887801b59798816efd52d1..943efdb141c6e86d2e8c0fc2e386c14bfea39cf1 100644 (file)
@@ -1,6 +1,7 @@
 CONFIG_ARM=y
 CONFIG_ARCH_ZYNQ=y
 CONFIG_SYS_TEXT_BASE=0x4000000
+# CONFIG_SPL_FAT_SUPPORT is not set
 CONFIG_DEFAULT_DEVICE_TREE="zynq-zc770-xm012"
 CONFIG_FIT=y
 CONFIG_FIT_SIGNATURE=y
index 4396db0eb151f67c0bab500b84b478120b5f37b4..5c029109e2b1e7af5975e0f5d0f12a6faa7001eb 100644 (file)
@@ -1,6 +1,7 @@
 CONFIG_ARM=y
 CONFIG_ARCH_ZYNQ=y
 CONFIG_SYS_TEXT_BASE=0x4000000
+# CONFIG_SPL_FAT_SUPPORT is not set
 CONFIG_DEFAULT_DEVICE_TREE="zynq-zc770-xm013"
 CONFIG_FIT=y
 CONFIG_FIT_SIGNATURE=y
index 07fa46ef7ef557b095da01cd86b1a255d1160745..929ae88c58325068ffd3bc2f5d0a69ab31710dd5 100644 (file)
@@ -6,8 +6,8 @@ UPD data for configuring the SoC.
 
 All properties can be found within the `upd-region` struct in
 arch/x86/include/asm/arch-baytrail/fsp/fsp_vpd.h, under the same names, and in
-Intel's FSP Binary Configuration Tool for Bay Trail.  This list of properties is
-matched up to Intel's E3800 FSPv4 release.
+Intel's FSP Binary Configuration Tool for Bay Trail.  This list of properties
+is matched up to Intel's E3800 FSPv4 release.
 
 # Boolean properties:
 
@@ -19,8 +19,6 @@ matched up to Intel's E3800 FSPv4 release.
 - fsp,enable-sata
 - fsp,enable-azalia
 - fsp,enable-xhci
-- fsp,enable-lpe
-- fsp,lpss-sio-enable-pci-mode
 - fsp,enable-dma0
 - fsp,enable-dma1
 - fsp,enable-i2-c0
@@ -35,7 +33,6 @@ matched up to Intel's E3800 FSPv4 release.
 - fsp,enable-hsi
 - fsp,mrc-debug-msg
 - fsp,isp-enable
-- fsp,scc-enable-pci-mode
 - fsp,igd-render-standby
 - fsp,txe-uma-enable
 - fsp,emmc45-ddr50-enabled
@@ -44,8 +41,8 @@ matched up to Intel's E3800 FSPv4 release.
 - fsp,enable-memory-down
 
 If you set "fsp,enable-memory-down" you are strongly encouraged to provide an
-"fsp,memory-down-params{};" to specify how your memory is configured.  If you do
-not set "fsp,enable-memory-down", then the DIMM SPD information will be
+"fsp,memory-down-params{};" to specify how your memory is configured.  If you
+do not set "fsp,enable-memory-down", then the DIMM SPD information will be
 discovered by the FSP and used to setup main memory.
 
 
@@ -57,11 +54,12 @@ discovered by the FSP and used to setup main memory.
 - fsp,mrc-init-spd-addr2
 - fsp,emmc-boot-mode
 - fsp,sata-mode
+- fsp,lpe-mode
+- fsp,lpss-sio-mode
 - fsp,igd-dvmt50-pre-alloc
 - fsp,aperture-size
 - fsp,gtt-size
-- fsp,serial-debug-port-address
-- fsp,serial-debug-port-type
+- fsp,scc-mode
 - fsp,os-selection
 - fsp,emmc45-retune-timer-value
 
@@ -74,41 +72,12 @@ discovered by the FSP and used to setup main memory.
 
        # Integer properties:
 
-       - fsp,dram-speed:
-         0x0: "800 MHz"
-         0x1: "1066 MHz"
-         0x2: "1333 MHz"
-         0x3: "1600 MHz"
-
+       - fsp,dram-speed
        - fsp,dram-type
-         0x0: "DDR3"
-         0x1: "DDR3L"
-         0x2: "DDR3U"
-         0x4: "LPDDR2"
-         0x5: "LPDDR3"
-         0x6: "DDR4"
-
        - fsp,dimm-width
-         0x0: "x8"
-         0x1: "x16"
-         0x2: "x32"
-
        - fsp,dimm-density
-         0x0: "1 Gbit"
-         0x1: "2 Gbit"
-         0x2: "4 Gbit"
-         0x3: "8 Gbit"
-
        - fsp,dimm-bus-width
-         0x0: "8 bits"
-         0x1: "16 bits"
-         0x2: "32 bits"
-         0x3: "64 bits"
-
        - fsp,dimm-sides
-         0x0: "1 rank"
-         0x1: "2 ranks"
-
        - fsp,dimm-tcl
        - fsp,dimm-trpt-rcd
        - fsp,dimm-twr
@@ -118,6 +87,9 @@ discovered by the FSP and used to setup main memory.
        - fsp,dimm-tfaw
 };
 
+For all integer properties, available options are listed in fsp_configs.h in
+arch/x86/include/asm/arch-baytrail/fsp directory (eg: MRC_INIT_TSEG_SIZE_1MB).
+
 
 Example (from MinnowMax Dual Core):
 -----------------------------------
@@ -127,20 +99,19 @@ Example (from MinnowMax Dual Core):
 
        fsp {
                compatible = "intel,baytrail-fsp";
-               fsp,mrc-init-tseg-size = <0>;
-               fsp,mrc-init-mmio-size = <0x800>;
+               fsp,mrc-init-tseg-size = <MRC_INIT_TSEG_SIZE_1MB>;
+               fsp,mrc-init-mmio-size = <MRC_INIT_MMIO_SIZE_2048MB>;
                fsp,mrc-init-spd-addr1 = <0xa0>;
                fsp,mrc-init-spd-addr2 = <0xa2>;
-               fsp,emmc-boot-mode = <2>;
+               fsp,emmc-boot-mode = <EMMC_BOOT_MODE_AUTO>;
                fsp,enable-sdio;
                fsp,enable-sdcard;
                fsp,enable-hsuart1;
                fsp,enable-spi;
                fsp,enable-sata;
-               fsp,sata-mode = <1>;
-               fsp,enable-xhci;
-               fsp,enable-lpe;
-               fsp,lpss-sio-enable-pci-mode;
+               fsp,sata-mode = <SATA_MODE_AHCI>;
+               fsp,lpe-mode = <LPE_MODE_PCI>;
+               fsp,lpss-sio-mode = <LPSS_SIO_MODE_PCI>;
                fsp,enable-dma0;
                fsp,enable-dma1;
                fsp,enable-i2c0;
@@ -152,27 +123,24 @@ Example (from MinnowMax Dual Core):
                fsp,enable-i2c6;
                fsp,enable-pwm0;
                fsp,enable-pwm1;
-               fsp,igd-dvmt50-pre-alloc = <2>;
-               fsp,aperture-size = <2>;
-               fsp,gtt-size = <2>;
-               fsp,serial-debug-port-address = <0x3f8>;
-               fsp,serial-debug-port-type = <1>;
-               fsp,mrc-debug-msg;
-               fsp,scc-enable-pci-mode;
-               fsp,os-selection = <4>;
+               fsp,igd-dvmt50-pre-alloc = <IGD_DVMT50_PRE_ALLOC_64MB>;
+               fsp,aperture-size = <APERTURE_SIZE_256MB>;
+               fsp,gtt-size = <GTT_SIZE_2MB>;
+               fsp,scc-mode = <SCC_MODE_PCI>;
+               fsp,os-selection = <OS_SELECTION_LINUX>;
                fsp,emmc45-ddr50-enabled;
                fsp,emmc45-retune-timer-value = <8>;
                fsp,enable-igd;
                fsp,enable-memory-down;
                fsp,memory-down-params {
                        compatible = "intel,baytrail-fsp-mdp";
-                       fsp,dram-speed = <1>;
-                       fsp,dram-type = <1>;
+                       fsp,dram-speed = <DRAM_SPEED_1066MTS>;
+                       fsp,dram-type = <DRAM_TYPE_DDR3L>;
                        fsp,dimm-0-enable;
-                       fsp,dimm-width = <1>;
-                       fsp,dimm-density = <2>;
-                       fsp,dimm-bus-width = <3>;
-                       fsp,dimm-sides = <0>;
+                       fsp,dimm-width = <DIMM_WIDTH_X16>;
+                       fsp,dimm-density = <DIMM_DENSITY_4GBIT>;
+                       fsp,dimm-bus-width = <DIMM_BUS_WIDTH_64BITS>;
+                       fsp,dimm-sides = <DIMM_SIDES_1RANKS>;
                        fsp,dimm-tcl = <0xb>;
                        fsp,dimm-trpt-rcd = <0xb>;
                        fsp,dimm-twr = <0xc>;
index 5b7ced59492dbf50f844b78d809b16e0c19850b3..aaf4dfb1e79514a79a036c2e184a6e224afe6db2 100644 (file)
@@ -12,6 +12,7 @@
 #include <asm/processor.h>
 #include <fsl_immap.h>
 #include <fsl_ddr.h>
+#include <asm/arch/clock.h>
 
 #if (CONFIG_CHIP_SELECTS_PER_CTRL > 4)
 #error Invalid setting for CONFIG_CHIP_SELECTS_PER_CTRL
index 21687dd0772a4d43040071911f6e50b63f5f27f7..c0ee858a02eeabd83981e8364fcc2be9e8218893 100644 (file)
 #include <fsl_ddr.h>
 #include <fsl_immap.h>
 #include <asm/io.h>
+#if defined(CONFIG_FSL_LSCH2) || defined(CONFIG_FSL_LSCH3) || \
+       defined(CONFIG_ARM)
+#include <asm/arch/clock.h>
+#endif
 
 /*
  * Determine Rtt value.
index e0f9e2ca3dd2540d8f650bc9434ee454c425de3e..3349fc5c3b5907a4195c74b539dbb3002614d4e2 100644 (file)
 #include <fsl_immap.h>
 #include <fsl_ddr.h>
 #include <fsl_errata.h>
+#if defined(CONFIG_FSL_LSCH2) || defined(CONFIG_FSL_LSCH3) || \
+       defined(CONFIG_ARM)
+#include <asm/arch/clock.h>
+#endif
 
 #if defined(CONFIG_SYS_FSL_ERRATUM_A008511) | \
        defined(CONFIG_SYS_FSL_ERRATUM_A009803)
index b45a8797e449c0a675c415626360fe9bc43bcd75..20edd2dc28e54b48318af47e8cb9786daf483407 100644 (file)
@@ -9,6 +9,10 @@
 #include <fsl_ddr_sdram.h>
 
 #include <fsl_ddr.h>
+#if defined(CONFIG_FSL_LSCH2) || defined(CONFIG_FSL_LSCH3) || \
+       defined(CONFIG_ARM)
+#include <asm/arch/clock.h>
+#endif
 
 /*
  * Use our own stack based buffer before relocation to allow accessing longer
index b58784be65d20d35840000f690720e1b8a0f4a2c..0a305b36b8b1a71ad0f9853bb1b4aab3b51d4586 100644 (file)
 #include <fsl_ddr.h>
 #include <fsl_immap.h>
 #include <asm/io.h>
+#if defined(CONFIG_FSL_LSCH2) || defined(CONFIG_FSL_LSCH3) || \
+       defined(CONFIG_ARM)
+#include <asm/arch/clock.h>
+#endif
 
 /* To avoid 64-bit full-divides, we factor this here */
 #define ULL_2E12 2000000000000ULL
index 03df558879b00963d9a6614fd0a96a06094e012f..8937e99b4734146cb3d637d72ef2f89507822dce 100644 (file)
@@ -42,7 +42,6 @@ obj-$(CONFIG_SH_GPIO_PFC)     += sh_pfc.o
 obj-$(CONFIG_OMAP_GPIO)        += omap_gpio.o
 obj-$(CONFIG_DB8500_GPIO)      += db8500_gpio.o
 obj-$(CONFIG_BCM2835_GPIO)     += bcm2835_gpio.o
-obj-$(CONFIG_S3C2440_GPIO)     += s3c2440_gpio.o
 obj-$(CONFIG_XILINX_GPIO)      += xilinx_gpio.o
 obj-$(CONFIG_ADI_GPIO2)        += adi_gpio2.o
 obj-$(CONFIG_TCA642X)          += tca642x.o
diff --git a/drivers/gpio/s3c2440_gpio.c b/drivers/gpio/s3c2440_gpio.c
deleted file mode 100644 (file)
index d6c7eeb..0000000
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * Copyright (C) 2012
- * Gabriel Huau <contact@huau-gabriel.fr>
- *
- * SPDX-License-Identifier:    GPL-2.0+
- */
-#include <common.h>
-#include <asm/arch/s3c2440.h>
-#include <asm/gpio.h>
-#include <asm/io.h>
-#include <errno.h>
-
-#define GPIO_INPUT  0x0
-#define GPIO_OUTPUT 0x1
-
-#define S3C_GPIO_CON   0x0
-#define S3C_GPIO_DAT   0x4
-
-static uint32_t s3c_gpio_get_bank_addr(unsigned gpio)
-{
-       /* There is up to 16 pins per bank, one bank is 0x10 big. */
-       uint32_t addr = gpio & ~0xf;
-
-       if (addr >= 0x80 && addr != 0xd0) {     /* Wrong GPIO bank. */
-               printf("Invalid GPIO bank (bank %02x)\n", addr);
-               return 0xffffffff;
-       }
-
-       return addr | S3C24X0_GPIO_BASE;
-}
-
-int gpio_set_value(unsigned gpio, int value)
-{
-       uint32_t addr = s3c_gpio_get_bank_addr(gpio);
-
-       if (addr == 0xffffffff)
-               return -EINVAL;
-
-       if (value)
-               setbits_le32(addr | S3C_GPIO_DAT, 1 << (gpio & 0xf));
-       else
-               clrbits_le32(addr | S3C_GPIO_DAT, 1 << (gpio & 0xf));
-
-       return 0;
-}
-
-int gpio_get_value(unsigned gpio)
-{
-       uint32_t addr = s3c_gpio_get_bank_addr(gpio);
-
-       if (addr == 0xffffffff)
-               return -EINVAL;
-
-       return !!(readl(addr | S3C_GPIO_DAT) & (1 << (gpio & 0xf)));
-}
-
-int gpio_request(unsigned gpio, const char *label)
-{
-       return 0;
-}
-
-int gpio_free(unsigned gpio)
-{
-       return 0;
-}
-
-static int s3c_gpio_direction(unsigned gpio, uint8_t dir)
-{
-       uint32_t addr = s3c_gpio_get_bank_addr(gpio);
-       const uint32_t mask = 0x3 << ((gpio & 0xf) << 1);
-       const uint32_t dirm = dir << ((gpio & 0xf) << 1);
-
-       if (addr == 0xffffffff)
-               return -EINVAL;
-
-       clrsetbits_le32(addr | S3C_GPIO_CON, mask, dirm);
-       return 0;
-}
-
-int gpio_direction_input(unsigned gpio)
-{
-       return s3c_gpio_direction(gpio, GPIO_INPUT);
-}
-
-int gpio_direction_output(unsigned gpio, int value)
-{
-       return s3c_gpio_direction(gpio, GPIO_OUTPUT);
-}
index 06fe0a51f3dbb2a4d1c4b66c58e1a9d492427df4..996a6510a34ea96dc070fff1770879013eb8e5ad 100644 (file)
@@ -5,10 +5,6 @@
  * SPDX-License-Identifier:    GPL-2.0+
  */
 
-/* This code should work for both the S3C2400 and the S3C2410
- * as they seem to have the same I2C controller inside.
- * The different address mapping is handled by the s3c24xx.h files below.
- */
 #include <common.h>
 #include <errno.h>
 #include <dm.h>
index a07864989944727a15b7c05c207df9243e0deb8e..2d781c38a6eff4bef3cb3e36d606ad34d069d037 100644 (file)
@@ -40,7 +40,6 @@ obj-$(CONFIG_MMC_MXS)                 += mxsmmc.o
 obj-$(CONFIG_MMC_PCI)                  += pci_mmc.o
 obj-$(CONFIG_PXA_MMC_GENERIC) += pxa_mmc_gen.o
 obj-$(CONFIG_SUPPORT_EMMC_RPMB) += rpmb.o
-obj-$(CONFIG_S3C_SDI) += s3c_sdi.o
 obj-$(CONFIG_MMC_SANDBOX)              += sandbox_mmc.o
 obj-$(CONFIG_SH_MMCIF) += sh_mmcif.o
 obj-$(CONFIG_SH_SDHI) += sh_sdhi.o
diff --git a/drivers/mmc/s3c_sdi.c b/drivers/mmc/s3c_sdi.c
deleted file mode 100644 (file)
index faf7b83..0000000
+++ /dev/null
@@ -1,323 +0,0 @@
-/*
- * S3C24xx SD/MMC driver
- *
- * Based on OpenMoko S3C24xx driver by Harald Welte <laforge@openmoko.org>
- *
- * Copyright (C) 2014 Marek Vasut <marex@denx.de>
- *
- * SPDX-License-Identifier:    GPL-2.0+
- */
-
-#include <common.h>
-#include <malloc.h>
-#include <mmc.h>
-#include <errno.h>
-#include <asm/arch/s3c24x0_cpu.h>
-#include <asm/io.h>
-#include <asm/unaligned.h>
-
-#define S3C2440_SDICON_SDRESET         (1 << 8)
-#define S3C2410_SDICON_FIFORESET       (1 << 1)
-#define S3C2410_SDICON_CLOCKTYPE       (1 << 0)
-
-#define S3C2410_SDICMDCON_LONGRSP      (1 << 10)
-#define S3C2410_SDICMDCON_WAITRSP      (1 << 9)
-#define S3C2410_SDICMDCON_CMDSTART     (1 << 8)
-#define S3C2410_SDICMDCON_SENDERHOST   (1 << 6)
-#define S3C2410_SDICMDCON_INDEX                0x3f
-
-#define S3C2410_SDICMDSTAT_CRCFAIL     (1 << 12)
-#define S3C2410_SDICMDSTAT_CMDSENT     (1 << 11)
-#define S3C2410_SDICMDSTAT_CMDTIMEOUT  (1 << 10)
-#define S3C2410_SDICMDSTAT_RSPFIN      (1 << 9)
-
-#define S3C2440_SDIDCON_DS_WORD                (2 << 22)
-#define S3C2410_SDIDCON_TXAFTERRESP    (1 << 20)
-#define S3C2410_SDIDCON_RXAFTERCMD     (1 << 19)
-#define S3C2410_SDIDCON_BLOCKMODE      (1 << 17)
-#define S3C2410_SDIDCON_WIDEBUS                (1 << 16)
-#define S3C2440_SDIDCON_DATSTART       (1 << 14)
-#define S3C2410_SDIDCON_XFER_RXSTART   (2 << 12)
-#define S3C2410_SDIDCON_XFER_TXSTART   (3 << 12)
-#define S3C2410_SDIDCON_BLKNUM         0x7ff
-
-#define S3C2410_SDIDSTA_FIFOFAIL       (1 << 8)
-#define S3C2410_SDIDSTA_CRCFAIL                (1 << 7)
-#define S3C2410_SDIDSTA_RXCRCFAIL      (1 << 6)
-#define S3C2410_SDIDSTA_DATATIMEOUT    (1 << 5)
-#define S3C2410_SDIDSTA_XFERFINISH     (1 << 4)
-
-#define S3C2410_SDIFSTA_TFHALF         (1 << 11)
-#define S3C2410_SDIFSTA_COUNTMASK      0x7f
-
-/*
- * WARNING: We only support one SD IP block.
- * NOTE: It's not likely there will ever exist an S3C24xx with two,
- *       at least not in this universe all right.
- */
-static int wide_bus;
-
-static int
-s3cmmc_send_cmd(struct mmc *mmc, struct mmc_cmd *cmd, struct mmc_data *data)
-{
-       struct s3c24x0_sdi *sdi_regs = s3c24x0_get_base_sdi();
-       uint32_t sdiccon, sdicsta, sdidcon, sdidsta, sdidat, sdifsta;
-       uint32_t sdicsta_wait_bit = S3C2410_SDICMDSTAT_CMDSENT;
-       unsigned int timeout = 100000;
-       int ret = 0, xfer_len, data_offset = 0;
-       const uint32_t sdidsta_err_mask = S3C2410_SDIDSTA_FIFOFAIL |
-               S3C2410_SDIDSTA_CRCFAIL | S3C2410_SDIDSTA_RXCRCFAIL |
-               S3C2410_SDIDSTA_DATATIMEOUT;
-
-
-       writel(0xffffffff, &sdi_regs->sdicsta);
-       writel(0xffffffff, &sdi_regs->sdidsta);
-       writel(0xffffffff, &sdi_regs->sdifsta);
-
-       /* Set up data transfer (if applicable). */
-       if (data) {
-               writel(data->blocksize, &sdi_regs->sdibsize);
-
-               sdidcon = data->blocks & S3C2410_SDIDCON_BLKNUM;
-               sdidcon |= S3C2410_SDIDCON_BLOCKMODE;
-#if defined(CONFIG_S3C2440)
-               sdidcon |= S3C2440_SDIDCON_DS_WORD | S3C2440_SDIDCON_DATSTART;
-#endif
-               if (wide_bus)
-                       sdidcon |= S3C2410_SDIDCON_WIDEBUS;
-
-               if (data->flags & MMC_DATA_READ) {
-                       sdidcon |= S3C2410_SDIDCON_RXAFTERCMD;
-                       sdidcon |= S3C2410_SDIDCON_XFER_RXSTART;
-               } else {
-                       sdidcon |= S3C2410_SDIDCON_TXAFTERRESP;
-                       sdidcon |= S3C2410_SDIDCON_XFER_TXSTART;
-               }
-
-               writel(sdidcon, &sdi_regs->sdidcon);
-       }
-
-       /* Write CMD arg. */
-       writel(cmd->cmdarg, &sdi_regs->sdicarg);
-
-       /* Write CMD index. */
-       sdiccon = cmd->cmdidx & S3C2410_SDICMDCON_INDEX;
-       sdiccon |= S3C2410_SDICMDCON_SENDERHOST;
-       sdiccon |= S3C2410_SDICMDCON_CMDSTART;
-
-       /* Command with short response. */
-       if (cmd->resp_type & MMC_RSP_PRESENT) {
-               sdiccon |= S3C2410_SDICMDCON_WAITRSP;
-               sdicsta_wait_bit = S3C2410_SDICMDSTAT_RSPFIN;
-       }
-
-       /* Command with long response. */
-       if (cmd->resp_type & MMC_RSP_136)
-               sdiccon |= S3C2410_SDICMDCON_LONGRSP;
-
-       /* Start the command. */
-       writel(sdiccon, &sdi_regs->sdiccon);
-
-       /* Wait for the command to complete or for response. */
-       for (timeout = 100000; timeout; timeout--) {
-               sdicsta = readl(&sdi_regs->sdicsta);
-               if (sdicsta & sdicsta_wait_bit)
-                       break;
-
-               if (sdicsta & S3C2410_SDICMDSTAT_CMDTIMEOUT)
-                       timeout = 1;
-       }
-
-       /* Clean the status bits. */
-       setbits_le32(&sdi_regs->sdicsta, 0xf << 9);
-
-       if (!timeout) {
-               puts("S3C SDI: Command timed out!\n");
-               ret = -ETIMEDOUT;
-               goto error;
-       }
-
-       /* Read out the response. */
-       if (cmd->resp_type & MMC_RSP_136) {
-               cmd->response[0] = readl(&sdi_regs->sdirsp0);
-               cmd->response[1] = readl(&sdi_regs->sdirsp1);
-               cmd->response[2] = readl(&sdi_regs->sdirsp2);
-               cmd->response[3] = readl(&sdi_regs->sdirsp3);
-       } else {
-               cmd->response[0] = readl(&sdi_regs->sdirsp0);
-       }
-
-       /* If there are no data, we're done. */
-       if (!data)
-               return 0;
-
-       xfer_len = data->blocksize * data->blocks;
-
-       while (xfer_len > 0) {
-               sdidsta = readl(&sdi_regs->sdidsta);
-               sdifsta = readl(&sdi_regs->sdifsta);
-
-               if (sdidsta & sdidsta_err_mask) {
-                       printf("S3C SDI: Data error (sdta=0x%08x)\n", sdidsta);
-                       ret = -EIO;
-                       goto error;
-               }
-
-               if (data->flags & MMC_DATA_READ) {
-                       if ((sdifsta & S3C2410_SDIFSTA_COUNTMASK) < 4)
-                               continue;
-                       sdidat = readl(&sdi_regs->sdidat);
-                       put_unaligned_le32(sdidat, data->dest + data_offset);
-               } else {        /* Write */
-                       /* TX FIFO half full. */
-                       if (!(sdifsta & S3C2410_SDIFSTA_TFHALF))
-                               continue;
-
-                       /* TX FIFO is below 32b full, write. */
-                       sdidat = get_unaligned_le32(data->src + data_offset);
-                       writel(sdidat, &sdi_regs->sdidat);
-               }
-               data_offset += 4;
-               xfer_len -= 4;
-       }
-
-       /* Wait for the command to complete or for response. */
-       for (timeout = 100000; timeout; timeout--) {
-               sdidsta = readl(&sdi_regs->sdidsta);
-               if (sdidsta & S3C2410_SDIDSTA_XFERFINISH)
-                       break;
-
-               if (sdidsta & S3C2410_SDIDSTA_DATATIMEOUT)
-                       timeout = 1;
-       }
-
-       /* Clear status bits. */
-       writel(0x6f8, &sdi_regs->sdidsta);
-
-       if (!timeout) {
-               puts("S3C SDI: Command timed out!\n");
-               ret = -ETIMEDOUT;
-               goto error;
-       }
-
-       writel(0, &sdi_regs->sdidcon);
-
-       return 0;
-error:
-       return ret;
-}
-
-static int s3cmmc_set_ios(struct mmc *mmc)
-{
-       struct s3c24x0_sdi *sdi_regs = s3c24x0_get_base_sdi();
-       uint32_t divider = 0;
-
-       wide_bus = (mmc->bus_width == 4);
-
-       if (!mmc->clock)
-               return 0;
-
-       divider = DIV_ROUND_UP(get_PCLK(), mmc->clock);
-       if (divider)
-               divider--;
-
-       writel(divider, &sdi_regs->sdipre);
-       mdelay(125);
-
-       return 0;
-}
-
-static int s3cmmc_init(struct mmc *mmc)
-{
-       struct s3c24x0_clock_power *clk_power = s3c24x0_get_base_clock_power();
-       struct s3c24x0_sdi *sdi_regs = s3c24x0_get_base_sdi();
-
-       /* Start the clock. */
-       setbits_le32(&clk_power->clkcon, 1 << 9);
-
-#if defined(CONFIG_S3C2440)
-       writel(S3C2440_SDICON_SDRESET, &sdi_regs->sdicon);
-       mdelay(10);
-       writel(0x7fffff, &sdi_regs->sdidtimer);
-#else
-       writel(0xffff, &sdi_regs->sdidtimer);
-#endif
-       writel(MMC_MAX_BLOCK_LEN, &sdi_regs->sdibsize);
-       writel(0x0, &sdi_regs->sdiimsk);
-
-       writel(S3C2410_SDICON_FIFORESET | S3C2410_SDICON_CLOCKTYPE,
-              &sdi_regs->sdicon);
-
-       mdelay(125);
-
-       return 0;
-}
-
-struct s3cmmc_priv {
-       struct mmc_config       cfg;
-       int (*getcd)(struct mmc *);
-       int (*getwp)(struct mmc *);
-};
-
-static int s3cmmc_getcd(struct mmc *mmc)
-{
-       struct s3cmmc_priv *priv = mmc->priv;
-       if (priv->getcd)
-               return priv->getcd(mmc);
-       else
-               return 0;
-}
-
-static int s3cmmc_getwp(struct mmc *mmc)
-{
-       struct s3cmmc_priv *priv = mmc->priv;
-       if (priv->getwp)
-               return priv->getwp(mmc);
-       else
-               return 0;
-}
-
-static const struct mmc_ops s3cmmc_ops = {
-       .send_cmd       = s3cmmc_send_cmd,
-       .set_ios        = s3cmmc_set_ios,
-       .init           = s3cmmc_init,
-       .getcd          = s3cmmc_getcd,
-       .getwp          = s3cmmc_getwp,
-};
-
-int s3cmmc_initialize(bd_t *bis, int (*getcd)(struct mmc *),
-                     int (*getwp)(struct mmc *))
-{
-       struct s3cmmc_priv      *priv;
-       struct mmc              *mmc;
-       struct mmc_config       *cfg;
-
-       priv = calloc(1, sizeof(*priv));
-       if (!priv)
-               return -ENOMEM;
-       cfg = &priv->cfg;
-
-       cfg->name = "S3C MMC";
-       cfg->ops = &s3cmmc_ops;
-       cfg->voltages = MMC_VDD_32_33 | MMC_VDD_33_34;
-       cfg->host_caps = MMC_MODE_4BIT | MMC_MODE_HS;
-       cfg->f_min = 400000;
-       cfg->f_max = get_PCLK() / 2;
-       cfg->b_max = 0x80;
-
-#if defined(CONFIG_S3C2410)
-       /*
-        * S3C2410 has some bug that prevents reliable
-        * operation at higher speed
-        */
-       cfg->f_max /= 2;
-#endif
-
-       mmc = mmc_create(cfg, priv);
-       if (!mmc) {
-               free(priv);
-               return -ENOMEM;
-       }
-
-       return 0;
-}
index 82358f674bd7895bf35ad47e1c1c61b748670068..5d5f9f52676cd341908b11c4e9185172581bb5d1 100644 (file)
@@ -59,7 +59,6 @@ obj-$(CONFIG_NAND_MXC) += mxc_nand.o
 obj-$(CONFIG_NAND_MXS) += mxs_nand.o
 obj-$(CONFIG_NAND_NDFC) += ndfc.o
 obj-$(CONFIG_NAND_PXA3XX) += pxa3xx_nand.o
-obj-$(CONFIG_NAND_S3C2410) += s3c2410_nand.o
 obj-$(CONFIG_NAND_SPEAR) += spr_nand.o
 obj-$(CONFIG_TEGRA_NAND) += tegra_nand.o
 obj-$(CONFIG_NAND_OMAP_GPMC) += omap_gpmc.o
diff --git a/drivers/mtd/nand/s3c2410_nand.c b/drivers/mtd/nand/s3c2410_nand.c
deleted file mode 100644 (file)
index dd742a6..0000000
+++ /dev/null
@@ -1,175 +0,0 @@
-/*
- * (C) Copyright 2006 OpenMoko, Inc.
- * Author: Harald Welte <laforge@openmoko.org>
- *
- * SPDX-License-Identifier:    GPL-2.0+
- */
-
-#include <common.h>
-
-#include <nand.h>
-#include <asm/arch/s3c24x0_cpu.h>
-#include <asm/io.h>
-
-#define S3C2410_NFCONF_EN          (1<<15)
-#define S3C2410_NFCONF_512BYTE     (1<<14)
-#define S3C2410_NFCONF_4STEP       (1<<13)
-#define S3C2410_NFCONF_INITECC     (1<<12)
-#define S3C2410_NFCONF_nFCE        (1<<11)
-#define S3C2410_NFCONF_TACLS(x)    ((x)<<8)
-#define S3C2410_NFCONF_TWRPH0(x)   ((x)<<4)
-#define S3C2410_NFCONF_TWRPH1(x)   ((x)<<0)
-
-#define S3C2410_ADDR_NALE 4
-#define S3C2410_ADDR_NCLE 8
-
-#ifdef CONFIG_NAND_SPL
-
-/* in the early stage of NAND flash booting, printf() is not available */
-#define printf(fmt, args...)
-
-static void nand_read_buf(struct mtd_info *mtd, u_char *buf, int len)
-{
-       int i;
-       struct nand_chip *this = mtd_to_nand(mtd);
-
-       for (i = 0; i < len; i++)
-               buf[i] = readb(this->IO_ADDR_R);
-}
-#endif
-
-static void s3c24x0_hwcontrol(struct mtd_info *mtd, int cmd, unsigned int ctrl)
-{
-       struct nand_chip *chip = mtd_to_nand(mtd);
-       struct s3c24x0_nand *nand = s3c24x0_get_base_nand();
-
-       debug("hwcontrol(): 0x%02x 0x%02x\n", cmd, ctrl);
-
-       if (ctrl & NAND_CTRL_CHANGE) {
-               ulong IO_ADDR_W = (ulong)nand;
-
-               if (!(ctrl & NAND_CLE))
-                       IO_ADDR_W |= S3C2410_ADDR_NCLE;
-               if (!(ctrl & NAND_ALE))
-                       IO_ADDR_W |= S3C2410_ADDR_NALE;
-
-               chip->IO_ADDR_W = (void *)IO_ADDR_W;
-
-               if (ctrl & NAND_NCE)
-                       writel(readl(&nand->nfconf) & ~S3C2410_NFCONF_nFCE,
-                              &nand->nfconf);
-               else
-                       writel(readl(&nand->nfconf) | S3C2410_NFCONF_nFCE,
-                              &nand->nfconf);
-       }
-
-       if (cmd != NAND_CMD_NONE)
-               writeb(cmd, chip->IO_ADDR_W);
-}
-
-static int s3c24x0_dev_ready(struct mtd_info *mtd)
-{
-       struct s3c24x0_nand *nand = s3c24x0_get_base_nand();
-       debug("dev_ready\n");
-       return readl(&nand->nfstat) & 0x01;
-}
-
-#ifdef CONFIG_S3C2410_NAND_HWECC
-void s3c24x0_nand_enable_hwecc(struct mtd_info *mtd, int mode)
-{
-       struct s3c24x0_nand *nand = s3c24x0_get_base_nand();
-       debug("s3c24x0_nand_enable_hwecc(%p, %d)\n", mtd, mode);
-       writel(readl(&nand->nfconf) | S3C2410_NFCONF_INITECC, &nand->nfconf);
-}
-
-static int s3c24x0_nand_calculate_ecc(struct mtd_info *mtd, const u_char *dat,
-                                     u_char *ecc_code)
-{
-       struct s3c24x0_nand *nand = s3c24x0_get_base_nand();
-       ecc_code[0] = readb(&nand->nfecc);
-       ecc_code[1] = readb(&nand->nfecc + 1);
-       ecc_code[2] = readb(&nand->nfecc + 2);
-       debug("s3c24x0_nand_calculate_hwecc(%p,): 0x%02x 0x%02x 0x%02x\n",
-             mtd , ecc_code[0], ecc_code[1], ecc_code[2]);
-
-       return 0;
-}
-
-static int s3c24x0_nand_correct_data(struct mtd_info *mtd, u_char *dat,
-                                    u_char *read_ecc, u_char *calc_ecc)
-{
-       if (read_ecc[0] == calc_ecc[0] &&
-           read_ecc[1] == calc_ecc[1] &&
-           read_ecc[2] == calc_ecc[2])
-               return 0;
-
-       printf("s3c24x0_nand_correct_data: not implemented\n");
-       return -EBADMSG;
-}
-#endif
-
-int board_nand_init(struct nand_chip *nand)
-{
-       u_int32_t cfg;
-       u_int8_t tacls, twrph0, twrph1;
-       struct s3c24x0_clock_power *clk_power = s3c24x0_get_base_clock_power();
-       struct s3c24x0_nand *nand_reg = s3c24x0_get_base_nand();
-
-       debug("board_nand_init()\n");
-
-       writel(readl(&clk_power->clkcon) | (1 << 4), &clk_power->clkcon);
-
-       /* initialize hardware */
-#if defined(CONFIG_S3C24XX_CUSTOM_NAND_TIMING)
-       tacls  = CONFIG_S3C24XX_TACLS;
-       twrph0 = CONFIG_S3C24XX_TWRPH0;
-       twrph1 =  CONFIG_S3C24XX_TWRPH1;
-#else
-       tacls = 4;
-       twrph0 = 8;
-       twrph1 = 8;
-#endif
-
-       cfg = S3C2410_NFCONF_EN;
-       cfg |= S3C2410_NFCONF_TACLS(tacls - 1);
-       cfg |= S3C2410_NFCONF_TWRPH0(twrph0 - 1);
-       cfg |= S3C2410_NFCONF_TWRPH1(twrph1 - 1);
-       writel(cfg, &nand_reg->nfconf);
-
-       /* initialize nand_chip data structure */
-       nand->IO_ADDR_R = (void *)&nand_reg->nfdata;
-       nand->IO_ADDR_W = (void *)&nand_reg->nfdata;
-
-       nand->select_chip = NULL;
-
-       /* read_buf and write_buf are default */
-       /* read_byte and write_byte are default */
-#ifdef CONFIG_NAND_SPL
-       nand->read_buf = nand_read_buf;
-#endif
-
-       /* hwcontrol always must be implemented */
-       nand->cmd_ctrl = s3c24x0_hwcontrol;
-
-       nand->dev_ready = s3c24x0_dev_ready;
-
-#ifdef CONFIG_S3C2410_NAND_HWECC
-       nand->ecc.hwctl = s3c24x0_nand_enable_hwecc;
-       nand->ecc.calculate = s3c24x0_nand_calculate_ecc;
-       nand->ecc.correct = s3c24x0_nand_correct_data;
-       nand->ecc.mode = NAND_ECC_HW;
-       nand->ecc.size = CONFIG_SYS_NAND_ECCSIZE;
-       nand->ecc.bytes = CONFIG_SYS_NAND_ECCBYTES;
-       nand->ecc.strength = 1;
-#else
-       nand->ecc.mode = NAND_ECC_SOFT;
-#endif
-
-#ifdef CONFIG_S3C2410_NAND_BBT
-       nand->bbt_options |= NAND_BBT_USE_FLASH;
-#endif
-
-       debug("end of nand_init\n");
-
-       return 0;
-}
index d49bf572f8f92798592c0b7c386ff0c379750671..33634c33d4cb77cad995d25798def9ea904dcd75 100644 (file)
@@ -22,6 +22,13 @@ menuconfig NETDEVICES
 
 if NETDEVICES
 
+config PHY_GIGE
+       bool "Enable GbE PHY status parsing and configuration"
+       help
+         Enables support for parsing the status output and for
+         configuring GbE PHYs (affects the inner workings of some
+         commands and miiphyutil.c).
+
 config AG7XXX
        bool "Atheros AG7xxx Ethernet MAC support"
        depends on DM_ETH && ARCH_ATH79
@@ -187,6 +194,7 @@ config SUN8I_EMAC
         bool "Allwinner Sun8i Ethernet MAC support"
         depends on DM_ETH
         select PHYLIB
+       select PHY_GIGE
         help
           This driver supports the  Allwinner based SUN8I/SUN50I Ethernet MAC.
          It can be found in H3/A64/A83T based SoCs and compatible with both
index 778d2f573951294c436fa132f67bdf07c75b7575..d7db0fc432f7a93996cfbfd40439699f6de54e86 100644 (file)
@@ -612,21 +612,25 @@ static void cpsw_set_slave_mac(struct cpsw_slave *slave,
 #endif
 }
 
-static void cpsw_slave_update_link(struct cpsw_slave *slave,
+static int cpsw_slave_update_link(struct cpsw_slave *slave,
                                   struct cpsw_priv *priv, int *link)
 {
        struct phy_device *phy;
        u32 mac_control = 0;
+       int ret = -ENODEV;
 
        phy = priv->phydev;
-
        if (!phy)
-               return;
+               goto out;
+
+       ret = phy_startup(phy);
+       if (ret)
+               goto out;
 
-       phy_startup(phy);
-       *link = phy->link;
+       if (link)
+               *link = phy->link;
 
-       if (*link) { /* link up */
+       if (phy->link) { /* link up */
                mac_control = priv->data.mac_control;
                if (phy->speed == 1000)
                        mac_control |= GIGABITEN;
@@ -637,7 +641,7 @@ static void cpsw_slave_update_link(struct cpsw_slave *slave,
        }
 
        if (mac_control == slave->mac_control)
-               return;
+               goto out;
 
        if (mac_control) {
                printf("link up on port %d, speed %d, %s duplex\n",
@@ -649,17 +653,20 @@ static void cpsw_slave_update_link(struct cpsw_slave *slave,
 
        __raw_writel(mac_control, &slave->sliver->mac_control);
        slave->mac_control = mac_control;
+
+out:
+       return ret;
 }
 
 static int cpsw_update_link(struct cpsw_priv *priv)
 {
-       int link = 0;
+       int ret = -ENODEV;
        struct cpsw_slave *slave;
 
        for_active_slave(slave, priv)
-               cpsw_slave_update_link(slave, priv, &link);
+               ret = cpsw_slave_update_link(slave, priv, NULL);
 
-       return link;
+       return ret;
 }
 
 static inline u32  cpsw_get_slave_port(struct cpsw_priv *priv, u32 slave_num)
@@ -822,7 +829,9 @@ static int _cpsw_init(struct cpsw_priv *priv, u8 *enetaddr)
        for_active_slave(slave, priv)
                cpsw_slave_init(slave, priv);
 
-       cpsw_update_link(priv);
+       ret = cpsw_update_link(priv);
+       if (ret)
+               goto out;
 
        /* init descriptor pool */
        for (i = 0; i < NUM_DESCS; i++) {
@@ -897,7 +906,8 @@ static int _cpsw_init(struct cpsw_priv *priv, u8 *enetaddr)
                }
        }
 
-       return 0;
+out:
+       return ret;
 }
 
 static void _cpsw_halt(struct cpsw_priv *priv)
index e3a194c2c00e35438522d38dd134ee7788de4b36..e8569e6fef5fefdd36e874e7efc2689e559871ff 100644 (file)
@@ -18,6 +18,7 @@
 #include <linux/compiler.h>
 #include <linux/err.h>
 #include <asm/io.h>
+#include <power/regulator.h>
 #include "designware.h"
 
 DECLARE_GLOBAL_DATA_PTR;
@@ -661,6 +662,22 @@ int designware_eth_probe(struct udevice *dev)
        ulong ioaddr;
        int ret;
 
+#if defined(CONFIG_DM_REGULATOR)
+       struct udevice *phy_supply;
+
+       ret = device_get_supply_regulator(dev, "phy-supply",
+                                         &phy_supply);
+       if (ret) {
+               debug("%s: No phy supply\n", dev->name);
+       } else {
+               ret = regulator_set_enable(phy_supply, true);
+               if (ret) {
+                       puts("Error enabling phy supply\n");
+                       return ret;
+               }
+       }
+#endif
+
 #ifdef CONFIG_DM_PCI
        /*
         * If we are on PCI bus, either directly attached to a PCI root port,
index 93ba318bf5286bd11114cf5a94dad87497a99f27..6bb6a71470808d0ec9422173ce04c1dd931ec283 100644 (file)
@@ -66,12 +66,12 @@ phy_interface_t fman_port_enet_if(enum fm_port port)
        if (port == FM1_DTSEC3)
                if ((rcwsr13 & FSL_CHASSIS2_RCWSR13_EC1) ==
                                FSL_CHASSIS2_RCWSR13_EC1_DTSEC3_RGMII) {
-                       return PHY_INTERFACE_MODE_RGMII;
+                       return PHY_INTERFACE_MODE_RGMII_TXID;
                }
        if (port == FM1_DTSEC4)
                if ((rcwsr13 & FSL_CHASSIS2_RCWSR13_EC2) ==
                                FSL_CHASSIS2_RCWSR13_EC2_DTSEC4_RGMII) {
-                       return PHY_INTERFACE_MODE_RGMII;
+                       return PHY_INTERFACE_MODE_RGMII_TXID;
                }
 
        /* handle SGMII */
index bf555548b7b4a9944251edb8ab8e0bc05a306f13..6c91fb97f4a56c95e167da28d969d75ff907fa6a 100644 (file)
@@ -72,12 +72,12 @@ phy_interface_t fman_port_enet_if(enum fm_port port)
        if (port == FM1_DTSEC3)
                if ((rcwsr13 & FSL_CHASSIS2_RCWSR13_EC1) ==
                                FSL_CHASSIS2_RCWSR13_EC1_DTSEC3_RGMII)
-                       return PHY_INTERFACE_MODE_RGMII;
+                       return PHY_INTERFACE_MODE_RGMII_TXID;
 
        if (port == FM1_DTSEC4)
                if ((rcwsr13 & FSL_CHASSIS2_RCWSR13_EC2) ==
                                FSL_CHASSIS2_RCWSR13_EC2_DTSEC4_RGMII)
-                       return PHY_INTERFACE_MODE_RGMII;
+                       return PHY_INTERFACE_MODE_RGMII_TXID;
 
        /* handle SGMII, only MAC 2/5/6/9/10 available */
        switch (port) {
index 86dc13d70d242c6ee6f71e59cda750dcbc1b0a04..6e31244f208c48a30dfd80424abfdb1eec5e08a6 100644 (file)
@@ -4,6 +4,7 @@
  * SPDX-License-Identifier:    GPL-2.0+
  */
 
+#include <asm/arch/clock.h>
 #include "qbman_portal.h"
 
 /* QBMan portal management command codes */
index 0a74e3e42e49f1110a0d53df7155d651484fac2f..8bf25c7040c9b2b2f5b67e446fcce86d8c1bca7e 100644 (file)
@@ -27,6 +27,7 @@
 
 #define MC_MEM_SIZE_ENV_VAR    "mcmemsize"
 #define MC_BOOT_TIMEOUT_ENV_VAR        "mcboottimeout"
+#define MC_BOOT_ENV_VAR                "mcinitcmd"
 
 DECLARE_GLOBAL_DATA_PTR;
 static int mc_boot_status = -1;
@@ -155,19 +156,142 @@ int parse_mc_firmware_fit_image(u64 mc_fw_addr,
 }
 #endif
 
-static int mc_fixup_dpc_mac_addr(void *blob, int noff, int dpmac_id,
-               struct eth_device *eth_dev)
+#define MC_DT_INCREASE_SIZE    64
+
+enum mc_fixup_type {
+       MC_FIXUP_DPL,
+       MC_FIXUP_DPC
+};
+
+static int mc_fixup_mac_addr(void *blob, int nodeoffset,
+                            const char *propname, struct eth_device *eth_dev,
+                            enum mc_fixup_type type)
 {
-       int nodeoffset, err = 0;
+       int err = 0, len = 0, size, i;
+       unsigned char env_enetaddr[ARP_HLEN];
+       unsigned int enetaddr_32[ARP_HLEN];
+       void *val = NULL;
+
+       switch (type) {
+       case MC_FIXUP_DPL:
+       /* DPL likes its addresses on 32 * ARP_HLEN bits */
+       for (i = 0; i < ARP_HLEN; i++)
+               enetaddr_32[i] = cpu_to_fdt32(eth_dev->enetaddr[i]);
+       val = enetaddr_32;
+       len = sizeof(enetaddr_32);
+       break;
+
+       case MC_FIXUP_DPC:
+       val = eth_dev->enetaddr;
+       len = ARP_HLEN;
+       break;
+       }
+
+       /* MAC address property present */
+       if (fdt_get_property(blob, nodeoffset, propname, NULL)) {
+               /* u-boot MAC addr randomly assigned - leave the present one */
+               if (!eth_getenv_enetaddr_by_index("eth", eth_dev->index,
+                                                 env_enetaddr))
+                       return err;
+       } else {
+               size = MC_DT_INCREASE_SIZE + strlen(propname) + len;
+               /* make room for mac address property */
+               err = fdt_increase_size(blob, size);
+               if (err) {
+                       printf("fdt_increase_size: err=%s\n",
+                              fdt_strerror(err));
+                       return err;
+               }
+       }
+
+       err = fdt_setprop(blob, nodeoffset, propname, val, len);
+       if (err) {
+               printf("fdt_setprop: err=%s\n", fdt_strerror(err));
+               return err;
+       }
+
+       return err;
+}
+
+#define is_dpni(s) (s != NULL ? !strncmp(s, "dpni@", 5) : 0)
+
+const char *dpl_get_connection_endpoint(void *blob, char *endpoint)
+{
+       int connoffset = fdt_path_offset(blob, "/connections"), off;
+       const char *s1, *s2;
+
+       for (off = fdt_first_subnode(blob, connoffset);
+            off >= 0;
+            off = fdt_next_subnode(blob, off)) {
+               s1 = fdt_stringlist_get(blob, off, "endpoint1", 0, NULL);
+               s2 = fdt_stringlist_get(blob, off, "endpoint2", 0, NULL);
+
+               if (!s1 || !s2)
+                       continue;
+
+               if (strcmp(endpoint, s1) == 0)
+                       return s2;
+
+               if (strcmp(endpoint, s2) == 0)
+                       return s1;
+       }
+
+       return NULL;
+}
+
+static int mc_fixup_dpl_mac_addr(void *blob, int dpmac_id,
+                                struct eth_device *eth_dev)
+{
+       int objoff = fdt_path_offset(blob, "/objects");
+       int dpmacoff = -1, dpnioff = -1;
+       const char *endpoint;
        char mac_name[10];
-       const char link_type_mode[] = "FIXED_LINK";
-       unsigned char env_enetaddr[6];
+       int err;
+
+       sprintf(mac_name, "dpmac@%d", dpmac_id);
+       dpmacoff = fdt_subnode_offset(blob, objoff, mac_name);
+       if (dpmacoff < 0)
+               /* dpmac not defined in DPL, so skip it. */
+               return 0;
+
+       err = mc_fixup_mac_addr(blob, dpmacoff, "mac_addr", eth_dev,
+                               MC_FIXUP_DPL);
+       if (err) {
+               printf("Error fixing up dpmac mac_addr in DPL\n");
+               return err;
+       }
+
+       /* now we need to figure out if there is any
+        * DPNI connected to this MAC, so we walk the
+        * connection list
+        */
+       endpoint = dpl_get_connection_endpoint(blob, mac_name);
+       if (!is_dpni(endpoint))
+               return 0;
+
+       /* let's see if we can fixup the DPNI as well */
+       dpnioff = fdt_subnode_offset(blob, objoff, endpoint);
+       if (dpnioff < 0)
+               /* DPNI not defined in DPL in the objects area */
+               return 0;
+
+       return mc_fixup_mac_addr(blob, dpnioff, "mac_addr", eth_dev,
+                                MC_FIXUP_DPL);
+}
+
+static int mc_fixup_dpc_mac_addr(void *blob, int dpmac_id,
+                                struct eth_device *eth_dev)
+{
+       int nodeoffset = fdt_path_offset(blob, "/board_info/ports"), noff;
+       int err = 0;
+       char mac_name[10];
+       const char link_type_mode[] = "MAC_LINK_TYPE_FIXED";
 
        sprintf(mac_name, "mac@%d", dpmac_id);
 
        /* node not found - create it */
-       nodeoffset = fdt_subnode_offset(blob, noff, (const char *) mac_name);
-       if (nodeoffset < 0) {
+       noff = fdt_subnode_offset(blob, nodeoffset, (const char *)mac_name);
+       if (noff < 0) {
                err = fdt_increase_size(blob, 200);
                if (err) {
                        printf("fdt_increase_size: err=%s\n",
@@ -175,10 +299,15 @@ static int mc_fixup_dpc_mac_addr(void *blob, int noff, int dpmac_id,
                        return err;
                }
 
-               nodeoffset = fdt_add_subnode(blob, noff, mac_name);
+               noff = fdt_add_subnode(blob, nodeoffset, mac_name);
+               if (noff < 0) {
+                       printf("fdt_add_subnode: err=%s\n",
+                              fdt_strerror(err));
+                       return err;
+               }
 
                /* add default property of fixed link */
-               err = fdt_appendprop_string(blob, nodeoffset,
+               err = fdt_appendprop_string(blob, noff,
                                            "link_type", link_type_mode);
                if (err) {
                        printf("fdt_appendprop_string: err=%s\n",
@@ -187,49 +316,53 @@ static int mc_fixup_dpc_mac_addr(void *blob, int noff, int dpmac_id,
                }
        }
 
-       /* port_mac_address property present in DPC */
-       if (fdt_get_property(blob, nodeoffset, "port_mac_address", NULL)) {
-               /* MAC addr randomly assigned - leave the one in DPC */
-               eth_getenv_enetaddr_by_index("eth", eth_dev->index,
-                                               env_enetaddr);
-               if (is_zero_ethaddr(env_enetaddr))
-                       return err;
+       return mc_fixup_mac_addr(blob, noff, "port_mac_address", eth_dev,
+                                MC_FIXUP_DPC);
+}
 
-               /* replace DPC MAC address with u-boot env one */
-               err = fdt_setprop(blob, nodeoffset, "port_mac_address",
-                                 eth_dev->enetaddr, 6);
-               if (err) {
-                       printf("fdt_setprop mac: err=%s\n", fdt_strerror(err));
-                       return err;
-               }
+static int mc_fixup_mac_addrs(void *blob, enum mc_fixup_type type)
+{
+       int i, err = 0, ret = 0;
+       char ethname[10];
+       struct eth_device *eth_dev;
 
-               return 0;
-       }
+       for (i = WRIOP1_DPMAC1; i < NUM_WRIOP_PORTS; i++) {
+               /* port not enabled */
+               if ((wriop_is_enabled_dpmac(i) != 1) ||
+                   (wriop_get_phy_address(i) == -1))
+                       continue;
 
-       /* append port_mac_address property to mac node in DPC */
-       err = fdt_increase_size(blob, 80);
-       if (err) {
-               printf("fdt_increase_size: err=%s\n", fdt_strerror(err));
-               return err;
-       }
+               sprintf(ethname, "DPMAC%d@%s", i,
+                       phy_interface_strings[wriop_get_enet_if(i)]);
 
-       err = fdt_appendprop(blob, nodeoffset,
-                            "port_mac_address", eth_dev->enetaddr, 6);
-       if (err) {
-               printf("fdt_appendprop: err=%s\n", fdt_strerror(err));
-               return err;
+               eth_dev = eth_get_dev_by_name(ethname);
+               if (eth_dev == NULL)
+                       continue;
+
+               switch (type) {
+               case MC_FIXUP_DPL:
+                       err = mc_fixup_dpl_mac_addr(blob, i, eth_dev);
+                       break;
+               case MC_FIXUP_DPC:
+                       err = mc_fixup_dpc_mac_addr(blob, i, eth_dev);
+                       break;
+               default:
+                       break;
+               }
+
+               if (err)
+                       printf("fsl-mc: ERROR fixing mac address for %s\n",
+                              ethname);
+               ret |= err;
        }
 
-       return err;
+       return ret;
 }
 
 static int mc_fixup_dpc(u64 dpc_addr)
 {
        void *blob = (void *)dpc_addr;
        int nodeoffset, err = 0;
-       char ethname[10];
-       struct eth_device *eth_dev;
-       int i;
 
        /* delete any existing ICID pools */
        nodeoffset = fdt_path_offset(blob, "/resources/icid_pools");
@@ -254,30 +387,9 @@ static int mc_fixup_dpc(u64 dpc_addr)
        /* fixup MAC addresses for dpmac ports */
        nodeoffset = fdt_path_offset(blob, "/board_info/ports");
        if (nodeoffset < 0)
-               goto out;
-
-       for (i = WRIOP1_DPMAC1; i < NUM_WRIOP_PORTS; i++) {
-               /* port not enabled */
-               if ((wriop_is_enabled_dpmac(i) != 1) ||
-                   (wriop_get_phy_address(i) == -1))
-                       continue;
-
-               sprintf(ethname, "DPMAC%d@%s", i,
-                       phy_interface_strings[wriop_get_enet_if(i)]);
-
-               eth_dev = eth_get_dev_by_name(ethname);
-               if (eth_dev == NULL)
-                       continue;
-
-               err = mc_fixup_dpc_mac_addr(blob, nodeoffset, i, eth_dev);
-               if (err) {
-                       printf("mc_fixup_dpc_mac_addr failed: err=%s\n",
-                       fdt_strerror(err));
-                       goto out;
-               }
-       }
+               return 0;
 
-out:
+       err = mc_fixup_mac_addrs(blob, MC_FIXUP_DPC);
        flush_dcache_range(dpc_addr, dpc_addr + fdt_totalsize(blob));
 
        return err;
@@ -340,6 +452,25 @@ static int load_mc_dpc(u64 mc_ram_addr, size_t mc_ram_size, u64 mc_dpc_addr)
        return 0;
 }
 
+
+static int mc_fixup_dpl(u64 dpl_addr)
+{
+       void *blob = (void *)dpl_addr;
+       u32 ver = fdt_getprop_u32_default(blob, "/", "dpl-version", 0);
+       int err = 0;
+
+       /* The DPL fixup for mac addresses is only relevant
+        * for old-style DPLs
+        */
+       if (ver >= 10)
+               return 0;
+
+       err = mc_fixup_mac_addrs(blob, MC_FIXUP_DPL);
+       flush_dcache_range(dpl_addr, dpl_addr + fdt_totalsize(blob));
+
+       return err;
+}
+
 static int load_mc_dpl(u64 mc_ram_addr, size_t mc_ram_size, u64 mc_dpl_addr)
 {
        u64 mc_dpl_offset;
@@ -386,6 +517,8 @@ static int load_mc_dpl(u64 mc_ram_addr, size_t mc_ram_size, u64 mc_dpl_addr)
                      (u64)dpl_fdt_hdr, dpl_size, mc_ram_addr + mc_dpl_offset);
 #endif /* not defined CONFIG_SYS_LS_MC_DPL_IN_DDR */
 
+       if (mc_fixup_dpl(mc_ram_addr + mc_dpl_offset))
+               return -EINVAL;
        dump_ram_words("DPL", (void *)(mc_ram_addr + mc_dpl_offset));
        return 0;
 }
@@ -1368,3 +1501,18 @@ U_BOOT_CMD(
        "fsl_mc lazyapply DPL [DPL_addr] - Apply DPL file on exit\n"
        "fsl_mc start aiop [FW_addr] - Start AIOP\n"
 );
+
+void mc_env_boot(void)
+{
+#if defined(CONFIG_FSL_MC_ENET)
+       char *mc_boot_env_var;
+       /* The MC may only be initialized in the reset PHY function
+        * because otherwise U-Boot has not yet set up all the MAC
+        * address info properly. Without MAC addresses, the MC code
+        * can not properly initialize the DPC.
+        */
+       mc_boot_env_var = getenv(MC_BOOT_ENV_VAR);
+       if (mc_boot_env_var)
+               run_command_list(mc_boot_env_var, -1, 0);
+#endif /* CONFIG_FSL_MC_ENET */
+}
index bbbdb74e9517604800fcf316f1d074c5431454c6..f9373db0b9370e7afcca58caba2c3928817b87d0 100644 (file)
@@ -450,7 +450,6 @@ static void macb_phy_reset(struct macb_device *macb, const char *name)
                       name, status);
 }
 
-#ifdef CONFIG_MACB_SEARCH_PHY
 static int macb_phy_find(struct macb_device *macb, const char *name)
 {
        int i;
@@ -471,7 +470,6 @@ static int macb_phy_find(struct macb_device *macb, const char *name)
 
        return 0;
 }
-#endif /* CONFIG_MACB_SEARCH_PHY */
 
 #ifdef CONFIG_DM_ETH
 static int macb_phy_init(struct udevice *dev, const char *name)
@@ -488,11 +486,9 @@ static int macb_phy_init(struct macb_device *macb, const char *name)
        int i;
 
        arch_get_mdio_control(name);
-#ifdef CONFIG_MACB_SEARCH_PHY
        /* Auto-detect phy_addr */
        if (!macb_phy_find(macb, name))
                return 0;
-#endif /* CONFIG_MACB_SEARCH_PHY */
 
        /* Check if the PHY is up to snuff... */
        phy_id = macb_mdio_read(macb, MII_PHYSID1);
@@ -667,7 +663,8 @@ static int _macb_init(struct macb_device *macb, const char *name)
                 * to select interface between RMII and MII.
                 */
 #ifdef CONFIG_DM_ETH
-               if (macb->phy_interface == PHY_INTERFACE_MODE_RMII)
+               if ((macb->phy_interface == PHY_INTERFACE_MODE_RMII) ||
+                   (macb->phy_interface == PHY_INTERFACE_MODE_RGMII))
                        gem_writel(macb, UR, GEM_BIT(RGMII));
                else
                        gem_writel(macb, UR, 0);
index 6dc7239cd7af6e5606b03eff8047ae8d551dc729..1b46218e4dd91b3ec32928f625b32f9cb2ba6d76 100644 (file)
@@ -442,7 +442,7 @@ do {                                                                        \
 /* MPCS registers */
 
 #define PCS40G_COMMON_CONTROL                  0x14
-#define      FORWARD_ERROR_CORRECTION_MASK     BIT(1)
+#define      FORWARD_ERROR_CORRECTION_MASK     BIT(10)
 
 #define PCS_CLOCK_RESET                                0x14c
 #define      TX_SD_CLK_RESET_MASK              BIT(0)
@@ -3251,7 +3251,7 @@ static int gop_xpcs_mode(struct mvpp2_port *port, int num_of_lanes)
 
        /* configure XG MAC mode */
        val = readl(port->priv->xpcs_base + MVPP22_XPCS_GLOBAL_CFG_0_REG);
-       val &= ~MVPP22_XPCS_PCSMODE_OFFS;
+       val &= ~MVPP22_XPCS_PCSMODE_MASK;
        val &= ~MVPP22_XPCS_LANEACTIVE_MASK;
        val |= (2 * lane) << MVPP22_XPCS_LANEACTIVE_OFFS;
        writel(val, port->priv->xpcs_base + MVPP22_XPCS_GLOBAL_CFG_0_REG);
@@ -4479,7 +4479,15 @@ static int mvpp2_rx_refill(struct mvpp2_port *port,
 /* Set hw internals when starting port */
 static void mvpp2_start_dev(struct mvpp2_port *port)
 {
-       mvpp2_gmac_max_rx_size_set(port);
+       switch (port->phy_interface) {
+       case PHY_INTERFACE_MODE_RGMII:
+       case PHY_INTERFACE_MODE_RGMII_ID:
+       case PHY_INTERFACE_MODE_SGMII:
+               mvpp2_gmac_max_rx_size_set(port);
+       default:
+               break;
+       }
+
        mvpp2_txp_max_tx_size_set(port);
 
        if (port->priv->hw_version == MVPP21)
@@ -4574,11 +4582,16 @@ static int mvpp2_open(struct udevice *dev, struct mvpp2_port *port)
                return err;
        }
 
-       err = mvpp2_phy_connect(dev, port);
-       if (err < 0)
-               return err;
+       if (port->phy_node) {
+               err = mvpp2_phy_connect(dev, port);
+               if (err < 0)
+                       return err;
 
-       mvpp2_link_event(port);
+               mvpp2_link_event(port);
+       } else {
+               mvpp2_egress_enable(port);
+               mvpp2_ingress_enable(port);
+       }
 
        mvpp2_start_dev(port);
 
@@ -4723,13 +4736,19 @@ static int phy_info_parse(struct udevice *dev, struct mvpp2_port *port)
        const char *phy_mode_str;
        int phy_node;
        u32 id;
-       u32 phyaddr;
+       u32 phyaddr = 0;
        int phy_mode = -1;
 
        phy_node = fdtdec_lookup_phandle(gd->fdt_blob, port_node, "phy");
-       if (phy_node < 0) {
-               dev_err(&pdev->dev, "missing phy\n");
-               return -ENODEV;
+
+       if (phy_node > 0) {
+               phyaddr = fdtdec_get_int(gd->fdt_blob, phy_node, "reg", 0);
+               if (phyaddr < 0) {
+                       dev_err(&pdev->dev, "could not find phy address\n");
+                       return -1;
+               }
+       } else {
+               phy_node = 0;
        }
 
        phy_mode_str = fdt_getprop(gd->fdt_blob, port_node, "phy-mode", NULL);
@@ -4755,8 +4774,6 @@ static int phy_info_parse(struct udevice *dev, struct mvpp2_port *port)
        port->phy_speed = fdtdec_get_int(gd->fdt_blob, port_node,
                                         "phy-speed", 1000);
 
-       phyaddr = fdtdec_get_int(gd->fdt_blob, phy_node, "reg", 0);
-
        port->id = id;
        if (port->priv->hw_version == MVPP21)
                port->first_rxq = port->id * rxq_number;
@@ -5316,7 +5333,14 @@ static int mvpp2_start(struct udevice *dev)
        /* Reconfigure parser accept the original MAC address */
        mvpp2_prs_update_mac_da(port, port->dev_addr);
 
-       mvpp2_port_power_up(port);
+       switch (port->phy_interface) {
+       case PHY_INTERFACE_MODE_RGMII:
+       case PHY_INTERFACE_MODE_RGMII_ID:
+       case PHY_INTERFACE_MODE_SGMII:
+               mvpp2_port_power_up(port);
+       default:
+               break;
+       }
 
        mvpp2_open(dev, port);
 
@@ -5479,7 +5503,8 @@ static int mvpp2_probe(struct udevice *dev)
                        port->gop_id * MVPP22_PORT_OFFSET;
 
                /* Set phy address of the port */
-               mvpp22_smi_phy_addr_cfg(port);
+               if(port->phy_node)
+                       mvpp22_smi_phy_addr_cfg(port);
 
                /* GoP Init */
                gop_port_init(port);
index d40fff0e48863fb79f26099899257ae4b32566a5..8866f6632fd22151e30dd2682f051921c6e85854 100644 (file)
@@ -117,15 +117,17 @@ static void pch_gbe_rx_descs_init(struct udevice *dev)
 
        memset(rx_desc, 0, sizeof(struct pch_gbe_rx_desc) * PCH_GBE_DESC_NUM);
        for (i = 0; i < PCH_GBE_DESC_NUM; i++)
-               rx_desc->buffer_addr = dm_pci_phys_to_mem(priv->dev,
-                       (ulong)(priv->rx_buff[i]));
+               rx_desc[i].buffer_addr = dm_pci_virt_to_mem(priv->dev,
+                       priv->rx_buff[i]);
 
-       writel(dm_pci_phys_to_mem(priv->dev, (ulong)rx_desc),
+       flush_dcache_range((ulong)rx_desc, (ulong)&rx_desc[PCH_GBE_DESC_NUM]);
+
+       writel(dm_pci_virt_to_mem(priv->dev, rx_desc),
               &mac_regs->rx_dsc_base);
        writel(sizeof(struct pch_gbe_rx_desc) * (PCH_GBE_DESC_NUM - 1),
               &mac_regs->rx_dsc_size);
 
-       writel(dm_pci_phys_to_mem(priv->dev, (ulong)(rx_desc + 1)),
+       writel(dm_pci_virt_to_mem(priv->dev, rx_desc + 1),
               &mac_regs->rx_dsc_sw_p);
 }
 
@@ -137,11 +139,13 @@ static void pch_gbe_tx_descs_init(struct udevice *dev)
 
        memset(tx_desc, 0, sizeof(struct pch_gbe_tx_desc) * PCH_GBE_DESC_NUM);
 
-       writel(dm_pci_phys_to_mem(priv->dev, (ulong)tx_desc),
+       flush_dcache_range((ulong)tx_desc, (ulong)&tx_desc[PCH_GBE_DESC_NUM]);
+
+       writel(dm_pci_virt_to_mem(priv->dev, tx_desc),
               &mac_regs->tx_dsc_base);
        writel(sizeof(struct pch_gbe_tx_desc) * (PCH_GBE_DESC_NUM - 1),
               &mac_regs->tx_dsc_size);
-       writel(dm_pci_phys_to_mem(priv->dev, (ulong)(tx_desc + 1)),
+       writel(dm_pci_virt_to_mem(priv->dev, tx_desc + 1),
               &mac_regs->tx_dsc_sw_p);
 }
 
@@ -245,24 +249,28 @@ static int pch_gbe_send(struct udevice *dev, void *packet, int length)
        u32 int_st;
        ulong start;
 
+       flush_dcache_range((ulong)packet, (ulong)packet + length);
+
        tx_head = &priv->tx_desc[0];
        tx_desc = &priv->tx_desc[priv->tx_idx];
 
        if (length < 64)
                frame_ctrl |= PCH_GBE_TXD_CTRL_APAD;
 
-       tx_desc->buffer_addr = dm_pci_phys_to_mem(priv->dev, (ulong)packet);
+       tx_desc->buffer_addr = dm_pci_virt_to_mem(priv->dev, packet);
        tx_desc->length = length;
        tx_desc->tx_words_eob = length + 3;
        tx_desc->tx_frame_ctrl = frame_ctrl;
        tx_desc->dma_status = 0;
        tx_desc->gbec_status = 0;
 
+       flush_dcache_range((ulong)tx_desc, (ulong)&tx_desc[1]);
+
        /* Test the wrap-around condition */
        if (++priv->tx_idx >= PCH_GBE_DESC_NUM)
                priv->tx_idx = 0;
 
-       writel(dm_pci_phys_to_mem(priv->dev, (ulong)(tx_head + priv->tx_idx)),
+       writel(dm_pci_virt_to_mem(priv->dev, tx_head + priv->tx_idx),
               &mac_regs->tx_dsc_sw_p);
 
        start = get_timer(0);
@@ -283,7 +291,8 @@ static int pch_gbe_recv(struct udevice *dev, int flags, uchar **packetp)
        struct pch_gbe_priv *priv = dev_get_priv(dev);
        struct pch_gbe_regs *mac_regs = priv->mac_regs;
        struct pch_gbe_rx_desc *rx_desc;
-       ulong hw_desc, buffer_addr, length;
+       ulong hw_desc, length;
+       void *buffer;
 
        rx_desc = &priv->rx_desc[priv->rx_idx];
 
@@ -291,12 +300,16 @@ static int pch_gbe_recv(struct udevice *dev, int flags, uchar **packetp)
        hw_desc = readl(&mac_regs->rx_dsc_hw_p_hld);
 
        /* Just return if not receiving any packet */
-       if ((ulong)rx_desc == hw_desc)
+       if (virt_to_phys(rx_desc) == hw_desc)
                return -EAGAIN;
 
-       buffer_addr = dm_pci_mem_to_phys(priv->dev, rx_desc->buffer_addr);
-       *packetp = (uchar *)buffer_addr;
+       /* Invalidate the descriptor */
+       invalidate_dcache_range((ulong)rx_desc, (ulong)&rx_desc[1]);
+
        length = rx_desc->rx_words_eob - 3 - ETH_FCS_LEN;
+       buffer = dm_pci_mem_to_virt(priv->dev, rx_desc->buffer_addr, length, 0);
+       invalidate_dcache_range((ulong)buffer, (ulong)buffer + length);
+       *packetp = (uchar *)buffer;
 
        return length;
 }
@@ -315,7 +328,7 @@ static int pch_gbe_free_pkt(struct udevice *dev, uchar *packet, int length)
        if (++rx_swp >= PCH_GBE_DESC_NUM)
                rx_swp = 0;
 
-       writel(dm_pci_phys_to_mem(priv->dev, (ulong)(rx_head + rx_swp)),
+       writel(dm_pci_virt_to_mem(priv->dev, rx_head + rx_swp),
               &mac_regs->rx_dsc_sw_p);
 
        return 0;
@@ -422,6 +435,7 @@ int pch_gbe_probe(struct udevice *dev)
        struct pch_gbe_priv *priv;
        struct eth_pdata *plat = dev_get_platdata(dev);
        void *iobase;
+       int err;
 
        /*
         * The priv structure contains the descriptors and frame buffers which
@@ -444,6 +458,10 @@ int pch_gbe_probe(struct udevice *dev)
        pch_gbe_mdio_init(dev->name, priv->mac_regs);
        priv->bus = miiphy_get_dev_by_name(dev->name);
 
+       err = pch_gbe_reset(dev);
+       if (err)
+               return err;
+
        return pch_gbe_phy_init(dev);
 }
 
index aca3990aebf12296701c1d48d44522bd966f7551..1afd8097b2fa7d8bcafbb30b16190c3e4e061bff 100644 (file)
@@ -57,6 +57,40 @@ config PHY_MARVELL
 
 config PHY_MICREL
        bool "Micrel Ethernet PHYs support"
+       help
+         Enable support for the GbE PHYs manufactured by Micrel (now
+         a part of Microchip). This includes drivers for the KSZ804,
+         KSZ8031, KSZ8051, KSZ8081, KSZ8895, KSZ886x, KSZ8721
+         either/or KSZ9021 (see the "Micrel KSZ9021 family support"
+         config option for details), and KSZ9031 (if configured).
+
+if PHY_MICREL
+
+config PHY_MICREL_KSZ9021
+       bool "Micrel KSZ9021 family support"
+       select PHY_GIGE
+       help
+         Enable support for the Micrel KSZ9021 GbE PHY family.  If
+         enabled, the extended register read/write for KSZ9021 PHYs
+         is supported through the 'mdio' command and any RGMII signal
+         delays configured in the device tree will be applied to the
+         PHY during initialisation.
+
+         Note that the KSZ9021 uses the same part number os the
+         KSZ8921BL, so enabling this option disables support for the
+         KSZ8721BL.
+
+config PHY_MICREL_KSZ9031
+       bool "Micrel KSZ9031 family support"
+       select PHY_GIGE
+       help
+         Enable support for the Micrel KSZ9031 GbE PHY family.  If
+         enabled, the extended register read/write for KSZ9021 PHYs
+         is supported through the 'mdio' command and any RGMII signal
+         delays configured in the device tree will be applied to the
+         PHY during initialisatioin.
+
+endif # PHY_MICREL
 
 config PHY_MSCC
        bool "Microsemi Corp Ethernet PHYs support"
index ab0c44354c3494f70a4629e2ada0e5f767bd6602..8041922a02dc6ff533536dd5c96a0df3cfdd0438 100644 (file)
@@ -13,6 +13,8 @@
 
 #define PHY_AUTONEGOTIATE_TIMEOUT 5000
 
+#define MII_MARVELL_PHY_PAGE           22
+
 /* 88E1011 PHY Status Register */
 #define MIIM_88E1xxx_PHY_STATUS                0x11
 #define MIIM_88E1xxx_PHYSTAT_SPEED     0xc000
 #define MIIM_88E1310_PHY_PAGE          22
 
 /* 88E151x PHY defines */
+/* Page 2 registers */
+#define MIIM_88E151x_PHY_MSCR          21
+#define MIIM_88E151x_RGMII_RX_DELAY    BIT(5)
+#define MIIM_88E151x_RGMII_TX_DELAY    BIT(4)
+#define MIIM_88E151x_RGMII_RXTX_DELAY  (BIT(5) | BIT(4))
 /* Page 3 registers */
 #define MIIM_88E151x_LED_FUNC_CTRL     16
 #define MIIM_88E151x_LED_FLD_SZ                4
@@ -295,6 +302,8 @@ void m88e1518_phy_writebits(struct phy_device *phydev,
 
 static int m88e1518_config(struct phy_device *phydev)
 {
+       u16 reg;
+
        /*
         * As per Marvell Release Notes - Alaska 88E1510/88E1518/88E1512
         * /88E1514 Rev A0, Errata Section 3.1
@@ -331,7 +340,41 @@ static int m88e1518_config(struct phy_device *phydev)
                udelay(100);
        }
 
-       return m88e1111s_config(phydev);
+       if (phydev->interface == PHY_INTERFACE_MODE_SGMII) {
+               reg = phy_read(phydev, MDIO_DEVAD_NONE,
+                              MIIM_88E1111_PHY_EXT_SR);
+
+               reg &= ~(MIIM_88E1111_HWCFG_MODE_MASK);
+               reg |= MIIM_88E1111_HWCFG_MODE_SGMII_NO_CLK;
+               reg |= MIIM_88E1111_HWCFG_FIBER_COPPER_AUTO;
+
+               phy_write(phydev, MDIO_DEVAD_NONE,
+                         MIIM_88E1111_PHY_EXT_SR, reg);
+       }
+
+       if (phy_interface_is_rgmii(phydev)) {
+               phy_write(phydev, MDIO_DEVAD_NONE, MII_MARVELL_PHY_PAGE, 2);
+
+               reg = phy_read(phydev, MDIO_DEVAD_NONE, MIIM_88E151x_PHY_MSCR);
+               reg &= ~MIIM_88E151x_RGMII_RXTX_DELAY;
+               if (phydev->interface == PHY_INTERFACE_MODE_RGMII_ID)
+                       reg |= MIIM_88E151x_RGMII_RXTX_DELAY;
+               else if (phydev->interface == PHY_INTERFACE_MODE_RGMII_RXID)
+                       reg |= MIIM_88E151x_RGMII_RX_DELAY;
+               else if (phydev->interface == PHY_INTERFACE_MODE_RGMII_TXID)
+                       reg |= MIIM_88E151x_RGMII_TX_DELAY;
+               phy_write(phydev, MDIO_DEVAD_NONE, MIIM_88E151x_PHY_MSCR, reg);
+
+               phy_write(phydev, MDIO_DEVAD_NONE, MII_MARVELL_PHY_PAGE, 0);
+       }
+
+       /* soft reset */
+       phy_reset(phydev);
+
+       genphy_config_aneg(phydev);
+       genphy_restart_aneg(phydev);
+
+       return 0;
 }
 
 /* Marvell 88E1510 */
index 1bb7fa576f581903a6e12c8b129dc7d9c9cd3131..f6bbcdc48eded15e2ed78d842c37b1b6ad46bea9 100644 (file)
@@ -192,7 +192,7 @@ static u32 phy_setup_op(struct zynq_gem_priv *priv, u32 phy_addr, u32 regnum,
        int err;
 
        err = wait_for_bit(__func__, &regs->nwsr, ZYNQ_GEM_NWSR_MDIOIDLE_MASK,
-                           true, 20000, true);
+                           true, 20000, false);
        if (err)
                return err;
 
@@ -205,7 +205,7 @@ static u32 phy_setup_op(struct zynq_gem_priv *priv, u32 phy_addr, u32 regnum,
        writel(mgtcr, &regs->phymntnc);
 
        err = wait_for_bit(__func__, &regs->nwsr, ZYNQ_GEM_NWSR_MDIOIDLE_MASK,
-                           true, 20000, true);
+                           true, 20000, false);
        if (err)
                return err;
 
@@ -407,10 +407,6 @@ static int zynq_gem_init(struct udevice *dev)
                dummy_rx_bd->addr = ZYNQ_GEM_RXBUF_WRAP_MASK |
                                ZYNQ_GEM_RXBUF_NEW_MASK;
                dummy_rx_bd->status = 0;
-               flush_dcache_range((ulong)&dummy_tx_bd, (ulong)&dummy_tx_bd +
-                                  sizeof(dummy_tx_bd));
-               flush_dcache_range((ulong)&dummy_rx_bd, (ulong)&dummy_rx_bd +
-                                  sizeof(dummy_rx_bd));
 
                writel((ulong)dummy_tx_bd, &regs->transmit_q1_ptr);
                writel((ulong)dummy_rx_bd, &regs->receive_q1_ptr);
@@ -587,14 +583,12 @@ __weak int zynq_board_read_rom_ethaddr(unsigned char *ethaddr)
 
 static int zynq_gem_read_rom_mac(struct udevice *dev)
 {
-       int retval;
        struct eth_pdata *pdata = dev_get_platdata(dev);
 
-       retval = zynq_board_read_rom_ethaddr(pdata->enetaddr);
-       if (retval == -ENOSYS)
-               retval = 0;
+       if (!pdata)
+               return -ENOSYS;
 
-       return retval;
+       return zynq_board_read_rom_ethaddr(pdata->enetaddr);
 }
 
 static int zynq_gem_miiphy_read(struct mii_dev *bus, int addr,
index 7565e2fd929e6e89a0382bb8537f8a9d5afccdd7..78cde21cf4f84d34dc7cdfb622cb009bcdcdd60c 100644 (file)
 #include <errno.h>
 #include <malloc.h>
 #include <dm.h>
+#if defined(CONFIG_FSL_LSCH2) || defined(CONFIG_FSL_LSCH3) || \
+       defined(CONFIG_ARM)
+#include <asm/arch/clock.h>
+#endif
 #include "pcie_layerscape.h"
 
 DECLARE_GLOBAL_DATA_PTR;
index ce709bfc1477b75aebc1d0431eada2f05a4ffd1f..9e6c2f5dfcf62e8b06935aa9ae3c40a734f9571d 100644 (file)
@@ -14,6 +14,9 @@
 #ifdef CONFIG_OF_BOARD_SETUP
 #include <libfdt.h>
 #include <fdt_support.h>
+#ifdef CONFIG_ARM
+#include <asm/arch/clock.h>
+#endif
 #include "pcie_layerscape.h"
 
 #if defined(CONFIG_FSL_LSCH3) || defined(CONFIG_FSL_LSCH2)
index 4f0a27892f2e8e19de9f3605b0de94cdaeb1b018..24e764dc7c59ea2aa5bc0d3bdb885cb65bb1185a 100644 (file)
@@ -8,6 +8,7 @@
  */
 
 #include <common.h>
+#include <malloc.h>
 #include <command.h>
 #include <linux/errno.h>
 #include <asm/io.h>
 #include <asm/arch/immap_ls102xa.h>
 #endif
 
+#ifdef CONFIG_SYS_QE_FMAN_FW_IN_MMC
+#include <mmc.h>
+#endif
+
 #define MPC85xx_DEVDISR_QE_DISABLE     0x1
 
 qe_map_t               *qe_immr = NULL;
@@ -194,8 +199,37 @@ void u_qe_init(void)
 {
        qe_immr = (qe_map_t *)(CONFIG_SYS_IMMR + QE_IMMR_OFFSET);
 
-       u_qe_upload_firmware((const void *)CONFIG_SYS_QE_FW_ADDR);
+       void *addr = (void *)CONFIG_SYS_QE_FW_ADDR;
+#ifdef CONFIG_SYS_QE_FMAN_FW_IN_MMC
+       int dev = CONFIG_SYS_MMC_ENV_DEV;
+       u32 cnt = CONFIG_SYS_QE_FMAN_FW_LENGTH / 512;
+       u32 blk = CONFIG_SYS_QE_FW_ADDR / 512;
+
+       if (mmc_initialize(gd->bd)) {
+               printf("%s: mmc_initialize() failed\n", __func__);
+               return;
+       }
+       addr = malloc(CONFIG_SYS_QE_FMAN_FW_LENGTH);
+       struct mmc *mmc = find_mmc_device(CONFIG_SYS_MMC_ENV_DEV);
+
+       if (!mmc) {
+               free(addr);
+               printf("\nMMC cannot find device for ucode\n");
+       } else {
+               printf("\nMMC read: dev # %u, block # %u, count %u ...\n",
+                      dev, blk, cnt);
+               mmc_init(mmc);
+               (void)mmc->block_dev.block_read(&mmc->block_dev, blk, cnt,
+                                               addr);
+               /* flush cache after read */
+               flush_cache((ulong)addr, cnt * 512);
+       }
+#endif
+       u_qe_upload_firmware(addr);
        out_be32(&qe_immr->iram.iready, QE_IRAM_READY);
+#ifdef CONFIG_SYS_QE_FMAN_FW_IN_MMC
+       free(addr);
+#endif
 }
 #endif
 
index b640519555dc2a3088bc1aca6cfe4b0cc4527de8..902de2b6c479c4ac6b807686be1d9116e4326a55 100644 (file)
@@ -132,8 +132,8 @@ static int stm32_fmc_ofdata_to_platdata(struct udevice *dev)
 
 static int stm32_fmc_probe(struct udevice *dev)
 {
-#ifdef CONFIG_CLK
        int ret;
+#ifdef CONFIG_CLK
        struct clk clk;
 
        ret = clk_get_by_index(dev, 0, &clk);
index 0c32a3d8c9eef6effe7972285bc554d416744410..a79708cde2800a7169e905396afb808b15aa6767 100644 (file)
@@ -30,6 +30,8 @@ struct sti_reset {
  * @reset_bit: Bit number in reset register.
  * @ack_offset: Ack reset register offset in syscon bank.
  * @ack_bit: Bit number in Ack reset register.
+ * @deassert_cnt: incremented when reset is deasserted, reset can only be
+ *                asserted when equal to 0
  */
 
 struct syscfg_reset_channel_data {
@@ -38,6 +40,7 @@ struct syscfg_reset_channel_data {
        int reset_bit;
        int ack_offset;
        int ack_bit;
+       int deassert_cnt;
 };
 
 /**
@@ -54,7 +57,7 @@ struct syscfg_reset_controller_data {
        bool wait_for_ack;
        bool active_low;
        int nr_channels;
-       const struct syscfg_reset_channel_data *channels;
+       struct syscfg_reset_channel_data *channels;
 };
 
 /* STiH407 Peripheral powerdown definitions. */
@@ -102,7 +105,7 @@ static const char stih407_lpm[] = "st,stih407-lpm-syscfg";
 #define SYSSTAT_4520   0x820
 #define SYSCFG_4002    0x8
 
-static const struct syscfg_reset_channel_data stih407_powerdowns[] = {
+static struct syscfg_reset_channel_data stih407_powerdowns[] = {
        [STIH407_EMISS_POWERDOWN] = STIH407_PDN_0(1),
        [STIH407_NAND_POWERDOWN] = STIH407_PDN_0(0),
        [STIH407_USB3_POWERDOWN] = STIH407_PDN_1(6),
@@ -122,7 +125,7 @@ static const struct syscfg_reset_channel_data stih407_powerdowns[] = {
 
 #define LPM_SYSCFG_1   0x4     /* Softreset IRB & SBC UART */
 
-static const struct syscfg_reset_channel_data stih407_softresets[] = {
+static struct syscfg_reset_channel_data stih407_softresets[] = {
        [STIH407_ETH1_SOFTRESET] = STIH407_SRST_SBC(SYSCFG_4002, 4),
        [STIH407_MMC1_SOFTRESET] = STIH407_SRST_CORE(SYSCFG_5132, 3),
        [STIH407_USB2_PORT0_SOFTRESET] = STIH407_SRST_CORE(SYSCFG_5132, 28),
@@ -161,7 +164,7 @@ static const struct syscfg_reset_channel_data stih407_softresets[] = {
 /* PicoPHY reset/control */
 #define SYSCFG_5061    0x0f4
 
-static const struct syscfg_reset_channel_data stih407_picophyresets[] = {
+static struct syscfg_reset_channel_data stih407_picophyresets[] = {
        [STIH407_PICOPHY0_RESET] = STIH407_SRST_CORE(SYSCFG_5061, 5),
        [STIH407_PICOPHY1_RESET] = STIH407_SRST_CORE(SYSCFG_5061, 6),
        [STIH407_PICOPHY2_RESET] = STIH407_SRST_CORE(SYSCFG_5061, 7),
@@ -223,7 +226,7 @@ static int sti_reset_program_hw(struct reset_ctl *reset_ctl, int assert)
        struct udevice *dev = reset_ctl->dev;
        struct syscfg_reset_controller_data *reset_desc =
                (struct syscfg_reset_controller_data *)(dev->driver_data);
-       struct syscfg_reset_channel_data ch;
+       struct syscfg_reset_channel_data *ch;
        phys_addr_t base;
        u32 ctrl_val = reset_desc->active_low ? !assert : !!assert;
        void __iomem *reg;
@@ -235,19 +238,35 @@ static int sti_reset_program_hw(struct reset_ctl *reset_ctl, int assert)
        /* get reset sysconf register base address */
        base = sti_reset_get_regmap(reset_desc->channels[reset_ctl->id].compatible);
 
-       ch = reset_desc->channels[reset_ctl->id];
-       reg = (void __iomem *)base + ch.reset_offset;
+       ch = &reset_desc->channels[reset_ctl->id];
+
+       /* check the deassert counter to assert reset when it reaches 0 */
+       if (!assert) {
+               ch->deassert_cnt++;
+               if (ch->deassert_cnt > 1)
+                       return 0;
+       } else {
+               if (ch->deassert_cnt > 0) {
+                       ch->deassert_cnt--;
+                       if (ch->deassert_cnt > 0)
+                               return 0;
+               } else
+                       error("Reset balancing error: reset_ctl=%p dev=%p id=%lu\n",
+                             reset_ctl, reset_ctl->dev, reset_ctl->id);
+       }
+
+       reg = (void __iomem *)base + ch->reset_offset;
 
        if (ctrl_val)
-               generic_set_bit(ch.reset_bit, reg);
+               generic_set_bit(ch->reset_bit, reg);
        else
-               generic_clear_bit(ch.reset_bit, reg);
+               generic_clear_bit(ch->reset_bit, reg);
 
        if (!reset_desc->wait_for_ack)
                return 0;
 
-       reg = (void __iomem *)base + ch.ack_offset;
-       if (wait_for_bit(__func__, reg, BIT(ch.ack_bit), ctrl_val,
+       reg = (void __iomem *)base + ch->ack_offset;
+       if (wait_for_bit(__func__, reg, BIT(ch->ack_bit), ctrl_val,
                         1000, false)) {
                error("Stuck on waiting ack reset_ctl=%p dev=%p id=%lu\n",
                      reset_ctl, reset_ctl->dev, reset_ctl->id);
index 338ac08d8a7f165573f2518dfdc5ba8550a6b655..4e642ae435a3be29341b5d61c2e619cbf6129593 100644 (file)
@@ -9,6 +9,10 @@
 #include <common.h>
 #include <fsl_errata.h>
 #include<fsl_usb.h>
+#if defined(CONFIG_FSL_LSCH2) || defined(CONFIG_FSL_LSCH3) || \
+       defined(CONFIG_ARM)
+#include <asm/arch/clock.h>
+#endif
 
 /* USB Erratum Checking code */
 #if defined(CONFIG_PPC) || defined(CONFIG_ARM)
index 973cd971ad19a0195dc8b6f18c9ab4fdcfcc5b3d..0e3ba9473003bcedf033b0527bbdc706366fbf97 100644 (file)
 #define gadget_is_atmel_usba(g)        0
 #endif
 
-#ifdef CONFIG_USB_GADGET_S3C2410
-#define gadget_is_s3c2410(g)    (!strcmp("s3c2410_udc", (g)->name))
-#else
-#define gadget_is_s3c2410(g)    0
-#endif
-
 #ifdef CONFIG_USB_GADGET_AT91
 #define gadget_is_at91(g)      (!strcmp("at91_udc", (g)->name))
 #else
@@ -207,8 +201,6 @@ static inline int usb_gadget_controller_number(struct usb_gadget *gadget)
                return 0x09;
        else if (gadget_is_pxa27x(gadget))
                return 0x10;
-       else if (gadget_is_s3c2410(gadget))
-               return 0x11;
        else if (gadget_is_at91(gadget))
                return 0x12;
        else if (gadget_is_imx(gadget))
index 4ece0a2e4bde8cf34cd5c02ffe48caa112299418..a73b2551764c022eabcc71bf75ba92ee956550ff 100644 (file)
@@ -17,7 +17,6 @@ obj-$(CONFIG_USB_OHCI_DA8XX) += ohci-da8xx.o
 obj-$(CONFIG_USB_ISP116X_HCD) += isp116x-hcd.o
 obj-$(CONFIG_USB_R8A66597_HCD) += r8a66597-hcd.o
 obj-$(CONFIG_USB_SL811HS) += sl811-hcd.o
-obj-$(CONFIG_USB_OHCI_S3C24XX) += ohci-s3c24xx.o
 obj-$(CONFIG_USB_OHCI_EP93XX) += ohci-ep93xx.o
 obj-$(CONFIG_USB_OHCI_SUNXI) += ohci-sunxi.o
 obj-$(CONFIG_USB_OHCI_LPC32XX) += ohci-lpc32xx.o
index 2367671daee49cc7650d42188ddea27cd60a0f8b..f348ec9bca9d8ff1c6b4bf0bb8018986e0d384ce 100644 (file)
@@ -17,6 +17,7 @@
 #include <asm/imx-common/iomux-v3.h>
 #include <asm/imx-common/sys_proto.h>
 #include <dm.h>
+#include <asm/mach-types.h>
 #include <power/regulator.h>
 
 #include "ehci.h"
index 80cfe11290e212d40e755a112509fcd20a6eb0ac..b5e0304348d430a8a636e2672f24b8c23308869e 100644 (file)
@@ -51,7 +51,6 @@
 #endif
 
 #if defined(CONFIG_CPU_ARM920T) || \
-    defined(CONFIG_S3C24X0) || \
     defined(CONFIG_440EP) || \
     defined(CONFIG_PCI_OHCI) || \
     defined(CONFIG_MPC5200) || \
diff --git a/drivers/usb/host/ohci-s3c24xx.c b/drivers/usb/host/ohci-s3c24xx.c
deleted file mode 100644 (file)
index 28b9ab5..0000000
+++ /dev/null
@@ -1,1688 +0,0 @@
-/*
- * URB OHCI HCD (Host Controller Driver) for USB on the S3C2400.
- *
- * (C) Copyright 2003
- * Gary Jennejohn, DENX Software Engineering <garyj@denx.de>
- *
- * Note: Much of this code has been derived from Linux 2.4
- * (C) Copyright 1999 Roman Weissgaerber <weissg@vienna.at>
- * (C) Copyright 2000-2002 David Brownell
- *
- * SPDX-License-Identifier:    GPL-2.0+
- */
-/*
- * IMPORTANT NOTES
- * 1 - this driver is intended for use with USB Mass Storage Devices
- *     (BBB) ONLY. There is NO support for Interrupt or Isochronous pipes!
- */
-
-#include <common.h>
-/* #include <pci.h> no PCI on the S3C24X0 */
-
-#if defined(CONFIG_USB_OHCI) && defined(CONFIG_S3C24X0)
-
-#include <asm/arch/s3c24x0_cpu.h>
-#include <asm/io.h>
-#include <malloc.h>
-#include <usb.h>
-#include "ohci-s3c24xx.h"
-
-#define OHCI_USE_NPS           /* force NoPowerSwitching mode */
-#undef OHCI_VERBOSE_DEBUG      /* not always helpful */
-
-
-/* For initializing controller (mask in an HCFS mode too) */
-#define        OHCI_CONTROL_INIT \
-       (OHCI_CTRL_CBSR & 0x3) | OHCI_CTRL_IE | OHCI_CTRL_PLE
-
-#undef DEBUG
-#ifdef DEBUG
-#define dbg(format, arg...) printf("DEBUG: " format "\n", ## arg)
-#else
-#define dbg(format, arg...) do {} while(0)
-#endif /* DEBUG */
-#define err(format, arg...) printf("ERROR: " format "\n", ## arg)
-#undef SHOW_INFO
-#ifdef SHOW_INFO
-#define info(format, arg...) printf("INFO: " format "\n", ## arg)
-#else
-#define info(format, arg...) do {} while(0)
-#endif
-
-#define m16_swap(x) swap_16(x)
-#define m32_swap(x) swap_32(x)
-
-/* global struct ohci */
-static struct ohci gohci;
-/* this must be aligned to a 256 byte boundary */
-struct ohci_hcca ghcca[1];
-/* a pointer to the aligned storage */
-struct ohci_hcca *phcca;
-/* this allocates EDs for all possible endpoints */
-struct ohci_device ohci_dev;
-/* urb_priv */
-struct urb_priv urb_priv;
-/* RHSC flag */
-int got_rhsc;
-/* device which was disconnected */
-struct usb_device *devgone;
-/* flag guarding URB transation */
-int urb_finished = 0;
-
-/*-------------------------------------------------------------------------*/
-
-/* AMD-756 (D2 rev) reports corrupt register contents in some cases.
- * The erratum (#4) description is incorrect.  AMD's workaround waits
- * till some bits (mostly reserved) are clear; ok for all revs.
- */
-#define OHCI_QUIRK_AMD756 0xabcd
-#define read_roothub(hc, register, mask) ({ \
-       u32 temp = readl (&hc->regs->roothub.register); \
-       if (hc->flags & OHCI_QUIRK_AMD756) \
-               while (temp & mask) \
-                       temp = readl (&hc->regs->roothub.register); \
-       temp; })
-
-static u32 roothub_a(struct ohci *hc)
-{
-       return read_roothub(hc, a, 0xfc0fe000);
-}
-static inline u32 roothub_b(struct ohci *hc)
-{
-       return readl(&hc->regs->roothub.b);
-}
-static inline u32 roothub_status(struct ohci *hc)
-{
-       return readl(&hc->regs->roothub.status);
-}
-static u32 roothub_portstatus(struct ohci *hc, int i)
-{
-       return read_roothub(hc, portstatus[i], 0xffe0fce0);
-}
-
-/* forward declaration */
-static int hc_interrupt(void);
-static void td_submit_job(struct usb_device *dev, unsigned long pipe,
-                         void *buffer, int transfer_len,
-                         struct devrequest *setup, struct urb_priv *urb,
-                         int interval);
-
-/*-------------------------------------------------------------------------*
- * URB support functions
- *-------------------------------------------------------------------------*/
-
-/* free HCD-private data associated with this URB */
-
-static void urb_free_priv(struct urb_priv *urb)
-{
-       int i;
-       int last;
-       struct td *td;
-
-       last = urb->length - 1;
-       if (last >= 0) {
-               for (i = 0; i <= last; i++) {
-                       td = urb->td[i];
-                       if (td) {
-                               td->usb_dev = NULL;
-                               urb->td[i] = NULL;
-                       }
-               }
-       }
-}
-
-/*-------------------------------------------------------------------------*/
-
-#ifdef DEBUG
-static int sohci_get_current_frame_number(struct usb_device *dev);
-
-/* debug| print the main components of an URB
- * small: 0) header + data packets 1) just header */
-
-static void pkt_print(struct usb_device *dev, unsigned long pipe, void *buffer,
-                     int transfer_len, struct devrequest *setup, char *str,
-                     int small)
-{
-       struct urb_priv *purb = &urb_priv;
-
-       dbg("%s URB:[%4x] dev:%2d,ep:%2d-%c,type:%s,len:%d/%d stat:%#lx",
-           str,
-           sohci_get_current_frame_number(dev),
-           usb_pipedevice(pipe),
-           usb_pipeendpoint(pipe),
-           usb_pipeout(pipe) ? 'O' : 'I',
-           usb_pipetype(pipe) < 2 ?
-               (usb_pipeint(pipe) ? "INTR" : "ISOC") :
-               (usb_pipecontrol(pipe) ? "CTRL" : "BULK"),
-           purb->actual_length, transfer_len, dev->status);
-#ifdef OHCI_VERBOSE_DEBUG
-       if (!small) {
-               int i, len;
-
-               if (usb_pipecontrol(pipe)) {
-                       printf(__FILE__ ": cmd(8):");
-                       for (i = 0; i < 8; i++)
-                               printf(" %02x", ((__u8 *) setup)[i]);
-                       printf("\n");
-               }
-               if (transfer_len > 0 && buffer) {
-                       printf(__FILE__ ": data(%d/%d):",
-                              purb->actual_length, transfer_len);
-                       len = usb_pipeout(pipe) ?
-                           transfer_len : purb->actual_length;
-                       for (i = 0; i < 16 && i < len; i++)
-                               printf(" %02x", ((__u8 *) buffer)[i]);
-                       printf("%s\n", i < len ? "..." : "");
-               }
-       }
-#endif
-}
-
-/* just for debugging; prints non-empty branches of the
-   int ed tree inclusive iso eds*/
-void ep_print_int_eds(struct ohci *ohci, char *str)
-{
-       int i, j;
-       __u32 *ed_p;
-       for (i = 0; i < 32; i++) {
-               j = 5;
-               ed_p = &(ohci->hcca->int_table[i]);
-               if (*ed_p == 0)
-                       continue;
-               printf(__FILE__ ": %s branch int %2d(%2x):", str, i, i);
-               while (*ed_p != 0 && j--) {
-                       struct ed *ed = (struct ed *) m32_swap(ed_p);
-                       printf(" ed: %4x;", ed->hwINFO);
-                       ed_p = &ed->hwNextED;
-               }
-               printf("\n");
-       }
-}
-
-static void ohci_dump_intr_mask(char *label, __u32 mask)
-{
-       dbg("%s: 0x%08x%s%s%s%s%s%s%s%s%s",
-           label,
-           mask,
-           (mask & OHCI_INTR_MIE) ? " MIE" : "",
-           (mask & OHCI_INTR_OC) ? " OC" : "",
-           (mask & OHCI_INTR_RHSC) ? " RHSC" : "",
-           (mask & OHCI_INTR_FNO) ? " FNO" : "",
-           (mask & OHCI_INTR_UE) ? " UE" : "",
-           (mask & OHCI_INTR_RD) ? " RD" : "",
-           (mask & OHCI_INTR_SF) ? " SF" : "",
-           (mask & OHCI_INTR_WDH) ? " WDH" : "",
-           (mask & OHCI_INTR_SO) ? " SO" : "");
-}
-
-static void maybe_print_eds(char *label, __u32 value)
-{
-       struct ed *edp = (struct ed *) value;
-
-       if (value) {
-               dbg("%s %08x", label, value);
-               dbg("%08x", edp->hwINFO);
-               dbg("%08x", edp->hwTailP);
-               dbg("%08x", edp->hwHeadP);
-               dbg("%08x", edp->hwNextED);
-       }
-}
-
-static char *hcfs2string(int state)
-{
-       switch (state) {
-       case OHCI_USB_RESET:
-               return "reset";
-       case OHCI_USB_RESUME:
-               return "resume";
-       case OHCI_USB_OPER:
-               return "operational";
-       case OHCI_USB_SUSPEND:
-               return "suspend";
-       }
-       return "?";
-}
-
-/* dump control and status registers */
-static void ohci_dump_status(struct ohci *controller)
-{
-       struct ohci_regs *regs = controller->regs;
-       __u32 temp;
-
-       temp = readl(&regs->revision) & 0xff;
-       if (temp != 0x10)
-               dbg("spec %d.%d", (temp >> 4), (temp & 0x0f));
-
-       temp = readl(&regs->control);
-       dbg("control: 0x%08x%s%s%s HCFS=%s%s%s%s%s CBSR=%d", temp,
-           (temp & OHCI_CTRL_RWE) ? " RWE" : "",
-           (temp & OHCI_CTRL_RWC) ? " RWC" : "",
-           (temp & OHCI_CTRL_IR) ? " IR" : "",
-           hcfs2string(temp & OHCI_CTRL_HCFS),
-           (temp & OHCI_CTRL_BLE) ? " BLE" : "",
-           (temp & OHCI_CTRL_CLE) ? " CLE" : "",
-           (temp & OHCI_CTRL_IE) ? " IE" : "",
-           (temp & OHCI_CTRL_PLE) ? " PLE" : "", temp & OHCI_CTRL_CBSR);
-
-       temp = readl(&regs->cmdstatus);
-       dbg("cmdstatus: 0x%08x SOC=%d%s%s%s%s", temp,
-           (temp & OHCI_SOC) >> 16,
-           (temp & OHCI_OCR) ? " OCR" : "",
-           (temp & OHCI_BLF) ? " BLF" : "",
-           (temp & OHCI_CLF) ? " CLF" : "", (temp & OHCI_HCR) ? " HCR" : "");
-
-       ohci_dump_intr_mask("intrstatus", readl(&regs->intrstatus));
-       ohci_dump_intr_mask("intrenable", readl(&regs->intrenable));
-
-       maybe_print_eds("ed_periodcurrent", readl(&regs->ed_periodcurrent));
-
-       maybe_print_eds("ed_controlhead", readl(&regs->ed_controlhead));
-       maybe_print_eds("ed_controlcurrent", readl(&regs->ed_controlcurrent));
-
-       maybe_print_eds("ed_bulkhead", readl(&regs->ed_bulkhead));
-       maybe_print_eds("ed_bulkcurrent", readl(&regs->ed_bulkcurrent));
-
-       maybe_print_eds("donehead", readl(&regs->donehead));
-}
-
-static void ohci_dump_roothub(struct ohci *controller, int verbose)
-{
-       __u32 temp, ndp, i;
-
-       temp = roothub_a(controller);
-       ndp = (temp & RH_A_NDP);
-
-       if (verbose) {
-               dbg("roothub.a: %08x POTPGT=%d%s%s%s%s%s NDP=%d", temp,
-                   ((temp & RH_A_POTPGT) >> 24) & 0xff,
-                   (temp & RH_A_NOCP) ? " NOCP" : "",
-                   (temp & RH_A_OCPM) ? " OCPM" : "",
-                   (temp & RH_A_DT) ? " DT" : "",
-                   (temp & RH_A_NPS) ? " NPS" : "",
-                   (temp & RH_A_PSM) ? " PSM" : "", ndp);
-               temp = roothub_b(controller);
-               dbg("roothub.b: %08x PPCM=%04x DR=%04x",
-                   temp, (temp & RH_B_PPCM) >> 16, (temp & RH_B_DR)
-                   );
-               temp = roothub_status(controller);
-               dbg("roothub.status: %08x%s%s%s%s%s%s",
-                   temp,
-                   (temp & RH_HS_CRWE) ? " CRWE" : "",
-                   (temp & RH_HS_OCIC) ? " OCIC" : "",
-                   (temp & RH_HS_LPSC) ? " LPSC" : "",
-                   (temp & RH_HS_DRWE) ? " DRWE" : "",
-                   (temp & RH_HS_OCI) ? " OCI" : "",
-                   (temp & RH_HS_LPS) ? " LPS" : "");
-       }
-
-       for (i = 0; i < ndp; i++) {
-               temp = roothub_portstatus(controller, i);
-               dbg("roothub.portstatus [%d] = 0x%08x%s%s%s%s%s%s%s%s%s%s%s%s",
-                   i,
-                   temp,
-                   (temp & RH_PS_PRSC) ? " PRSC" : "",
-                   (temp & RH_PS_OCIC) ? " OCIC" : "",
-                   (temp & RH_PS_PSSC) ? " PSSC" : "",
-                   (temp & RH_PS_PESC) ? " PESC" : "",
-                   (temp & RH_PS_CSC) ? " CSC" : "",
-                   (temp & RH_PS_LSDA) ? " LSDA" : "",
-                   (temp & RH_PS_PPS) ? " PPS" : "",
-                   (temp & RH_PS_PRS) ? " PRS" : "",
-                   (temp & RH_PS_POCI) ? " POCI" : "",
-                   (temp & RH_PS_PSS) ? " PSS" : "",
-                   (temp & RH_PS_PES) ? " PES" : "",
-                   (temp & RH_PS_CCS) ? " CCS" : "");
-       }
-}
-
-static void ohci_dump(struct ohci *controller, int verbose)
-{
-       dbg("OHCI controller usb-%s state", controller->slot_name);
-
-       /* dumps some of the state we know about */
-       ohci_dump_status(controller);
-       if (verbose)
-               ep_print_int_eds(controller, "hcca");
-       dbg("hcca frame #%04x", controller->hcca->frame_no);
-       ohci_dump_roothub(controller, 1);
-}
-
-#endif /* DEBUG */
-
-/*-------------------------------------------------------------------------*
- * Interface functions (URB)
- *-------------------------------------------------------------------------*/
-
-/* get a transfer request */
-
-int sohci_submit_job(struct usb_device *dev, unsigned long pipe, void *buffer,
-                    int transfer_len, struct devrequest *setup, int interval)
-{
-       struct ohci *ohci;
-       struct ed *ed;
-       struct urb_priv *purb_priv;
-       int i, size = 0;
-
-       ohci = &gohci;
-
-       /* when controller's hung, permit only roothub cleanup attempts
-        * such as powering down ports */
-       if (ohci->disabled) {
-               err("sohci_submit_job: EPIPE");
-               return -1;
-       }
-
-       /* if we have an unfinished URB from previous transaction let's
-        * fail and scream as quickly as possible so as not to corrupt
-        * further communication */
-       if (!urb_finished) {
-               err("sohci_submit_job: URB NOT FINISHED");
-               return -1;
-       }
-       /* we're about to begin a new transaction here
-          so mark the URB unfinished */
-       urb_finished = 0;
-
-       /* every endpoint has a ed, locate and fill it */
-       ed = ep_add_ed(dev, pipe);
-       if (!ed) {
-               err("sohci_submit_job: ENOMEM");
-               return -1;
-       }
-
-       /* for the private part of the URB we need the number of TDs (size) */
-       switch (usb_pipetype(pipe)) {
-       case PIPE_BULK:
-               /* one TD for every 4096 Byte */
-               size = (transfer_len - 1) / 4096 + 1;
-               break;
-       case PIPE_CONTROL:
-               /* 1 TD for setup, 1 for ACK and 1 for every 4096 B */
-               size = (transfer_len == 0) ? 2 : (transfer_len - 1) / 4096 + 3;
-               break;
-       }
-
-       if (size >= (N_URB_TD - 1)) {
-               err("need %d TDs, only have %d", size, N_URB_TD);
-               return -1;
-       }
-       purb_priv = &urb_priv;
-       purb_priv->pipe = pipe;
-
-       /* fill the private part of the URB */
-       purb_priv->length = size;
-       purb_priv->ed = ed;
-       purb_priv->actual_length = 0;
-
-       /* allocate the TDs */
-       /* note that td[0] was allocated in ep_add_ed */
-       for (i = 0; i < size; i++) {
-               purb_priv->td[i] = td_alloc(dev);
-               if (!purb_priv->td[i]) {
-                       purb_priv->length = i;
-                       urb_free_priv(purb_priv);
-                       err("sohci_submit_job: ENOMEM");
-                       return -1;
-               }
-       }
-
-       if (ed->state == ED_NEW || (ed->state & ED_DEL)) {
-               urb_free_priv(purb_priv);
-               err("sohci_submit_job: EINVAL");
-               return -1;
-       }
-
-       /* link the ed into a chain if is not already */
-       if (ed->state != ED_OPER)
-               ep_link(ohci, ed);
-
-       /* fill the TDs and link it to the ed */
-       td_submit_job(dev, pipe, buffer, transfer_len, setup, purb_priv,
-                     interval);
-
-       return 0;
-}
-
-/*-------------------------------------------------------------------------*/
-
-#ifdef DEBUG
-/* tell us the current USB frame number */
-
-static int sohci_get_current_frame_number(struct usb_device *usb_dev)
-{
-       struct ohci *ohci = &gohci;
-
-       return m16_swap(ohci->hcca->frame_no);
-}
-#endif
-
-/*-------------------------------------------------------------------------*
- * ED handling functions
- *-------------------------------------------------------------------------*/
-
-/* link an ed into one of the HC chains */
-
-static int ep_link(struct ohci *ohci, struct ed *edi)
-{
-       struct ed *ed = edi;
-
-       ed->state = ED_OPER;
-
-       switch (ed->type) {
-       case PIPE_CONTROL:
-               ed->hwNextED = 0;
-               if (ohci->ed_controltail == NULL) {
-                       writel((u32)ed, &ohci->regs->ed_controlhead);
-               } else {
-                       ohci->ed_controltail->hwNextED = (__u32) m32_swap(ed);
-               }
-               ed->ed_prev = ohci->ed_controltail;
-               if (!ohci->ed_controltail && !ohci->ed_rm_list[0] &&
-                   !ohci->ed_rm_list[1] && !ohci->sleeping) {
-                       ohci->hc_control |= OHCI_CTRL_CLE;
-                       writel(ohci->hc_control, &ohci->regs->control);
-               }
-               ohci->ed_controltail = edi;
-               break;
-
-       case PIPE_BULK:
-               ed->hwNextED = 0;
-               if (ohci->ed_bulktail == NULL) {
-                       writel((u32)ed, &ohci->regs->ed_bulkhead);
-               } else {
-                       ohci->ed_bulktail->hwNextED = (__u32) m32_swap(ed);
-               }
-               ed->ed_prev = ohci->ed_bulktail;
-               if (!ohci->ed_bulktail && !ohci->ed_rm_list[0] &&
-                   !ohci->ed_rm_list[1] && !ohci->sleeping) {
-                       ohci->hc_control |= OHCI_CTRL_BLE;
-                       writel(ohci->hc_control, &ohci->regs->control);
-               }
-               ohci->ed_bulktail = edi;
-               break;
-       }
-       return 0;
-}
-
-/*-------------------------------------------------------------------------*/
-
-/* unlink an ed from one of the HC chains.
- * just the link to the ed is unlinked.
- * the link from the ed still points to another operational ed or 0
- * so the HC can eventually finish the processing of the unlinked ed */
-
-static int ep_unlink(struct ohci *ohci, struct ed *ed)
-{
-       struct ed *next;
-       ed->hwINFO |= m32_swap(OHCI_ED_SKIP);
-
-       switch (ed->type) {
-       case PIPE_CONTROL:
-               if (ed->ed_prev == NULL) {
-                       if (!ed->hwNextED) {
-                               ohci->hc_control &= ~OHCI_CTRL_CLE;
-                               writel(ohci->hc_control, &ohci->regs->control);
-                       }
-                       writel(m32_swap(*((__u32 *) &ed->hwNextED)),
-                              &ohci->regs->ed_controlhead);
-               } else {
-                       ed->ed_prev->hwNextED = ed->hwNextED;
-               }
-               if (ohci->ed_controltail == ed) {
-                       ohci->ed_controltail = ed->ed_prev;
-               } else {
-                       next = (struct ed *)m32_swap(*((__u32 *)&ed->hwNextED));
-                       next->ed_prev = ed->ed_prev;
-               }
-               break;
-
-       case PIPE_BULK:
-               if (ed->ed_prev == NULL) {
-                       if (!ed->hwNextED) {
-                               ohci->hc_control &= ~OHCI_CTRL_BLE;
-                               writel(ohci->hc_control, &ohci->regs->control);
-                       }
-                       writel(m32_swap(*((__u32 *) &ed->hwNextED)),
-                              &ohci->regs->ed_bulkhead);
-               } else {
-                       ed->ed_prev->hwNextED = ed->hwNextED;
-               }
-               if (ohci->ed_bulktail == ed) {
-                       ohci->ed_bulktail = ed->ed_prev;
-               } else {
-                       next = (struct ed *)m32_swap(*((__u32 *)&ed->hwNextED));
-                       next->ed_prev = ed->ed_prev;
-               }
-               break;
-       }
-       ed->state = ED_UNLINK;
-       return 0;
-}
-
-/*-------------------------------------------------------------------------*/
-
-/* add/reinit an endpoint; this should be done once at the usb_set_configuration
- * command, but the USB stack is a little bit stateless  so we do it at every
- * transaction. If the state of the ed is ED_NEW then a dummy td is added and
- * the state is changed to ED_UNLINK. In all other cases the state is left
- * unchanged. The ed info fields are setted anyway even though most of them
- * should not change */
-
-static struct ed *ep_add_ed(struct usb_device *usb_dev, unsigned long pipe)
-{
-       struct td *td;
-       struct ed *ed_ret;
-       struct ed *ed;
-
-       ed = ed_ret = &ohci_dev.ed[(usb_pipeendpoint(pipe) << 1) |
-                                  (usb_pipecontrol(pipe) ? 0 :
-                                   usb_pipeout(pipe))];
-
-       if ((ed->state & ED_DEL) || (ed->state & ED_URB_DEL)) {
-               err("ep_add_ed: pending delete");
-               /* pending delete request */
-               return NULL;
-       }
-
-       if (ed->state == ED_NEW) {
-               ed->hwINFO = m32_swap(OHCI_ED_SKIP);    /* skip ed */
-               /* dummy td; end of td list for ed */
-               td = td_alloc(usb_dev);
-               ed->hwTailP = (__u32) m32_swap(td);
-               ed->hwHeadP = ed->hwTailP;
-               ed->state = ED_UNLINK;
-               ed->type = usb_pipetype(pipe);
-               ohci_dev.ed_cnt++;
-       }
-
-       ed->hwINFO = m32_swap(usb_pipedevice(pipe)
-                             | usb_pipeendpoint(pipe) << 7
-                             | (usb_pipeisoc(pipe) ? 0x8000 : 0)
-                             | (usb_pipecontrol(pipe) ? 0 :
-                                (usb_pipeout(pipe) ? 0x800 : 0x1000))
-                             | (usb_dev->speed == USB_SPEED_LOW) << 13 |
-                             usb_maxpacket(usb_dev, pipe) << 16);
-
-       return ed_ret;
-}
-
-/*-------------------------------------------------------------------------*
- * TD handling functions
- *-------------------------------------------------------------------------*/
-
-/* enqueue next TD for this URB (OHCI spec 5.2.8.2) */
-
-static void td_fill(struct ohci *ohci, unsigned int info, void *data, int len,
-                   struct usb_device *dev, int index,
-                   struct urb_priv *urb_priv)
-{
-       struct td *td, *td_pt;
-#ifdef OHCI_FILL_TRACE
-       int i;
-#endif
-
-       if (index > urb_priv->length) {
-               err("index > length");
-               return;
-       }
-       /* use this td as the next dummy */
-       td_pt = urb_priv->td[index];
-       td_pt->hwNextTD = 0;
-
-       /* fill the old dummy TD */
-       td = urb_priv->td[index] =
-           (struct td *) (m32_swap(urb_priv->ed->hwTailP) & ~0xf);
-
-       td->ed = urb_priv->ed;
-       td->next_dl_td = NULL;
-       td->index = index;
-       td->data = (__u32) data;
-#ifdef OHCI_FILL_TRACE
-       if (usb_pipebulk(urb_priv->pipe) && usb_pipeout(urb_priv->pipe)) {
-               for (i = 0; i < len; i++)
-                       printf("td->data[%d] %#2x ", i,
-                              ((unsigned char *)td->data)[i]);
-               printf("\n");
-       }
-#endif
-       if (!len)
-               data = 0;
-
-       td->hwINFO = (__u32) m32_swap(info);
-       td->hwCBP = (__u32) m32_swap(data);
-       if (data)
-               td->hwBE = (__u32) m32_swap(data + len - 1);
-       else
-               td->hwBE = 0;
-       td->hwNextTD = (__u32) m32_swap(td_pt);
-
-       /* append to queue */
-       td->ed->hwTailP = td->hwNextTD;
-}
-
-/*-------------------------------------------------------------------------*/
-
-/* prepare all TDs of a transfer */
-
-static void td_submit_job(struct usb_device *dev, unsigned long pipe,
-                         void *buffer, int transfer_len,
-                         struct devrequest *setup, struct urb_priv *urb,
-                         int interval)
-{
-       struct ohci *ohci = &gohci;
-       int data_len = transfer_len;
-       void *data;
-       int cnt = 0;
-       __u32 info = 0;
-       unsigned int toggle = 0;
-
-       /* OHCI handles the DATA-toggles itself, we just
-          use the USB-toggle bits for resetting */
-       if (usb_gettoggle(dev, usb_pipeendpoint(pipe), usb_pipeout(pipe))) {
-               toggle = TD_T_TOGGLE;
-       } else {
-               toggle = TD_T_DATA0;
-               usb_settoggle(dev, usb_pipeendpoint(pipe), usb_pipeout(pipe),
-                             1);
-       }
-       urb->td_cnt = 0;
-       if (data_len)
-               data = buffer;
-       else
-               data = 0;
-
-       switch (usb_pipetype(pipe)) {
-       case PIPE_BULK:
-               info = usb_pipeout(pipe) ? TD_CC | TD_DP_OUT : TD_CC | TD_DP_IN;
-               while (data_len > 4096) {
-                       td_fill(ohci, info | (cnt ? TD_T_TOGGLE : toggle), data,
-                               4096, dev, cnt, urb);
-                       data += 4096;
-                       data_len -= 4096;
-                       cnt++;
-               }
-               info = usb_pipeout(pipe) ?
-                               TD_CC | TD_DP_OUT :
-                               TD_CC | TD_R | TD_DP_IN;
-               td_fill(ohci, info | (cnt ? TD_T_TOGGLE : toggle), data,
-                       data_len, dev, cnt, urb);
-               cnt++;
-
-               if (!ohci->sleeping)
-                       /* start bulk list */
-                       writel(OHCI_BLF, &ohci->regs->cmdstatus);
-               break;
-
-       case PIPE_CONTROL:
-               info = TD_CC | TD_DP_SETUP | TD_T_DATA0;
-               td_fill(ohci, info, setup, 8, dev, cnt++, urb);
-               if (data_len > 0) {
-                       info = usb_pipeout(pipe) ?
-                           TD_CC | TD_R | TD_DP_OUT | TD_T_DATA1 :
-                           TD_CC | TD_R | TD_DP_IN | TD_T_DATA1;
-                       /* NOTE:  mishandles transfers >8K, some >4K */
-                       td_fill(ohci, info, data, data_len, dev, cnt++, urb);
-               }
-               info = usb_pipeout(pipe) ?
-                   TD_CC | TD_DP_IN | TD_T_DATA1 :
-                   TD_CC | TD_DP_OUT | TD_T_DATA1;
-               td_fill(ohci, info, data, 0, dev, cnt++, urb);
-               if (!ohci->sleeping)
-                       /* start Control list */
-                       writel(OHCI_CLF, &ohci->regs->cmdstatus);
-               break;
-       }
-       if (urb->length != cnt)
-               dbg("TD LENGTH %d != CNT %d", urb->length, cnt);
-}
-
-/*-------------------------------------------------------------------------*
- * Done List handling functions
- *-------------------------------------------------------------------------*/
-
-
-/* calculate the transfer length and update the urb */
-
-static void dl_transfer_length(struct td *td)
-{
-       __u32 tdBE, tdCBP;
-       struct urb_priv *lurb_priv = &urb_priv;
-
-       tdBE = m32_swap(td->hwBE);
-       tdCBP = m32_swap(td->hwCBP);
-
-       if (!(usb_pipecontrol(lurb_priv->pipe) &&
-             ((td->index == 0) || (td->index == lurb_priv->length - 1)))) {
-               if (tdBE != 0) {
-                       if (td->hwCBP == 0)
-                               lurb_priv->actual_length += tdBE - td->data + 1;
-                       else
-                               lurb_priv->actual_length += tdCBP - td->data;
-               }
-       }
-}
-
-/*-------------------------------------------------------------------------*/
-
-/* replies to the request have to be on a FIFO basis so
- * we reverse the reversed done-list */
-
-static struct td *dl_reverse_done_list(struct ohci *ohci)
-{
-       __u32 td_list_hc;
-       __u32 tmp;
-       struct td *td_rev = NULL;
-       struct td *td_list = NULL;
-       struct urb_priv *lurb_priv = NULL;
-
-       td_list_hc = m32_swap(ohci->hcca->done_head) & 0xfffffff0;
-       ohci->hcca->done_head = 0;
-
-       while (td_list_hc) {
-               td_list = (struct td *) td_list_hc;
-
-               if (TD_CC_GET(m32_swap(td_list->hwINFO))) {
-                       lurb_priv = &urb_priv;
-                       dbg(" USB-error/status: %x : %p",
-                           TD_CC_GET(m32_swap(td_list->hwINFO)), td_list);
-                       if (td_list->ed->hwHeadP & m32_swap(0x1)) {
-                               if (lurb_priv &&
-                                   ((td_list->index+1) < lurb_priv->length)) {
-                                       tmp = lurb_priv->length - 1;
-                                       td_list->ed->hwHeadP =
-                                               (lurb_priv->td[tmp]->hwNextTD &
-                                                m32_swap(0xfffffff0)) |
-                                                (td_list->ed->hwHeadP &
-                                                 m32_swap(0x2));
-                                       lurb_priv->td_cnt += lurb_priv->length -
-                                                            td_list->index - 1;
-                               } else
-                                       td_list->ed->hwHeadP &=
-                                           m32_swap(0xfffffff2);
-                       }
-               }
-
-               td_list->next_dl_td = td_rev;
-               td_rev = td_list;
-               td_list_hc = m32_swap(td_list->hwNextTD) & 0xfffffff0;
-       }
-
-       return td_list;
-}
-
-/*-------------------------------------------------------------------------*/
-
-/* td done list */
-static int dl_done_list(struct ohci *ohci, struct td *td_list)
-{
-       struct td *td_list_next = NULL;
-       struct ed *ed;
-       int cc = 0;
-       int stat = 0;
-       /* urb_t *urb; */
-       struct urb_priv *lurb_priv;
-       __u32 tdINFO, edHeadP, edTailP;
-
-       while (td_list) {
-               td_list_next = td_list->next_dl_td;
-
-               lurb_priv = &urb_priv;
-               tdINFO = m32_swap(td_list->hwINFO);
-
-               ed = td_list->ed;
-
-               dl_transfer_length(td_list);
-
-               /* error code of transfer */
-               cc = TD_CC_GET(tdINFO);
-               if (cc != 0) {
-                       dbg("ConditionCode %#x", cc);
-                       stat = cc_to_error[cc];
-               }
-
-               /* see if this done list makes for all TD's of current URB,
-                * and mark the URB finished if so */
-               if (++(lurb_priv->td_cnt) == lurb_priv->length) {
-                       if ((ed->state & (ED_OPER | ED_UNLINK)))
-                               urb_finished = 1;
-                       else
-                               dbg("dl_done_list: strange.., ED state %x, "
-                                   "ed->state\n");
-               } else
-                       dbg("dl_done_list: processing TD %x, len %x\n",
-                           lurb_priv->td_cnt, lurb_priv->length);
-
-               if (ed->state != ED_NEW) {
-                       edHeadP = m32_swap(ed->hwHeadP) & 0xfffffff0;
-                       edTailP = m32_swap(ed->hwTailP);
-
-                       /* unlink eds if they are not busy */
-                       if ((edHeadP == edTailP) && (ed->state == ED_OPER))
-                               ep_unlink(ohci, ed);
-               }
-
-               td_list = td_list_next;
-       }
-       return stat;
-}
-
-/*-------------------------------------------------------------------------*
- * Virtual Root Hub
- *-------------------------------------------------------------------------*/
-
-#include <usbroothubdes.h>
-
-/* Hub class-specific descriptor is constructed dynamically */
-
-
-/*-------------------------------------------------------------------------*/
-
-#define OK(x)                  len = (x); break
-#ifdef DEBUG
-#define WR_RH_STAT(x) \
-{ \
-       info("WR:status %#8x", (x)); \
-       writel((x), &gohci.regs->roothub.status); \
-}
-#define WR_RH_PORTSTAT(x) \
-{ \
-       info("WR:portstatus[%d] %#8x", wIndex-1, (x)); \
-       writel((x), &gohci.regs->roothub.portstatus[wIndex-1]); \
-}
-#else
-#define WR_RH_STAT(x) \
-       writel((x), &gohci.regs->roothub.status)
-#define WR_RH_PORTSTAT(x)\
-       writel((x), &gohci.regs->roothub.portstatus[wIndex-1])
-#endif
-#define RD_RH_STAT     roothub_status(&gohci)
-#define RD_RH_PORTSTAT roothub_portstatus(&gohci, wIndex-1)
-
-/* request to virtual root hub */
-
-int rh_check_port_status(struct ohci *controller)
-{
-       __u32 temp, ndp, i;
-       int res;
-
-       res = -1;
-       temp = roothub_a(controller);
-       ndp = (temp & RH_A_NDP);
-       for (i = 0; i < ndp; i++) {
-               temp = roothub_portstatus(controller, i);
-               /* check for a device disconnect */
-               if (((temp & (RH_PS_PESC | RH_PS_CSC)) ==
-                    (RH_PS_PESC | RH_PS_CSC)) && ((temp & RH_PS_CCS) == 0)) {
-                       res = i;
-                       break;
-               }
-       }
-       return res;
-}
-
-static int ohci_submit_rh_msg(struct usb_device *dev, unsigned long pipe,
-                             void *buffer, int transfer_len,
-                             struct devrequest *cmd)
-{
-       void *data = buffer;
-       int leni = transfer_len;
-       int len = 0;
-       int stat = 0;
-       union {
-               __u32 word[4];
-               __u16 hword[8];
-               __u8 byte[16];
-       } datab;
-       __u8 *data_buf = datab.byte;
-       __u16 bmRType_bReq;
-       __u16 wValue;
-       __u16 wIndex;
-       __u16 wLength;
-
-#ifdef DEBUG
-       urb_priv.actual_length = 0;
-       pkt_print(dev, pipe, buffer, transfer_len, cmd, "SUB(rh)",
-                 usb_pipein(pipe));
-#else
-       mdelay(1);
-#endif
-       if (usb_pipeint(pipe)) {
-               info("Root-Hub submit IRQ: NOT implemented");
-               return 0;
-       }
-
-       bmRType_bReq = cmd->requesttype | (cmd->request << 8);
-       wValue = m16_swap(cmd->value);
-       wIndex = m16_swap(cmd->index);
-       wLength = m16_swap(cmd->length);
-
-       info("Root-Hub: adr: %2x cmd(%1x): %08x %04x %04x %04x",
-            dev->devnum, 8, bmRType_bReq, wValue, wIndex, wLength);
-
-       switch (bmRType_bReq) {
-               /* Request Destination:
-                  without flags: Device,
-                  RH_INTERFACE: interface,
-                  RH_ENDPOINT: endpoint,
-                  RH_CLASS means HUB here,
-                  RH_OTHER | RH_CLASS  almost ever means HUB_PORT here
-                */
-
-       case RH_GET_STATUS:
-               datab.hword[0] = m16_swap(1);
-               OK(2);
-       case RH_GET_STATUS | RH_INTERFACE:
-               datab.hword[0] = m16_swap(0);
-               OK(2);
-       case RH_GET_STATUS | RH_ENDPOINT:
-               datab.hword[0] = m16_swap(0);
-               OK(2);
-       case RH_GET_STATUS | RH_CLASS:
-               datab.word[0] =
-                   m32_swap(RD_RH_STAT & ~(RH_HS_CRWE | RH_HS_DRWE));
-               OK(4);
-       case RH_GET_STATUS | RH_OTHER | RH_CLASS:
-               datab.word[0] = m32_swap(RD_RH_PORTSTAT);
-               OK(4);
-
-       case RH_CLEAR_FEATURE | RH_ENDPOINT:
-               switch (wValue) {
-               case (RH_ENDPOINT_STALL):
-                       OK(0);
-               }
-               break;
-
-       case RH_CLEAR_FEATURE | RH_CLASS:
-               switch (wValue) {
-               case RH_C_HUB_LOCAL_POWER:
-                       OK(0);
-               case (RH_C_HUB_OVER_CURRENT):
-                       WR_RH_STAT(RH_HS_OCIC);
-                       OK(0);
-               }
-               break;
-
-       case RH_CLEAR_FEATURE | RH_OTHER | RH_CLASS:
-               switch (wValue) {
-               case (RH_PORT_ENABLE):
-                       WR_RH_PORTSTAT(RH_PS_CCS);
-                       OK(0);
-               case (RH_PORT_SUSPEND):
-                       WR_RH_PORTSTAT(RH_PS_POCI);
-                       OK(0);
-               case (RH_PORT_POWER):
-                       WR_RH_PORTSTAT(RH_PS_LSDA);
-                       OK(0);
-               case (RH_C_PORT_CONNECTION):
-                       WR_RH_PORTSTAT(RH_PS_CSC);
-                       OK(0);
-               case (RH_C_PORT_ENABLE):
-                       WR_RH_PORTSTAT(RH_PS_PESC);
-                       OK(0);
-               case (RH_C_PORT_SUSPEND):
-                       WR_RH_PORTSTAT(RH_PS_PSSC);
-                       OK(0);
-               case (RH_C_PORT_OVER_CURRENT):
-                       WR_RH_PORTSTAT(RH_PS_OCIC);
-                       OK(0);
-               case (RH_C_PORT_RESET):
-                       WR_RH_PORTSTAT(RH_PS_PRSC);
-                       OK(0);
-               }
-               break;
-
-       case RH_SET_FEATURE | RH_OTHER | RH_CLASS:
-               switch (wValue) {
-               case (RH_PORT_SUSPEND):
-                       WR_RH_PORTSTAT(RH_PS_PSS);
-                       OK(0);
-               case (RH_PORT_RESET):   /* BUG IN HUP CODE ******** */
-                       if (RD_RH_PORTSTAT & RH_PS_CCS)
-                               WR_RH_PORTSTAT(RH_PS_PRS);
-                       OK(0);
-               case (RH_PORT_POWER):
-                       WR_RH_PORTSTAT(RH_PS_PPS);
-                       OK(0);
-               case (RH_PORT_ENABLE):  /* BUG IN HUP CODE ******** */
-                       if (RD_RH_PORTSTAT & RH_PS_CCS)
-                               WR_RH_PORTSTAT(RH_PS_PES);
-                       OK(0);
-               }
-               break;
-
-       case RH_SET_ADDRESS:
-               gohci.rh.devnum = wValue;
-               OK(0);
-
-       case RH_GET_DESCRIPTOR:
-               switch ((wValue & 0xff00) >> 8) {
-               case (0x01):    /* device descriptor */
-                       len = min_t(unsigned int,
-                                   leni,
-                                   min_t(unsigned int,
-                                         sizeof(root_hub_dev_des), wLength));
-                       data_buf = root_hub_dev_des;
-                       OK(len);
-               case (0x02):    /* configuration descriptor */
-                       len = min_t(unsigned int,
-                                   leni,
-                                   min_t(unsigned int,
-                                         sizeof(root_hub_config_des),
-                                         wLength));
-                       data_buf = root_hub_config_des;
-                       OK(len);
-               case (0x03):    /* string descriptors */
-                       if (wValue == 0x0300) {
-                               len = min_t(unsigned int,
-                                           leni,
-                                           min_t(unsigned int,
-                                                 sizeof(root_hub_str_index0),
-                                                 wLength));
-                               data_buf = root_hub_str_index0;
-                               OK(len);
-                       }
-                       if (wValue == 0x0301) {
-                               len = min_t(unsigned int,
-                                           leni,
-                                           min_t(unsigned int,
-                                                 sizeof(root_hub_str_index1),
-                                                 wLength));
-                               data_buf = root_hub_str_index1;
-                               OK(len);
-                       }
-               default:
-                       stat = USB_ST_STALLED;
-               }
-               break;
-
-       case RH_GET_DESCRIPTOR | RH_CLASS:
-               {
-                       __u32 temp = roothub_a(&gohci);
-
-                       data_buf[0] = 9;        /* min length; */
-                       data_buf[1] = 0x29;
-                       data_buf[2] = temp & RH_A_NDP;
-                       data_buf[3] = 0;
-                       if (temp & RH_A_PSM)
-                               /* per-port power switching? */
-                               data_buf[3] |= 0x1;
-                       if (temp & RH_A_NOCP)
-                               /* no overcurrent reporting? */
-                               data_buf[3] |= 0x10;
-                       else if (temp & RH_A_OCPM)
-                               /* per-port overcurrent reporting? */
-                               data_buf[3] |= 0x8;
-
-                       /* corresponds to data_buf[4-7] */
-                       datab.word[1] = 0;
-                       data_buf[5] = (temp & RH_A_POTPGT) >> 24;
-                       temp = roothub_b(&gohci);
-                       data_buf[7] = temp & RH_B_DR;
-                       if (data_buf[2] < 7) {
-                               data_buf[8] = 0xff;
-                       } else {
-                               data_buf[0] += 2;
-                               data_buf[8] = (temp & RH_B_DR) >> 8;
-                               data_buf[10] = data_buf[9] = 0xff;
-                       }
-
-                       len = min_t(unsigned int, leni,
-                                   min_t(unsigned int, data_buf[0], wLength));
-                       OK(len);
-               }
-
-       case RH_GET_CONFIGURATION:
-               *(__u8 *) data_buf = 0x01;
-               OK(1);
-
-       case RH_SET_CONFIGURATION:
-               WR_RH_STAT(0x10000);
-               OK(0);
-
-       default:
-               dbg("unsupported root hub command");
-               stat = USB_ST_STALLED;
-       }
-
-#ifdef DEBUG
-       ohci_dump_roothub(&gohci, 1);
-#else
-       mdelay(1);
-#endif
-
-       len = min_t(int, len, leni);
-       if (data != data_buf)
-               memcpy(data, data_buf, len);
-       dev->act_len = len;
-       dev->status = stat;
-
-#ifdef DEBUG
-       if (transfer_len)
-               urb_priv.actual_length = transfer_len;
-       pkt_print(dev, pipe, buffer, transfer_len, cmd, "RET(rh)",
-                 0 /*usb_pipein(pipe) */);
-#else
-       mdelay(1);
-#endif
-
-       return stat;
-}
-
-/*-------------------------------------------------------------------------*/
-
-/* common code for handling submit messages - used for all but root hub */
-/* accesses. */
-int submit_common_msg(struct usb_device *dev, unsigned long pipe, void *buffer,
-                     int transfer_len, struct devrequest *setup, int interval)
-{
-       int stat = 0;
-       int maxsize = usb_maxpacket(dev, pipe);
-       int timeout;
-
-       /* device pulled? Shortcut the action. */
-       if (devgone == dev) {
-               dev->status = USB_ST_CRC_ERR;
-               return 0;
-       }
-#ifdef DEBUG
-       urb_priv.actual_length = 0;
-       pkt_print(dev, pipe, buffer, transfer_len, setup, "SUB",
-                 usb_pipein(pipe));
-#else
-       mdelay(1);
-#endif
-       if (!maxsize) {
-               err("submit_common_message: pipesize for pipe %lx is zero",
-                   pipe);
-               return -1;
-       }
-
-       if (sohci_submit_job(dev, pipe, buffer, transfer_len, setup, interval) <
-           0) {
-               err("sohci_submit_job failed");
-               return -1;
-       }
-
-       mdelay(10);
-       /* ohci_dump_status(&gohci); */
-
-       /* allow more time for a BULK device to react - some are slow */
-#define BULK_TO         5000           /* timeout in milliseconds */
-       if (usb_pipebulk(pipe))
-               timeout = BULK_TO;
-       else
-               timeout = 100;
-
-       /* wait for it to complete */
-       for (;;) {
-               /* check whether the controller is done */
-               stat = hc_interrupt();
-
-               if (stat < 0) {
-                       stat = USB_ST_CRC_ERR;
-                       break;
-               }
-
-               /* NOTE: since we are not interrupt driven in U-Boot and always
-                * handle only one URB at a time, we cannot assume the
-                * transaction finished on the first successful return from
-                * hc_interrupt().. unless the flag for current URB is set,
-                * meaning that all TD's to/from device got actually
-                * transferred and processed. If the current URB is not
-                * finished we need to re-iterate this loop so as
-                * hc_interrupt() gets called again as there needs to be some
-                * more TD's to process still */
-               if ((stat >= 0) && (stat != 0xff) && (urb_finished)) {
-                       /* 0xff is returned for an SF-interrupt */
-                       break;
-               }
-
-               if (--timeout) {
-                       mdelay(1);
-                       if (!urb_finished)
-                               dbg("\%");
-
-               } else {
-                       err("CTL:TIMEOUT ");
-                       dbg("submit_common_msg: TO status %x\n", stat);
-                       stat = USB_ST_CRC_ERR;
-                       urb_finished = 1;
-                       break;
-               }
-       }
-
-#if 0
-       /* we got an Root Hub Status Change interrupt */
-       if (got_rhsc) {
-#ifdef DEBUG
-               ohci_dump_roothub(&gohci, 1);
-#endif
-               got_rhsc = 0;
-               /* abuse timeout */
-               timeout = rh_check_port_status(&gohci);
-               if (timeout >= 0) {
-#if 0                  /* this does nothing useful, but leave it here
-                          in case that changes */
-                       /* the called routine adds 1 to the passed value */
-                       usb_hub_port_connect_change(gohci.rh.dev, timeout - 1);
-#endif
-                       /*
-                        * XXX
-                        * This is potentially dangerous because it assumes
-                        * that only one device is ever plugged in!
-                        */
-                       devgone = dev;
-               }
-       }
-#endif
-
-       dev->status = stat;
-       dev->act_len = transfer_len;
-
-#ifdef DEBUG
-       pkt_print(dev, pipe, buffer, transfer_len, setup, "RET(ctlr)",
-                 usb_pipein(pipe));
-#else
-       mdelay(1);
-#endif
-
-       /* free TDs in urb_priv */
-       urb_free_priv(&urb_priv);
-       return 0;
-}
-
-/* submit routines called from usb.c */
-int submit_bulk_msg(struct usb_device *dev, unsigned long pipe, void *buffer,
-                   int transfer_len)
-{
-       info("submit_bulk_msg");
-       return submit_common_msg(dev, pipe, buffer, transfer_len, NULL, 0);
-}
-
-int submit_control_msg(struct usb_device *dev, unsigned long pipe, void *buffer,
-                      int transfer_len, struct devrequest *setup)
-{
-       int maxsize = usb_maxpacket(dev, pipe);
-
-       info("submit_control_msg");
-#ifdef DEBUG
-       urb_priv.actual_length = 0;
-       pkt_print(dev, pipe, buffer, transfer_len, setup, "SUB",
-                 usb_pipein(pipe));
-#else
-       mdelay(1);
-#endif
-       if (!maxsize) {
-               err("submit_control_message: pipesize for pipe %lx is zero",
-                   pipe);
-               return -1;
-       }
-       if (((pipe >> 8) & 0x7f) == gohci.rh.devnum) {
-               gohci.rh.dev = dev;
-               /* root hub - redirect */
-               return ohci_submit_rh_msg(dev, pipe, buffer, transfer_len,
-                                         setup);
-       }
-
-       return submit_common_msg(dev, pipe, buffer, transfer_len, setup, 0);
-}
-
-int submit_int_msg(struct usb_device *dev, unsigned long pipe, void *buffer,
-                  int transfer_len, int interval)
-{
-       info("submit_int_msg");
-       return -1;
-}
-
-/*-------------------------------------------------------------------------*
- * HC functions
- *-------------------------------------------------------------------------*/
-
-/* reset the HC and BUS */
-
-static int hc_reset(struct ohci *ohci)
-{
-       int timeout = 30;
-       int smm_timeout = 50;   /* 0,5 sec */
-
-       if (readl(&ohci->regs->control) & OHCI_CTRL_IR) {
-               /* SMM owns the HC - request ownership */
-               writel(OHCI_OCR, &ohci->regs->cmdstatus);
-               info("USB HC TakeOver from SMM");
-               while (readl(&ohci->regs->control) & OHCI_CTRL_IR) {
-                       mdelay(10);
-                       if (--smm_timeout == 0) {
-                               err("USB HC TakeOver failed!");
-                               return -1;
-                       }
-               }
-       }
-
-       /* Disable HC interrupts */
-       writel(OHCI_INTR_MIE, &ohci->regs->intrdisable);
-
-       dbg("USB HC reset_hc usb-%s: ctrl = 0x%X ;",
-           ohci->slot_name, readl(&ohci->regs->control));
-
-       /* Reset USB (needed by some controllers) */
-       writel(0, &ohci->regs->control);
-
-       /* HC Reset requires max 10 us delay */
-       writel(OHCI_HCR, &ohci->regs->cmdstatus);
-       while ((readl(&ohci->regs->cmdstatus) & OHCI_HCR) != 0) {
-               if (--timeout == 0) {
-                       err("USB HC reset timed out!");
-                       return -1;
-               }
-               udelay(1);
-       }
-       return 0;
-}
-
-/*-------------------------------------------------------------------------*/
-
-/* Start an OHCI controller, set the BUS operational
- * enable interrupts
- * connect the virtual root hub */
-
-static int hc_start(struct ohci *ohci)
-{
-       __u32 mask;
-       unsigned int fminterval;
-
-       ohci->disabled = 1;
-
-       /* Tell the controller where the control and bulk lists are
-        * The lists are empty now. */
-
-       writel(0, &ohci->regs->ed_controlhead);
-       writel(0, &ohci->regs->ed_bulkhead);
-
-       /* a reset clears this */
-       writel((__u32) ohci->hcca, &ohci->regs->hcca);
-
-       fminterval = 0x2edf;
-       writel((fminterval * 9) / 10, &ohci->regs->periodicstart);
-       fminterval |= ((((fminterval - 210) * 6) / 7) << 16);
-       writel(fminterval, &ohci->regs->fminterval);
-       writel(0x628, &ohci->regs->lsthresh);
-
-       /* start controller operations */
-       ohci->hc_control = OHCI_CONTROL_INIT | OHCI_USB_OPER;
-       ohci->disabled = 0;
-       writel(ohci->hc_control, &ohci->regs->control);
-
-       /* disable all interrupts */
-       mask = (OHCI_INTR_SO | OHCI_INTR_WDH | OHCI_INTR_SF | OHCI_INTR_RD |
-               OHCI_INTR_UE | OHCI_INTR_FNO | OHCI_INTR_RHSC |
-               OHCI_INTR_OC | OHCI_INTR_MIE);
-       writel(mask, &ohci->regs->intrdisable);
-       /* clear all interrupts */
-       mask &= ~OHCI_INTR_MIE;
-       writel(mask, &ohci->regs->intrstatus);
-       /* Choose the interrupts we care about now  - but w/o MIE */
-       mask = OHCI_INTR_RHSC | OHCI_INTR_UE | OHCI_INTR_WDH | OHCI_INTR_SO;
-       writel(mask, &ohci->regs->intrenable);
-
-#ifdef OHCI_USE_NPS
-       /* required for AMD-756 and some Mac platforms */
-       writel((roothub_a(ohci) | RH_A_NPS) & ~RH_A_PSM,
-              &ohci->regs->roothub.a);
-       writel(RH_HS_LPSC, &ohci->regs->roothub.status);
-#endif /* OHCI_USE_NPS */
-
-       /* POTPGT delay is bits 24-31, in 2 ms units. */
-       mdelay((roothub_a(ohci) >> 23) & 0x1fe);
-
-       /* connect the virtual root hub */
-       ohci->rh.devnum = 0;
-
-       return 0;
-}
-
-/*-------------------------------------------------------------------------*/
-
-/* an interrupt happens */
-
-static int hc_interrupt(void)
-{
-       struct ohci *ohci = &gohci;
-       struct ohci_regs *regs = ohci->regs;
-       int ints;
-       int stat = -1;
-
-       if ((ohci->hcca->done_head != 0) &&
-           !(m32_swap(ohci->hcca->done_head) & 0x01)) {
-
-               ints = OHCI_INTR_WDH;
-
-       } else {
-               ints = readl(&regs->intrstatus);
-               if (ints == ~(u32) 0) {
-                       ohci->disabled++;
-                       err("%s device removed!", ohci->slot_name);
-                       return -1;
-               }
-               ints &= readl(&regs->intrenable);
-               if (ints == 0) {
-                       dbg("hc_interrupt: returning..\n");
-                       return 0xff;
-               }
-       }
-
-       /* dbg("Interrupt: %x frame: %x", ints,
-           le16_to_cpu(ohci->hcca->frame_no)); */
-
-       if (ints & OHCI_INTR_RHSC) {
-               got_rhsc = 1;
-               stat = 0xff;
-       }
-
-       if (ints & OHCI_INTR_UE) {
-               ohci->disabled++;
-               err("OHCI Unrecoverable Error, controller usb-%s disabled",
-                   ohci->slot_name);
-               /* e.g. due to PCI Master/Target Abort */
-
-#ifdef DEBUG
-               ohci_dump(ohci, 1);
-#else
-               mdelay(1);
-#endif
-               /* FIXME: be optimistic, hope that bug won't repeat often. */
-               /* Make some non-interrupt context restart the controller. */
-               /* Count and limit the retries though; either hardware or */
-               /* software errors can go forever... */
-               hc_reset(ohci);
-               return -1;
-       }
-
-       if (ints & OHCI_INTR_WDH) {
-               mdelay(1);
-
-               writel(OHCI_INTR_WDH, &regs->intrdisable);
-               stat = dl_done_list(&gohci, dl_reverse_done_list(&gohci));
-               writel(OHCI_INTR_WDH, &regs->intrenable);
-       }
-
-       if (ints & OHCI_INTR_SO) {
-               dbg("USB Schedule overrun\n");
-               writel(OHCI_INTR_SO, &regs->intrenable);
-               stat = -1;
-       }
-
-       /* FIXME:  this assumes SOF (1/ms) interrupts don't get lost... */
-       if (ints & OHCI_INTR_SF) {
-               unsigned int frame = m16_swap(ohci->hcca->frame_no) & 1;
-               mdelay(1);
-               writel(OHCI_INTR_SF, &regs->intrdisable);
-               if (ohci->ed_rm_list[frame] != NULL)
-                       writel(OHCI_INTR_SF, &regs->intrenable);
-               stat = 0xff;
-       }
-
-       writel(ints, &regs->intrstatus);
-       return stat;
-}
-
-/*-------------------------------------------------------------------------*/
-
-/*-------------------------------------------------------------------------*/
-
-/* De-allocate all resources.. */
-
-static void hc_release_ohci(struct ohci *ohci)
-{
-       dbg("USB HC release ohci usb-%s", ohci->slot_name);
-
-       if (!ohci->disabled)
-               hc_reset(ohci);
-}
-
-/*-------------------------------------------------------------------------*/
-
-/*
- * low level initalisation routine, called from usb.c
- */
-static char ohci_inited = 0;
-
-int usb_lowlevel_init(int index, enum usb_init_type init, void **controller)
-{
-       struct s3c24x0_clock_power *clk_power = s3c24x0_get_base_clock_power();
-       struct s3c24x0_gpio *gpio = s3c24x0_get_base_gpio();
-
-       /*
-        * Set the 48 MHz UPLL clocking. Values are taken from
-        * "PLL value selection guide", 6-23, s3c2400_UM.pdf.
-        */
-       clk_power->upllcon = ((40 << 12) + (1 << 4) + 2);
-       gpio->misccr |= 0x8;    /* 1 = use pads related USB for USB host */
-
-       /*
-        * Enable USB host clock.
-        */
-       clk_power->clkcon |= (1 << 4);
-
-       memset(&gohci, 0, sizeof(struct ohci));
-       memset(&urb_priv, 0, sizeof(struct urb_priv));
-
-       /* align the storage */
-       if ((__u32) &ghcca[0] & 0xff) {
-               err("HCCA not aligned!!");
-               return -1;
-       }
-       phcca = &ghcca[0];
-       info("aligned ghcca %p", phcca);
-       memset(&ohci_dev, 0, sizeof(struct ohci_device));
-       if ((__u32) &ohci_dev.ed[0] & 0x7) {
-               err("EDs not aligned!!");
-               return -1;
-       }
-       memset(gtd, 0, sizeof(struct td) * (NUM_TD + 1));
-       if ((__u32) gtd & 0x7) {
-               err("TDs not aligned!!");
-               return -1;
-       }
-       ptd = gtd;
-       gohci.hcca = phcca;
-       memset(phcca, 0, sizeof(struct ohci_hcca));
-
-       gohci.disabled = 1;
-       gohci.sleeping = 0;
-       gohci.irq = -1;
-       gohci.regs = (struct ohci_regs *)S3C24X0_USB_HOST_BASE;
-
-       gohci.flags = 0;
-       gohci.slot_name = "s3c2400";
-
-       if (hc_reset(&gohci) < 0) {
-               hc_release_ohci(&gohci);
-               /* Initialization failed */
-               clk_power->clkcon &= ~(1 << 4);
-               return -1;
-       }
-
-       /* FIXME this is a second HC reset; why?? */
-       gohci.hc_control = OHCI_USB_RESET;
-       writel(gohci.hc_control, &gohci.regs->control);
-       mdelay(10);
-
-       if (hc_start(&gohci) < 0) {
-               err("can't start usb-%s", gohci.slot_name);
-               hc_release_ohci(&gohci);
-               /* Initialization failed */
-               clk_power->clkcon &= ~(1 << 4);
-               return -1;
-       }
-#ifdef DEBUG
-       ohci_dump(&gohci, 1);
-#else
-       mdelay(1);
-#endif
-       ohci_inited = 1;
-       urb_finished = 1;
-
-       return 0;
-}
-
-int usb_lowlevel_stop(int index)
-{
-       struct s3c24x0_clock_power *clk_power = s3c24x0_get_base_clock_power();
-
-       /* this gets called really early - before the controller has */
-       /* even been initialized! */
-       if (!ohci_inited)
-               return 0;
-       /* TODO release any interrupts, etc. */
-       /* call hc_release_ohci() here ? */
-       hc_reset(&gohci);
-       /* may not want to do this */
-       clk_power->clkcon &= ~(1 << 4);
-       return 0;
-}
-
-#endif /* defined(CONFIG_USB_OHCI) && defined(CONFIG_S3C24X0) */
-
-#if defined(CONFIG_USB_OHCI_NEW) && \
-    defined(CONFIG_SYS_USB_OHCI_CPU_INIT) && \
-    defined(CONFIG_S3C24X0)
-
-int usb_cpu_init(void)
-{
-       struct s3c24x0_clock_power *clk_power = s3c24x0_get_base_clock_power();
-       struct s3c24x0_gpio *gpio = s3c24x0_get_base_gpio();
-
-       /*
-        * Set the 48 MHz UPLL clocking. Values are taken from
-        * "PLL value selection guide", 6-23, s3c2400_UM.pdf.
-        */
-       writel((40 << 12) + (1 << 4) + 2, &clk_power->upllcon);
-       /* 1 = use pads related USB for USB host */
-       writel(readl(&gpio->misccr) | 0x8, &gpio->misccr);
-
-       /*
-        * Enable USB host clock.
-        */
-       writel(readl(&clk_power->clkcon) | (1 << 4), &clk_power->clkcon);
-
-       return 0;
-}
-
-int usb_cpu_stop(void)
-{
-       struct s3c24x0_clock_power *clk_power = s3c24x0_get_base_clock_power();
-       /* may not want to do this */
-       writel(readl(&clk_power->clkcon) & ~(1 << 4), &clk_power->clkcon);
-       return 0;
-}
-
-int usb_cpu_init_fail(void)
-{
-       struct s3c24x0_clock_power *clk_power = s3c24x0_get_base_clock_power();
-       writel(readl(&clk_power->clkcon) & ~(1 << 4), &clk_power->clkcon);
-       return 0;
-}
-
-#endif /* defined(CONFIG_USB_OHCI_NEW) && \
-          defined(CONFIG_SYS_USB_OHCI_CPU_INIT) && \
-          defined(CONFIG_S3C24X0) */
diff --git a/drivers/usb/host/ohci-s3c24xx.h b/drivers/usb/host/ohci-s3c24xx.h
deleted file mode 100644 (file)
index f272d78..0000000
+++ /dev/null
@@ -1,409 +0,0 @@
-/*
- * URB OHCI HCD (Host Controller Driver) for USB.
- *
- * (C) Copyright 1999 Roman Weissgaerber <weissg@vienna.at>
- * (C) Copyright 2000-2001 David Brownell <dbrownell@users.sourceforge.net>
- *
- * usb-ohci.h
- */
-
-
-static int cc_to_error[16] = {
-
-/* mapping of the OHCI CC status to error codes */
-       /* No  Error  */ 0,
-       /* CRC Error  */ USB_ST_CRC_ERR,
-       /* Bit Stuff  */ USB_ST_BIT_ERR,
-       /* Data Togg  */ USB_ST_CRC_ERR,
-       /* Stall      */ USB_ST_STALLED,
-       /* DevNotResp */ -1,
-       /* PIDCheck   */ USB_ST_BIT_ERR,
-       /* UnExpPID   */ USB_ST_BIT_ERR,
-       /* DataOver   */ USB_ST_BUF_ERR,
-       /* DataUnder  */ USB_ST_BUF_ERR,
-       /* reservd    */ -1,
-       /* reservd    */ -1,
-       /* BufferOver */ USB_ST_BUF_ERR,
-       /* BuffUnder  */ USB_ST_BUF_ERR,
-       /* Not Access */ -1,
-       /* Not Access */ -1
-};
-
-/* ED States */
-#define ED_NEW         0x00
-#define ED_UNLINK      0x01
-#define ED_OPER                0x02
-#define ED_DEL         0x04
-#define ED_URB_DEL     0x08
-
-/* usb_ohci_ed */
-struct ed {
-       __u32 hwINFO;
-       __u32 hwTailP;
-       __u32 hwHeadP;
-       __u32 hwNextED;
-
-       struct ed *ed_prev;
-       __u8 int_period;
-       __u8 int_branch;
-       __u8 int_load;
-       __u8 int_interval;
-       __u8 state;
-       __u8 type;
-       __u16 last_iso;
-       struct ed *ed_rm_list;
-
-       struct usb_device *usb_dev;
-       __u32 unused[3];
-} __attribute__ ((aligned(16)));
-
-/* TD info field */
-#define TD_CC                  0xf0000000
-#define TD_CC_GET(td_p)                (((td_p) >> 28) & 0x0f)
-#define TD_CC_SET(td_p, cc) \
-       {(td_p) = ((td_p) & 0x0fffffff) | (((cc) & 0x0f) << 28)}
-#define TD_EC                  0x0C000000
-#define TD_T                   0x03000000
-#define TD_T_DATA0             0x02000000
-#define TD_T_DATA1             0x03000000
-#define TD_T_TOGGLE            0x00000000
-#define TD_R                   0x00040000
-#define TD_DI                  0x00E00000
-#define TD_DI_SET(X)           (((X) & 0x07)<< 21)
-#define TD_DP                  0x00180000
-#define TD_DP_SETUP            0x00000000
-#define TD_DP_IN               0x00100000
-#define TD_DP_OUT              0x00080000
-
-#define TD_ISO                 0x00010000
-#define TD_DEL                 0x00020000
-
-/* CC Codes */
-#define TD_CC_NOERROR          0x00
-#define TD_CC_CRC              0x01
-#define TD_CC_BITSTUFFING      0x02
-#define TD_CC_DATATOGGLEM      0x03
-#define TD_CC_STALL            0x04
-#define TD_DEVNOTRESP          0x05
-#define TD_PIDCHECKFAIL        0x06
-#define TD_UNEXPECTEDPID       0x07
-#define TD_DATAOVERRUN         0x08
-#define TD_DATAUNDERRUN        0x09
-#define TD_BUFFEROVERRUN       0x0C
-#define TD_BUFFERUNDERRUN      0x0D
-#define TD_NOTACCESSED         0x0F
-
-
-#define MAXPSW 1
-
-struct td {
-       __u32 hwINFO;
-       __u32 hwCBP;            /* Current Buffer Pointer */
-       __u32 hwNextTD;         /* Next TD Pointer */
-       __u32 hwBE;             /* Memory Buffer End Pointer */
-
-       __u8 unused;
-       __u8 index;
-       struct ed *ed;
-       struct td *next_dl_td;
-       struct usb_device *usb_dev;
-       int transfer_len;
-       __u32 data;
-
-       __u32 unused2[2];
-} __attribute__ ((aligned(32)));
-
-#define OHCI_ED_SKIP   (1 << 14)
-
-/*
- * The HCCA (Host Controller Communications Area) is a 256 byte
- * structure defined in the OHCI spec. that the host controller is
- * told the base address of.  It must be 256-byte aligned.
- */
-
-#define NUM_INTS 32            /* part of the OHCI standard */
-struct ohci_hcca {
-       __u32 int_table[NUM_INTS];      /* Interrupt ED table */
-       __u16 frame_no;         /* current frame number */
-       __u16 pad1;             /* set to 0 on each frame_no change */
-       __u32 done_head;        /* info returned for an interrupt */
-       u8 reserved_for_hc[116];
-} __attribute__ ((aligned(256)));
-
-/*
- * Maximum number of root hub ports.
- */
-#define MAX_ROOT_PORTS 15      /* maximum OHCI root hub ports */
-
-/*
- * This is the structure of the OHCI controller's memory mapped I/O
- * region.  This is Memory Mapped I/O. You must use the readl() and
- * writel() macros defined in asm/io.h to access these!!
- */
-struct ohci_regs {
-       /* control and status registers */
-       __u32 revision;
-       __u32 control;
-       __u32 cmdstatus;
-       __u32 intrstatus;
-       __u32 intrenable;
-       __u32 intrdisable;
-       /* memory pointers */
-       __u32 hcca;
-       __u32 ed_periodcurrent;
-       __u32 ed_controlhead;
-       __u32 ed_controlcurrent;
-       __u32 ed_bulkhead;
-       __u32 ed_bulkcurrent;
-       __u32 donehead;
-       /* frame counters */
-       __u32 fminterval;
-       __u32 fmremaining;
-       __u32 fmnumber;
-       __u32 periodicstart;
-       __u32 lsthresh;
-       /* Root hub ports */
-       struct ohci_roothub_regs {
-               __u32 a;
-               __u32 b;
-               __u32 status;
-               __u32 portstatus[MAX_ROOT_PORTS];
-       } roothub;
-} __attribute__ ((aligned(32)));
-
-/* OHCI CONTROL AND STATUS REGISTER MASKS */
-
-/*
- * HcControl (control) register masks
- */
-#define OHCI_CTRL_CBSR (3 << 0)        /* control/bulk service ratio */
-#define OHCI_CTRL_PLE  (1 << 2)        /* periodic list enable */
-#define OHCI_CTRL_IE   (1 << 3)        /* isochronous enable */
-#define OHCI_CTRL_CLE  (1 << 4)        /* control list enable */
-#define OHCI_CTRL_BLE  (1 << 5)        /* bulk list enable */
-#define OHCI_CTRL_HCFS (3 << 6)        /* host controller functional state */
-#define OHCI_CTRL_IR   (1 << 8)        /* interrupt routing */
-#define OHCI_CTRL_RWC  (1 << 9)        /* remote wakeup connected */
-#define OHCI_CTRL_RWE  (1 << 10)       /* remote wakeup enable */
-
-/* pre-shifted values for HCFS */
-#      define OHCI_USB_RESET   (0 << 6)
-#      define OHCI_USB_RESUME  (1 << 6)
-#      define OHCI_USB_OPER    (2 << 6)
-#      define OHCI_USB_SUSPEND (3 << 6)
-
-/*
- * HcCommandStatus (cmdstatus) register masks
- */
-#define OHCI_HCR       (1 << 0)        /* host controller reset */
-#define OHCI_CLF       (1 << 1)        /* control list filled */
-#define OHCI_BLF       (1 << 2)        /* bulk list filled */
-#define OHCI_OCR       (1 << 3)        /* ownership change request */
-#define OHCI_SOC       (3 << 16)       /* scheduling overrun count */
-
-/*
- * masks used with interrupt registers:
- * HcInterruptStatus (intrstatus)
- * HcInterruptEnable (intrenable)
- * HcInterruptDisable (intrdisable)
- */
-#define OHCI_INTR_SO   (1 << 0)        /* scheduling overrun */
-#define OHCI_INTR_WDH  (1 << 1)        /* writeback of done_head */
-#define OHCI_INTR_SF   (1 << 2)        /* start frame */
-#define OHCI_INTR_RD   (1 << 3)        /* resume detect */
-#define OHCI_INTR_UE   (1 << 4)        /* unrecoverable error */
-#define OHCI_INTR_FNO  (1 << 5)        /* frame number overflow */
-#define OHCI_INTR_RHSC (1 << 6)        /* root hub status change */
-#define OHCI_INTR_OC   (1 << 30)       /* ownership change */
-#define OHCI_INTR_MIE  (1 << 31)       /* master interrupt enable */
-
-/* Virtual Root HUB */
-struct virt_root_hub {
-       int devnum;             /* Address of Root Hub endpoint */
-       void *dev;              /* was urb */
-       void *int_addr;
-       int send;
-       int interval;
-};
-
-/* USB HUB CONSTANTS (not OHCI-specific; see hub.h) */
-
-/* destination of request */
-#define RH_INTERFACE           0x01
-#define RH_ENDPOINT            0x02
-#define RH_OTHER               0x03
-
-#define RH_CLASS               0x20
-#define RH_VENDOR              0x40
-
-/* Requests: bRequest << 8 | bmRequestType */
-#define RH_GET_STATUS          0x0080
-#define RH_CLEAR_FEATURE       0x0100
-#define RH_SET_FEATURE         0x0300
-#define RH_SET_ADDRESS         0x0500
-#define RH_GET_DESCRIPTOR      0x0680
-#define RH_SET_DESCRIPTOR      0x0700
-#define RH_GET_CONFIGURATION   0x0880
-#define RH_SET_CONFIGURATION   0x0900
-#define RH_GET_STATE           0x0280
-#define RH_GET_INTERFACE       0x0A80
-#define RH_SET_INTERFACE       0x0B00
-#define RH_SYNC_FRAME          0x0C80
-/* Our Vendor Specific Request */
-#define RH_SET_EP              0x2000
-
-
-/* Hub port features */
-#define RH_PORT_CONNECTION     0x00
-#define RH_PORT_ENABLE         0x01
-#define RH_PORT_SUSPEND                0x02
-#define RH_PORT_OVER_CURRENT   0x03
-#define RH_PORT_RESET          0x04
-#define RH_PORT_POWER          0x08
-#define RH_PORT_LOW_SPEED      0x09
-
-#define RH_C_PORT_CONNECTION   0x10
-#define RH_C_PORT_ENABLE       0x11
-#define RH_C_PORT_SUSPEND      0x12
-#define RH_C_PORT_OVER_CURRENT 0x13
-#define RH_C_PORT_RESET                0x14
-
-/* Hub features */
-#define RH_C_HUB_LOCAL_POWER   0x00
-#define RH_C_HUB_OVER_CURRENT  0x01
-
-#define RH_DEVICE_REMOTE_WAKEUP 0x00
-#define RH_ENDPOINT_STALL      0x01
-
-#define RH_ACK                 0x01
-#define RH_REQ_ERR             -1
-#define RH_NACK                        0x00
-
-
-/* OHCI ROOT HUB REGISTER MASKS */
-
-/* roothub.portstatus [i] bits */
-#define RH_PS_CCS              0x00000001 /* current connect status */
-#define RH_PS_PES              0x00000002 /* port enable status */
-#define RH_PS_PSS              0x00000004 /* port suspend status */
-#define RH_PS_POCI             0x00000008 /* port over current indicator */
-#define RH_PS_PRS              0x00000010 /* port reset status */
-#define RH_PS_PPS              0x00000100 /* port power status */
-#define RH_PS_LSDA             0x00000200 /* low speed device attached */
-#define RH_PS_CSC              0x00010000 /* connect status change */
-#define RH_PS_PESC             0x00020000 /* port enable status change */
-#define RH_PS_PSSC             0x00040000 /* port suspend status change */
-#define RH_PS_OCIC             0x00080000 /* over current indicator change */
-#define RH_PS_PRSC             0x00100000 /* port reset status change */
-
-/* roothub.status bits */
-#define RH_HS_LPS              0x00000001 /* local power status */
-#define RH_HS_OCI              0x00000002 /* over current indicator */
-#define RH_HS_DRWE             0x00008000 /* device remote wakeup enable */
-#define RH_HS_LPSC             0x00010000 /* local power status change */
-#define RH_HS_OCIC             0x00020000 /* over current indicator change */
-#define RH_HS_CRWE             0x80000000 /* clear remote wakeup enable */
-
-/* roothub.b masks */
-#define RH_B_DR                        0x0000ffff /* device removable flags */
-#define RH_B_PPCM              0xffff0000 /* port power control mask */
-
-/* roothub.a masks */
-#define        RH_A_NDP                (0xff << 0)  /* number of downstream ports */
-#define        RH_A_PSM                (1 << 8)     /* power switching mode */
-#define        RH_A_NPS                (1 << 9)     /* no power switching */
-#define        RH_A_DT                 (1 << 10)    /* device type (mbz) */
-#define        RH_A_OCPM               (1 << 11)    /* over current protection mode */
-#define        RH_A_NOCP               (1 << 12)    /* no over current protection */
-#define        RH_A_POTPGT             (0xff << 24) /* power on to power good time */
-
-/* urb */
-#define N_URB_TD 48
-struct urb_priv {
-       struct ed *ed;
-       __u16 length;           /* number of tds associated with this request */
-       __u16 td_cnt;           /* number of tds already serviced */
-       int state;
-       unsigned long pipe;
-       int actual_length;
-       struct td *td[N_URB_TD];        /* list pointer to all corresponding TDs
-                                          associated with this request */
-};
-#define URB_DEL 1
-
-/*
- * This is the full ohci controller description
- *
- * Note how the "proper" USB information is just
- * a subset of what the full implementation needs. (Linus)
- */
-
-
-struct ohci {
-       struct ohci_hcca *hcca; /* hcca */
-       /*dma_addr_t hcca_dma; */
-
-       int irq;
-       int disabled;           /* e.g. got a UE, we're hung */
-       int sleeping;
-       unsigned long flags;    /* for HC bugs */
-
-       struct ohci_regs *regs; /* OHCI controller's memory */
-
-       struct ed *ed_rm_list[2];  /* lists of all endpoints to be removed */
-       struct ed *ed_bulktail;    /* last endpoint of bulk list */
-       struct ed *ed_controltail; /* last endpoint of control list */
-       int intrstatus;
-       __u32 hc_control;       /* copy of the hc control reg */
-       struct usb_device *dev[32];
-       struct virt_root_hub rh;
-
-       const char *slot_name;
-};
-
-#define NUM_EDS 8              /* num of preallocated endpoint descriptors */
-
-struct ohci_device {
-       struct ed ed[NUM_EDS];
-       int ed_cnt;
-};
-
-/* hcd */
-/* endpoint */
-static int ep_link(struct ohci *ohci, struct ed *ed);
-static int ep_unlink(struct ohci *ohci, struct ed *ed);
-static struct ed *ep_add_ed(struct usb_device *usb_dev, unsigned long pipe);
-
-/*-------------------------------------------------------------------------*/
-
-/* we need more TDs than EDs */
-#define NUM_TD 64
-
-/* +1 so we can align the storage */
-struct td gtd[NUM_TD + 1];
-
-/* pointers to aligned storage */
-struct td *ptd;
-
-/* TDs ... */
-static inline struct td *td_alloc(struct usb_device *usb_dev)
-{
-       int i;
-       struct td *td;
-
-       td = NULL;
-       for (i = 0; i < NUM_TD; i++) {
-               if (ptd[i].usb_dev == NULL) {
-                       td = &ptd[i];
-                       td->usb_dev = usb_dev;
-                       break;
-               }
-       }
-
-       return td;
-}
-
-static inline void ed_free(struct ed *ed)
-{
-       ed->usb_dev = NULL;
-}
index cafaae5f31a548929ec8773908661441b1454d00..a468bd96ad798520462e112eb4a163688d4f8b70 100644 (file)
@@ -16,6 +16,7 @@
 #include <common.h>
 
 #include <asm/io.h>
+#include <pci.h>
 #include <video_fb.h>
 #include <sm501.h>
 
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..e7978aae67d27ac9aed8b66f3e5acee6db39e3db 100644 (file)
@@ -0,0 +1,24 @@
+config FS_FAT
+       bool "Enable FAT filesystem support"
+       help
+         This provides support for reading images from File Allocation Table
+         (FAT) filesystem. FAT filesystem is a legacy, lightweight filesystem.
+         It is useful mainly for its wide compatibility with various operating
+         systems. You can also enable CMD_FAT to get access to fat commands.
+
+config FAT_WRITE
+       bool "Enable FAT filesystem write support"
+       depends on FS_FAT
+       help
+         This provides support for creating and writing new files to an
+         existing FAT filesystem partition.
+
+config FS_FAT_MAX_CLUSTSIZE
+       int "Set maximum possible clusersize"
+       default 65536
+       depends on FS_FAT
+       help
+         Set the maximum possible clustersize for the FAT filesytem. This
+         is the smallest amount of disk space that can be used to hold a
+         file. Unless you have an extremely tight memory memory constraints,
+         leave the default.
diff --git a/include/api.h b/include/api.h
new file mode 100644 (file)
index 0000000..85817f3
--- /dev/null
@@ -0,0 +1,13 @@
+/*
+ * Copyright (c) 2017 Google, Inc
+ * Written by Simon Glass <sjg@chromium.org>
+ *
+ * SPDX-License-Identifier:     GPL-2.0+
+ */
+
+#ifndef __API_H
+#define __API_H
+
+void api_init(void);
+
+#endif
index e6f905110e3adec84b6067ca694b3dd6953ada72..fb90be9d3ebac66d42ebdfb62eaa97b69d193b20 100644 (file)
@@ -110,6 +110,10 @@ typedef struct global_data {
        ulong video_top;                /* Top of video frame buffer area */
        ulong video_bottom;             /* Bottom of video frame buffer area */
 #endif
+#ifdef CONFIG_BOOTSTAGE
+       struct bootstage_data *bootstage;       /* Bootstage information */
+       struct bootstage_data *new_bootstage;   /* Relocated bootstage info */
+#endif
 } gd_t;
 #endif
 
index a589be6316ee45ff73e7102143523599f5a5c6eb..c5d93f57fd7f45d75d6a5db67a0d2db364f1eefa 100644 (file)
@@ -2,6 +2,7 @@
  * This file implements recording of each stage of the boot process. It is
  * intended to implement timing of each stage, reporting this information
  * to the user and passing it to the OS for logging / further analysis.
+ * Note that it requires timer_get_boot_us() to be defined by the board
  *
  * Copyright (c) 2011 The Chromium OS Authors.
  *
@@ -176,6 +177,7 @@ enum bootstage_id {
         */
        BOOTSTAGE_ID_AWAKE,
        BOOTSTAGE_ID_START_SPL,
+       BOOTSTAGE_ID_END_SPL,
        BOOTSTAGE_ID_START_UBOOT_F,
        BOOTSTAGE_ID_START_UBOOT_R,
        BOOTSTAGE_ID_USB_START,
@@ -198,7 +200,11 @@ enum bootstage_id {
        BOOTSTAGE_ID_ACCUM_SCSI,
        BOOTSTAGE_ID_ACCUM_SPI,
        BOOTSTAGE_ID_ACCUM_DECOMP,
+       BOOTSTAGE_ID_ACCUM_OF_LIVE,
        BOOTSTAGE_ID_FPGA_INIT,
+       BOOTSTATE_ID_ACCUM_DM_SPL,
+       BOOTSTATE_ID_ACCUM_DM_F,
+       BOOTSTATE_ID_ACCUM_DM_R,
 
        /* a few spare for the user, from here */
        BOOTSTAGE_ID_USER,
@@ -209,14 +215,14 @@ enum bootstage_id {
 /*
  * Return the time since boot in microseconds, This is needed for bootstage
  * and should be defined in CPU- or board-specific code. If undefined then
- * millisecond resolution will be used (the standard get_timer()).
+ * you will get a link error.
  */
 ulong timer_get_boot_us(void);
 
 #if defined(USE_HOSTCC)
 #define show_boot_progress(val) do {} while (0)
 #else
-/*
+/**
  * Board code can implement show_boot_progress() if needed.
  *
  * @param val  Progress state (enum bootstage_id), or -id if an error
@@ -225,8 +231,14 @@ ulong timer_get_boot_us(void);
 void show_boot_progress(int val);
 #endif
 
-#if defined(CONFIG_BOOTSTAGE) && !defined(CONFIG_SPL_BUILD) && \
-       !defined(USE_HOSTCC)
+#if !defined(USE_HOSTCC)
+#if CONFIG_IS_ENABLED(BOOTSTAGE)
+#define ENABLE_BOOTSTAGE
+#endif
+#endif
+
+#ifdef ENABLE_BOOTSTAGE
+
 /* This is the full bootstage implementation */
 
 /**
@@ -234,7 +246,7 @@ void show_boot_progress(int val);
  *
  * Call this after relocation has happened and after malloc has been initted.
  * We need to copy any pointers in bootstage records that were added pre-
- * relocation, since memory can be overritten later.
+ * relocation, since memory can be overwritten later.
  * @return Always returns 0, to indicate success
  */
 int bootstage_relocate(void);
@@ -250,7 +262,7 @@ int bootstage_relocate(void);
 ulong bootstage_add_record(enum bootstage_id id, const char *name,
                           int flags, ulong mark);
 
-/*
+/**
  * Mark a time stamp for the current boot stage.
  */
 ulong bootstage_mark(enum bootstage_id id);
@@ -309,7 +321,7 @@ void bootstage_report(void);
  */
 int bootstage_fdt_add_report(void);
 
-/*
+/**
  * Stash bootstage data into memory
  *
  * @param base Base address of memory buffer
@@ -326,9 +338,26 @@ int bootstage_stash(void *base, int size);
  *
  * @param base Base address of memory buffer
  * @param size Size of memory buffer (-1 if unknown)
- * @return 0 if unstashed ok, -1 if bootstage info not found, or out of space
+ * @return 0 if unstashed ok, -ENOENT if bootstage info not found, -ENOSPC if
+ *     there is not space for read the stacked data, or other error if
+ *     something else went wrong
+ */
+int bootstage_unstash(const void *base, int size);
+
+/**
+ * bootstage_get_size() - Get the size of the bootstage data
+ *
+ * @return size of boostage data in bytes
  */
-int bootstage_unstash(void *base, int size);
+int bootstage_get_size(void);
+
+/**
+ * bootstage_init() - Prepare bootstage for use
+ *
+ * @first: true if this is the first time bootstage is set up. This causes it
+ *     to add a 'reset' record with a time of 0.
+ */
+int bootstage_init(bool first);
 
 #else
 static inline ulong bootstage_add_record(enum bootstage_id id,
@@ -386,11 +415,22 @@ static inline int bootstage_stash(void *base, int size)
        return 0;       /* Pretend to succeed */
 }
 
-static inline int bootstage_unstash(void *base, int size)
+static inline int bootstage_unstash(const void *base, int size)
 {
        return 0;       /* Pretend to succeed */
 }
-#endif /* CONFIG_BOOTSTAGE */
+
+static inline int bootstage_get_size(void)
+{
+       return 0;
+}
+
+static inline int bootstage_init(bool first)
+{
+       return 0;
+}
+
+#endif /* ENABLE_BOOTSTAGE */
 
 /* Helper macro for adding a bootstage to a line of code */
 #define BOOTSTAGE_MARKER()     \
index 45f190a600f58b39b140f3638ce6530e2636e4eb..638c45b954d22a2df3e704e010ee8c90dd20a90e 100644 (file)
@@ -30,61 +30,6 @@ typedef volatile unsigned char       vu_char;
 #include <asm/ptrace.h>
 #include <stdarg.h>
 #include <linux/kernel.h>
-#if defined(CONFIG_PCI) && defined(CONFIG_4xx)
-#include <pci.h>
-#endif
-#if defined(CONFIG_8xx)
-#include <asm/8xx_immap.h>
-#if defined(CONFIG_MPC859)     || defined(CONFIG_MPC859T)      || \
-    defined(CONFIG_MPC866)     || \
-    defined(CONFIG_MPC866P)
-# define CONFIG_MPC866_FAMILY 1
-#elif defined(CONFIG_MPC885)
-# define CONFIG_MPC885_FAMILY   1
-#endif
-#if   defined(CONFIG_MPC860)      \
-   || defined(CONFIG_MPC860T)     \
-   || defined(CONFIG_MPC866_FAMILY) \
-   || defined(CONFIG_MPC885_FAMILY)
-# define CONFIG_MPC86x 1
-#endif
-#elif defined(CONFIG_5xx)
-#include <asm/5xx_immap.h>
-#elif defined(CONFIG_MPC5xxx)
-#include <mpc5xxx.h>
-#elif defined(CONFIG_MPC512X)
-#include <asm/immap_512x.h>
-#elif defined(CONFIG_MPC8260)
-#if   defined(CONFIG_MPC8247) \
-   || defined(CONFIG_MPC8272)
-#define CONFIG_MPC8272_FAMILY  1
-#endif
-#include <asm/immap_8260.h>
-#endif
-#ifdef CONFIG_MPC86xx
-#include <mpc86xx.h>
-#include <asm/immap_86xx.h>
-#endif
-#ifdef CONFIG_MPC85xx
-#include <mpc85xx.h>
-#include <asm/immap_85xx.h>
-#endif
-#ifdef CONFIG_MPC83xx
-#include <mpc83xx.h>
-#include <asm/immap_83xx.h>
-#endif
-#ifdef CONFIG_4xx
-#include <asm/ppc4xx.h>
-#endif
-#ifdef CONFIG_SOC_DA8XX
-#include <asm/arch/hardware.h>
-#endif
-#ifdef CONFIG_FSL_LSCH3
-#include <asm/arch/immap_lsch3.h>
-#endif
-#ifdef CONFIG_FSL_LSCH2
-#include <asm/arch/immap_lsch2.h>
-#endif
 
 #include <part.h>
 #include <flash.h>
@@ -166,28 +111,6 @@ typedef void (interrupt_handler_t)(void *);
 #include <asm/u-boot.h> /* boot information for Linux kernel */
 #include <asm/global_data.h>   /* global data used for startup functions */
 
-/*
- * enable common handling for all TQM8xxL/M boards:
- * - CONFIG_TQM8xxM will be defined for all TQM8xxM boards
- * - CONFIG_TQM8xxL will be defined for all TQM8xxL _and_ TQM8xxM boards
- *                  and for the TQM885D board
- */
-#if defined(CONFIG_TQM823M) || defined(CONFIG_TQM850M) || \
-    defined(CONFIG_TQM855M) || defined(CONFIG_TQM860M) || \
-    defined(CONFIG_TQM862M) || defined(CONFIG_TQM866M)
-# ifndef CONFIG_TQM8xxM
-#  define CONFIG_TQM8xxM
-# endif
-#endif
-#if defined(CONFIG_TQM823L) || defined(CONFIG_TQM850L) || \
-    defined(CONFIG_TQM855L) || defined(CONFIG_TQM860L) || \
-    defined(CONFIG_TQM862L) || defined(CONFIG_TQM8xxM) || \
-    defined(CONFIG_TQM885D)
-# ifndef CONFIG_TQM8xxL
-#  define CONFIG_TQM8xxL
-# endif
-#endif
-
 #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) || \
@@ -428,29 +351,6 @@ static inline int setenv_addr(const char *varname, const void *addr)
        return setenv_hex(varname, (ulong)addr);
 }
 
-#ifdef CONFIG_ARM
-# include <asm/mach-types.h>
-# include <asm/setup.h>
-# include <asm/u-boot-arm.h>   /* ARM version to be fixed! */
-#endif /* CONFIG_ARM */
-#ifdef CONFIG_X86              /* x86 version to be fixed! */
-# include <asm/u-boot-x86.h>
-#endif /* CONFIG_X86 */
-#ifdef CONFIG_SANDBOX
-# include <asm/u-boot-sandbox.h>       /* TODO(sjg) what needs to be fixed? */
-#endif
-#ifdef CONFIG_NDS32
-# include <asm/mach-types.h>
-# include <asm/setup.h>
-# include <asm/u-boot-nds32.h>
-#endif /* CONFIG_NDS32 */
-#ifdef CONFIG_MIPS
-# include <asm/u-boot-mips.h>
-#endif /* CONFIG_MIPS */
-#ifdef CONFIG_ARC
-# include <asm/u-boot-arc.h>
-#endif /* CONFIG_ARC */
-
 #ifdef CONFIG_AUTO_COMPLETE
 int env_complete(char *var, int maxv, char *cmdv[], int maxsz, char *buf);
 #endif
@@ -459,25 +359,6 @@ int get_env_id (void);
 void   pci_init      (void);
 void   pci_init_board(void);
 
-#if defined(CONFIG_PCI) && defined(CONFIG_4xx)
-    int           pci_pre_init        (struct pci_controller *);
-    int           is_pci_host         (struct pci_controller *);
-#endif
-
-#if defined(CONFIG_PCI) && (defined(CONFIG_440) || defined(CONFIG_405EX))
-#   if defined(CONFIG_SYS_PCI_TARGET_INIT)
-       void    pci_target_init      (struct pci_controller *);
-#   endif
-#   if defined(CONFIG_SYS_PCI_MASTER_INIT)
-       void    pci_master_init      (struct pci_controller *);
-#   endif
-#if defined(CONFIG_440SPE) || \
-    defined(CONFIG_460EX) || defined(CONFIG_460GT) || \
-    defined(CONFIG_405EX)
-   void pcie_setup_hoses(int busno);
-#endif
-#endif
-
 int    misc_init_f   (void);
 int    misc_init_r   (void);
 
@@ -487,9 +368,6 @@ void        jumptable_init(void);
 /* common/kallsysm.c */
 const char *symbol_lookup(unsigned long addr, unsigned long *caddr);
 
-/* api/api.c */
-void   api_init (void);
-
 /* common/memsize.c */
 long   get_ram_size  (long *, long);
 phys_size_t get_effective_memsize(void);
@@ -545,21 +423,6 @@ int testdram(void);
 #endif /* CONFIG_SYS_DRAM_TEST */
 
 /* $(CPU)/start.S */
-#if defined(CONFIG_5xx) || \
-    defined(CONFIG_8xx)
-uint   get_immr      (uint);
-#endif
-#if defined(CONFIG_MPC5xxx)
-uint   get_svr       (void);
-#endif
-uint   get_pvr       (void);
-uint   get_svr       (void);
-uint   rd_ic_cst     (void);
-void   wr_ic_cst     (uint);
-void   wr_ic_adr     (uint);
-uint   rd_dc_cst     (void);
-void   wr_dc_cst     (uint);
-void   wr_dc_adr     (uint);
 int    icache_status (void);
 void   icache_enable (void);
 void   icache_disable(void);
@@ -574,40 +437,6 @@ void       relocate_code(ulong, gd_t *, ulong) __attribute__ ((noreturn));
 #endif
 ulong  get_endaddr   (void);
 void   trap_init     (ulong);
-#if defined (CONFIG_4xx)       || \
-    defined (CONFIG_MPC5xxx)   || \
-    defined (CONFIG_MPC85xx)   || \
-    defined (CONFIG_MPC86xx)   || \
-    defined (CONFIG_MPC83xx)
-unsigned char  in8(unsigned int);
-void           out8(unsigned int, unsigned char);
-unsigned short in16(unsigned int);
-unsigned short in16r(unsigned int);
-void           out16(unsigned int, unsigned short value);
-void           out16r(unsigned int, unsigned short value);
-unsigned long  in32(unsigned int);
-unsigned long  in32r(unsigned int);
-void           out32(unsigned int, unsigned long value);
-void           out32r(unsigned int, unsigned long value);
-void           ppcDcbf(unsigned long value);
-void           ppcDcbi(unsigned long value);
-void           ppcSync(void);
-void           ppcDcbz(unsigned long value);
-#endif
-#if defined (CONFIG_MICROBLAZE)
-unsigned short in16(unsigned int);
-void           out16(unsigned int, unsigned short value);
-#endif
-
-#if defined (CONFIG_MPC83xx)
-void           ppcDWload(unsigned int *addr, unsigned int *ret);
-void           ppcDWstore(unsigned int *addr, unsigned int *value);
-void disable_addr_trans(void);
-void enable_addr_trans(void);
-#if defined(CONFIG_DDR_ECC) && !defined(CONFIG_ECC_INIT_VIA_DDRCONTROLLER)
-void ddr_enable_ecc(unsigned int dram_size);
-#endif
-#endif
 
 /* $(CPU)/cpu.c */
 static inline int cpumask_next(int cpu, unsigned int mask)
@@ -668,76 +497,9 @@ int serial_stub_tstc(struct stdio_dev *sdev);
 
 /* $(CPU)/speed.c */
 int    get_clocks (void);
-#if defined(CONFIG_MPC5xxx)
-int    prt_mpc5xxx_clks (void);
-#endif
-#ifdef CONFIG_4xx
-ulong  get_OPB_freq (void);
-ulong  get_PCI_freq (void);
-#endif
-#if defined(CONFIG_S3C24X0) || \
-    defined(CONFIG_LH7A40X) || \
-    defined(CONFIG_EP93XX)
-ulong  get_FCLK (void);
-ulong  get_HCLK (void);
-ulong  get_PCLK (void);
-ulong  get_UCLK (void);
-#endif
-#if defined(CONFIG_LH7A40X)
-ulong  get_PLLCLK (void);
-#endif
-#if defined(CONFIG_IMX)
-ulong get_systemPLLCLK(void);
-ulong get_FCLK(void);
-ulong get_HCLK(void);
-ulong get_BCLK(void);
-ulong get_PERCLK1(void);
-ulong get_PERCLK2(void);
-ulong get_PERCLK3(void);
-#endif
 ulong  get_bus_freq  (ulong);
 int get_serial_clock(void);
 
-#if defined(CONFIG_MPC85xx)
-typedef MPC85xx_SYS_INFO sys_info_t;
-void   get_sys_info  ( sys_info_t * );
-void ft_fixup_cpu(void *, u64);
-void ft_fixup_num_cores(void *);
-#endif
-#if defined(CONFIG_MPC86xx)
-typedef MPC86xx_SYS_INFO sys_info_t;
-void   get_sys_info  ( sys_info_t * );
-static inline ulong get_ddr_freq(ulong dummy)
-{
-       return get_bus_freq(dummy);
-}
-#else
-ulong get_ddr_freq(ulong);
-#endif
-
-#if defined(CONFIG_4xx)
-#  if defined(CONFIG_440)
-#      if defined(CONFIG_440SPE)
-        unsigned long determine_sysper(void);
-        unsigned long determine_pci_clock_per(void);
-#      endif
-#  endif
-typedef PPC4xx_SYS_INFO sys_info_t;
-int    ppc440spe_revB(void);
-void   get_sys_info  ( sys_info_t * );
-#endif
-
-/* $(CPU)/cpu_init.c */
-#if defined(CONFIG_8xx) || defined(CONFIG_MPC8260)
-void   cpu_init_f    (volatile immap_t *immr);
-#endif
-#if defined(CONFIG_4xx) || defined(CONFIG_MCF52x2) || defined(CONFIG_MPC86xx)
-void   cpu_init_f    (void);
-#endif
-#ifdef CONFIG_MPC85xx
-ulong cpu_init_f(void);
-#endif
-
 int    cpu_init_r    (void);
 
 /* $(CPU)/interrupts.c */
@@ -963,14 +725,6 @@ int cpu_release(int nr, int argc, char * const argv[]);
 
 #endif /* __ASSEMBLY__ */
 
-#ifdef CONFIG_PPC
-/*
- * Has to be included outside of the #ifndef __ASSEMBLY__ section.
- * Otherwise might lead to compilation errors in assembler files.
- */
-#include <asm/cache.h>
-#endif
-
 /* Put only stuff here that the assembler can digest */
 
 /* Declare an unsigned long constant digestable both by C and an assembler. */
index 5a698a8349ab2751486f842a5a1415e097466d57..2656c75b3005a8fcb2c1593a79564167224b310b 100644 (file)
 #define CONFIG_SYS_BAUDRATE_TABLE      { 9600, 19200, 38400, 57600, 115200 }
 #endif
 
-#if defined(CONFIG_CMD_FAT) && !defined(CONFIG_FS_FAT)
+#if defined(CONFIG_ENV_IS_IN_FAT) && !defined(CONFIG_FS_FAT)
 #define CONFIG_FS_FAT
 #endif
 
+#if defined(CONFIG_ENV_IS_IN_FAT) && !defined(CONFIG_FAT_WRITE)
+#define CONFIG_FAT_WRITE
+#endif
+
 #if (defined(CONFIG_CMD_EXT4) || defined(CONFIG_CMD_EXT2)) && \
                                                !defined(CONFIG_FS_EXT4)
 #define CONFIG_FS_EXT4
index 25f63e8311425ebdaf50e76bd0df4a39c4744c1c..1d8e39c2035256d245c3234f500280518ef5c808 100644 (file)
@@ -75,7 +75,6 @@
 #define FAT_ENV_INTERFACE              "mmc"
 #define FAT_ENV_DEVICE_AND_PART                "0:1"
 #define FAT_ENV_FILE                   "uboot.env"
-#define CONFIG_FAT_WRITE
 
 #define CONFIG_SPL_LDSCRIPT            "arch/arm/mach-omap2/u-boot-spl.lds"
 
index 2c49729caab5fffd6a7c9c21e0ad923cb7256e22..c3cade9ea6b14a8473081a7791195b3c6f611794 100644 (file)
@@ -50,9 +50,6 @@
 #define CONFIG_TFTP_BLOCKSIZE          16352
 #define CONFIG_TFTP_TSIZE
 
-/* Miscellaneous commands */
-#define CONFIG_FAT_WRITE
-
 #undef CONFIG_IPADDR
 #define CONFIG_IPADDR          192.168.10.2
 #define CONFIG_NETMASK         255.255.255.0
index 83a09153b4cdb6275912e354302135cc033982f6..8be586b51f898a3a21ac9a50bd8bc82c7e8ebe58 100644 (file)
@@ -66,7 +66,6 @@
 
 #define CONFIG_SUPPORT_EMMC_BOOT       /* eMMC specific */
 #define CONFIG_BOUNCE_BUFFER
-#define CONFIG_FAT_WRITE
 
 #ifdef CONFIG_MX6Q
 #define CONFIG_CMD_SATA
index cdb50cc28b8e94fccdcc9658228bc7d4cacc7558..9772d8b5c3918649114962d5a7b5ab35ed017d9f 100644 (file)
@@ -46,9 +46,6 @@
 #define CONFIG_TFTP_BLOCKSIZE          16352
 #define CONFIG_TFTP_TSIZE
 
-/* Miscellaneous commands */
-#define CONFIG_FAT_WRITE
-
 /* Increase console I/O buffer size */
 #undef CONFIG_SYS_CBSIZE
 #define CONFIG_SYS_CBSIZE              1024
index dbd4d843ebdeee9c6d85539a0f83c763796ff066..dea8130046557c7858d99e13883d250f1c6dd9d9 100644 (file)
@@ -54,7 +54,6 @@
 #else
 /* u-boot env in sd/mmc card */
 #define CONFIG_ENV_IS_IN_FAT
-#define CONFIG_FAT_WRITE
 #define FAT_ENV_INTERFACE      "mmc"
 #define FAT_ENV_DEVICE_AND_PART        "0"
 #define FAT_ENV_FILE           "uboot.env"
index 010ebdbd40f01c03c5455d6fb27d26b3cd684b06..a0c5b9afae1baff03808eb5619e60b9ea8e05157 100644 (file)
 #define FAT_ENV_DEVICE_AND_PART        "0"
 #define FAT_ENV_FILE           "uboot.env"
 #define CONFIG_ENV_IS_IN_FAT
-#define CONFIG_FAT_WRITE
 #define CONFIG_ENV_SIZE                0x4000
 
 #define CONFIG_BOOTARGS                "console=ttyS0,115200 " \
index 411d7412afd0abaee122f563102fdf4772993f5f..50ddbd647595738fb215681082e8982e7a139d00 100644 (file)
 #else
 /* Use file in FAT file to save environment */
 #define CONFIG_ENV_IS_IN_FAT
-#define CONFIG_FAT_WRITE
 #define FAT_ENV_INTERFACE              "mmc"
 #define FAT_ENV_FILE                   "uboot.env"
 #define FAT_ENV_DEVICE_AND_PART                "0"
index 7dcf7913de19321f697445fc5ec55f8a0d7f68c9..8a8eb7c34fd96293c4a3f66f2311916a6a60a23b 100644 (file)
 
 /* bootstrap + u-boot + env + linux in mmc */
 #define CONFIG_ENV_IS_IN_FAT
-#define CONFIG_FAT_WRITE
 #define FAT_ENV_INTERFACE      "mmc"
 #define FAT_ENV_FILE           "uboot.env"
 #define FAT_ENV_DEVICE_AND_PART        "0"
index 33cc5fc7aae8e8ddcb1105630f8a7d0f884cd7da..fd2dbed1374dff37604b70e4d380d4d493763e61 100644 (file)
 #else /* CONFIG_SYS_USE_MMC */
 /* bootstrap + u-boot + env + linux in mmc */
 #define CONFIG_ENV_IS_IN_FAT
-#define CONFIG_FAT_WRITE
 #define FAT_ENV_INTERFACE      "mmc"
 #define FAT_ENV_FILE           "uboot.env"
 #define FAT_ENV_DEVICE_AND_PART "0"
index 9a36a4c5d75027ede84b38dc86be79fe15fbdeac..02ae65ff5771f83aff18ee00a7e1de97e643c6d2 100644 (file)
 /* Initial upstream - boot to cmd prompt only */
 #define CONFIG_BOOTCOMMAND             ""
 
-/* Commands */
-#define CONFIG_FAT_WRITE
-
 #undef CONFIG_USB_GADGET_VBUS_DRAW
 #define CONFIG_USB_GADGET_VBUS_DRAW    0
 #define CONFIG_USBID_ADDR              0x34052c46
index bb61e5b8c8c6a40683452451824019df151ec369..5a85f7fa9c05324dc12c909bb85bcff000773ed2 100644 (file)
 /* Initial upstream - boot to cmd prompt only */
 #define CONFIG_BOOTCOMMAND             ""
 
-/* Commands */
-#define CONFIG_FAT_WRITE
-
 #define CONFIG_USBID_ADDR              0x34052c46
 
 #endif /* __BCM28155_AP_H */
index fa7eff54289660e985a9bca0feb0a8903d7e6ddf..2afbbea140a652f6ccbc8cdeb84fdca2aa0b1bc2 100644 (file)
@@ -62,9 +62,6 @@
 
 #define CONFIG_MX_CYCLIC
 
-/* Commands */
-#define CONFIG_FAT_WRITE
-
 /* Enable Time Command */
 
 /* Misc utility code */
index 521d097f8a9643bcbcfe7f673500117992c0ba56..10e8f88810ed3773f2b812ce42cc4d9cc22648ba 100644 (file)
@@ -276,7 +276,6 @@ MMCARGS
  * enabled a number of useful commands and support.
  */
 #if defined(CONFIG_MMC) || defined(CONFIG_USB_STORAGE)
-#define CONFIG_FAT_WRITE
 #define CONFIG_FS_EXT4
 #define CONFIG_EXT4_WRITE
 #endif /* CONFIG_MMC, ... */
index 99846890e0f7ed438c3998df5512ebe6bcf24fe7..5814d748d9585cb9978167449685a57c3caa52fd 100644 (file)
@@ -118,12 +118,5 @@ BUR_COMMON_ENV \
 #define CONFIG_ENV_OFFSET              0x40000 /* TODO: Adresse definieren */
 #define CONFIG_ENV_OFFSET_REDUND       (CONFIG_ENV_OFFSET + CONFIG_ENV_SIZE)
 #define CONFIG_SYS_REDUNDAND_ENVIRONMENT
-/*
- * Common filesystems support.  When we have removable storage we
- * enabled a number of useful commands and support.
- */
-#if defined(CONFIG_MMC) || defined(CONFIG_USB_STORAGE)
-#define CONFIG_FAT_WRITE
-#endif /* CONFIG_MMC, ... */
 
 #endif /* __CONFIG_BRXRE1_H__ */
index 29d3bdacacbb75ceca848002135e46e6b6c17f23..d43e3314a75823f5377244c0f09d3877195068e5 100644 (file)
 int calimain_get_osc_freq(void);
 #endif
 
+#include <asm/arch/hardware.h>
+
 #endif /* __CONFIG_H */
index 96e5c9cdd5a1931f9ca186a2474abc5d84714113..a04f4cd23d27b1a923c8fc03f5f1e596fbbe4834 100644 (file)
@@ -42,9 +42,9 @@
 #define CONFIG_SPL_SPI_FLASH_SUPPORT
 #define CONFIG_SPL_SPI_LOAD
 
-/* SD/MMC RAW boot */
-#undef CONFIG_SPL_FS_LOAD_PAYLOAD_NAME
-#undef CONFIG_SYS_MMCSD_FS_BOOT_PARTITION
+/* SD/MMC RAW/FS boot */
+#define CONFIG_SPL_FS_LOAD_PAYLOAD_NAME "u-boot.img"
+#define CONFIG_SYS_MMCSD_FS_BOOT_PARTITION 1
 
 /* Environment */
 #define CONFIG_ENV_SIZE                        (16 << 10) /* 16 KiB env size */
        "bootkernel=bootz ${loadaddr} - ${fdtaddr}\0" \
        "mmcloadfdt=load mmc ${mmcdev} ${fdtaddr} ${fdtfile}\0" \
        "mmcloadkernel=load mmc ${mmcdev} ${loadaddr} ${kernel}\0" \
+       "emmcloadfdt=load mmc ${mmcdev} ${fdtaddr} ${fdtfile}\0" \
+       "emmcloadkernel=load mmc ${mmcdev} ${loadaddr} ${kernel}\0" \
        "load_mmc=mmc dev ${mmcdev} && mmc rescan && " \
-               "run mmcloadkernel run mmcloadfdt\0" \
+               "run mmcloadkernel && run mmcloadfdt\0" \
        "mmcroot=/dev/mmcblk1p2\0" \
        "mmcrootfstype=ext4 rw rootwait\0" \
        "mmcargs=setenv bootargs console=${console} root=${mmcroot} " \
                "source ${loadaddr}\0" \
        "sataboot=run load_sata && run sataargs && " \
                "echo Booting from SATA ... && " \
-               "run bootkernel\0" \
+               "run bootkernel\0"
 
 #undef CONFIG_BOOTCOMMAND
 #define CONFIG_BOOTCOMMAND \
index 8f4022a1348ba5c1ebd1961675f152568dc232e9..82812e577a9598708d4a3a313b3868fcf92c6259 100644 (file)
@@ -64,7 +64,6 @@
 
 #define CONFIG_SUPPORT_EMMC_BOOT       /* eMMC specific */
 #define CONFIG_BOUNCE_BUFFER
-#define CONFIG_FAT_WRITE
 
 /* Network */
 #define CONFIG_FEC_MXC
index 03f6863169d3d2324832e2d71cc40be5032a6d0a..7355f78fcf040a68fb8e076ad96f5151b876f778 100644 (file)
 #define CONFIG_LZO
 #define CONFIG_RBTREE
 
-/* Debug commands */
-
-/* Miscellaneous commands */
-#define CONFIG_FAT_WRITE
 
 #define BOARD_EXTRA_ENV_SETTINGS \
        "mtdparts=" MTDPARTS_DEFAULT "\0"
index 853cd5287800eb04d5f9010bbe5902c560b41b4c..53ff33e4b9d9d373f30ba8602950b7fc0a123d9e 100644 (file)
@@ -44,9 +44,6 @@
 #define CONFIG_TFTP_BLOCKSIZE          16352
 #define CONFIG_TFTP_TSIZE
 
-/* Miscellaneous commands */
-#define CONFIG_FAT_WRITE
-
 /* Increase console I/O buffer size */
 #undef CONFIG_SYS_CBSIZE
 #define CONFIG_SYS_CBSIZE              1024
index f46f46619678635ee959f2fabd630327f5dd472c..b7199bb9e021fabd37870f6e69c7cfa749863af9 100644 (file)
 #define CONFIG_SYS_INIT_SP_ADDR                (CONFIG_SYS_SDRAM_BASE + 0x1000 - /* Fix this */ \
                                        GENERATED_GBL_DATA_SIZE)
 #endif /* CONFIG_DIRECT_NOR_BOOT */
+
+#include <asm/arch/hardware.h>
+
 #endif /* __CONFIG_H */
index c892b5faa9f617ce3175e8a84c2d231f6bba60ba..92ce1273c63376121483557431405087eb3c7103 100644 (file)
@@ -94,7 +94,6 @@
 #define CONFIG_CMD_NAND_LOCK_UNLOCK    /* nand (un)lock commands       */
 
 #undef CONFIG_SUPPORT_RAW_INITRD
-#undef CONFIG_FAT_WRITE
 
 /* BOOTP/DHCP options */
 #define CONFIG_BOOTP_SUBNETMASK
index 17608a54cd9dd3f1e01b9e0c37c234ad5ca561b8..71c9d82791e38178e9bad0e2f0338311a0d4552e 100644 (file)
@@ -27,7 +27,7 @@
 #define CONFIG_ENV_IS_IN_MMC
 #define CONFIG_SYS_MMC_ENV_DEV         1       /* SLOT2: eMMC(1) */
 #define CONFIG_ENV_SIZE                        (128 << 10)
-#define CONFIG_ENV_OFFSET              0xE0000
+#define CONFIG_ENV_OFFSET              0x260000
 #define CONFIG_ENV_OFFSET_REDUND       (CONFIG_ENV_OFFSET + CONFIG_ENV_SIZE)
 #define CONFIG_SYS_REDUNDAND_ENVIRONMENT
 #endif
index 4c874367fd2db8a84caafaf8623732d7a5df731f..133b2b023ca123b91bb1c133574e547a6c2958db 100644 (file)
@@ -24,7 +24,6 @@
  * Commands configuration
  */
 #define CONFIG_CMD_EXT2
-#define CONFIG_CMD_FAT
 
 /*
  * mv-plug-common.h should be defined after CMD configs since it used them
index fc0f5e60177a59d63a4d00b9ab7eb858072c7fec..6fc6ec90af5c687ad1e837d67f556a404ecc7998 100644 (file)
        "ubootupd_nand=echo run load_magic,run load_nand,run upd;\0"    \
        "bootcmd=run net_testrfs\0"
 
+#include <asm/arch/hardware.h>
+
 #endif /* __CONFIG_H */
index a0152a4a43e94b00855cd0d018e41702b7263482..1662dbf1971bed0c94aedf32064891c76cb65b1a 100644 (file)
@@ -87,8 +87,6 @@
        "led4=60,0,1\0" \
        "led5=63,0,1\0"
 
-#undef CONFIG_CMD_FAT
-
 /* Physical Memory Map */
 #define CONFIG_MAX_RAM_BANK_SIZE       (1024 << 20)    /* 1GB */
 
index ade66a43309d8ee5fe5135515e10962a336f36cf..031586b0dfc4112469d7243353cff4bde6329977 100644 (file)
@@ -41,9 +41,6 @@
 /* PWM */
 #define CONFIG_PWM
 
-/* Command definition*/
-#define CONFIG_FAT_WRITE
-
 /* Miscellaneous configurable options */
 #define CONFIG_SYS_CBSIZE              1024    /* Console I/O Buffer Size */
 #define CONFIG_SYS_PBSIZE              1024    /* Print Buffer Size */
index 0fb6fb3b60cd39aaddc9318c0d3e105dc4e36ede..2b4fec4bd4239a4d12e7497d06fa93c8b50bfb30 100644 (file)
 #define FAT_ENV_INTERFACE               "mmc"
 #define FAT_ENV_DEVICE_AND_PART         "1:1"
 #define FAT_ENV_FILE                    "uboot.env"
-#define CONFIG_FAT_WRITE
 #define CONFIG_ENV_VARS_UBOOT_CONFIG
 
 /* Monitor Command Prompt */
index 127e7e73962246831f68d26d2ac8984c9b977dba..f78aa47ae26669d0829c6a31cb0bfbb0df1ed37d 100644 (file)
 #define CONFIG_IPAM390_GPIO_LED_RED    ((16 * 7) + 11)
 #define CONFIG_IPAM390_GPIO_LED_GREEN  ((16 * 7) + 12)
 
+#include <asm/arch/hardware.h>
+
 #endif /* __CONFIG_H */
index 3a7993e8290c9135b73167064490a6e4073ad3c5..b186bfc891516b9275593c1173908683533f26f2 100644 (file)
        "name_uboot=u-boot-spi-k2e-evm.gph\0"                           \
        "name_fs=arago-console-image-k2e-evm.cpio.gz\0"
 
+#define CONFIG_ENV_SIZE                                (256 << 10)  /* 256 KiB */
+#define CONFIG_ENV_IS_IN_NAND
+#define CONFIG_ENV_OFFSET                      0x100000
+
 #include <configs/ti_armv7_keystone2.h>
 
 /* SPL SPI Loader Configuration */
index bee1be794bafd7aa441733e1911e9b2f88b55102..1cc35769840ff0834a1407788d99784b7233d5a8 100644 (file)
@@ -48,8 +48,6 @@
        "get_pmmc_${boot} run_pmmc get_mon_${boot} run_mon "            \
        "get_fdt_${boot} get_kern_${boot} run_kern"
 
-#include <configs/ti_armv7_keystone2.h>
-
 /* SPL SPI Loader Configuration */
 #define CONFIG_SPL_TEXT_BASE           0x0c080000
 
@@ -63,8 +61,8 @@
 #define CONFIG_PHY_MICREL
 #define PHY_ANEG_TIMEOUT       10000 /* PHY needs longer aneg time */
 
-#undef CONFIG_ENV_IS_IN_NAND
 #define CONFIG_ENV_IS_IN_FAT
+#define CONFIG_ENV_SIZE                        (256 << 10)  /* 256 KiB */
 #define FAT_ENV_INTERFACE              "mmc"
 #define FAT_ENV_DEVICE_AND_PART                "0:1"
 #define FAT_ENV_FILE                   "uboot.env"
@@ -80,4 +78,7 @@
 #endif
 
 #define SPI_MTD_PARTS  KEYSTONE_SPI1_MTD_PARTS
+
+#include <configs/ti_armv7_keystone2.h>
+
 #endif /* __CONFIG_K2G_EVM_H */
index 202167bdef790e0fc1808a40f0e3aca68bc09c82..9598bc6976e9e29f741211cc9b602f01d8fc8eec 100644 (file)
        "name_uboot=u-boot-spi-k2hk-evm.gph\0"                          \
        "name_fs=arago-console-image-k2hk-evm.cpio.gz\0"
 
+#define CONFIG_ENV_SIZE                                (256 << 10)  /* 256 KiB */
+#define CONFIG_ENV_IS_IN_NAND
+#define CONFIG_ENV_OFFSET                      0x100000
+
 #include <configs/ti_armv7_keystone2.h>
 
 /* SPL SPI Loader Configuration */
index a7ccdd117cd2c17e2175bd7eeba89671dae7d893..d054276e61eb5f7a825623b83dc79a2445384860 100644 (file)
        "name_uboot=u-boot-spi-k2l-evm.gph\0"                           \
        "name_fs=arago-console-image-k2l-evm.cpio.gz\0"
 
+#define CONFIG_ENV_SIZE                                (256 << 10)  /* 256 KiB */
+#define CONFIG_ENV_IS_IN_NAND
+#define CONFIG_ENV_OFFSET                      0x100000
+
 #include <configs/ti_armv7_keystone2.h>
 
 /* SPL SPI Loader Configuration */
index f230f40d76e9fe51db088d1eb72d1d2147d14754..15da4074f269e32560a7f923e05026c60f0cf124 100644 (file)
 
 #define CONFIG_SYS_INIT_SP_ADDR                0x80010000
 
+#include <asm/arch/hardware.h>
+
 #endif /* __CONFIG_H */
index bd9b0d30a5b9348b37601306f806b1fd7c6a9c76..42bbc028d385ce54b7b411b70cf1ac6207be99a8 100644 (file)
 #define CONFIG_PANIC_HANG
 #define CONFIG_SYS_BOOTM_LEN   (64 << 20)      /* Increase max gunzip size */
 
+#include <asm/arch/soc.h>
+
 #endif /* __LS1012A_COMMON_H */
index d6839c09160a29089a14fa8706500c72ada9dcb9..c1ec2d440cd823302f0d36b56c02773c6227c84d 100644 (file)
 #define CONFIG_SYS_SCSI_MAX_DEVICE     (CONFIG_SYS_SCSI_MAX_SCSI_ID * \
                CONFIG_SYS_SCSI_MAX_LUN)
 
-#define CONFIG_CMD_FAT
-
 /* SPI */
 #if defined(CONFIG_QSPI_BOOT) || defined(CONFIG_SD_BOOT_QSPI)
 #define CONFIG_SPI_FLASH_SPANSION
index 8cf4eaa0218583ff724e0e1486a87bb8d39ed620..152954165cc802e978a68a653508e32b95474f2f 100644 (file)
@@ -125,6 +125,7 @@ unsigned long get_board_ddr_clk(void);
 #if !defined(CONFIG_SD_BOOT) && !defined(CONFIG_NAND_BOOT) && \
        !defined(CONFIG_QSPI_BOOT)
 #define CONFIG_U_QE
+#define CONFIG_SYS_QE_FMAN_FW_IN_NOR
 #endif
 
 /*
index f0033b85d8e931dc61e400722aaea23e87f188e8..067ef4df93c32a6ceb04c02064521de825352c29 100644 (file)
 #if !defined(CONFIG_SD_BOOT) && !defined(CONFIG_NAND_BOOT) && \
        !defined(CONFIG_QSPI_BOOT)
 #define CONFIG_U_QE
+#define CONFIG_SYS_QE_FMAN_FW_IN_NOR
 #endif
 
 /*
index 1b0106d5ab0b345e115277f4d955d8228f75ed5e..32f7162bbc4c3d64fa8c631784871d29ef704259 100644 (file)
  */
 #define CONFIG_SYS_QE_FMAN_FW_IN_MMC
 #define CONFIG_SYS_FMAN_FW_ADDR                (512 * 0x4800)
+#define CONFIG_SYS_QE_FW_ADDR          (512 * 0x4a08)
 #elif defined(CONFIG_QSPI_BOOT)
 #define CONFIG_SYS_QE_FW_IN_SPIFLASH
 #define CONFIG_SYS_FMAN_FW_ADDR                0x40900000
 #define CONFIG_SYS_QE_FMAN_FW_IN_NOR
 /* FMan fireware Pre-load address */
 #define CONFIG_SYS_FMAN_FW_ADDR                0x60900000
+#define CONFIG_SYS_QE_FW_ADDR          0x60940000
 #endif
 #define CONFIG_SYS_QE_FMAN_FW_LENGTH   0x10000
 #define CONFIG_SYS_FDT_PAD             (0x3000 + CONFIG_SYS_QE_FMAN_FW_LENGTH)
 
 #define CONFIG_SYS_BOOTM_LEN   (64 << 20)      /* Increase max gunzip size */
 
+#include <asm/arch/soc.h>
+
 #endif /* __LS1043A_COMMON_H */
index 2647b150b46a7498f9292baede3ed4bd3e86517f..deae7873588ee5d11a8819f4fdcb5df765d8bf5d 100644 (file)
 
 /* QE */
 #ifndef SPL_NO_QE
-#if !defined(CONFIG_SD_BOOT) && !defined(CONFIG_NAND_BOOT) && \
-       !defined(CONFIG_QSPI_BOOT)
+#if !defined(CONFIG_NAND_BOOT) && !defined(CONFIG_QSPI_BOOT)
 #define CONFIG_U_QE
 #endif
-#define CONFIG_SYS_QE_FW_ADDR     0x60940000
 #endif
 
 /* USB */
 #define CONFIG_LIBATA
 #define CONFIG_SCSI_AHCI
 #define CONFIG_CMD_SCSI
-#ifndef CONFIG_CMD_FAT
-#define CONFIG_CMD_FAT
-#endif
 #ifndef CONFIG_CMD_EXT2
 #define CONFIG_CMD_EXT2
 #endif
index b66b8ac72c2369ce636fb2a60e1874c2c1761b5f..1b91676c2d1b1e8bd13b881faec9eb52363fef72 100644 (file)
 
 #define CONFIG_SYS_BOOTM_LEN   (64 << 20)      /* Increase max gunzip size */
 
+#include <asm/arch/soc.h>
+
 #endif /* __LS1046A_COMMON_H */
index b044768883f01b76929f51d001632c1de59b3e90..dbca05a3f6278a94bc8194df71175f9ea3367bab 100644 (file)
@@ -156,6 +156,11 @@ unsigned long long get_qixis_addr(void);
 #define CONFIG_SYS_LS_MC_AIOP_IMG_MAX_LENGTH   0x200000
 #define CONFIG_SYS_LS_MC_DRAM_AIOP_IMG_OFFSET  0x07000000
 
+/* Define phy_reset function to boot the MC based on mcinitcmd.
+ * This happens late enough to properly fixup u-boot env MAC addresses.
+ */
+#define CONFIG_RESET_PHY_R
+
 /*
  * Carve out a DDR region which will not be used by u-boot/Linux
  *
@@ -203,9 +208,16 @@ unsigned long long get_qixis_addr(void);
                                "earlycon=uart8250,mmio,0x21c0500 " \
                                "ramdisk_size=0x2000000 default_hugepagesz=2m" \
                                " hugepagesz=2m hugepages=256"
+#ifdef CONFIG_SD_BOOT
+#define CONFIG_BOOTCOMMAND     "mmc read 0x80200000 0x6800 0x800;"\
+                               " fsl_mc apply dpl 0x80200000 &&" \
+                               " mmc read $kernel_load $kernel_start" \
+                               " $kernel_size && bootm $kernel_load"
+#else
 #define CONFIG_BOOTCOMMAND     "fsl_mc apply dpl 0x580d00000 &&" \
                                " cp.b $kernel_start $kernel_load" \
                                " $kernel_size && bootm $kernel_load"
+#endif
 
 /* Monitor Command Prompt */
 #define CONFIG_SYS_CBSIZE              512     /* Console I/O Buffer Size */
@@ -228,12 +240,16 @@ unsigned long long get_qixis_addr(void);
 #define CONFIG_SPL_TARGET              "u-boot-with-spl.bin"
 #define CONFIG_SPL_TEXT_BASE           0x1800a000
 
+#ifdef CONFIG_NAND_BOOT
 #define CONFIG_SYS_NAND_U_BOOT_DST     0x80400000
 #define CONFIG_SYS_NAND_U_BOOT_START   CONFIG_SYS_NAND_U_BOOT_DST
+#endif
 #define CONFIG_SYS_SPL_MALLOC_SIZE     0x00100000
 #define CONFIG_SYS_SPL_MALLOC_START    0x80200000
 #define CONFIG_SYS_MONITOR_LEN         (640 * 1024)
 
 #define CONFIG_SYS_BOOTM_LEN   (64 << 20)      /* Increase max gunzip size */
 
+#include <asm/arch/soc.h>
+
 #endif /* __LS2_COMMON_H */
index d0b0aa93e463c807a09b319c909570835f767b53..8a8ee9d351f9144b0459b1854e9c970989c5c340 100644 (file)
@@ -166,12 +166,14 @@ unsigned long get_board_ddr_clk(void);
 #define QIXIS_LBMAP_DFLTBANK           0x00
 #define QIXIS_LBMAP_ALTBANK            0x04
 #define QIXIS_LBMAP_NAND               0x09
+#define QIXIS_LBMAP_SD                 0x00
 #define QIXIS_LBMAP_QSPI               0x0f
 #define QIXIS_RST_CTL_RESET            0x31
 #define QIXIS_RCFG_CTL_RECONFIG_IDLE   0x20
 #define QIXIS_RCFG_CTL_RECONFIG_START  0x21
 #define QIXIS_RCFG_CTL_WATCHDOG_ENBLE  0x08
 #define QIXIS_RCW_SRC_NAND             0x107
+#define QIXIS_RCW_SRC_SD               0x40
 #define QIXIS_RCW_SRC_QSPI             0x62
 #define        QIXIS_RST_FORCE_MEM             0x01
 
@@ -198,7 +200,8 @@ unsigned long get_board_ddr_clk(void);
                                        FTIM2_GPCM_TWP(0x3E))
 #define CONFIG_SYS_CS3_FTIM3           0x0
 
-#if defined(CONFIG_SPL) && defined(CONFIG_NAND)
+#if defined(CONFIG_SPL)
+#if defined(CONFIG_NAND_BOOT)
 #define CONFIG_SYS_CSPR1_EXT           CONFIG_SYS_NOR0_CSPR_EXT
 #define CONFIG_SYS_CSPR1               CONFIG_SYS_NOR0_CSPR_EARLY
 #define CONFIG_SYS_CSPR1_FINAL         CONFIG_SYS_NOR0_CSPR
@@ -234,6 +237,12 @@ unsigned long get_board_ddr_clk(void);
 #define CONFIG_SPL_PAD_TO              0x20000
 #define CONFIG_SYS_NAND_U_BOOT_OFFS    (256 * 1024)
 #define CONFIG_SYS_NAND_U_BOOT_SIZE    (640 * 1024)
+#elif defined(CONFIG_SD_BOOT)
+#define CONFIG_ENV_OFFSET              0x200000
+#define CONFIG_ENV_IS_IN_MMC
+#define CONFIG_SYS_MMC_ENV_DEV         0
+#define CONFIG_ENV_SIZE                        0x20000
+#endif
 #else
 #define CONFIG_SYS_CSPR0_EXT           CONFIG_SYS_NOR0_CSPR_EXT
 #define CONFIG_SYS_CSPR0               CONFIG_SYS_NOR0_CSPR_EARLY
@@ -366,6 +375,22 @@ unsigned long get_board_ddr_clk(void);
        "esbc_validate 0x580740000;"            \
        "fsl_mc start mc 0x580a00000"           \
        " 0x580e00000 \0"
+#elif defined(CONFIG_SD_BOOT)
+#define CONFIG_EXTRA_ENV_SETTINGS              \
+       "hwconfig=fsl_ddr:bank_intlv=auto\0"    \
+       "loadaddr=0x90100000\0"                 \
+       "kernel_addr=0x800\0"                \
+       "ramdisk_addr=0x800000\0"               \
+       "ramdisk_size=0x2000000\0"              \
+       "fdt_high=0xa0000000\0"                 \
+       "initrd_high=0xffffffffffffffff\0"      \
+       "kernel_start=0x8000\0"              \
+       "kernel_load=0xa0000000\0"              \
+       "kernel_size=0x14000\0"               \
+       "mcinitcmd=mmcinfo;mmc read 0x80000000 0x5000 0x800;"  \
+       "mmc read 0x80100000 0x7000 0x800;" \
+       "fsl_mc start mc 0x80000000 0x80100000\0"       \
+       "mcmemsize=0x70000000 \0"
 #else
 #define CONFIG_EXTRA_ENV_SETTINGS              \
        "hwconfig=fsl_ddr:bank_intlv=auto\0"    \
@@ -384,7 +409,7 @@ unsigned long get_board_ddr_clk(void);
 #endif /* CONFIG_SECURE_BOOT */
 
 
-#ifdef CONFIG_FSL_MC_ENET
+#if defined(CONFIG_FSL_MC_ENET) && !defined(CONFIG_SPL_BUILD)
 #define CONFIG_FSL_MEMAC
 #define        CONFIG_PHYLIB
 #define CONFIG_PHYLIB_10G
index c4717238bb5c90aa5993d6b01a8d2d76ec332744..8dea0313a346f6af149b95338bab2cc787d6c13f 100644 (file)
@@ -14,8 +14,6 @@
 #define CONFIG_TIMESTAMP               /* Print image info with timestamp */
 
 /* U-Boot Commands */
-#define CONFIG_FAT_WRITE
-
 #define CONFIG_CMD_NAND
 #define CONFIG_CMD_NAND_TRIMFFS
 
index b237cea1da259ac7967633bad63a914bed87ad1a..51812257e19989e5a1ac99303d57963dc76ddbb7 100644 (file)
@@ -20,8 +20,6 @@
 /*
  * U-Boot Commands
  */
-#define CONFIG_FAT_WRITE
-
 #define CONFIG_CMD_NAND
 #define CONFIG_CMD_NAND_TRIMFFS
 #define CONFIG_CMD_SATA
index 6dc1fb047e80d10d2634da1569227865e97ae2a8..bb661400ec4d18d75c9ea0f7981503b9a5debe33 100644 (file)
 #undef CONFIG_BOOTARGS
 #define CONFIG_SYS_USE_SERIALFLASH     1
 
-/*
- * U-Boot Commands
- */
-#define CONFIG_FAT_WRITE
-
 /*
  * Memory configurations
  */
index 12a4dfce6b9673c2c4656e5543422ad559f04dff..89e3807a14b56ff169fafcdfd64f5d6e807d6222 100644 (file)
@@ -40,6 +40,7 @@
        func(MMC, mmc, 0) \
        func(MMC, mmc, 1) \
        func(MMC, mmc, 2) \
+       func(PXE, pxe, na) \
        func(DHCP, dhcp, na)
 
 #include <config_distro_bootcmd.h>
index 37f365dc55ba5b85fe266dc4e9f66b1e25cf787f..288a8894d17e938750645b7bc0819677294f596a 100644 (file)
@@ -45,9 +45,6 @@
 #define CONFIG_ENV_IS_IN_MMC
 #define CONFIG_ENV_SIZE                        SZ_8K
 
-#define CONFIG_CMD_FAT
-#define CONFIG_DOS_PARTITION
-
 /* Using ULP WDOG for reset */
 #define WDOG_BASE_ADDR                 WDG1_RBASE
 
index 6cb1807a8e6c9bca321077c960f8b37d2a2a68f5..1f1bf15af7bc9ebd911c32fb7da473a18de981b1 100644 (file)
@@ -17,7 +17,6 @@
 #include "mx6_common.h"
 
 /* U-Boot Commands */
-#define CONFIG_FAT_WRITE
 #define CONFIG_CMD_PCI
 #define CONFIG_CMD_SATA
 
index d8b0c023b94b23435b6199a5be3549d01a4b36cf..e7fac6d1e1e57af7dfa2655bb92ab2880cb983ea 100644 (file)
@@ -37,7 +37,7 @@
 #define CONFIG_ENV_IS_IN_MMC
 #define CONFIG_SYS_MMC_ENV_DEV         1       /* SLOT2: eMMC(1) */
 #define CONFIG_ENV_SIZE                        (128 << 10)
-#define CONFIG_ENV_OFFSET              0xE0000
+#define CONFIG_ENV_OFFSET              0x260000
 #define CONFIG_ENV_OFFSET_REDUND       (CONFIG_ENV_OFFSET + CONFIG_ENV_SIZE)
 #define CONFIG_SYS_REDUNDAND_ENVIRONMENT
 
index 8904cd5cc772aa8bd5c0ae7fd1116fe2107bd49e..0a8096cc76f7487f3656c8e3cc5ec5bb2023dd80 100644 (file)
 #define CONFIG_SYS_SDRAM_BASE          0xc0000000
 #define CONFIG_SYS_INIT_SP_ADDR                (CONFIG_SYS_SDRAM_BASE + 0x1000 - /* Fix this */ \
                                        GENERATED_GBL_DATA_SIZE)
+
+#include <asm/arch/hardware.h>
+
 #endif /* __CONFIG_H */
index 2dcc6c4539cead26ecd71c0e716a26017f8c8a66..c5bfdec8fa878ce9268203a3ca41ca2b627ce2e5 100644 (file)
@@ -90,8 +90,6 @@
  */
 /* FAT FS */
 #define CONFIG_SUPPORT_VFAT
-#define CONFIG_FS_FAT
-#define CONFIG_FAT_WRITE
 
 /* EXT4 FS */
 #define CONFIG_FS_EXT4
index 998a7a344b2b9e7a05fd8afc8f49fc80708fafd9..c83e559a5ac726fd3d842346250e1586692530ac 100644 (file)
 #define FAT_ENV_DEVICE_AND_PART        "0"
 #define FAT_ENV_FILE           "uboot.env"
 #define CONFIG_ENV_IS_IN_FAT
-#define CONFIG_FAT_WRITE
 #define CONFIG_ENV_SIZE                0x4000
 
 #define CONFIG_BOOTARGS                "console=ttyS0,115200 " \
index 3a719c0b37d47c6e365c067fff4572ea66595ea7..365950d7298a0bb29a13e7261e8799f78a60269f 100644 (file)
@@ -14,7 +14,6 @@
 #define CONFIG_CMD_SDRAM
 
 /* Support File sytems */
-#define CONFIG_FAT_WRITE
 #define CONFIG_SUPPORT_VFAT
 #define CONFIG_FS_EXT4
 #define CONFIG_EXT4_WRITE
index e73bc6185631151fec258d41287aa849cfe590ff..8da3e7a2355730dde588346ccc561ecd9b6df693 100644 (file)
@@ -13,7 +13,6 @@
 #include <asm/arch/rmobile.h>
 
 #define CONFIG_CMD_SDRAM
-#define CONFIG_CMD_FAT
 #define CONFIG_CMD_EXT2
 #define CONFIG_CMD_EXT4
 #define CONFIG_CMD_EXT4_WRITE
@@ -24,7 +23,6 @@
 #define CONFIG_SUPPORT_RAW_INITRD
 
 /* Support File sytems */
-#define CONFIG_FAT_WRITE
 #define CONFIG_SUPPORT_VFAT
 #define CONFIG_FS_EXT4
 #define CONFIG_EXT4_WRITE
index 2893f80c9f23ad2792925980002898b51a6a2ccb..836c5e3fed453e70bfdb7e02f7f0042103bbdf45 100644 (file)
@@ -36,8 +36,6 @@
 /* MMC/SD IP block */
 #define CONFIG_BOUNCE_BUFFER
 
-#define CONFIG_FAT_WRITE
-
 #define CONFIG_SYS_SDRAM_BASE          0x60000000
 #define CONFIG_NR_DRAM_BANKS           1
 #define SDRAM_BANK_SIZE                        (512UL << 20UL)
index 81a1553390b28aeb7d1e18b6ad457617e243a264..a1e0eb7c8d68f093aeae10a175337dfe5a53cade 100644 (file)
@@ -61,8 +61,6 @@
 /* MMC/SD IP block */
 #define CONFIG_BOUNCE_BUFFER
 
-#define CONFIG_FAT_WRITE
-
 #define CONFIG_SYS_SDRAM_BASE          0x60000000
 #define CONFIG_NR_DRAM_BANKS           1
 #define SDRAM_BANK_SIZE                        (2UL << 30)
index 4cf71fa17e150427b8ccf63e21a049d36d9bfa3c..ecf2675255120349ec166bbfd68ce3e4b3fb87b8 100644 (file)
@@ -38,8 +38,6 @@
 /* MMC/SD IP block */
 #define CONFIG_BOUNCE_BUFFER
 
-#define CONFIG_FAT_WRITE
-
 /* RAW SD card / eMMC locations. */
 #define CONFIG_SYS_SPI_U_BOOT_OFFS     (128 << 10)
 
index b0dcd4820986ec23ecd6026f40ce31917e3349a3..7ccbc9b241ca855e45877b97743de74508a03361 100644 (file)
@@ -28,8 +28,6 @@
 #define CONFIG_BOUNCE_BUFFER
 
 #define CONFIG_SUPPORT_VFAT
-#define CONFIG_FS_FAT
-#define CONFIG_FAT_WRITE
 #define CONFIG_FS_EXT4
 
 /* RAW SD card / eMMC locations. */
index 49f56f23de5b9036f971ba165bfbe21edec88b2e..7a8a442336a119aedffa067a11a0cb9c9d07a811 100644 (file)
@@ -43,8 +43,6 @@
 #define CONFIG_ROCKCHIP_SDHCI_MAX_FREQ 200000000
 
 #define CONFIG_SUPPORT_VFAT
-#define CONFIG_FS_FAT
-#define CONFIG_FAT_WRITE
 #define CONFIG_FS_EXT4
 
 /* RAW SD card / eMMC locations. */
index 7b9017ff99f98ab375a118e7cfc165a555faff57..d715eaad14f4d3c25f0fecc853c838cf0a367b28 100644 (file)
@@ -97,7 +97,6 @@
 #define FAT_ENV_INTERFACE              "mmc"
 #define FAT_ENV_DEVICE_AND_PART                "0:1"
 #define FAT_ENV_FILE                   "uboot.env"
-#define CONFIG_FAT_WRITE
 #define CONFIG_ENV_VARS_UBOOT_CONFIG
 #define CONFIG_SYS_LOAD_ADDR           0x1000000
 #define CONFIG_PREBOOT                 "usb start"
index e49b3d95803bf40d449eb5c7f288b9a1793e8ffc..c328e43dd64f9cb6c77ac49760de6df4eff31c7d 100644 (file)
 #define CONFIG_SYS_ONENAND_BASE                0xB0000000
 
 /* write support for filesystems */
-#define CONFIG_FAT_WRITE
 #define CONFIG_EXT4_WRITE
 
 /* GPT */
index 57fa67d234bedec88b8b6e0754de7dfb2f77e293..7607f946405a120e09a90ba51839ab6950ad8b49 100644 (file)
 #define CONFIG_USB_ETH_RNDIS
 #define CONFIG_USBNET_MANUFACTURER      "Atmel SAMA5D2_PTC"
 
-#if defined(CONFIG_CMD_USB)
-#define CONFIG_CMD_FAT
-#endif
-
 /* Ethernet Hardware */
 #define CONFIG_MACB
 #define CONFIG_RMII
index 074c7568f04d24ae1c0cefad8ec957b40b7763f3..fbe26cae21b8b7196e41e5504eb04673028700e2 100644 (file)
 #define CONFIG_SYS_USB_OHCI_MAX_ROOT_PORTS     2
 #endif
 
-#if defined(CONFIG_CMD_USB) || defined(CONFIG_CMD_MMC)
-#define CONFIG_FAT_WRITE
-#endif
-
 #define CONFIG_SYS_LOAD_ADDR                   0x22000000 /* load address */
 
 #if CONFIG_SYS_USE_NANDFLASH
index 9540a4a0ff9097312fe9e3dbfe58ff21764e68e4..891d6a0f79acf0226d66f5835b46037a556e4849 100644 (file)
 #define CONFIG_SYS_USB_OHCI_MAX_ROOT_PORTS     3
 #endif
 
-#if defined(CONFIG_CMD_USB) || defined(CONFIG_CMD_MMC)
-#define CONFIG_FAT_WRITE
-#endif
-
 #define CONFIG_SYS_LOAD_ADDR                   0x22000000 /* load address */
 
 #ifdef CONFIG_SYS_USE_SERIALFLASH
index fbbd6cd99b8e7405abfd1902d9fb809e1d47f6d8..31ceb5402f7f674faaeaa16c6ffce5cbefff2a86 100644 (file)
@@ -29,8 +29,6 @@
 
 #define CONFIG_CMD_PCI
 
-#define CONFIG_FS_FAT
-#define CONFIG_FAT_WRITE
 #define CONFIG_FS_EXT4
 #define CONFIG_EXT4_WRITE
 #define CONFIG_HOST_MAX_DEVICES 4
index 91618676752f981372ab33a41ac80eea99cb1114..b5705b71693c986e56cd06fc82a0582d29d8574a 100644 (file)
 
 #define CONFIG_SYS_MMCSD_FS_BOOT_PARTITION     1
 #define CONFIG_SPL_FS_LOAD_PAYLOAD_NAME        "u-boot.img"
-#define CONFIG_FS_FAT
 
 #define CONFIG_SPL_SPI_LOAD
 #define CONFIG_SYS_SPI_U_BOOT_OFFS     0x20000
index 99b5b23d2940b85d670c8ebbb932de2642b2924b..4e0b9b12525791754527addad416110fc4e7cf2c 100644 (file)
 /* Command line configuration */
 #define CONFIG_CMD_PING
 #define CONFIG_CMD_DHCP
-#define CONFIG_CMD_FAT
 #define CONFIG_CMD_USB
 #define CONFIG_CMD_MII
 #define CONFIG_CMD_MMC
index 7ea780b48b1a7ed9c06c3ba7d16111302ceeb5f7..3b59b6a1069f309db4402a81fb48e95db7cc8f77 100644 (file)
@@ -8,8 +8,7 @@
 #define __CONFIG_SOCFGPA_ARRIA10_H__
 
 #include <asm/arch/base_addr_a10.h>
-/* U-Boot Commands */
-#define CONFIG_FAT_WRITE
+
 #define CONFIG_HW_WATCHDOG
 
 /* Booting Linux */
index b60d007478dfcfd5773676956069dad4b0ad16ae..fe4031910b63b5ff09b262c345a573945aa0e4f8 100644 (file)
@@ -8,8 +8,6 @@
 
 #include <asm/arch/base_addr_ac5.h>
 
-/* U-Boot Commands */
-#define CONFIG_FAT_WRITE
 #define CONFIG_HW_WATCHDOG
 
 /* Memory configurations */
index dfe4980b85a0f33bb273c947e22a251b83d65342..be565211219631369e4f9c5766333821ad05be4b 100644 (file)
@@ -8,8 +8,6 @@
 
 #include <asm/arch/base_addr_ac5.h>
 
-/* U-Boot Commands */
-#define CONFIG_FAT_WRITE
 #define CONFIG_HW_WATCHDOG
 
 /* Memory configurations */
index dd5933d43c24fd91c4f57405ccf57882b7fc2c58..320c585a397866b58f0c767bca03d21c20b107f0 100644 (file)
@@ -8,8 +8,6 @@
 
 #include <asm/arch/base_addr_ac5.h>
 
-/* U-Boot Commands */
-#define CONFIG_FAT_WRITE
 #define CONFIG_HW_WATCHDOG
 
 /* Memory configurations */
index 302ec200bdee25cb4d434d65b562ada7bfcbbf38..ef693b00380fc71b04e1c3ea3027450bb026d74d 100644 (file)
@@ -8,8 +8,6 @@
 
 #include <asm/arch/base_addr_ac5.h>
 
-/* U-Boot Commands */
-#define CONFIG_FAT_WRITE
 #define CONFIG_HW_WATCHDOG
 
 /* Memory configurations */
index 014828bc08279c873d8cf873baaa31e7f05b6a57..522ac74ffef54365078d72bd7c92047d66d7bf81 100644 (file)
@@ -8,8 +8,6 @@
 
 #include <asm/arch/base_addr_ac5.h>
 
-/* U-Boot Commands */
-#define CONFIG_FAT_WRITE
 #define CONFIG_HW_WATCHDOG
 
 /* Memory configurations */
index 3585eeb3c4ac7ccdf28a9121d3978a28823ee58f..68403aa744c3417aa9f9d2ad36642bc0531401bc 100644 (file)
@@ -9,8 +9,6 @@
 
 #include <asm/arch/base_addr_ac5.h>
 
-/* U-Boot Commands */
-#define CONFIG_FAT_WRITE
 #define CONFIG_HW_WATCHDOG
 
 /* Memory configurations */
index 2d367026b6eb49992d0cef832468f163d4d5d707..ee85708b7a0a5c1f589838158c0a676878a829a8 100644 (file)
@@ -8,8 +8,6 @@
 
 #include <asm/arch/base_addr_ac5.h>
 
-/* U-Boot Commands */
-#define CONFIG_FAT_WRITE
 #define CONFIG_HW_WATCHDOG
 
 /* Memory configurations */
index c9fc5c90d96371f3d4bbf12106f5d2c21a6f7c06..c75acc0749def305b52d1dc5753495a0809e7bff 100644 (file)
@@ -8,8 +8,6 @@
 
 #include <asm/arch/base_addr_ac5.h>
 
-/* U-Boot Commands */
-#define CONFIG_FAT_WRITE
 #define CONFIG_HW_WATCHDOG
 
 /* Memory configurations */
index 5dc929852bcac73cdd7d1605d83017832e2a3784..a08fa9ff4ccc5dbf432bdc9c36ba1d75888de1ef 100644 (file)
@@ -8,8 +8,6 @@
 
 #include <asm/arch/base_addr_ac5.h>
 
-/* U-Boot Commands */
-#define CONFIG_FAT_WRITE
 #define CONFIG_HW_WATCHDOG
 
 /* Memory configurations */
index 64e1595cbe79a1db3723a8c15c69e1a8634b3288..4366061f77ea6332c485d4a62088701855805f51 100644 (file)
@@ -8,8 +8,6 @@
 
 #include <asm/arch/base_addr_ac5.h>
 
-#define CONFIG_FAT_WRITE
-
 #define CONFIG_HW_WATCHDOG
 
 /* Memory configurations */
index 251dd0e901b18e7fc2e25f4c7173fe5fd9985c3e..e2bdfb12f91f151f0d881ef3681a666f2b5a5304 100644 (file)
@@ -8,8 +8,6 @@
 
 #include <asm/arch/base_addr_ac5.h>
 
-/* U-Boot Commands */
-#define CONFIG_FAT_WRITE
 #define CONFIG_HW_WATCHDOG
 
 /* Memory configurations */
index f042f0d0c29fba459b1ca0aa33185f1e480fb8b2..9b514ff37ac6b14dc2336788c2783ad249a0e87e 100644 (file)
 
 #define CONFIG_SYS_MONITOR_LEN         (768 << 10)     /* 768 KiB */
 
-#define CONFIG_FAT_WRITE       /* enable write access */
-
 #define CONFIG_SPL_FRAMEWORK
 
 #ifndef CONFIG_ARM64           /* AArch64 FEL support is not ready yet */
index 1a4a7e23205aa21c55600dc8e38d6ed090ff06fe..c03efd852a66b40b1bb39bde751ae7e3f7407343 100644 (file)
 #ifdef CONFIG_FS_EXT4
 #undef CONFIG_FS_EXT4
 #endif
-#ifdef CONFIG_FS_FAT
-#undef CONFIG_FS_FAT
-#endif
 
 /* remove USB */
 #ifdef CONFIG_USB_EHCI_TEGRA
index 7ca5c0b9dac22589dc2228530b68f3a6f29dfef8..723435e0ae2cc1f31afa1ff266af4d1ab783a77a 100644 (file)
@@ -99,7 +99,6 @@
 
 #ifndef CONFIG_SPL_BUILD
 #include <config_distro_defaults.h>
-#define CONFIG_FAT_WRITE
 #endif
 
 #endif /* _TEGRA_COMMON_H_ */
index a4066a8494626cfaeff2e96405b2fd55cef00c69..ea83ea2495e5d3dfebac6a436a672f58c820afd6 100644 (file)
@@ -16,9 +16,6 @@
 #ifndef __CONFIG_TI814X_EVM_H
 #define __CONFIG_TI814X_EVM_H
 
-#define CONFIG_TI81XX
-#define CONFIG_TI814X
-
 #include <asm/arch/omap.h>
 
 #define CONFIG_ENV_SIZE                        (128 << 10)     /* 128 KiB */
index 2303970d889b75030b0cb5c3ba84bdfeb9bce920..defcad4518806f0ed8d192aeb6a8ef5b5e358985 100644 (file)
 #ifndef __CONFIG_TI816X_EVM_H
 #define __CONFIG_TI816X_EVM_H
 
-#define CONFIG_TI81XX
-#define CONFIG_TI816X
-
-#define CONFIG_ARCH_CPU_INIT
-
+#include <configs/ti_armv7_omap.h>
 #include <asm/arch/omap.h>
 
 #define CONFIG_ENV_SIZE                        0x2000
-#define CONFIG_SYS_MALLOC_LEN          (CONFIG_ENV_SIZE + (32 * 1024))
-#define CONFIG_SYS_LONGHELP            /* undef save memory */
 #define CONFIG_MACH_TYPE               MACH_TYPE_TI8168EVM
 
-#define CONFIG_CMDLINE_TAG             /* enable passing of ATAGs */
-#define CONFIG_SETUP_MEMORY_TAGS
-#define CONFIG_INITRD_TAG              /* required for ramdisk support */
-
 #define CONFIG_EXTRA_ENV_SETTINGS      \
-       "loadaddr=0x81000000\0"         \
+       DEFAULT_LINUX_BOOT_ENV \
+       "mtdids=" MTDIDS_DEFAULT "\0" \
+       "mtdparts=" MTDPARTS_DEFAULT "\0" \
 
 #define CONFIG_BOOTCOMMAND                     \
        "mmc rescan;"                           \
 #define V_OSCK          24000000    /* Clock output from T2 */
 #define V_SCLK          (V_OSCK >> 1)
 
-#define CONFIG_SYS_MAXARGS     32
-#define CONFIG_SYS_CBSIZE      512 /* console I/O buffer size */
-#define CONFIG_SYS_PBSIZE      (CONFIG_SYS_CBSIZE \
-               + sizeof(CONFIG_SYS_PROMPT) + 16) /* print buffer size */
-#define CONFIG_SYS_BARGSIZE    CONFIG_SYS_CBSIZE /* boot arg buffer size */
-
-#define CONFIG_SYS_LOAD_ADDR           0x81000000 /* Default load address */
-
 #define CONFIG_CMD_ASKENV
 
-#define CONFIG_FS_FAT
-
-/*
- * Only one of the following two options (DDR3/DDR2) should be enabled
- * CONFIG_TI816X_EVM_DDR2
- * CONFIG_TI816X_EVM_DDR3
- */
-#define CONFIG_TI816X_EVM_DDR3
-
-/*
- * Supported values: 400, 531, 675 or 796 MHz
- */
-#define CONFIG_TI816X_DDR_PLL_796
-
-#define CONFIG_TI816X_USE_EMIF0        1
-#define CONFIG_TI816X_USE_EMIF1        1
-
-#define CONFIG_NR_DRAM_BANKS   2               /* we have 2 banks of DRAM */
-#define PHYS_DRAM_1            0x80000000      /* DRAM Bank #1 */
-#define PHYS_DRAM_1_SIZE        0x40000000     /* 1 GB */
-#define PHYS_DRAM_2            0xC0000000      /* DRAM Bank #2 */
-#define PHYS_DRAM_2_SIZE       0x40000000      /* 1 GB */
-
 #define CONFIG_MAX_RAM_BANK_SIZE       (2048 << 20)    /* 2048MB */
-#define CONFIG_SYS_SDRAM_BASE          PHYS_DRAM_1
-#define CONFIG_SYS_INIT_SP_ADDR                (NON_SECURE_SRAM_END - \
-               GENERATED_GBL_DATA_SIZE)
+#define CONFIG_SYS_SDRAM_BASE          0x80000000
 
 /**
  * Platform/Board specific defs
@@ -85,8 +44,6 @@
 #define CONFIG_SYS_TIMERBASE    0x4802E000
 #define CONFIG_SYS_PTV          2   /* Divisor: 2^(PTV+1) => 8 */
 
-#undef CONFIG_NAND_OMAP_GPMC
-
 /*
  * NS16550 Configuration
  */
 #define CONFIG_SERIAL3
 #define CONFIG_CONS_INDEX      1
 
-#define CONFIG_ENV_IS_NOWHERE
+/*
+ * GPMC NAND block.  We support 1 device and the physical address to
+ * access CS0 at is 0x8000000.
+ */
+#define CONFIG_SYS_NAND_BASE           0x8000000
+#define CONFIG_SYS_MAX_NAND_DEVICE     1
+
+/* NAND: SPL related configs */
+#define CONFIG_SPL_NAND_AM33XX_BCH
+
+/* NAND: device related configs */
+#define CONFIG_SYS_NAND_5_ADDR_CYCLE
+#define CONFIG_SYS_NAND_BUSWIDTH_16BIT
+#define CONFIG_SYS_NAND_PAGE_COUNT     (CONFIG_SYS_NAND_BLOCK_SIZE / \
+                                        CONFIG_SYS_NAND_PAGE_SIZE)
+#define CONFIG_SYS_NAND_PAGE_SIZE      2048
+#define CONFIG_SYS_NAND_OOBSIZE                64
+#define CONFIG_SYS_NAND_BLOCK_SIZE     (128*1024)
+/* NAND: driver related configs */
+#define CONFIG_NAND_OMAP_GPMC_PREFETCH
+#define CONFIG_NAND_OMAP_ELM
+#define CONFIG_SYS_NAND_BAD_BLOCK_POS  NAND_LARGE_BADBLOCK_POS
+#define CONFIG_SYS_NAND_ECCPOS         { 2, 3, 4, 5, 6, 7, 8, 9, \
+                                        10, 11, 12, 13, 14, 15, 16, 17, \
+                                        18, 19, 20, 21, 22, 23, 24, 25, \
+                                        26, 27, 28, 29, 30, 31, 32, 33, \
+                                        34, 35, 36, 37, 38, 39, 40, 41, \
+                                        42, 43, 44, 45, 46, 47, 48, 49, \
+                                        50, 51, 52, 53, 54, 55, 56, 57, }
+
+#define CONFIG_SYS_NAND_ECCSIZE                512
+#define CONFIG_SYS_NAND_ECCBYTES       14
+#define CONFIG_SYS_NAND_ONFI_DETECTION
+#define CONFIG_NAND_OMAP_ECCSCHEME     OMAP_ECC_BCH8_CODE_HW
+#define MTDIDS_DEFAULT                 "nand0=nand.0"
+#define MTDPARTS_DEFAULT               "mtdparts=nand.0:" \
+                                       "128k(NAND.SPL)," \
+                                       "128k(NAND.SPL.backup1)," \
+                                       "128k(NAND.SPL.backup2)," \
+                                       "128k(NAND.SPL.backup3)," \
+                                       "256k(NAND.u-boot-spl-os)," \
+                                       "1m(NAND.u-boot)," \
+                                       "128k(NAND.u-boot-env)," \
+                                       "128k(NAND.u-boot-env.backup1)," \
+                                       "8m(NAND.kernel)," \
+                                       "-(NAND.file-system)"
+#define CONFIG_SYS_NAND_U_BOOT_OFFS    0x000c0000
+#define CONFIG_ENV_IS_IN_NAND
+#define CONFIG_ENV_OFFSET              0x001c0000
+#define CONFIG_ENV_OFFSET_REDUND       0x001e0000
+#define CONFIG_SYS_ENV_SECT_SIZE       CONFIG_SYS_NAND_BLOCK_SIZE
 
 /* SPL */
 /* Defines for SPL */
-#define CONFIG_SPL_FRAMEWORK
+#define CONFIG_SPL_NAND_AM33XX_BCH     /* ELM support */
 #define CONFIG_SPL_TEXT_BASE    0x40400000
 #define CONFIG_SPL_MAX_SIZE            (SRAM_SCRATCH_SPACE_ADDR - \
                                         CONFIG_SPL_TEXT_BASE)
 
-#define CONFIG_SPL_BSS_START_ADDR   0x80000000
-#define CONFIG_SPL_BSS_MAX_SIZE     0x80000     /* 512 KB */
-
-#define CONFIG_SYS_MMCSD_FS_BOOT_PARTITION     1
-#define CONFIG_SPL_FS_LOAD_PAYLOAD_NAME        "u-boot.img"
-
-#define CONFIG_SYS_SPI_U_BOOT_OFFS  0x20000
-#define CONFIG_SYS_SPI_U_BOOT_SIZE  0x40000
 #define CONFIG_SPL_LDSCRIPT     "arch/arm/mach-omap2/u-boot-spl.lds"
 
 #define CONFIG_SYS_TEXT_BASE        0x80800000
-#define CONFIG_SYS_SPL_MALLOC_START 0x80208000
-#define CONFIG_SYS_SPL_MALLOC_SIZE  0x100000
 
 /* Since SPL did pll and ddr initialization for us,
  * we don't need to do it twice.
 #define CONFIG_SKIP_LOWLEVEL_INIT
 #endif
 
+/*
+ * Disable MMC DM for SPL build and can be re-enabled after adding
+ * DM support in SPL
+ */
+#ifdef CONFIG_SPL_BUILD
+#undef CONFIG_DM_MMC
+#undef CONFIG_TIMER
+#undef CONFIG_DM_USB
+#endif
 #endif
index 0bd3c9f94cfacf257e48fd8dd06366ec114b3ab1..a4676d3a7ffb98d896d562172ef6941700b6135c 100644 (file)
 
 #define CONFIG_SUPPORT_RAW_INITRD
 
-/*
- * Common filesystems support.  When we have removable storage we
- * enabled a number of useful commands and support.
- */
-#if defined(CONFIG_MMC) || defined(CONFIG_USB_STORAGE)
-#define CONFIG_FAT_WRITE
-#endif
-
 /*
  * Our platforms make use of SPL to initalize the hardware (primarily
  * memory) enough for full U-Boot to be loaded. We make use of the general
 #define CONFIG_SPL_FS_LOAD_ARGS_NAME           "args"
 
 /* RAW SD card / eMMC */
-#define CONFIG_SYS_MMCSD_RAW_MODE_KERNEL_SECTOR        0x900   /* address 0x120000 */
-#define CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTOR  0x80    /* address 0x10000 */
-#define CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTORS 0x80    /* 64KiB */
+#define CONFIG_SYS_MMCSD_RAW_MODE_KERNEL_SECTOR        0x1700  /* address 0x2E0000 */
+#define CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTOR  0x1500  /* address 0x2A0000 */
+#define CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTORS 0x200   /* 256KiB */
+
 
 /* spl export command */
 #define CONFIG_CMD_SPL
index 06b9bba80c41822152d9cd9adae2fc7f46219ad0..ac8dabd9caebb7db2f5f046dbf6d188e887463ec 100644 (file)
 #define CONFIG_SYS_MAX_NAND_DEVICE             1
 #define CONFIG_SYS_NAND_MAX_CHIPS              1
 #define CONFIG_SYS_NAND_NO_SUBPAGE_WRITE
-#define CONFIG_ENV_SIZE                                (256 << 10)  /* 256 KiB */
-#define CONFIG_ENV_IS_IN_NAND
-#define CONFIG_ENV_OFFSET                      0x100000
 #define CONFIG_MTD_PARTITIONS
 #define CONFIG_RBTREE
 #define CONFIG_LZO
 /* USB Configuration */
 #define CONFIG_USB_XHCI_KEYSTONE
 #define CONFIG_SYS_USB_XHCI_MAX_ROOT_PORTS     2
-#define CONFIG_FS_FAT
 #define CONFIG_USB_SS_BASE                     KS2_USB_SS_BASE
 #define CONFIG_USB_HOST_XHCI_BASE              KS2_USB_HOST_XHCI_BASE
 #define CONFIG_DEV_USB_PHY_BASE                        KS2_DEV_USB_PHY_BASE
index bc57e8a73a6daadcdf36cc0a0791e652e32bbba9..e45b506eba9217849aa8cd8e2e5c87b27b846121 100644 (file)
 
 /* USB */
 #define CONFIG_SYS_USB_XHCI_MAX_ROOT_PORTS     4
-#define CONFIG_FAT_WRITE
 
 /* SD/MMC */
 #define CONFIG_SUPPORT_EMMC_BOOT
index 1b436205401124c00729bfa598c21f10614c25fe..c56cd8c98bf704a9ea9cc5482eabb4f1d71c9ed9 100644 (file)
 # define FAT_ENV_INTERFACE             "mmc"
 #endif
 
-#if defined(CONFIG_MMC_SDHCI_ZYNQ) || defined(CONFIG_ZYNQMP_USB)
-# define CONFIG_FAT_WRITE
-#endif
-
 #ifdef CONFIG_NAND_ARASAN
 # define CONFIG_CMD_NAND_LOCK_UNLOCK
 # define CONFIG_SYS_MAX_NAND_DEVICE    1
index df4765c0760b9be1f327e4ffa854a4689c77e6cc..4b6b08885134125187fb38a82a4e4a983c6483e5 100644 (file)
 
 #if defined(CONFIG_MMC_SDHCI_ZYNQ) || defined(CONFIG_ZYNQ_USB)
 # define CONFIG_SUPPORT_VFAT
-# define CONFIG_FAT_WRITE
 #endif
 
 #if defined(CONFIG_ZYNQ_I2C0) || defined(CONFIG_ZYNQ_I2C1)
diff --git a/include/dt-bindings/clock/sun50i-a64-ccu.h b/include/dt-bindings/clock/sun50i-a64-ccu.h
new file mode 100644 (file)
index 0000000..370c0a0
--- /dev/null
@@ -0,0 +1,134 @@
+/*
+ * Copyright (C) 2016 Maxime Ripard <maxime.ripard@free-electrons.com>
+ *
+ * This file is dual-licensed: you can use it either under the terms
+ * of the GPL or the X11 license, at your option. Note that this dual
+ * licensing only applies to this file, and not this project as a
+ * whole.
+ *
+ *  a) This file is free software; you can redistribute it and/or
+ *     modify it under the terms of the GNU General Public License as
+ *     published by the Free Software Foundation; either version 2 of the
+ *     License, or (at your option) any later version.
+ *
+ *     This file is distributed in the hope that it will be useful,
+ *     but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *     GNU General Public License for more details.
+ *
+ * Or, alternatively,
+ *
+ *  b) Permission is hereby granted, free of charge, to any person
+ *     obtaining a copy of this software and associated documentation
+ *     files (the "Software"), to deal in the Software without
+ *     restriction, including without limitation the rights to use,
+ *     copy, modify, merge, publish, distribute, sublicense, and/or
+ *     sell copies of the Software, and to permit persons to whom the
+ *     Software is furnished to do so, subject to the following
+ *     conditions:
+ *
+ *     The above copyright notice and this permission notice shall be
+ *     included in all copies or substantial portions of the Software.
+ *
+ *     THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ *     EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ *     OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ *     NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ *     HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ *     WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ *     FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ *     OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+#ifndef _DT_BINDINGS_CLK_SUN50I_A64_H_
+#define _DT_BINDINGS_CLK_SUN50I_A64_H_
+
+#define CLK_BUS_MIPI_DSI       28
+#define CLK_BUS_CE             29
+#define CLK_BUS_DMA            30
+#define CLK_BUS_MMC0           31
+#define CLK_BUS_MMC1           32
+#define CLK_BUS_MMC2           33
+#define CLK_BUS_NAND           34
+#define CLK_BUS_DRAM           35
+#define CLK_BUS_EMAC           36
+#define CLK_BUS_TS             37
+#define CLK_BUS_HSTIMER                38
+#define CLK_BUS_SPI0           39
+#define CLK_BUS_SPI1           40
+#define CLK_BUS_OTG            41
+#define CLK_BUS_EHCI0          42
+#define CLK_BUS_EHCI1          43
+#define CLK_BUS_OHCI0          44
+#define CLK_BUS_OHCI1          45
+#define CLK_BUS_VE             46
+#define CLK_BUS_TCON0          47
+#define CLK_BUS_TCON1          48
+#define CLK_BUS_DEINTERLACE    49
+#define CLK_BUS_CSI            50
+#define CLK_BUS_HDMI           51
+#define CLK_BUS_DE             52
+#define CLK_BUS_GPU            53
+#define CLK_BUS_MSGBOX         54
+#define CLK_BUS_SPINLOCK       55
+#define CLK_BUS_CODEC          56
+#define CLK_BUS_SPDIF          57
+#define CLK_BUS_PIO            58
+#define CLK_BUS_THS            59
+#define CLK_BUS_I2S0           60
+#define CLK_BUS_I2S1           61
+#define CLK_BUS_I2S2           62
+#define CLK_BUS_I2C0           63
+#define CLK_BUS_I2C1           64
+#define CLK_BUS_I2C2           65
+#define CLK_BUS_SCR            66
+#define CLK_BUS_UART0          67
+#define CLK_BUS_UART1          68
+#define CLK_BUS_UART2          69
+#define CLK_BUS_UART3          70
+#define CLK_BUS_UART4          71
+#define CLK_BUS_DBG            72
+#define CLK_THS                        73
+#define CLK_NAND               74
+#define CLK_MMC0               75
+#define CLK_MMC1               76
+#define CLK_MMC2               77
+#define CLK_TS                 78
+#define CLK_CE                 79
+#define CLK_SPI0               80
+#define CLK_SPI1               81
+#define CLK_I2S0               82
+#define CLK_I2S1               83
+#define CLK_I2S2               84
+#define CLK_SPDIF              85
+#define CLK_USB_PHY0           86
+#define CLK_USB_PHY1           87
+#define CLK_USB_HSIC           88
+#define CLK_USB_HSIC_12M       89
+
+#define CLK_USB_OHCI0          91
+
+#define CLK_USB_OHCI1          93
+
+#define CLK_DRAM_VE            95
+#define CLK_DRAM_CSI           96
+#define CLK_DRAM_DEINTERLACE   97
+#define CLK_DRAM_TS            98
+#define CLK_DE                 99
+#define CLK_TCON0              100
+#define CLK_TCON1              101
+#define CLK_DEINTERLACE                102
+#define CLK_CSI_MISC           103
+#define CLK_CSI_SCLK           104
+#define CLK_CSI_MCLK           105
+#define CLK_VE                 106
+#define CLK_AC_DIG             107
+#define CLK_AC_DIG_4X          108
+#define CLK_AVS                        109
+#define CLK_HDMI               110
+#define CLK_HDMI_DDC           111
+
+#define CLK_DSI_DPHY           113
+#define CLK_GPU                        114
+
+#endif /* _DT_BINDINGS_CLK_SUN50I_H_ */
diff --git a/include/dt-bindings/reset/sun50i-a64-ccu.h b/include/dt-bindings/reset/sun50i-a64-ccu.h
new file mode 100644 (file)
index 0000000..db60b29
--- /dev/null
@@ -0,0 +1,98 @@
+/*
+ * Copyright (C) 2016 Maxime Ripard <maxime.ripard@free-electrons.com>
+ *
+ * This file is dual-licensed: you can use it either under the terms
+ * of the GPL or the X11 license, at your option. Note that this dual
+ * licensing only applies to this file, and not this project as a
+ * whole.
+ *
+ *  a) This file is free software; you can redistribute it and/or
+ *     modify it under the terms of the GNU General Public License as
+ *     published by the Free Software Foundation; either version 2 of the
+ *     License, or (at your option) any later version.
+ *
+ *     This file is distributed in the hope that it will be useful,
+ *     but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *     GNU General Public License for more details.
+ *
+ * Or, alternatively,
+ *
+ *  b) Permission is hereby granted, free of charge, to any person
+ *     obtaining a copy of this software and associated documentation
+ *     files (the "Software"), to deal in the Software without
+ *     restriction, including without limitation the rights to use,
+ *     copy, modify, merge, publish, distribute, sublicense, and/or
+ *     sell copies of the Software, and to permit persons to whom the
+ *     Software is furnished to do so, subject to the following
+ *     conditions:
+ *
+ *     The above copyright notice and this permission notice shall be
+ *     included in all copies or substantial portions of the Software.
+ *
+ *     THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ *     EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ *     OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ *     NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ *     HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ *     WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ *     FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ *     OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+#ifndef _DT_BINDINGS_RST_SUN50I_A64_H_
+#define _DT_BINDINGS_RST_SUN50I_A64_H_
+
+#define RST_USB_PHY0           0
+#define RST_USB_PHY1           1
+#define RST_USB_HSIC           2
+#define RST_DRAM               3
+#define RST_MBUS               4
+#define RST_BUS_MIPI_DSI       5
+#define RST_BUS_CE             6
+#define RST_BUS_DMA            7
+#define RST_BUS_MMC0           8
+#define RST_BUS_MMC1           9
+#define RST_BUS_MMC2           10
+#define RST_BUS_NAND           11
+#define RST_BUS_DRAM           12
+#define RST_BUS_EMAC           13
+#define RST_BUS_TS             14
+#define RST_BUS_HSTIMER                15
+#define RST_BUS_SPI0           16
+#define RST_BUS_SPI1           17
+#define RST_BUS_OTG            18
+#define RST_BUS_EHCI0          19
+#define RST_BUS_EHCI1          20
+#define RST_BUS_OHCI0          21
+#define RST_BUS_OHCI1          22
+#define RST_BUS_VE             23
+#define RST_BUS_TCON0          24
+#define RST_BUS_TCON1          25
+#define RST_BUS_DEINTERLACE    26
+#define RST_BUS_CSI            27
+#define RST_BUS_HDMI0          28
+#define RST_BUS_HDMI1          29
+#define RST_BUS_DE             30
+#define RST_BUS_GPU            31
+#define RST_BUS_MSGBOX         32
+#define RST_BUS_SPINLOCK       33
+#define RST_BUS_DBG            34
+#define RST_BUS_LVDS           35
+#define RST_BUS_CODEC          36
+#define RST_BUS_SPDIF          37
+#define RST_BUS_THS            38
+#define RST_BUS_I2S0           39
+#define RST_BUS_I2S1           40
+#define RST_BUS_I2S2           41
+#define RST_BUS_I2C0           42
+#define RST_BUS_I2C1           43
+#define RST_BUS_I2C2           44
+#define RST_BUS_SCR            45
+#define RST_BUS_UART0          46
+#define RST_BUS_UART1          47
+#define RST_BUS_UART2          48
+#define RST_BUS_UART3          49
+#define RST_BUS_UART4          50
+
+#endif /* _DT_BINDINGS_RST_SUN50I_A64_H_ */
index caf71a3fe63071ad886d1720eb954050b623849a..c9f61a577ec2fec5e896fe3f3eed39caf78ed28a 100644 (file)
        "rootfs part 0 2;" \
        "MLO fat 0 1;" \
        "MLO.raw raw 0x100 0x100;" \
-       "u-boot.img.raw raw 0x300 0x400;" \
-       "spl-os-args.raw raw 0x80 0x80;" \
-       "spl-os-image.raw raw 0x900 0x2000;" \
+       "u-boot.img.raw raw 0x300 0x1000;" \
+       "u-env.raw raw 0x1300 0x200;" \
+       "spl-os-args.raw raw 0x1500 0x200;" \
+       "spl-os-image.raw raw 0x1700 0x6900;" \
        "spl-os-args fat 0 1;" \
        "spl-os-image fat 0 1;" \
        "u-boot.img fat 0 1;" \
@@ -28,8 +29,9 @@
        "MLO fat 1 1;" \
        "MLO.raw raw 0x100 0x100;" \
        "u-boot.img.raw raw 0x300 0x1000;" \
-       "spl-os-args.raw raw 0x80 0x80;" \
-       "spl-os-image.raw raw 0x900 0x2000;" \
+       "u-env.raw raw 0x1300 0x200;" \
+       "spl-os-args.raw raw 0x1500 0x200;" \
+       "spl-os-image.raw raw 0x1700 0x6900;" \
        "spl-os-args fat 1 1;" \
        "spl-os-image fat 1 1;" \
        "u-boot.img fat 1 1;" \
index e38f3808af2524463507848b89044f37433f54e8..71879f01cac159ece96d87418069869099375fc5 100644 (file)
@@ -18,9 +18,6 @@
 #define VFAT_MAXSEQ            9   /* Up to 9 of 13 2-byte UTF-16 entries */
 #define PREFETCH_BLOCKS                2
 
-#ifndef CONFIG_FS_FAT_MAX_CLUSTSIZE
-#define CONFIG_FS_FAT_MAX_CLUSTSIZE 65536
-#endif
 #define MAX_CLUSTSIZE  CONFIG_FS_FAT_MAX_CLUSTSIZE
 
 #define DIRENTSPERBLOCK        (mydata->sect_size / sizeof(dir_entry))
index 526aedb51556b60efb35960a4a2012af170a8e78..7ead62e7771561402c45e197e8ea53276568d7fb 100644 (file)
@@ -1,111 +1 @@
-#ifndef _FDT_H
-#define _FDT_H
-/*
- * libfdt - Flat Device Tree manipulation
- * Copyright (C) 2006 David Gibson, IBM Corporation.
- * Copyright 2012 Kim Phillips, Freescale Semiconductor.
- *
- * libfdt is dual licensed: you can use it either under the terms of
- * the GPL, or the BSD license, at your option.
- *
- *  a) This library is free software; you can redistribute it and/or
- *     modify it under the terms of the GNU General Public License as
- *     published by the Free Software Foundation; either version 2 of the
- *     License, or (at your option) any later version.
- *
- *     This library is distributed in the hope that it will be useful,
- *     but WITHOUT ANY WARRANTY; without even the implied warranty of
- *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *     GNU General Public License for more details.
- *
- *     You should have received a copy of the GNU General Public
- *     License along with this library; if not, write to the Free
- *     Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
- *     MA 02110-1301 USA
- *
- * Alternatively,
- *
- *  b) 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.
- *
- *     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 OWNER 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.
- */
-
-#ifndef __ASSEMBLY__
-
-struct fdt_header {
-       fdt32_t magic;                   /* magic word FDT_MAGIC */
-       fdt32_t totalsize;               /* total size of DT block */
-       fdt32_t off_dt_struct;           /* offset to structure */
-       fdt32_t off_dt_strings;          /* offset to strings */
-       fdt32_t off_mem_rsvmap;          /* offset to memory reserve map */
-       fdt32_t version;                 /* format version */
-       fdt32_t last_comp_version;       /* last compatible version */
-
-       /* version 2 fields below */
-       fdt32_t boot_cpuid_phys;         /* Which physical CPU id we're
-                                           booting on */
-       /* version 3 fields below */
-       fdt32_t size_dt_strings;         /* size of the strings block */
-
-       /* version 17 fields below */
-       fdt32_t size_dt_struct;          /* size of the structure block */
-};
-
-struct fdt_reserve_entry {
-       fdt64_t address;
-       fdt64_t size;
-};
-
-struct fdt_node_header {
-       fdt32_t tag;
-       char name[0];
-};
-
-struct fdt_property {
-       fdt32_t tag;
-       fdt32_t len;
-       fdt32_t nameoff;
-       char data[0];
-};
-
-#endif /* !__ASSEMBLY */
-
-#define FDT_MAGIC      0xd00dfeed      /* 4: version, 4: total size */
-#define FDT_TAGSIZE    sizeof(fdt32_t)
-
-#define FDT_BEGIN_NODE 0x1             /* Start node: full name */
-#define FDT_END_NODE   0x2             /* End node */
-#define FDT_PROP       0x3             /* Property: name off,
-                                          size, content */
-#define FDT_NOP                0x4             /* nop */
-#define FDT_END                0x9
-
-#define FDT_V1_SIZE    (7*sizeof(fdt32_t))
-#define FDT_V2_SIZE    (FDT_V1_SIZE + sizeof(fdt32_t))
-#define FDT_V3_SIZE    (FDT_V2_SIZE + sizeof(fdt32_t))
-#define FDT_V16_SIZE   FDT_V3_SIZE
-#define FDT_V17_SIZE   (FDT_V16_SIZE + sizeof(fdt32_t))
-
-#endif /* _FDT_H */
+#include <../lib/libfdt/fdt.h>
index ffe6da54b76a996a21f8a5ad00c3bdafc452c196..60088ecf8326196de83f9a3721a9e438f4ba1483 100644 (file)
@@ -61,4 +61,5 @@ u64 mc_get_dram_addr(void);
 unsigned long mc_get_dram_block_size(void);
 int fsl_mc_ldpaa_init(bd_t *bis);
 int fsl_mc_ldpaa_exit(bd_t *bd);
+void mc_env_boot(void);
 #endif
index a86f2162aa884308941eae3d53d8bb36e68b0f85..29aa687507813e950f3f752af6010ccb4b6d2f47 100644 (file)
@@ -11,6 +11,9 @@
 #ifdef CONFIG_FSL_IFC
 #include <config.h>
 #include <common.h>
+#ifdef CONFIG_ARM
+#include <asm/arch/soc.h>
+#endif
 
 #define FSL_IFC_V1_1_0 0x01010000
 #define FSL_IFC_V2_0_0 0x02000000
index e2bc2e00c184e6e163711b18e02aea340dd4b126..10296a21addf36e6466c636ee30d71da7fd407a5 100644 (file)
@@ -1,2137 +1 @@
-#ifndef _LIBFDT_H
-#define _LIBFDT_H
-/*
- * libfdt - Flat Device Tree manipulation
- * Copyright (C) 2006 David Gibson, IBM Corporation.
- *
- * libfdt is dual licensed: you can use it either under the terms of
- * the GPL, or the BSD license, at your option.
- *
- *  a) This library is free software; you can redistribute it and/or
- *     modify it under the terms of the GNU General Public License as
- *     published by the Free Software Foundation; either version 2 of the
- *     License, or (at your option) any later version.
- *
- *     This library is distributed in the hope that it will be useful,
- *     but WITHOUT ANY WARRANTY; without even the implied warranty of
- *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *     GNU General Public License for more details.
- *
- *     You should have received a copy of the GNU General Public
- *     License along with this library; if not, write to the Free
- *     Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
- *     MA 02110-1301 USA
- *
- * Alternatively,
- *
- *  b) 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.
- *
- *     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 OWNER 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.
- */
-
-#include <libfdt_env.h>
-#include <fdt.h>
-
-#define FDT_FIRST_SUPPORTED_VERSION    0x10
-#define FDT_LAST_SUPPORTED_VERSION     0x11
-
-/* Error codes: informative error codes */
-#define FDT_ERR_NOTFOUND       1
-       /* FDT_ERR_NOTFOUND: The requested node or property does not exist */
-#define FDT_ERR_EXISTS         2
-       /* FDT_ERR_EXISTS: Attempted to create a node or property which
-        * already exists */
-#define FDT_ERR_NOSPACE                3
-       /* FDT_ERR_NOSPACE: Operation needed to expand the device
-        * tree, but its buffer did not have sufficient space to
-        * contain the expanded tree. Use fdt_open_into() to move the
-        * device tree to a buffer with more space. */
-
-/* Error codes: codes for bad parameters */
-#define FDT_ERR_BADOFFSET      4
-       /* FDT_ERR_BADOFFSET: Function was passed a structure block
-        * offset which is out-of-bounds, or which points to an
-        * unsuitable part of the structure for the operation. */
-#define FDT_ERR_BADPATH                5
-       /* FDT_ERR_BADPATH: Function was passed a badly formatted path
-        * (e.g. missing a leading / for a function which requires an
-        * absolute path) */
-#define FDT_ERR_BADPHANDLE     6
-       /* FDT_ERR_BADPHANDLE: Function was passed an invalid phandle.
-        * This can be caused either by an invalid phandle property
-        * length, or the phandle value was either 0 or -1, which are
-        * not permitted. */
-#define FDT_ERR_BADSTATE       7
-       /* FDT_ERR_BADSTATE: Function was passed an incomplete device
-        * tree created by the sequential-write functions, which is
-        * not sufficiently complete for the requested operation. */
-
-/* Error codes: codes for bad device tree blobs */
-#define FDT_ERR_TRUNCATED      8
-       /* FDT_ERR_TRUNCATED: Structure block of the given device tree
-        * ends without an FDT_END tag. */
-#define FDT_ERR_BADMAGIC       9
-       /* FDT_ERR_BADMAGIC: Given "device tree" appears not to be a
-        * device tree at all - it is missing the flattened device
-        * tree magic number. */
-#define FDT_ERR_BADVERSION     10
-       /* FDT_ERR_BADVERSION: Given device tree has a version which
-        * can't be handled by the requested operation.  For
-        * read-write functions, this may mean that fdt_open_into() is
-        * required to convert the tree to the expected version. */
-#define FDT_ERR_BADSTRUCTURE   11
-       /* FDT_ERR_BADSTRUCTURE: Given device tree has a corrupt
-        * structure block or other serious error (e.g. misnested
-        * nodes, or subnodes preceding properties). */
-#define FDT_ERR_BADLAYOUT      12
-       /* FDT_ERR_BADLAYOUT: For read-write functions, the given
-        * device tree has it's sub-blocks in an order that the
-        * function can't handle (memory reserve map, then structure,
-        * then strings).  Use fdt_open_into() to reorganize the tree
-        * into a form suitable for the read-write operations. */
-
-/* "Can't happen" error indicating a bug in libfdt */
-#define FDT_ERR_INTERNAL       13
-       /* FDT_ERR_INTERNAL: libfdt has failed an internal assertion.
-        * Should never be returned, if it is, it indicates a bug in
-        * libfdt itself. */
-
-/* Errors in device tree content */
-#define FDT_ERR_BADNCELLS      14
-       /* FDT_ERR_BADNCELLS: Device tree has a #address-cells, #size-cells
-        * or similar property with a bad format or value */
-
-#define FDT_ERR_BADVALUE       15
-       /* FDT_ERR_BADVALUE: Device tree has a property with an unexpected
-        * value. For example: a property expected to contain a string list
-        * is not NUL-terminated within the length of its value. */
-
-#define FDT_ERR_BADOVERLAY     16
-       /* FDT_ERR_BADOVERLAY: The device tree overlay, while
-        * correctly structured, cannot be applied due to some
-        * unexpected or missing value, property or node. */
-
-#define FDT_ERR_NOPHANDLES     17
-       /* FDT_ERR_NOPHANDLES: The device tree doesn't have any
-        * phandle available anymore without causing an overflow */
-
-#define FDT_ERR_TOODEEP        18
-       /* FDT_ERR_TOODEEP: The depth of a node has exceeded the internal
-        * libfdt limit. This can happen if you have more than
-        * FDT_MAX_DEPTH nested nodes. */
-
-#define FDT_ERR_MAX            18
-
-/**********************************************************************/
-/* Low-level functions (you probably don't need these)                */
-/**********************************************************************/
-
-const void *fdt_offset_ptr(const void *fdt, int offset, unsigned int checklen);
-static inline void *fdt_offset_ptr_w(void *fdt, int offset, int checklen)
-{
-       return (void *)(uintptr_t)fdt_offset_ptr(fdt, offset, checklen);
-}
-
-uint32_t fdt_next_tag(const void *fdt, int offset, int *nextoffset);
-
-/**********************************************************************/
-/* Traversal functions                                                */
-/**********************************************************************/
-
-int fdt_next_node(const void *fdt, int offset, int *depth);
-
-/**
- * fdt_first_subnode() - get offset of first direct subnode
- *
- * @fdt:       FDT blob
- * @offset:    Offset of node to check
- * @return offset of first subnode, or -FDT_ERR_NOTFOUND if there is none
- */
-int fdt_first_subnode(const void *fdt, int offset);
-
-/**
- * fdt_next_subnode() - get offset of next direct subnode
- *
- * After first calling fdt_first_subnode(), call this function repeatedly to
- * get direct subnodes of a parent node.
- *
- * @fdt:       FDT blob
- * @offset:    Offset of previous subnode
- * @return offset of next subnode, or -FDT_ERR_NOTFOUND if there are no more
- * subnodes
- */
-int fdt_next_subnode(const void *fdt, int offset);
-
-/**
- * fdt_for_each_subnode - iterate over all subnodes of a parent
- *
- * @node:      child node (int, lvalue)
- * @fdt:       FDT blob (const void *)
- * @parent:    parent node (int)
- *
- * This is actually a wrapper around a for loop and would be used like so:
- *
- *     fdt_for_each_subnode(node, fdt, parent) {
- *             Use node
- *             ...
- *     }
- *
- *     if ((node < 0) && (node != -FDT_ERR_NOT_FOUND)) {
- *             Error handling
- *     }
- *
- * Note that this is implemented as a macro and @node is used as
- * iterator in the loop. The parent variable be constant or even a
- * literal.
- *
- */
-#define fdt_for_each_subnode(node, fdt, parent)                \
-       for (node = fdt_first_subnode(fdt, parent);     \
-            node >= 0;                                 \
-            node = fdt_next_subnode(fdt, node))
-
-/**********************************************************************/
-/* General functions                                                  */
-/**********************************************************************/
-
-#define fdt_get_header(fdt, field) \
-       (fdt32_to_cpu(((const struct fdt_header *)(fdt))->field))
-#define fdt_magic(fdt)                 (fdt_get_header(fdt, magic))
-#define fdt_totalsize(fdt)             (fdt_get_header(fdt, totalsize))
-#define fdt_off_dt_struct(fdt)         (fdt_get_header(fdt, off_dt_struct))
-#define fdt_off_dt_strings(fdt)                (fdt_get_header(fdt, off_dt_strings))
-#define fdt_off_mem_rsvmap(fdt)                (fdt_get_header(fdt, off_mem_rsvmap))
-#define fdt_version(fdt)               (fdt_get_header(fdt, version))
-#define fdt_last_comp_version(fdt)     (fdt_get_header(fdt, last_comp_version))
-#define fdt_boot_cpuid_phys(fdt)       (fdt_get_header(fdt, boot_cpuid_phys))
-#define fdt_size_dt_strings(fdt)       (fdt_get_header(fdt, size_dt_strings))
-#define fdt_size_dt_struct(fdt)                (fdt_get_header(fdt, size_dt_struct))
-
-#define __fdt_set_hdr(name) \
-       static inline void fdt_set_##name(void *fdt, uint32_t val) \
-       { \
-               struct fdt_header *fdth = (struct fdt_header *)fdt; \
-               fdth->name = cpu_to_fdt32(val); \
-       }
-__fdt_set_hdr(magic);
-__fdt_set_hdr(totalsize);
-__fdt_set_hdr(off_dt_struct);
-__fdt_set_hdr(off_dt_strings);
-__fdt_set_hdr(off_mem_rsvmap);
-__fdt_set_hdr(version);
-__fdt_set_hdr(last_comp_version);
-__fdt_set_hdr(boot_cpuid_phys);
-__fdt_set_hdr(size_dt_strings);
-__fdt_set_hdr(size_dt_struct);
-#undef __fdt_set_hdr
-
-/**
- * fdt_check_header - sanity check a device tree or possible device tree
- * @fdt: pointer to data which might be a flattened device tree
- *
- * fdt_check_header() checks that the given buffer contains what
- * appears to be a flattened device tree with sane information in its
- * header.
- *
- * returns:
- *     0, if the buffer appears to contain a valid device tree
- *     -FDT_ERR_BADMAGIC,
- *     -FDT_ERR_BADVERSION,
- *     -FDT_ERR_BADSTATE, standard meanings, as above
- */
-int fdt_check_header(const void *fdt);
-
-/**
- * fdt_move - move a device tree around in memory
- * @fdt: pointer to the device tree to move
- * @buf: pointer to memory where the device is to be moved
- * @bufsize: size of the memory space at buf
- *
- * fdt_move() relocates, if possible, the device tree blob located at
- * fdt to the buffer at buf of size bufsize.  The buffer may overlap
- * with the existing device tree blob at fdt.  Therefore,
- *     fdt_move(fdt, fdt, fdt_totalsize(fdt))
- * should always succeed.
- *
- * returns:
- *     0, on success
- *     -FDT_ERR_NOSPACE, bufsize is insufficient to contain the device tree
- *     -FDT_ERR_BADMAGIC,
- *     -FDT_ERR_BADVERSION,
- *     -FDT_ERR_BADSTATE, standard meanings
- */
-int fdt_move(const void *fdt, void *buf, int bufsize);
-
-/**********************************************************************/
-/* Read-only functions                                                */
-/**********************************************************************/
-
-/**
- * fdt_string - retrieve a string from the strings block of a device tree
- * @fdt: pointer to the device tree blob
- * @stroffset: offset of the string within the strings block (native endian)
- *
- * fdt_string() retrieves a pointer to a single string from the
- * strings block of the device tree blob at fdt.
- *
- * returns:
- *     a pointer to the string, on success
- *     NULL, if stroffset is out of bounds
- */
-const char *fdt_string(const void *fdt, int stroffset);
-
-/**
- * fdt_get_max_phandle - retrieves the highest phandle in a tree
- * @fdt: pointer to the device tree blob
- *
- * fdt_get_max_phandle retrieves the highest phandle in the given
- * device tree. This will ignore badly formatted phandles, or phandles
- * with a value of 0 or -1.
- *
- * returns:
- *      the highest phandle on success
- *      0, if no phandle was found in the device tree
- *      -1, if an error occurred
- */
-uint32_t fdt_get_max_phandle(const void *fdt);
-
-/**
- * fdt_num_mem_rsv - retrieve the number of memory reserve map entries
- * @fdt: pointer to the device tree blob
- *
- * Returns the number of entries in the device tree blob's memory
- * reservation map.  This does not include the terminating 0,0 entry
- * or any other (0,0) entries reserved for expansion.
- *
- * returns:
- *     the number of entries
- */
-int fdt_num_mem_rsv(const void *fdt);
-
-/**
- * fdt_get_mem_rsv - retrieve one memory reserve map entry
- * @fdt: pointer to the device tree blob
- * @address, @size: pointers to 64-bit variables
- *
- * On success, *address and *size will contain the address and size of
- * the n-th reserve map entry from the device tree blob, in
- * native-endian format.
- *
- * returns:
- *     0, on success
- *     -FDT_ERR_BADMAGIC,
- *     -FDT_ERR_BADVERSION,
- *     -FDT_ERR_BADSTATE, standard meanings
- */
-int fdt_get_mem_rsv(const void *fdt, int n, uint64_t *address, uint64_t *size);
-
-/**
- * fdt_subnode_offset_namelen - find a subnode based on substring
- * @fdt: pointer to the device tree blob
- * @parentoffset: structure block offset of a node
- * @name: name of the subnode to locate
- * @namelen: number of characters of name to consider
- *
- * Identical to fdt_subnode_offset(), but only examine the first
- * namelen characters of name for matching the subnode name.  This is
- * useful for finding subnodes based on a portion of a larger string,
- * such as a full path.
- */
-int fdt_subnode_offset_namelen(const void *fdt, int parentoffset,
-                              const char *name, int namelen);
-/**
- * fdt_subnode_offset - find a subnode of a given node
- * @fdt: pointer to the device tree blob
- * @parentoffset: structure block offset of a node
- * @name: name of the subnode to locate
- *
- * fdt_subnode_offset() finds a subnode of the node at structure block
- * offset parentoffset with the given name.  name may include a unit
- * address, in which case fdt_subnode_offset() will find the subnode
- * with that unit address, or the unit address may be omitted, in
- * which case fdt_subnode_offset() will find an arbitrary subnode
- * whose name excluding unit address matches the given name.
- *
- * returns:
- *     structure block offset of the requested subnode (>=0), on success
- *     -FDT_ERR_NOTFOUND, if the requested subnode does not exist
- *     -FDT_ERR_BADOFFSET, if parentoffset did not point to an FDT_BEGIN_NODE
- *             tag
- *     -FDT_ERR_BADMAGIC,
- *     -FDT_ERR_BADVERSION,
- *     -FDT_ERR_BADSTATE,
- *     -FDT_ERR_BADSTRUCTURE,
- *     -FDT_ERR_TRUNCATED, standard meanings.
- */
-int fdt_subnode_offset(const void *fdt, int parentoffset, const char *name);
-
-/**
- * fdt_path_offset_namelen - find a tree node by its full path
- * @fdt: pointer to the device tree blob
- * @path: full path of the node to locate
- * @namelen: number of characters of path to consider
- *
- * Identical to fdt_path_offset(), but only consider the first namelen
- * characters of path as the path name.
- */
-int fdt_path_offset_namelen(const void *fdt, const char *path, int namelen);
-
-/**
- * fdt_path_offset - find a tree node by its full path
- * @fdt: pointer to the device tree blob
- * @path: full path of the node to locate
- *
- * fdt_path_offset() finds a node of a given path in the device tree.
- * Each path component may omit the unit address portion, but the
- * results of this are undefined if any such path component is
- * ambiguous (that is if there are multiple nodes at the relevant
- * level matching the given component, differentiated only by unit
- * address).
- *
- * returns:
- *     structure block offset of the node with the requested path (>=0), on
- *             success
- *     -FDT_ERR_BADPATH, given path does not begin with '/' or is invalid
- *     -FDT_ERR_NOTFOUND, if the requested node does not exist
- *      -FDT_ERR_BADMAGIC,
- *     -FDT_ERR_BADVERSION,
- *     -FDT_ERR_BADSTATE,
- *     -FDT_ERR_BADSTRUCTURE,
- *     -FDT_ERR_TRUNCATED, standard meanings.
- */
-int fdt_path_offset(const void *fdt, const char *path);
-
-/**
- * fdt_get_name - retrieve the name of a given node
- * @fdt: pointer to the device tree blob
- * @nodeoffset: structure block offset of the starting node
- * @lenp: pointer to an integer variable (will be overwritten) or NULL
- *
- * fdt_get_name() retrieves the name (including unit address) of the
- * device tree node at structure block offset nodeoffset.  If lenp is
- * non-NULL, the length of this name is also returned, in the integer
- * pointed to by lenp.
- *
- * returns:
- *     pointer to the node's name, on success
- *             If lenp is non-NULL, *lenp contains the length of that name
- *                     (>=0)
- *     NULL, on error
- *             if lenp is non-NULL *lenp contains an error code (<0):
- *             -FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE
- *                     tag
- *             -FDT_ERR_BADMAGIC,
- *             -FDT_ERR_BADVERSION,
- *             -FDT_ERR_BADSTATE, standard meanings
- */
-const char *fdt_get_name(const void *fdt, int nodeoffset, int *lenp);
-
-/**
- * fdt_first_property_offset - find the offset of a node's first property
- * @fdt: pointer to the device tree blob
- * @nodeoffset: structure block offset of a node
- *
- * fdt_first_property_offset() finds the first property of the node at
- * the given structure block offset.
- *
- * returns:
- *     structure block offset of the property (>=0), on success
- *     -FDT_ERR_NOTFOUND, if the requested node has no properties
- *     -FDT_ERR_BADOFFSET, if nodeoffset did not point to an FDT_BEGIN_NODE tag
- *      -FDT_ERR_BADMAGIC,
- *     -FDT_ERR_BADVERSION,
- *     -FDT_ERR_BADSTATE,
- *     -FDT_ERR_BADSTRUCTURE,
- *     -FDT_ERR_TRUNCATED, standard meanings.
- */
-int fdt_first_property_offset(const void *fdt, int nodeoffset);
-
-/**
- * fdt_next_property_offset - step through a node's properties
- * @fdt: pointer to the device tree blob
- * @offset: structure block offset of a property
- *
- * fdt_next_property_offset() finds the property immediately after the
- * one at the given structure block offset.  This will be a property
- * of the same node as the given property.
- *
- * returns:
- *     structure block offset of the next property (>=0), on success
- *     -FDT_ERR_NOTFOUND, if the given property is the last in its node
- *     -FDT_ERR_BADOFFSET, if nodeoffset did not point to an FDT_PROP tag
- *      -FDT_ERR_BADMAGIC,
- *     -FDT_ERR_BADVERSION,
- *     -FDT_ERR_BADSTATE,
- *     -FDT_ERR_BADSTRUCTURE,
- *     -FDT_ERR_TRUNCATED, standard meanings.
- */
-int fdt_next_property_offset(const void *fdt, int offset);
-
-/**
- * fdt_for_each_property_offset - iterate over all properties of a node
- *
- * @property_offset:   property offset (int, lvalue)
- * @fdt:               FDT blob (const void *)
- * @node:              node offset (int)
- *
- * This is actually a wrapper around a for loop and would be used like so:
- *
- *     fdt_for_each_property_offset(property, fdt, node) {
- *             Use property
- *             ...
- *     }
- *
- *     if ((property < 0) && (property != -FDT_ERR_NOT_FOUND)) {
- *             Error handling
- *     }
- *
- * Note that this is implemented as a macro and property is used as
- * iterator in the loop. The node variable can be constant or even a
- * literal.
- */
-#define fdt_for_each_property_offset(property, fdt, node)      \
-       for (property = fdt_first_property_offset(fdt, node);   \
-            property >= 0;                                     \
-            property = fdt_next_property_offset(fdt, property))
-
-/**
- * fdt_get_property_by_offset - retrieve the property at a given offset
- * @fdt: pointer to the device tree blob
- * @offset: offset of the property to retrieve
- * @lenp: pointer to an integer variable (will be overwritten) or NULL
- *
- * fdt_get_property_by_offset() retrieves a pointer to the
- * fdt_property structure within the device tree blob at the given
- * offset.  If lenp is non-NULL, the length of the property value is
- * also returned, in the integer pointed to by lenp.
- *
- * returns:
- *     pointer to the structure representing the property
- *             if lenp is non-NULL, *lenp contains the length of the property
- *             value (>=0)
- *     NULL, on error
- *             if lenp is non-NULL, *lenp contains an error code (<0):
- *             -FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_PROP tag
- *             -FDT_ERR_BADMAGIC,
- *             -FDT_ERR_BADVERSION,
- *             -FDT_ERR_BADSTATE,
- *             -FDT_ERR_BADSTRUCTURE,
- *             -FDT_ERR_TRUNCATED, standard meanings
- */
-const struct fdt_property *fdt_get_property_by_offset(const void *fdt,
-                                                     int offset,
-                                                     int *lenp);
-
-/**
- * fdt_get_property_namelen - find a property based on substring
- * @fdt: pointer to the device tree blob
- * @nodeoffset: offset of the node whose property to find
- * @name: name of the property to find
- * @namelen: number of characters of name to consider
- * @lenp: pointer to an integer variable (will be overwritten) or NULL
- *
- * Identical to fdt_get_property(), but only examine the first namelen
- * characters of name for matching the property name.
- */
-const struct fdt_property *fdt_get_property_namelen(const void *fdt,
-                                                   int nodeoffset,
-                                                   const char *name,
-                                                   int namelen, int *lenp);
-
-/**
- * fdt_get_property - find a given property in a given node
- * @fdt: pointer to the device tree blob
- * @nodeoffset: offset of the node whose property to find
- * @name: name of the property to find
- * @lenp: pointer to an integer variable (will be overwritten) or NULL
- *
- * fdt_get_property() retrieves a pointer to the fdt_property
- * structure within the device tree blob corresponding to the property
- * named 'name' of the node at offset nodeoffset.  If lenp is
- * non-NULL, the length of the property value is also returned, in the
- * integer pointed to by lenp.
- *
- * returns:
- *     pointer to the structure representing the property
- *             if lenp is non-NULL, *lenp contains the length of the property
- *             value (>=0)
- *     NULL, on error
- *             if lenp is non-NULL, *lenp contains an error code (<0):
- *             -FDT_ERR_NOTFOUND, node does not have named property
- *             -FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE
- *                     tag
- *             -FDT_ERR_BADMAGIC,
- *             -FDT_ERR_BADVERSION,
- *             -FDT_ERR_BADSTATE,
- *             -FDT_ERR_BADSTRUCTURE,
- *             -FDT_ERR_TRUNCATED, standard meanings
- */
-const struct fdt_property *fdt_get_property(const void *fdt, int nodeoffset,
-                                           const char *name, int *lenp);
-static inline struct fdt_property *fdt_get_property_w(void *fdt, int nodeoffset,
-                                                     const char *name,
-                                                     int *lenp)
-{
-       return (struct fdt_property *)(uintptr_t)
-               fdt_get_property(fdt, nodeoffset, name, lenp);
-}
-
-/**
- * fdt_getprop_by_offset - retrieve the value of a property at a given offset
- * @fdt: pointer to the device tree blob
- * @ffset: offset of the property to read
- * @namep: pointer to a string variable (will be overwritten) or NULL
- * @lenp: pointer to an integer variable (will be overwritten) or NULL
- *
- * fdt_getprop_by_offset() retrieves a pointer to the value of the
- * property at structure block offset 'offset' (this will be a pointer
- * to within the device blob itself, not a copy of the value).  If
- * lenp is non-NULL, the length of the property value is also
- * returned, in the integer pointed to by lenp.  If namep is non-NULL,
- * the property's namne will also be returned in the char * pointed to
- * by namep (this will be a pointer to within the device tree's string
- * block, not a new copy of the name).
- *
- * returns:
- *     pointer to the property's value
- *             if lenp is non-NULL, *lenp contains the length of the property
- *             value (>=0)
- *             if namep is non-NULL *namep contiains a pointer to the property
- *             name.
- *     NULL, on error
- *             if lenp is non-NULL, *lenp contains an error code (<0):
- *             -FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_PROP tag
- *             -FDT_ERR_BADMAGIC,
- *             -FDT_ERR_BADVERSION,
- *             -FDT_ERR_BADSTATE,
- *             -FDT_ERR_BADSTRUCTURE,
- *             -FDT_ERR_TRUNCATED, standard meanings
- */
-const void *fdt_getprop_by_offset(const void *fdt, int offset,
-                                 const char **namep, int *lenp);
-
-/**
- * fdt_getprop_namelen - get property value based on substring
- * @fdt: pointer to the device tree blob
- * @nodeoffset: offset of the node whose property to find
- * @name: name of the property to find
- * @namelen: number of characters of name to consider
- * @lenp: pointer to an integer variable (will be overwritten) or NULL
- *
- * Identical to fdt_getprop(), but only examine the first namelen
- * characters of name for matching the property name.
- */
-const void *fdt_getprop_namelen(const void *fdt, int nodeoffset,
-                               const char *name, int namelen, int *lenp);
-static inline void *fdt_getprop_namelen_w(void *fdt, int nodeoffset,
-                                         const char *name, int namelen,
-                                         int *lenp)
-{
-       return (void *)(uintptr_t)fdt_getprop_namelen(fdt, nodeoffset, name,
-                                                     namelen, lenp);
-}
-
-/**
- * fdt_getprop - retrieve the value of a given property
- * @fdt: pointer to the device tree blob
- * @nodeoffset: offset of the node whose property to find
- * @name: name of the property to find
- * @lenp: pointer to an integer variable (will be overwritten) or NULL
- *
- * fdt_getprop() retrieves a pointer to the value of the property
- * named 'name' of the node at offset nodeoffset (this will be a
- * pointer to within the device blob itself, not a copy of the value).
- * If lenp is non-NULL, the length of the property value is also
- * returned, in the integer pointed to by lenp.
- *
- * returns:
- *     pointer to the property's value
- *             if lenp is non-NULL, *lenp contains the length of the property
- *             value (>=0)
- *     NULL, on error
- *             if lenp is non-NULL, *lenp contains an error code (<0):
- *             -FDT_ERR_NOTFOUND, node does not have named property
- *             -FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE
- *                     tag
- *             -FDT_ERR_BADMAGIC,
- *             -FDT_ERR_BADVERSION,
- *             -FDT_ERR_BADSTATE,
- *             -FDT_ERR_BADSTRUCTURE,
- *             -FDT_ERR_TRUNCATED, standard meanings
- */
-const void *fdt_getprop(const void *fdt, int nodeoffset,
-                       const char *name, int *lenp);
-static inline void *fdt_getprop_w(void *fdt, int nodeoffset,
-                                 const char *name, int *lenp)
-{
-       return (void *)(uintptr_t)fdt_getprop(fdt, nodeoffset, name, lenp);
-}
-
-/**
- * fdt_get_phandle - retrieve the phandle of a given node
- * @fdt: pointer to the device tree blob
- * @nodeoffset: structure block offset of the node
- *
- * fdt_get_phandle() retrieves the phandle of the device tree node at
- * structure block offset nodeoffset.
- *
- * returns:
- *     the phandle of the node at nodeoffset, on success (!= 0, != -1)
- *     0, if the node has no phandle, or another error occurs
- */
-uint32_t fdt_get_phandle(const void *fdt, int nodeoffset);
-
-/**
- * fdt_get_alias_namelen - get alias based on substring
- * @fdt: pointer to the device tree blob
- * @name: name of the alias th look up
- * @namelen: number of characters of name to consider
- *
- * Identical to fdt_get_alias(), but only examine the first namelen
- * characters of name for matching the alias name.
- */
-const char *fdt_get_alias_namelen(const void *fdt,
-                                 const char *name, int namelen);
-
-/**
- * fdt_get_alias - retrieve the path referenced by a given alias
- * @fdt: pointer to the device tree blob
- * @name: name of the alias th look up
- *
- * fdt_get_alias() retrieves the value of a given alias.  That is, the
- * value of the property named 'name' in the node /aliases.
- *
- * returns:
- *     a pointer to the expansion of the alias named 'name', if it exists
- *     NULL, if the given alias or the /aliases node does not exist
- */
-const char *fdt_get_alias(const void *fdt, const char *name);
-
-/**
- * fdt_get_path - determine the full path of a node
- * @fdt: pointer to the device tree blob
- * @nodeoffset: offset of the node whose path to find
- * @buf: character buffer to contain the returned path (will be overwritten)
- * @buflen: size of the character buffer at buf
- *
- * fdt_get_path() computes the full path of the node at offset
- * nodeoffset, and records that path in the buffer at buf.
- *
- * NOTE: This function is expensive, as it must scan the device tree
- * structure from the start to nodeoffset.
- *
- * returns:
- *     0, on success
- *             buf contains the absolute path of the node at
- *             nodeoffset, as a NUL-terminated string.
- *     -FDT_ERR_BADOFFSET, nodeoffset does not refer to a BEGIN_NODE tag
- *     -FDT_ERR_NOSPACE, the path of the given node is longer than (bufsize-1)
- *             characters and will not fit in the given buffer.
- *     -FDT_ERR_BADMAGIC,
- *     -FDT_ERR_BADVERSION,
- *     -FDT_ERR_BADSTATE,
- *     -FDT_ERR_BADSTRUCTURE, standard meanings
- */
-int fdt_get_path(const void *fdt, int nodeoffset, char *buf, int buflen);
-
-/**
- * fdt_supernode_atdepth_offset - find a specific ancestor of a node
- * @fdt: pointer to the device tree blob
- * @nodeoffset: offset of the node whose parent to find
- * @supernodedepth: depth of the ancestor to find
- * @nodedepth: pointer to an integer variable (will be overwritten) or NULL
- *
- * fdt_supernode_atdepth_offset() finds an ancestor of the given node
- * at a specific depth from the root (where the root itself has depth
- * 0, its immediate subnodes depth 1 and so forth).  So
- *     fdt_supernode_atdepth_offset(fdt, nodeoffset, 0, NULL);
- * will always return 0, the offset of the root node.  If the node at
- * nodeoffset has depth D, then:
- *     fdt_supernode_atdepth_offset(fdt, nodeoffset, D, NULL);
- * will return nodeoffset itself.
- *
- * NOTE: This function is expensive, as it must scan the device tree
- * structure from the start to nodeoffset.
- *
- * returns:
- *     structure block offset of the node at node offset's ancestor
- *             of depth supernodedepth (>=0), on success
- *     -FDT_ERR_BADOFFSET, nodeoffset does not refer to a BEGIN_NODE tag
- *     -FDT_ERR_NOTFOUND, supernodedepth was greater than the depth of
- *             nodeoffset
- *     -FDT_ERR_BADMAGIC,
- *     -FDT_ERR_BADVERSION,
- *     -FDT_ERR_BADSTATE,
- *     -FDT_ERR_BADSTRUCTURE, standard meanings
- */
-int fdt_supernode_atdepth_offset(const void *fdt, int nodeoffset,
-                                int supernodedepth, int *nodedepth);
-
-/**
- * fdt_node_depth - find the depth of a given node
- * @fdt: pointer to the device tree blob
- * @nodeoffset: offset of the node whose parent to find
- *
- * fdt_node_depth() finds the depth of a given node.  The root node
- * has depth 0, its immediate subnodes depth 1 and so forth.
- *
- * NOTE: This function is expensive, as it must scan the device tree
- * structure from the start to nodeoffset.
- *
- * returns:
- *     depth of the node at nodeoffset (>=0), on success
- *     -FDT_ERR_BADOFFSET, nodeoffset does not refer to a BEGIN_NODE tag
- *     -FDT_ERR_BADMAGIC,
- *     -FDT_ERR_BADVERSION,
- *     -FDT_ERR_BADSTATE,
- *     -FDT_ERR_BADSTRUCTURE, standard meanings
- */
-int fdt_node_depth(const void *fdt, int nodeoffset);
-
-/**
- * fdt_parent_offset - find the parent of a given node
- * @fdt: pointer to the device tree blob
- * @nodeoffset: offset of the node whose parent to find
- *
- * fdt_parent_offset() locates the parent node of a given node (that
- * is, it finds the offset of the node which contains the node at
- * nodeoffset as a subnode).
- *
- * NOTE: This function is expensive, as it must scan the device tree
- * structure from the start to nodeoffset, *twice*.
- *
- * returns:
- *     structure block offset of the parent of the node at nodeoffset
- *             (>=0), on success
- *     -FDT_ERR_BADOFFSET, nodeoffset does not refer to a BEGIN_NODE tag
- *     -FDT_ERR_BADMAGIC,
- *     -FDT_ERR_BADVERSION,
- *     -FDT_ERR_BADSTATE,
- *     -FDT_ERR_BADSTRUCTURE, standard meanings
- */
-int fdt_parent_offset(const void *fdt, int nodeoffset);
-
-/**
- * fdt_node_offset_by_prop_value - find nodes with a given property value
- * @fdt: pointer to the device tree blob
- * @startoffset: only find nodes after this offset
- * @propname: property name to check
- * @propval: property value to search for
- * @proplen: length of the value in propval
- *
- * fdt_node_offset_by_prop_value() returns the offset of the first
- * node after startoffset, which has a property named propname whose
- * value is of length proplen and has value equal to propval; or if
- * startoffset is -1, the very first such node in the tree.
- *
- * To iterate through all nodes matching the criterion, the following
- * idiom can be used:
- *     offset = fdt_node_offset_by_prop_value(fdt, -1, propname,
- *                                            propval, proplen);
- *     while (offset != -FDT_ERR_NOTFOUND) {
- *             // other code here
- *             offset = fdt_node_offset_by_prop_value(fdt, offset, propname,
- *                                                    propval, proplen);
- *     }
- *
- * Note the -1 in the first call to the function, if 0 is used here
- * instead, the function will never locate the root node, even if it
- * matches the criterion.
- *
- * returns:
- *     structure block offset of the located node (>= 0, >startoffset),
- *              on success
- *     -FDT_ERR_NOTFOUND, no node matching the criterion exists in the
- *             tree after startoffset
- *     -FDT_ERR_BADOFFSET, nodeoffset does not refer to a BEGIN_NODE tag
- *     -FDT_ERR_BADMAGIC,
- *     -FDT_ERR_BADVERSION,
- *     -FDT_ERR_BADSTATE,
- *     -FDT_ERR_BADSTRUCTURE, standard meanings
- */
-int fdt_node_offset_by_prop_value(const void *fdt, int startoffset,
-                                 const char *propname,
-                                 const void *propval, int proplen);
-
-/**
- * fdt_node_offset_by_phandle - find the node with a given phandle
- * @fdt: pointer to the device tree blob
- * @phandle: phandle value
- *
- * fdt_node_offset_by_phandle() returns the offset of the node
- * which has the given phandle value.  If there is more than one node
- * in the tree with the given phandle (an invalid tree), results are
- * undefined.
- *
- * returns:
- *     structure block offset of the located node (>= 0), on success
- *     -FDT_ERR_NOTFOUND, no node with that phandle exists
- *     -FDT_ERR_BADPHANDLE, given phandle value was invalid (0 or -1)
- *     -FDT_ERR_BADMAGIC,
- *     -FDT_ERR_BADVERSION,
- *     -FDT_ERR_BADSTATE,
- *     -FDT_ERR_BADSTRUCTURE, standard meanings
- */
-int fdt_node_offset_by_phandle(const void *fdt, uint32_t phandle);
-
-/**
- * fdt_node_check_compatible: check a node's compatible property
- * @fdt: pointer to the device tree blob
- * @nodeoffset: offset of a tree node
- * @compatible: string to match against
- *
- *
- * fdt_node_check_compatible() returns 0 if the given node contains a
- * 'compatible' property with the given string as one of its elements,
- * it returns non-zero otherwise, or on error.
- *
- * returns:
- *     0, if the node has a 'compatible' property listing the given string
- *     1, if the node has a 'compatible' property, but it does not list
- *             the given string
- *     -FDT_ERR_NOTFOUND, if the given node has no 'compatible' property
- *     -FDT_ERR_BADOFFSET, if nodeoffset does not refer to a BEGIN_NODE tag
- *     -FDT_ERR_BADMAGIC,
- *     -FDT_ERR_BADVERSION,
- *     -FDT_ERR_BADSTATE,
- *     -FDT_ERR_BADSTRUCTURE, standard meanings
- */
-int fdt_node_check_compatible(const void *fdt, int nodeoffset,
-                             const char *compatible);
-
-/**
- * fdt_node_offset_by_compatible - find nodes with a given 'compatible' value
- * @fdt: pointer to the device tree blob
- * @startoffset: only find nodes after this offset
- * @compatible: 'compatible' string to match against
- *
- * fdt_node_offset_by_compatible() returns the offset of the first
- * node after startoffset, which has a 'compatible' property which
- * lists the given compatible string; or if startoffset is -1, the
- * very first such node in the tree.
- *
- * To iterate through all nodes matching the criterion, the following
- * idiom can be used:
- *     offset = fdt_node_offset_by_compatible(fdt, -1, compatible);
- *     while (offset != -FDT_ERR_NOTFOUND) {
- *             // other code here
- *             offset = fdt_node_offset_by_compatible(fdt, offset, compatible);
- *     }
- *
- * Note the -1 in the first call to the function, if 0 is used here
- * instead, the function will never locate the root node, even if it
- * matches the criterion.
- *
- * returns:
- *     structure block offset of the located node (>= 0, >startoffset),
- *              on success
- *     -FDT_ERR_NOTFOUND, no node matching the criterion exists in the
- *             tree after startoffset
- *     -FDT_ERR_BADOFFSET, nodeoffset does not refer to a BEGIN_NODE tag
- *     -FDT_ERR_BADMAGIC,
- *     -FDT_ERR_BADVERSION,
- *     -FDT_ERR_BADSTATE,
- *     -FDT_ERR_BADSTRUCTURE, standard meanings
- */
-int fdt_node_offset_by_compatible(const void *fdt, int startoffset,
-                                 const char *compatible);
-
-/**
- * fdt_stringlist_contains - check a string list property for a string
- * @strlist: Property containing a list of strings to check
- * @listlen: Length of property
- * @str: String to search for
- *
- * This is a utility function provided for convenience. The list contains
- * one or more strings, each terminated by \0, as is found in a device tree
- * "compatible" property.
- *
- * @return: 1 if the string is found in the list, 0 not found, or invalid list
- */
-int fdt_stringlist_contains(const char *strlist, int listlen, const char *str);
-
-/**
- * fdt_stringlist_count - count the number of strings in a string list
- * @fdt: pointer to the device tree blob
- * @nodeoffset: offset of a tree node
- * @property: name of the property containing the string list
- * @return:
- *   the number of strings in the given property
- *   -FDT_ERR_BADVALUE if the property value is not NUL-terminated
- *   -FDT_ERR_NOTFOUND if the property does not exist
- */
-int fdt_stringlist_count(const void *fdt, int nodeoffset, const char *property);
-
-/**
- * fdt_stringlist_search - find a string in a string list and return its index
- * @fdt: pointer to the device tree blob
- * @nodeoffset: offset of a tree node
- * @property: name of the property containing the string list
- * @string: string to look up in the string list
- *
- * Note that it is possible for this function to succeed on property values
- * that are not NUL-terminated. That's because the function will stop after
- * finding the first occurrence of @string. This can for example happen with
- * small-valued cell properties, such as #address-cells, when searching for
- * the empty string.
- *
- * @return:
- *   the index of the string in the list of strings
- *   -FDT_ERR_BADVALUE if the property value is not NUL-terminated
- *   -FDT_ERR_NOTFOUND if the property does not exist or does not contain
- *                     the given string
- */
-int fdt_stringlist_search(const void *fdt, int nodeoffset, const char *property,
-                         const char *string);
-
-/**
- * fdt_stringlist_get() - obtain the string at a given index in a string list
- * @fdt: pointer to the device tree blob
- * @nodeoffset: offset of a tree node
- * @property: name of the property containing the string list
- * @index: index of the string to return
- * @lenp: return location for the string length or an error code on failure
- *
- * Note that this will successfully extract strings from properties with
- * non-NUL-terminated values. For example on small-valued cell properties
- * this function will return the empty string.
- *
- * If non-NULL, the length of the string (on success) or a negative error-code
- * (on failure) will be stored in the integer pointer to by lenp.
- *
- * @return:
- *   A pointer to the string at the given index in the string list or NULL on
- *   failure. On success the length of the string will be stored in the memory
- *   location pointed to by the lenp parameter, if non-NULL. On failure one of
- *   the following negative error codes will be returned in the lenp parameter
- *   (if non-NULL):
- *     -FDT_ERR_BADVALUE if the property value is not NUL-terminated
- *     -FDT_ERR_NOTFOUND if the property does not exist
- */
-const char *fdt_stringlist_get(const void *fdt, int nodeoffset,
-                              const char *property, int index,
-                              int *lenp);
-
-/**********************************************************************/
-/* Read-only functions (addressing related)                           */
-/**********************************************************************/
-
-/**
- * FDT_MAX_NCELLS - maximum value for #address-cells and #size-cells
- *
- * This is the maximum value for #address-cells, #size-cells and
- * similar properties that will be processed by libfdt.  IEE1275
- * requires that OF implementations handle values up to 4.
- * Implementations may support larger values, but in practice higher
- * values aren't used.
- */
-#define FDT_MAX_NCELLS         4
-
-/**
- * fdt_address_cells - retrieve address size for a bus represented in the tree
- * @fdt: pointer to the device tree blob
- * @nodeoffset: offset of the node to find the address size for
- *
- * When the node has a valid #address-cells property, returns its value.
- *
- * returns:
- *     0 <= n < FDT_MAX_NCELLS, on success
- *      2, if the node has no #address-cells property
- *      -FDT_ERR_BADNCELLS, if the node has a badly formatted or invalid
- *             #address-cells property
- *     -FDT_ERR_BADMAGIC,
- *     -FDT_ERR_BADVERSION,
- *     -FDT_ERR_BADSTATE,
- *     -FDT_ERR_BADSTRUCTURE,
- *     -FDT_ERR_TRUNCATED, standard meanings
- */
-int fdt_address_cells(const void *fdt, int nodeoffset);
-
-/**
- * fdt_size_cells - retrieve address range size for a bus represented in the
- *                  tree
- * @fdt: pointer to the device tree blob
- * @nodeoffset: offset of the node to find the address range size for
- *
- * When the node has a valid #size-cells property, returns its value.
- *
- * returns:
- *     0 <= n < FDT_MAX_NCELLS, on success
- *      2, if the node has no #address-cells property
- *      -FDT_ERR_BADNCELLS, if the node has a badly formatted or invalid
- *             #size-cells property
- *     -FDT_ERR_BADMAGIC,
- *     -FDT_ERR_BADVERSION,
- *     -FDT_ERR_BADSTATE,
- *     -FDT_ERR_BADSTRUCTURE,
- *     -FDT_ERR_TRUNCATED, standard meanings
- */
-int fdt_size_cells(const void *fdt, int nodeoffset);
-
-
-/**********************************************************************/
-/* Write-in-place functions                                           */
-/**********************************************************************/
-
-/**
- * fdt_setprop_inplace_namelen_partial - change a property's value,
- *                                       but not its size
- * @fdt: pointer to the device tree blob
- * @nodeoffset: offset of the node whose property to change
- * @name: name of the property to change
- * @namelen: number of characters of name to consider
- * @idx: index of the property to change in the array
- * @val: pointer to data to replace the property value with
- * @len: length of the property value
- *
- * Identical to fdt_setprop_inplace(), but modifies the given property
- * starting from the given index, and using only the first characters
- * of the name. It is useful when you want to manipulate only one value of
- * an array and you have a string that doesn't end with \0.
- */
-int fdt_setprop_inplace_namelen_partial(void *fdt, int nodeoffset,
-                                       const char *name, int namelen,
-                                       uint32_t idx, const void *val,
-                                       int len);
-
-/**
- * fdt_setprop_inplace - change a property's value, but not its size
- * @fdt: pointer to the device tree blob
- * @nodeoffset: offset of the node whose property to change
- * @name: name of the property to change
- * @val: pointer to data to replace the property value with
- * @len: length of the property value
- *
- * fdt_setprop_inplace() replaces the value of a given property with
- * the data in val, of length len.  This function cannot change the
- * size of a property, and so will only work if len is equal to the
- * current length of the property.
- *
- * This function will alter only the bytes in the blob which contain
- * the given property value, and will not alter or move any other part
- * of the tree.
- *
- * returns:
- *     0, on success
- *     -FDT_ERR_NOSPACE, if len is not equal to the property's current length
- *     -FDT_ERR_NOTFOUND, node does not have the named property
- *     -FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE tag
- *     -FDT_ERR_BADMAGIC,
- *     -FDT_ERR_BADVERSION,
- *     -FDT_ERR_BADSTATE,
- *     -FDT_ERR_BADSTRUCTURE,
- *     -FDT_ERR_TRUNCATED, standard meanings
- */
-int fdt_setprop_inplace(void *fdt, int nodeoffset, const char *name,
-                       const void *val, int len);
-
-/**
- * fdt_setprop_inplace_u32 - change the value of a 32-bit integer property
- * @fdt: pointer to the device tree blob
- * @nodeoffset: offset of the node whose property to change
- * @name: name of the property to change
- * @val: 32-bit integer value to replace the property with
- *
- * fdt_setprop_inplace_u32() replaces the value of a given property
- * with the 32-bit integer value in val, converting val to big-endian
- * if necessary.  This function cannot change the size of a property,
- * and so will only work if the property already exists and has length
- * 4.
- *
- * This function will alter only the bytes in the blob which contain
- * the given property value, and will not alter or move any other part
- * of the tree.
- *
- * returns:
- *     0, on success
- *     -FDT_ERR_NOSPACE, if the property's length is not equal to 4
- *     -FDT_ERR_NOTFOUND, node does not have the named property
- *     -FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE tag
- *     -FDT_ERR_BADMAGIC,
- *     -FDT_ERR_BADVERSION,
- *     -FDT_ERR_BADSTATE,
- *     -FDT_ERR_BADSTRUCTURE,
- *     -FDT_ERR_TRUNCATED, standard meanings
- */
-static inline int fdt_setprop_inplace_u32(void *fdt, int nodeoffset,
-                                         const char *name, uint32_t val)
-{
-       fdt32_t tmp = cpu_to_fdt32(val);
-       return fdt_setprop_inplace(fdt, nodeoffset, name, &tmp, sizeof(tmp));
-}
-
-/**
- * fdt_setprop_inplace_u64 - change the value of a 64-bit integer property
- * @fdt: pointer to the device tree blob
- * @nodeoffset: offset of the node whose property to change
- * @name: name of the property to change
- * @val: 64-bit integer value to replace the property with
- *
- * fdt_setprop_inplace_u64() replaces the value of a given property
- * with the 64-bit integer value in val, converting val to big-endian
- * if necessary.  This function cannot change the size of a property,
- * and so will only work if the property already exists and has length
- * 8.
- *
- * This function will alter only the bytes in the blob which contain
- * the given property value, and will not alter or move any other part
- * of the tree.
- *
- * returns:
- *     0, on success
- *     -FDT_ERR_NOSPACE, if the property's length is not equal to 8
- *     -FDT_ERR_NOTFOUND, node does not have the named property
- *     -FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE tag
- *     -FDT_ERR_BADMAGIC,
- *     -FDT_ERR_BADVERSION,
- *     -FDT_ERR_BADSTATE,
- *     -FDT_ERR_BADSTRUCTURE,
- *     -FDT_ERR_TRUNCATED, standard meanings
- */
-static inline int fdt_setprop_inplace_u64(void *fdt, int nodeoffset,
-                                         const char *name, uint64_t val)
-{
-       fdt64_t tmp = cpu_to_fdt64(val);
-       return fdt_setprop_inplace(fdt, nodeoffset, name, &tmp, sizeof(tmp));
-}
-
-/**
- * fdt_setprop_inplace_cell - change the value of a single-cell property
- *
- * This is an alternative name for fdt_setprop_inplace_u32()
- */
-static inline int fdt_setprop_inplace_cell(void *fdt, int nodeoffset,
-                                          const char *name, uint32_t val)
-{
-       return fdt_setprop_inplace_u32(fdt, nodeoffset, name, val);
-}
-
-/**
- * fdt_nop_property - replace a property with nop tags
- * @fdt: pointer to the device tree blob
- * @nodeoffset: offset of the node whose property to nop
- * @name: name of the property to nop
- *
- * fdt_nop_property() will replace a given property's representation
- * in the blob with FDT_NOP tags, effectively removing it from the
- * tree.
- *
- * This function will alter only the bytes in the blob which contain
- * the property, and will not alter or move any other part of the
- * tree.
- *
- * returns:
- *     0, on success
- *     -FDT_ERR_NOTFOUND, node does not have the named property
- *     -FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE tag
- *     -FDT_ERR_BADMAGIC,
- *     -FDT_ERR_BADVERSION,
- *     -FDT_ERR_BADSTATE,
- *     -FDT_ERR_BADSTRUCTURE,
- *     -FDT_ERR_TRUNCATED, standard meanings
- */
-int fdt_nop_property(void *fdt, int nodeoffset, const char *name);
-
-/**
- * fdt_nop_node - replace a node (subtree) with nop tags
- * @fdt: pointer to the device tree blob
- * @nodeoffset: offset of the node to nop
- *
- * fdt_nop_node() will replace a given node's representation in the
- * blob, including all its subnodes, if any, with FDT_NOP tags,
- * effectively removing it from the tree.
- *
- * This function will alter only the bytes in the blob which contain
- * the node and its properties and subnodes, and will not alter or
- * move any other part of the tree.
- *
- * returns:
- *     0, on success
- *     -FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE tag
- *     -FDT_ERR_BADMAGIC,
- *     -FDT_ERR_BADVERSION,
- *     -FDT_ERR_BADSTATE,
- *     -FDT_ERR_BADSTRUCTURE,
- *     -FDT_ERR_TRUNCATED, standard meanings
- */
-int fdt_nop_node(void *fdt, int nodeoffset);
-
-/**********************************************************************/
-/* Sequential write functions                                         */
-/**********************************************************************/
-
-int fdt_create(void *buf, int bufsize);
-int fdt_resize(void *fdt, void *buf, int bufsize);
-int fdt_add_reservemap_entry(void *fdt, uint64_t addr, uint64_t size);
-int fdt_finish_reservemap(void *fdt);
-int fdt_begin_node(void *fdt, const char *name);
-int fdt_property(void *fdt, const char *name, const void *val, int len);
-static inline int fdt_property_u32(void *fdt, const char *name, uint32_t val)
-{
-       fdt32_t tmp = cpu_to_fdt32(val);
-       return fdt_property(fdt, name, &tmp, sizeof(tmp));
-}
-static inline int fdt_property_u64(void *fdt, const char *name, uint64_t val)
-{
-       fdt64_t tmp = cpu_to_fdt64(val);
-       return fdt_property(fdt, name, &tmp, sizeof(tmp));
-}
-static inline int fdt_property_cell(void *fdt, const char *name, uint32_t val)
-{
-       return fdt_property_u32(fdt, name, val);
-}
-
-/**
- * fdt_property_placeholder - add a new property and return a ptr to its value
- *
- * @fdt: pointer to the device tree blob
- * @name: name of property to add
- * @len: length of property value in bytes
- * @valp: returns a pointer to where where the value should be placed
- *
- * returns:
- *     0, on success
- *     -FDT_ERR_BADMAGIC,
- *     -FDT_ERR_NOSPACE, standard meanings
- */
-int fdt_property_placeholder(void *fdt, const char *name, int len, void **valp);
-
-#define fdt_property_string(fdt, name, str) \
-       fdt_property(fdt, name, str, strlen(str)+1)
-int fdt_end_node(void *fdt);
-int fdt_finish(void *fdt);
-
-/**********************************************************************/
-/* Read-write functions                                               */
-/**********************************************************************/
-
-int fdt_create_empty_tree(void *buf, int bufsize);
-int fdt_open_into(const void *fdt, void *buf, int bufsize);
-int fdt_pack(void *fdt);
-
-/**
- * fdt_add_mem_rsv - add one memory reserve map entry
- * @fdt: pointer to the device tree blob
- * @address, @size: 64-bit values (native endian)
- *
- * Adds a reserve map entry to the given blob reserving a region at
- * address address of length size.
- *
- * This function will insert data into the reserve map and will
- * therefore change the indexes of some entries in the table.
- *
- * returns:
- *     0, on success
- *     -FDT_ERR_NOSPACE, there is insufficient free space in the blob to
- *             contain the new reservation entry
- *     -FDT_ERR_BADMAGIC,
- *     -FDT_ERR_BADVERSION,
- *     -FDT_ERR_BADSTATE,
- *     -FDT_ERR_BADSTRUCTURE,
- *     -FDT_ERR_BADLAYOUT,
- *     -FDT_ERR_TRUNCATED, standard meanings
- */
-int fdt_add_mem_rsv(void *fdt, uint64_t address, uint64_t size);
-
-/**
- * fdt_del_mem_rsv - remove a memory reserve map entry
- * @fdt: pointer to the device tree blob
- * @n: entry to remove
- *
- * fdt_del_mem_rsv() removes the n-th memory reserve map entry from
- * the blob.
- *
- * This function will delete data from the reservation table and will
- * therefore change the indexes of some entries in the table.
- *
- * returns:
- *     0, on success
- *     -FDT_ERR_NOTFOUND, there is no entry of the given index (i.e. there
- *             are less than n+1 reserve map entries)
- *     -FDT_ERR_BADMAGIC,
- *     -FDT_ERR_BADVERSION,
- *     -FDT_ERR_BADSTATE,
- *     -FDT_ERR_BADSTRUCTURE,
- *     -FDT_ERR_BADLAYOUT,
- *     -FDT_ERR_TRUNCATED, standard meanings
- */
-int fdt_del_mem_rsv(void *fdt, int n);
-
-/**
- * fdt_set_name - change the name of a given node
- * @fdt: pointer to the device tree blob
- * @nodeoffset: structure block offset of a node
- * @name: name to give the node
- *
- * fdt_set_name() replaces the name (including unit address, if any)
- * of the given node with the given string.  NOTE: this function can't
- * efficiently check if the new name is unique amongst the given
- * node's siblings; results are undefined if this function is invoked
- * with a name equal to one of the given node's siblings.
- *
- * This function may insert or delete data from the blob, and will
- * therefore change the offsets of some existing nodes.
- *
- * returns:
- *     0, on success
- *     -FDT_ERR_NOSPACE, there is insufficient free space in the blob
- *             to contain the new name
- *     -FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE tag
- *     -FDT_ERR_BADMAGIC,
- *     -FDT_ERR_BADVERSION,
- *     -FDT_ERR_BADSTATE, standard meanings
- */
-int fdt_set_name(void *fdt, int nodeoffset, const char *name);
-
-/**
- * fdt_setprop - create or change a property
- * @fdt: pointer to the device tree blob
- * @nodeoffset: offset of the node whose property to change
- * @name: name of the property to change
- * @val: pointer to data to set the property value to
- * @len: length of the property value
- *
- * fdt_setprop() sets the value of the named property in the given
- * node to the given value and length, creating the property if it
- * does not already exist.
- *
- * This function may insert or delete data from the blob, and will
- * therefore change the offsets of some existing nodes.
- *
- * returns:
- *     0, on success
- *     -FDT_ERR_NOSPACE, there is insufficient free space in the blob to
- *             contain the new property value
- *     -FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE tag
- *     -FDT_ERR_BADLAYOUT,
- *     -FDT_ERR_BADMAGIC,
- *     -FDT_ERR_BADVERSION,
- *     -FDT_ERR_BADSTATE,
- *     -FDT_ERR_BADSTRUCTURE,
- *     -FDT_ERR_BADLAYOUT,
- *     -FDT_ERR_TRUNCATED, standard meanings
- */
-int fdt_setprop(void *fdt, int nodeoffset, const char *name,
-               const void *val, int len);
-
-/**
- * fdt_setprop_u32 - set a property to a 32-bit integer
- * @fdt: pointer to the device tree blob
- * @nodeoffset: offset of the node whose property to change
- * @name: name of the property to change
- * @val: 32-bit integer value for the property (native endian)
- *
- * fdt_setprop_u32() sets the value of the named property in the given
- * node to the given 32-bit integer value (converting to big-endian if
- * necessary), or creates a new property with that value if it does
- * not already exist.
- *
- * This function may insert or delete data from the blob, and will
- * therefore change the offsets of some existing nodes.
- *
- * returns:
- *     0, on success
- *     -FDT_ERR_NOSPACE, there is insufficient free space in the blob to
- *             contain the new property value
- *     -FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE tag
- *     -FDT_ERR_BADLAYOUT,
- *     -FDT_ERR_BADMAGIC,
- *     -FDT_ERR_BADVERSION,
- *     -FDT_ERR_BADSTATE,
- *     -FDT_ERR_BADSTRUCTURE,
- *     -FDT_ERR_BADLAYOUT,
- *     -FDT_ERR_TRUNCATED, standard meanings
- */
-static inline int fdt_setprop_u32(void *fdt, int nodeoffset, const char *name,
-                                 uint32_t val)
-{
-       fdt32_t tmp = cpu_to_fdt32(val);
-       return fdt_setprop(fdt, nodeoffset, name, &tmp, sizeof(tmp));
-}
-
-/**
- * fdt_setprop_u64 - set a property to a 64-bit integer
- * @fdt: pointer to the device tree blob
- * @nodeoffset: offset of the node whose property to change
- * @name: name of the property to change
- * @val: 64-bit integer value for the property (native endian)
- *
- * fdt_setprop_u64() sets the value of the named property in the given
- * node to the given 64-bit integer value (converting to big-endian if
- * necessary), or creates a new property with that value if it does
- * not already exist.
- *
- * This function may insert or delete data from the blob, and will
- * therefore change the offsets of some existing nodes.
- *
- * returns:
- *     0, on success
- *     -FDT_ERR_NOSPACE, there is insufficient free space in the blob to
- *             contain the new property value
- *     -FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE tag
- *     -FDT_ERR_BADLAYOUT,
- *     -FDT_ERR_BADMAGIC,
- *     -FDT_ERR_BADVERSION,
- *     -FDT_ERR_BADSTATE,
- *     -FDT_ERR_BADSTRUCTURE,
- *     -FDT_ERR_BADLAYOUT,
- *     -FDT_ERR_TRUNCATED, standard meanings
- */
-static inline int fdt_setprop_u64(void *fdt, int nodeoffset, const char *name,
-                                 uint64_t val)
-{
-       fdt64_t tmp = cpu_to_fdt64(val);
-       return fdt_setprop(fdt, nodeoffset, name, &tmp, sizeof(tmp));
-}
-
-/**
- * fdt_setprop_cell - set a property to a single cell value
- *
- * This is an alternative name for fdt_setprop_u32()
- */
-static inline int fdt_setprop_cell(void *fdt, int nodeoffset, const char *name,
-                                  uint32_t val)
-{
-       return fdt_setprop_u32(fdt, nodeoffset, name, val);
-}
-
-/**
- * fdt_setprop_string - set a property to a string value
- * @fdt: pointer to the device tree blob
- * @nodeoffset: offset of the node whose property to change
- * @name: name of the property to change
- * @str: string value for the property
- *
- * fdt_setprop_string() sets the value of the named property in the
- * given node to the given string value (using the length of the
- * string to determine the new length of the property), or creates a
- * new property with that value if it does not already exist.
- *
- * This function may insert or delete data from the blob, and will
- * therefore change the offsets of some existing nodes.
- *
- * returns:
- *     0, on success
- *     -FDT_ERR_NOSPACE, there is insufficient free space in the blob to
- *             contain the new property value
- *     -FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE tag
- *     -FDT_ERR_BADLAYOUT,
- *     -FDT_ERR_BADMAGIC,
- *     -FDT_ERR_BADVERSION,
- *     -FDT_ERR_BADSTATE,
- *     -FDT_ERR_BADSTRUCTURE,
- *     -FDT_ERR_BADLAYOUT,
- *     -FDT_ERR_TRUNCATED, standard meanings
- */
-#define fdt_setprop_string(fdt, nodeoffset, name, str) \
-       fdt_setprop((fdt), (nodeoffset), (name), (str), strlen(str)+1)
-
-/**
- * fdt_appendprop - append to or create a property
- * @fdt: pointer to the device tree blob
- * @nodeoffset: offset of the node whose property to change
- * @name: name of the property to append to
- * @val: pointer to data to append to the property value
- * @len: length of the data to append to the property value
- *
- * fdt_appendprop() appends the value to the named property in the
- * given node, creating the property if it does not already exist.
- *
- * This function may insert data into the blob, and will therefore
- * change the offsets of some existing nodes.
- *
- * returns:
- *     0, on success
- *     -FDT_ERR_NOSPACE, there is insufficient free space in the blob to
- *             contain the new property value
- *     -FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE tag
- *     -FDT_ERR_BADLAYOUT,
- *     -FDT_ERR_BADMAGIC,
- *     -FDT_ERR_BADVERSION,
- *     -FDT_ERR_BADSTATE,
- *     -FDT_ERR_BADSTRUCTURE,
- *     -FDT_ERR_BADLAYOUT,
- *     -FDT_ERR_TRUNCATED, standard meanings
- */
-int fdt_appendprop(void *fdt, int nodeoffset, const char *name,
-                  const void *val, int len);
-
-/**
- * fdt_appendprop_u32 - append a 32-bit integer value to a property
- * @fdt: pointer to the device tree blob
- * @nodeoffset: offset of the node whose property to change
- * @name: name of the property to change
- * @val: 32-bit integer value to append to the property (native endian)
- *
- * fdt_appendprop_u32() appends the given 32-bit integer value
- * (converting to big-endian if necessary) to the value of the named
- * property in the given node, or creates a new property with that
- * value if it does not already exist.
- *
- * This function may insert data into the blob, and will therefore
- * change the offsets of some existing nodes.
- *
- * returns:
- *     0, on success
- *     -FDT_ERR_NOSPACE, there is insufficient free space in the blob to
- *             contain the new property value
- *     -FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE tag
- *     -FDT_ERR_BADLAYOUT,
- *     -FDT_ERR_BADMAGIC,
- *     -FDT_ERR_BADVERSION,
- *     -FDT_ERR_BADSTATE,
- *     -FDT_ERR_BADSTRUCTURE,
- *     -FDT_ERR_BADLAYOUT,
- *     -FDT_ERR_TRUNCATED, standard meanings
- */
-static inline int fdt_appendprop_u32(void *fdt, int nodeoffset,
-                                    const char *name, uint32_t val)
-{
-       fdt32_t tmp = cpu_to_fdt32(val);
-       return fdt_appendprop(fdt, nodeoffset, name, &tmp, sizeof(tmp));
-}
-
-/**
- * fdt_appendprop_u64 - append a 64-bit integer value to a property
- * @fdt: pointer to the device tree blob
- * @nodeoffset: offset of the node whose property to change
- * @name: name of the property to change
- * @val: 64-bit integer value to append to the property (native endian)
- *
- * fdt_appendprop_u64() appends the given 64-bit integer value
- * (converting to big-endian if necessary) to the value of the named
- * property in the given node, or creates a new property with that
- * value if it does not already exist.
- *
- * This function may insert data into the blob, and will therefore
- * change the offsets of some existing nodes.
- *
- * returns:
- *     0, on success
- *     -FDT_ERR_NOSPACE, there is insufficient free space in the blob to
- *             contain the new property value
- *     -FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE tag
- *     -FDT_ERR_BADLAYOUT,
- *     -FDT_ERR_BADMAGIC,
- *     -FDT_ERR_BADVERSION,
- *     -FDT_ERR_BADSTATE,
- *     -FDT_ERR_BADSTRUCTURE,
- *     -FDT_ERR_BADLAYOUT,
- *     -FDT_ERR_TRUNCATED, standard meanings
- */
-static inline int fdt_appendprop_u64(void *fdt, int nodeoffset,
-                                    const char *name, uint64_t val)
-{
-       fdt64_t tmp = cpu_to_fdt64(val);
-       return fdt_appendprop(fdt, nodeoffset, name, &tmp, sizeof(tmp));
-}
-
-/**
- * fdt_appendprop_cell - append a single cell value to a property
- *
- * This is an alternative name for fdt_appendprop_u32()
- */
-static inline int fdt_appendprop_cell(void *fdt, int nodeoffset,
-                                     const char *name, uint32_t val)
-{
-       return fdt_appendprop_u32(fdt, nodeoffset, name, val);
-}
-
-/**
- * fdt_appendprop_string - append a string to a property
- * @fdt: pointer to the device tree blob
- * @nodeoffset: offset of the node whose property to change
- * @name: name of the property to change
- * @str: string value to append to the property
- *
- * fdt_appendprop_string() appends the given string to the value of
- * the named property in the given node, or creates a new property
- * with that value if it does not already exist.
- *
- * This function may insert data into the blob, and will therefore
- * change the offsets of some existing nodes.
- *
- * returns:
- *     0, on success
- *     -FDT_ERR_NOSPACE, there is insufficient free space in the blob to
- *             contain the new property value
- *     -FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE tag
- *     -FDT_ERR_BADLAYOUT,
- *     -FDT_ERR_BADMAGIC,
- *     -FDT_ERR_BADVERSION,
- *     -FDT_ERR_BADSTATE,
- *     -FDT_ERR_BADSTRUCTURE,
- *     -FDT_ERR_BADLAYOUT,
- *     -FDT_ERR_TRUNCATED, standard meanings
- */
-#define fdt_appendprop_string(fdt, nodeoffset, name, str) \
-       fdt_appendprop((fdt), (nodeoffset), (name), (str), strlen(str)+1)
-
-/**
- * fdt_delprop - delete a property
- * @fdt: pointer to the device tree blob
- * @nodeoffset: offset of the node whose property to nop
- * @name: name of the property to nop
- *
- * fdt_del_property() will delete the given property.
- *
- * This function will delete data from the blob, and will therefore
- * change the offsets of some existing nodes.
- *
- * returns:
- *     0, on success
- *     -FDT_ERR_NOTFOUND, node does not have the named property
- *     -FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE tag
- *     -FDT_ERR_BADLAYOUT,
- *     -FDT_ERR_BADMAGIC,
- *     -FDT_ERR_BADVERSION,
- *     -FDT_ERR_BADSTATE,
- *     -FDT_ERR_BADSTRUCTURE,
- *     -FDT_ERR_TRUNCATED, standard meanings
- */
-int fdt_delprop(void *fdt, int nodeoffset, const char *name);
-
-/**
- * fdt_add_subnode_namelen - creates a new node based on substring
- * @fdt: pointer to the device tree blob
- * @parentoffset: structure block offset of a node
- * @name: name of the subnode to locate
- * @namelen: number of characters of name to consider
- *
- * Identical to fdt_add_subnode(), but use only the first namelen
- * characters of name as the name of the new node.  This is useful for
- * creating subnodes based on a portion of a larger string, such as a
- * full path.
- */
-int fdt_add_subnode_namelen(void *fdt, int parentoffset,
-                           const char *name, int namelen);
-
-/**
- * fdt_add_subnode - creates a new node
- * @fdt: pointer to the device tree blob
- * @parentoffset: structure block offset of a node
- * @name: name of the subnode to locate
- *
- * fdt_add_subnode() creates a new node as a subnode of the node at
- * structure block offset parentoffset, with the given name (which
- * should include the unit address, if any).
- *
- * This function will insert data into the blob, and will therefore
- * change the offsets of some existing nodes.
-
- * returns:
- *     structure block offset of the created nodeequested subnode (>=0), on
- *             success
- *     -FDT_ERR_NOTFOUND, if the requested subnode does not exist
- *     -FDT_ERR_BADOFFSET, if parentoffset did not point to an FDT_BEGIN_NODE
- *             tag
- *     -FDT_ERR_EXISTS, if the node at parentoffset already has a subnode of
- *             the given name
- *     -FDT_ERR_NOSPACE, if there is insufficient free space in the
- *             blob to contain the new node
- *     -FDT_ERR_NOSPACE
- *     -FDT_ERR_BADLAYOUT
- *      -FDT_ERR_BADMAGIC,
- *     -FDT_ERR_BADVERSION,
- *     -FDT_ERR_BADSTATE,
- *     -FDT_ERR_BADSTRUCTURE,
- *     -FDT_ERR_TRUNCATED, standard meanings.
- */
-int fdt_add_subnode(void *fdt, int parentoffset, const char *name);
-
-/**
- * fdt_del_node - delete a node (subtree)
- * @fdt: pointer to the device tree blob
- * @nodeoffset: offset of the node to nop
- *
- * fdt_del_node() will remove the given node, including all its
- * subnodes if any, from the blob.
- *
- * This function will delete data from the blob, and will therefore
- * change the offsets of some existing nodes.
- *
- * returns:
- *     0, on success
- *     -FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE tag
- *     -FDT_ERR_BADLAYOUT,
- *     -FDT_ERR_BADMAGIC,
- *     -FDT_ERR_BADVERSION,
- *     -FDT_ERR_BADSTATE,
- *     -FDT_ERR_BADSTRUCTURE,
- *     -FDT_ERR_TRUNCATED, standard meanings
- */
-int fdt_del_node(void *fdt, int nodeoffset);
-
-/**
- * fdt_overlay_apply - Applies a DT overlay on a base DT
- * @fdt: pointer to the base device tree blob
- * @fdto: pointer to the device tree overlay blob
- *
- * fdt_overlay_apply() will apply the given device tree overlay on the
- * given base device tree.
- *
- * Expect the base device tree to be modified, even if the function
- * returns an error.
- *
- * returns:
- *     0, on success
- *     -FDT_ERR_NOSPACE, there's not enough space in the base device tree
- *     -FDT_ERR_NOTFOUND, the overlay points to some inexistant nodes or
- *             properties in the base DT
- *     -FDT_ERR_BADPHANDLE,
- *     -FDT_ERR_BADOVERLAY,
- *     -FDT_ERR_NOPHANDLES,
- *     -FDT_ERR_INTERNAL,
- *     -FDT_ERR_BADLAYOUT,
- *     -FDT_ERR_BADMAGIC,
- *     -FDT_ERR_BADOFFSET,
- *     -FDT_ERR_BADPATH,
- *     -FDT_ERR_BADVERSION,
- *     -FDT_ERR_BADSTRUCTURE,
- *     -FDT_ERR_BADSTATE,
- *     -FDT_ERR_TRUNCATED, standard meanings
- */
-int fdt_overlay_apply(void *fdt, void *fdto);
-
-/**********************************************************************/
-/* Debugging / informational functions                                */
-/**********************************************************************/
-
-const char *fdt_strerror(int errval);
-
-/**
- * fdt_remove_unused_strings() - Remove any unused strings from an FDT
- *
- * This creates a new device tree in @new with unused strings removed. The
- * called can then use fdt_pack() to minimise the space consumed.
- *
- * @old:       Old device tree blog
- * @new:       Place to put new device tree blob, which must be as large as
- *             @old
- * @return
- *     0, on success
- *     -FDT_ERR_BADOFFSET, corrupt device tree
- *     -FDT_ERR_NOSPACE, out of space, which should not happen unless there
- *             is something very wrong with the device tree input
- */
-int fdt_remove_unused_strings(const void *old, void *new);
-
-struct fdt_region {
-       int offset;
-       int size;
-};
-
-/*
- * Flags for fdt_find_regions()
- *
- * Add a region for the string table (always the last region)
- */
-#define FDT_REG_ADD_STRING_TAB         (1 << 0)
-
-/*
- * Add all supernodes of a matching node/property, useful for creating a
- * valid subset tree
- */
-#define FDT_REG_SUPERNODES             (1 << 1)
-
-/* Add the FDT_BEGIN_NODE tags of subnodes, including their names */
-#define FDT_REG_DIRECT_SUBNODES        (1 << 2)
-
-/* Add all subnodes of a matching node */
-#define FDT_REG_ALL_SUBNODES           (1 << 3)
-
-/* Add a region for the mem_rsvmap table (always the first region) */
-#define FDT_REG_ADD_MEM_RSVMAP         (1 << 4)
-
-/* Indicates what an fdt part is (node, property, value) */
-#define FDT_IS_NODE                    (1 << 0)
-#define FDT_IS_PROP                    (1 << 1)
-#define FDT_IS_VALUE                   (1 << 2)        /* not supported */
-#define FDT_IS_COMPAT                  (1 << 3)        /* used internally */
-#define FDT_NODE_HAS_PROP              (1 << 4)        /* node contains prop */
-
-#define FDT_ANY_GLOBAL         (FDT_IS_NODE | FDT_IS_PROP | FDT_IS_VALUE | \
-                                       FDT_IS_COMPAT)
-#define FDT_IS_ANY                     0x1f            /* all the above */
-
-/* We set a reasonable limit on the number of nested nodes */
-#define FDT_MAX_DEPTH                  32
-
-/* Decribes what we want to include from the current tag */
-enum want_t {
-       WANT_NOTHING,
-       WANT_NODES_ONLY,                /* No properties */
-       WANT_NODES_AND_PROPS,           /* Everything for one level */
-       WANT_ALL_NODES_AND_PROPS        /* Everything for all levels */
-};
-
-/* Keeps track of the state at parent nodes */
-struct fdt_subnode_stack {
-       int offset;             /* Offset of node */
-       enum want_t want;       /* The 'want' value here */
-       int included;           /* 1 if we included this node, 0 if not */
-};
-
-struct fdt_region_ptrs {
-       int depth;                      /* Current tree depth */
-       int done;                       /* What we have completed scanning */
-       enum want_t want;               /* What we are currently including */
-       char *end;                      /* Pointer to end of full node path */
-       int nextoffset;                 /* Next node offset to check */
-};
-
-/* The state of our finding algortihm */
-struct fdt_region_state {
-       struct fdt_subnode_stack stack[FDT_MAX_DEPTH];  /* node stack */
-       struct fdt_region *region;      /* Contains list of regions found */
-       int count;                      /* Numnber of regions found */
-       const void *fdt;                /* FDT blob */
-       int max_regions;                /* Maximum regions to find */
-       int can_merge;          /* 1 if we can merge with previous region */
-       int start;                      /* Start position of current region */
-       struct fdt_region_ptrs ptrs;    /* Pointers for what we are up to */
-};
-
-/**
- * fdt_find_regions() - find regions in device tree
- *
- * Given a list of nodes to include and properties to exclude, find
- * the regions of the device tree which describe those included parts.
- *
- * The intent is to get a list of regions which will be invariant provided
- * those parts are invariant. For example, if you request a list of regions
- * for all nodes but exclude the property "data", then you will get the
- * same region contents regardless of any change to "data" properties.
- *
- * This function can be used to produce a byte-stream to send to a hashing
- * function to verify that critical parts of the FDT have not changed.
- *
- * Nodes which are given in 'inc' are included in the region list, as
- * are the names of the immediate subnodes nodes (but not the properties
- * or subnodes of those subnodes).
- *
- * For eaxample "/" means to include the root node, all root properties
- * and the FDT_BEGIN_NODE and FDT_END_NODE of all subnodes of /. The latter
- * ensures that we capture the names of the subnodes. In a hashing situation
- * it prevents the root node from changing at all Any change to non-excluded
- * properties, names of subnodes or number of subnodes would be detected.
- *
- * When used with FITs this provides the ability to hash and sign parts of
- * the FIT based on different configurations in the FIT. Then it is
- * impossible to change anything about that configuration (include images
- * attached to the configuration), but it may be possible to add new
- * configurations, new images or new signatures within the existing
- * framework.
- *
- * Adding new properties to a device tree may result in the string table
- * being extended (if the new property names are different from those
- * already added). This function can optionally include a region for
- * the string table so that this can be part of the hash too.
- *
- * The device tree header is not included in the list.
- *
- * @fdt:       Device tree to check
- * @inc:       List of node paths to included
- * @inc_count: Number of node paths in list
- * @exc_prop:  List of properties names to exclude
- * @exc_prop_count:    Number of properties in exclude list
- * @region:    Returns list of regions
- * @max_region:        Maximum length of region list
- * @path:      Pointer to a temporary string for the function to use for
- *             building path names
- * @path_len:  Length of path, must be large enough to hold the longest
- *             path in the tree
- * @add_string_tab:    1 to add a region for the string table
- * @return number of regions in list. If this is >max_regions then the
- * region array was exhausted. You should increase max_regions and try
- * the call again.
- */
-int fdt_find_regions(const void *fdt, char * const inc[], int inc_count,
-                    char * const exc_prop[], int exc_prop_count,
-                    struct fdt_region region[], int max_regions,
-                    char *path, int path_len, int add_string_tab);
-
-/**
- * fdt_first_region() - find regions in device tree
- *
- * Given a nodes and properties to include and properties to exclude, find
- * the regions of the device tree which describe those included parts.
- *
- * The use for this function is twofold. Firstly it provides a convenient
- * way of performing a structure-aware grep of the tree. For example it is
- * possible to grep for a node and get all the properties associated with
- * that node. Trees can be subsetted easily, by specifying the nodes that
- * are required, and then writing out the regions returned by this function.
- * This is useful for small resource-constrained systems, such as boot
- * loaders, which want to use an FDT but do not need to know about all of
- * it.
- *
- * Secondly it makes it easy to hash parts of the tree and detect changes.
- * The intent is to get a list of regions which will be invariant provided
- * those parts are invariant. For example, if you request a list of regions
- * for all nodes but exclude the property "data", then you will get the
- * same region contents regardless of any change to "data" properties.
- *
- * This function can be used to produce a byte-stream to send to a hashing
- * function to verify that critical parts of the FDT have not changed.
- * Note that semantically null changes in order could still cause false
- * hash misses. Such reordering might happen if the tree is regenerated
- * from source, and nodes are reordered (the bytes-stream will be emitted
- * in a different order and mnay hash functions will detect this). However
- * if an existing tree is modified using libfdt functions, such as
- * fdt_add_subnode() and fdt_setprop(), then this problem is avoided.
- *
- * The nodes/properties to include/exclude are defined by a function
- * provided by the caller. This function is called for each node and
- * property, and must return:
- *
- *    0 - to exclude this part
- *    1 - to include this part
- *   -1 - for FDT_IS_PROP only: no information is available, so include
- *             if its containing node is included
- *
- * The last case is only used to deal with properties. Often a property is
- * included if its containing node is included - this is the case where
- * -1 is returned.. However if the property is specifically required to be
- * included/excluded, then 0 or 1 can be returned. Note that including a
- * property when the FDT_REG_SUPERNODES flag is given will force its
- * containing node to be included since it is not valid to have a property
- * that is not in a node.
- *
- * Using the information provided, the inclusion of a node can be controlled
- * either by a node name or its compatible string, or any other property
- * that the function can determine.
- *
- * As an example, including node "/" means to include the root node and all
- * root properties. A flag provides a way of also including supernodes (of
- * which there is none for the root node), and another flag includes
- * immediate subnodes, so in this case we would get the FDT_BEGIN_NODE and
- * FDT_END_NODE of all subnodes of /.
- *
- * The subnode feature helps in a hashing situation since it prevents the
- * root node from changing at all. Any change to non-excluded properties,
- * names of subnodes or number of subnodes would be detected.
- *
- * When used with FITs this provides the ability to hash and sign parts of
- * the FIT based on different configurations in the FIT. Then it is
- * impossible to change anything about that configuration (include images
- * attached to the configuration), but it may be possible to add new
- * configurations, new images or new signatures within the existing
- * framework.
- *
- * Adding new properties to a device tree may result in the string table
- * being extended (if the new property names are different from those
- * already added). This function can optionally include a region for
- * the string table so that this can be part of the hash too. This is always
- * the last region.
- *
- * The FDT also has a mem_rsvmap table which can also be included, and is
- * always the first region if so.
- *
- * The device tree header is not included in the region list. Since the
- * contents of the FDT are changing (shrinking, often), the caller will need
- * to regenerate the header anyway.
- *
- * @fdt:       Device tree to check
- * @h_include: Function to call to determine whether to include a part or
- *             not:
- *
- *             @priv: Private pointer as passed to fdt_find_regions()
- *             @fdt: Pointer to FDT blob
- *             @offset: Offset of this node / property
- *             @type: Type of this part, FDT_IS_...
- *             @data: Pointer to data (node name, property name, compatible
- *                     string, value (not yet supported)
- *             @size: Size of data, or 0 if none
- *             @return 0 to exclude, 1 to include, -1 if no information is
- *             available
- * @priv:      Private pointer passed to h_include
- * @region:    Returns list of regions, sorted by offset
- * @max_regions: Maximum length of region list
- * @path:      Pointer to a temporary string for the function to use for
- *             building path names
- * @path_len:  Length of path, must be large enough to hold the longest
- *             path in the tree
- * @flags:     Various flags that control the region algortihm, see
- *             FDT_REG_...
- * @return number of regions in list. If this is >max_regions then the
- * region array was exhausted. You should increase max_regions and try
- * the call again. Only the first max_regions elements are available in the
- * array.
- *
- * On error a -ve value is return, which can be:
- *
- *     -FDT_ERR_BADSTRUCTURE (too deep or more END tags than BEGIN tags
- *     -FDT_ERR_BADLAYOUT
- *     -FDT_ERR_NOSPACE (path area is too small)
- */
-int fdt_first_region(const void *fdt,
-               int (*h_include)(void *priv, const void *fdt, int offset,
-                                int type, const char *data, int size),
-               void *priv, struct fdt_region *region,
-               char *path, int path_len, int flags,
-               struct fdt_region_state *info);
-
-/** fdt_next_region() - find next region
- *
- * See fdt_first_region() for full description. This function finds the
- * next region according to the provided parameters, which must be the same
- * as passed to fdt_first_region().
- *
- * This function can additionally return -FDT_ERR_NOTFOUND when there are no
- * more regions
- */
-int fdt_next_region(const void *fdt,
-               int (*h_include)(void *priv, const void *fdt, int offset,
-                                int type, const char *data, int size),
-               void *priv, struct fdt_region *region,
-               char *path, int path_len, int flags,
-               struct fdt_region_state *info);
-
-/**
- * fdt_add_alias_regions() - find aliases that point to existing regions
- *
- * Once a device tree grep is complete some of the nodes will be present
- * and some will have been dropped. This function checks all the alias nodes
- * to figure out which points point to nodes which are still present. These
- * aliases need to be kept, along with the nodes they reference.
- *
- * Given a list of regions function finds the aliases that still apply and
- * adds more regions to the list for these. This function is called after
- * fdt_next_region() has finished returning regions and requires the same
- * state.
- *
- * @fdt:       Device tree file to reference
- * @region:    List of regions that will be kept
- * @count:     Number of regions
- * @max_regions: Number of entries that can fit in @region
- * @info:      Region state as returned from fdt_next_region()
- * @return new number of regions in @region (i.e. count + the number added)
- * or -FDT_ERR_NOSPACE if there was not enough space.
- */
-int fdt_add_alias_regions(const void *fdt, struct fdt_region *region, int count,
-                         int max_regions, struct fdt_region_state *info);
-
-#endif /* _LIBFDT_H */
+#include <../lib/libfdt/libfdt.h>
index 5a5645a0bf74b4fb66f10a0e90b41719a4778a17..91503b8cb922010829e0679544929f66a937213b 100644 (file)
@@ -1169,7 +1169,8 @@ int fdtdec_setup_memory_size(void)
        }
 
        gd->ram_size = (phys_size_t)(res.end - res.start + 1);
-       debug("%s: Initial DRAM size %llx\n", __func__, (u64)gd->ram_size);
+       debug("%s: Initial DRAM size %llx\n", __func__,
+             (unsigned long long)gd->ram_size);
 
        return 0;
 }
diff --git a/lib/libfdt/fdt.h b/lib/libfdt/fdt.h
new file mode 100644 (file)
index 0000000..3134d78
--- /dev/null
@@ -0,0 +1,67 @@
+#ifndef _FDT_H
+#define _FDT_H
+/*
+ * libfdt - Flat Device Tree manipulation
+ * Copyright (C) 2006 David Gibson, IBM Corporation.
+ * Copyright 2012 Kim Phillips, Freescale Semiconductor.
+ *
+ * SPDX-License-Identifier:     GPL-2.0+ BSD-2-Clause
+ */
+
+#ifndef __ASSEMBLY__
+
+struct fdt_header {
+       fdt32_t magic;                   /* magic word FDT_MAGIC */
+       fdt32_t totalsize;               /* total size of DT block */
+       fdt32_t off_dt_struct;           /* offset to structure */
+       fdt32_t off_dt_strings;          /* offset to strings */
+       fdt32_t off_mem_rsvmap;          /* offset to memory reserve map */
+       fdt32_t version;                 /* format version */
+       fdt32_t last_comp_version;       /* last compatible version */
+
+       /* version 2 fields below */
+       fdt32_t boot_cpuid_phys;         /* Which physical CPU id we're
+                                           booting on */
+       /* version 3 fields below */
+       fdt32_t size_dt_strings;         /* size of the strings block */
+
+       /* version 17 fields below */
+       fdt32_t size_dt_struct;          /* size of the structure block */
+};
+
+struct fdt_reserve_entry {
+       fdt64_t address;
+       fdt64_t size;
+};
+
+struct fdt_node_header {
+       fdt32_t tag;
+       char name[0];
+};
+
+struct fdt_property {
+       fdt32_t tag;
+       fdt32_t len;
+       fdt32_t nameoff;
+       char data[0];
+};
+
+#endif /* !__ASSEMBLY */
+
+#define FDT_MAGIC      0xd00dfeed      /* 4: version, 4: total size */
+#define FDT_TAGSIZE    sizeof(fdt32_t)
+
+#define FDT_BEGIN_NODE 0x1             /* Start node: full name */
+#define FDT_END_NODE   0x2             /* End node */
+#define FDT_PROP       0x3             /* Property: name off,
+                                          size, content */
+#define FDT_NOP                0x4             /* nop */
+#define FDT_END                0x9
+
+#define FDT_V1_SIZE    (7*sizeof(fdt32_t))
+#define FDT_V2_SIZE    (FDT_V1_SIZE + sizeof(fdt32_t))
+#define FDT_V3_SIZE    (FDT_V2_SIZE + sizeof(fdt32_t))
+#define FDT_V16_SIZE   FDT_V3_SIZE
+#define FDT_V17_SIZE   (FDT_V16_SIZE + sizeof(fdt32_t))
+
+#endif /* _FDT_H */
diff --git a/lib/libfdt/libfdt.h b/lib/libfdt/libfdt.h
new file mode 100644 (file)
index 0000000..2f7ebf8
--- /dev/null
@@ -0,0 +1,2144 @@
+#ifndef _LIBFDT_H
+#define _LIBFDT_H
+/*
+ * libfdt - Flat Device Tree manipulation
+ * Copyright (C) 2006 David Gibson, IBM Corporation.
+ *
+ * SPDX-License-Identifier:     GPL-2.0+ BSD-2-Clause
+ */
+
+#include <libfdt_env.h>
+#include <fdt.h>
+
+#define FDT_FIRST_SUPPORTED_VERSION    0x10
+#define FDT_LAST_SUPPORTED_VERSION     0x11
+
+/* Error codes: informative error codes */
+#define FDT_ERR_NOTFOUND       1
+       /* FDT_ERR_NOTFOUND: The requested node or property does not exist */
+#define FDT_ERR_EXISTS         2
+       /* FDT_ERR_EXISTS: Attempted to create a node or property which
+        * already exists */
+#define FDT_ERR_NOSPACE                3
+       /* FDT_ERR_NOSPACE: Operation needed to expand the device
+        * tree, but its buffer did not have sufficient space to
+        * contain the expanded tree. Use fdt_open_into() to move the
+        * device tree to a buffer with more space. */
+
+/* Error codes: codes for bad parameters */
+#define FDT_ERR_BADOFFSET      4
+       /* FDT_ERR_BADOFFSET: Function was passed a structure block
+        * offset which is out-of-bounds, or which points to an
+        * unsuitable part of the structure for the operation. */
+#define FDT_ERR_BADPATH                5
+       /* FDT_ERR_BADPATH: Function was passed a badly formatted path
+        * (e.g. missing a leading / for a function which requires an
+        * absolute path) */
+#define FDT_ERR_BADPHANDLE     6
+       /* FDT_ERR_BADPHANDLE: Function was passed an invalid phandle.
+        * This can be caused either by an invalid phandle property
+        * length, or the phandle value was either 0 or -1, which are
+        * not permitted. */
+#define FDT_ERR_BADSTATE       7
+       /* FDT_ERR_BADSTATE: Function was passed an incomplete device
+        * tree created by the sequential-write functions, which is
+        * not sufficiently complete for the requested operation. */
+
+/* Error codes: codes for bad device tree blobs */
+#define FDT_ERR_TRUNCATED      8
+       /* FDT_ERR_TRUNCATED: Structure block of the given device tree
+        * ends without an FDT_END tag. */
+#define FDT_ERR_BADMAGIC       9
+       /* FDT_ERR_BADMAGIC: Given "device tree" appears not to be a
+        * device tree at all - it is missing the flattened device
+        * tree magic number. */
+#define FDT_ERR_BADVERSION     10
+       /* FDT_ERR_BADVERSION: Given device tree has a version which
+        * can't be handled by the requested operation.  For
+        * read-write functions, this may mean that fdt_open_into() is
+        * required to convert the tree to the expected version. */
+#define FDT_ERR_BADSTRUCTURE   11
+       /* FDT_ERR_BADSTRUCTURE: Given device tree has a corrupt
+        * structure block or other serious error (e.g. misnested
+        * nodes, or subnodes preceding properties). */
+#define FDT_ERR_BADLAYOUT      12
+       /* FDT_ERR_BADLAYOUT: For read-write functions, the given
+        * device tree has it's sub-blocks in an order that the
+        * function can't handle (memory reserve map, then structure,
+        * then strings).  Use fdt_open_into() to reorganize the tree
+        * into a form suitable for the read-write operations. */
+
+/* "Can't happen" error indicating a bug in libfdt */
+#define FDT_ERR_INTERNAL       13
+       /* FDT_ERR_INTERNAL: libfdt has failed an internal assertion.
+        * Should never be returned, if it is, it indicates a bug in
+        * libfdt itself. */
+
+/* Errors in device tree content */
+#define FDT_ERR_BADNCELLS      14
+       /* FDT_ERR_BADNCELLS: Device tree has a #address-cells, #size-cells
+        * or similar property with a bad format or value */
+
+#define FDT_ERR_BADVALUE       15
+       /* FDT_ERR_BADVALUE: Device tree has a property with an unexpected
+        * value. For example: a property expected to contain a string list
+        * is not NUL-terminated within the length of its value. */
+
+#define FDT_ERR_BADOVERLAY     16
+       /* FDT_ERR_BADOVERLAY: The device tree overlay, while
+        * correctly structured, cannot be applied due to some
+        * unexpected or missing value, property or node. */
+
+#define FDT_ERR_NOPHANDLES     17
+       /* FDT_ERR_NOPHANDLES: The device tree doesn't have any
+        * phandle available anymore without causing an overflow */
+
+#define FDT_ERR_TOODEEP        18
+       /* FDT_ERR_TOODEEP: The depth of a node has exceeded the internal
+        * libfdt limit. This can happen if you have more than
+        * FDT_MAX_DEPTH nested nodes. */
+
+#define FDT_ERR_MAX            18
+
+/**********************************************************************/
+/* Low-level functions (you probably don't need these)                */
+/**********************************************************************/
+
+#ifndef SWIG /* This function is not useful in Python */
+const void *fdt_offset_ptr(const void *fdt, int offset, unsigned int checklen);
+#endif
+static inline void *fdt_offset_ptr_w(void *fdt, int offset, int checklen)
+{
+       return (void *)(uintptr_t)fdt_offset_ptr(fdt, offset, checklen);
+}
+
+uint32_t fdt_next_tag(const void *fdt, int offset, int *nextoffset);
+
+/**********************************************************************/
+/* Traversal functions                                                */
+/**********************************************************************/
+
+int fdt_next_node(const void *fdt, int offset, int *depth);
+
+/**
+ * fdt_first_subnode() - get offset of first direct subnode
+ *
+ * @fdt:       FDT blob
+ * @offset:    Offset of node to check
+ * @return offset of first subnode, or -FDT_ERR_NOTFOUND if there is none
+ */
+int fdt_first_subnode(const void *fdt, int offset);
+
+/**
+ * fdt_next_subnode() - get offset of next direct subnode
+ *
+ * After first calling fdt_first_subnode(), call this function repeatedly to
+ * get direct subnodes of a parent node.
+ *
+ * @fdt:       FDT blob
+ * @offset:    Offset of previous subnode
+ * @return offset of next subnode, or -FDT_ERR_NOTFOUND if there are no more
+ * subnodes
+ */
+int fdt_next_subnode(const void *fdt, int offset);
+
+/**
+ * fdt_for_each_subnode - iterate over all subnodes of a parent
+ *
+ * @node:      child node (int, lvalue)
+ * @fdt:       FDT blob (const void *)
+ * @parent:    parent node (int)
+ *
+ * This is actually a wrapper around a for loop and would be used like so:
+ *
+ *     fdt_for_each_subnode(node, fdt, parent) {
+ *             Use node
+ *             ...
+ *     }
+ *
+ *     if ((node < 0) && (node != -FDT_ERR_NOT_FOUND)) {
+ *             Error handling
+ *     }
+ *
+ * Note that this is implemented as a macro and @node is used as
+ * iterator in the loop. The parent variable be constant or even a
+ * literal.
+ *
+ */
+#define fdt_for_each_subnode(node, fdt, parent)                \
+       for (node = fdt_first_subnode(fdt, parent);     \
+            node >= 0;                                 \
+            node = fdt_next_subnode(fdt, node))
+
+/**********************************************************************/
+/* General functions                                                  */
+/**********************************************************************/
+#define fdt_get_header(fdt, field) \
+       (fdt32_to_cpu(((const struct fdt_header *)(fdt))->field))
+#define fdt_magic(fdt)                 (fdt_get_header(fdt, magic))
+#define fdt_totalsize(fdt)             (fdt_get_header(fdt, totalsize))
+#define fdt_off_dt_struct(fdt)         (fdt_get_header(fdt, off_dt_struct))
+#define fdt_off_dt_strings(fdt)                (fdt_get_header(fdt, off_dt_strings))
+#define fdt_off_mem_rsvmap(fdt)                (fdt_get_header(fdt, off_mem_rsvmap))
+#define fdt_version(fdt)               (fdt_get_header(fdt, version))
+#define fdt_last_comp_version(fdt)     (fdt_get_header(fdt, last_comp_version))
+#define fdt_boot_cpuid_phys(fdt)       (fdt_get_header(fdt, boot_cpuid_phys))
+#define fdt_size_dt_strings(fdt)       (fdt_get_header(fdt, size_dt_strings))
+#define fdt_size_dt_struct(fdt)                (fdt_get_header(fdt, size_dt_struct))
+
+#define __fdt_set_hdr(name) \
+       static inline void fdt_set_##name(void *fdt, uint32_t val) \
+       { \
+               struct fdt_header *fdth = (struct fdt_header *)fdt; \
+               fdth->name = cpu_to_fdt32(val); \
+       }
+__fdt_set_hdr(magic);
+__fdt_set_hdr(totalsize);
+__fdt_set_hdr(off_dt_struct);
+__fdt_set_hdr(off_dt_strings);
+__fdt_set_hdr(off_mem_rsvmap);
+__fdt_set_hdr(version);
+__fdt_set_hdr(last_comp_version);
+__fdt_set_hdr(boot_cpuid_phys);
+__fdt_set_hdr(size_dt_strings);
+__fdt_set_hdr(size_dt_struct);
+#undef __fdt_set_hdr
+
+/**
+ * fdt_check_header - sanity check a device tree or possible device tree
+ * @fdt: pointer to data which might be a flattened device tree
+ *
+ * fdt_check_header() checks that the given buffer contains what
+ * appears to be a flattened device tree with sane information in its
+ * header.
+ *
+ * returns:
+ *     0, if the buffer appears to contain a valid device tree
+ *     -FDT_ERR_BADMAGIC,
+ *     -FDT_ERR_BADVERSION,
+ *     -FDT_ERR_BADSTATE, standard meanings, as above
+ */
+int fdt_check_header(const void *fdt);
+
+/**
+ * fdt_move - move a device tree around in memory
+ * @fdt: pointer to the device tree to move
+ * @buf: pointer to memory where the device is to be moved
+ * @bufsize: size of the memory space at buf
+ *
+ * fdt_move() relocates, if possible, the device tree blob located at
+ * fdt to the buffer at buf of size bufsize.  The buffer may overlap
+ * with the existing device tree blob at fdt.  Therefore,
+ *     fdt_move(fdt, fdt, fdt_totalsize(fdt))
+ * should always succeed.
+ *
+ * returns:
+ *     0, on success
+ *     -FDT_ERR_NOSPACE, bufsize is insufficient to contain the device tree
+ *     -FDT_ERR_BADMAGIC,
+ *     -FDT_ERR_BADVERSION,
+ *     -FDT_ERR_BADSTATE, standard meanings
+ */
+int fdt_move(const void *fdt, void *buf, int bufsize);
+
+/**********************************************************************/
+/* Read-only functions                                                */
+/**********************************************************************/
+
+/**
+ * fdt_string - retrieve a string from the strings block of a device tree
+ * @fdt: pointer to the device tree blob
+ * @stroffset: offset of the string within the strings block (native endian)
+ *
+ * fdt_string() retrieves a pointer to a single string from the
+ * strings block of the device tree blob at fdt.
+ *
+ * returns:
+ *     a pointer to the string, on success
+ *     NULL, if stroffset is out of bounds
+ */
+const char *fdt_string(const void *fdt, int stroffset);
+
+/**
+ * fdt_get_max_phandle - retrieves the highest phandle in a tree
+ * @fdt: pointer to the device tree blob
+ *
+ * fdt_get_max_phandle retrieves the highest phandle in the given
+ * device tree. This will ignore badly formatted phandles, or phandles
+ * with a value of 0 or -1.
+ *
+ * returns:
+ *      the highest phandle on success
+ *      0, if no phandle was found in the device tree
+ *      -1, if an error occurred
+ */
+uint32_t fdt_get_max_phandle(const void *fdt);
+
+/**
+ * fdt_num_mem_rsv - retrieve the number of memory reserve map entries
+ * @fdt: pointer to the device tree blob
+ *
+ * Returns the number of entries in the device tree blob's memory
+ * reservation map.  This does not include the terminating 0,0 entry
+ * or any other (0,0) entries reserved for expansion.
+ *
+ * returns:
+ *     the number of entries
+ */
+int fdt_num_mem_rsv(const void *fdt);
+
+/**
+ * fdt_get_mem_rsv - retrieve one memory reserve map entry
+ * @fdt: pointer to the device tree blob
+ * @address, @size: pointers to 64-bit variables
+ *
+ * On success, *address and *size will contain the address and size of
+ * the n-th reserve map entry from the device tree blob, in
+ * native-endian format.
+ *
+ * returns:
+ *     0, on success
+ *     -FDT_ERR_BADMAGIC,
+ *     -FDT_ERR_BADVERSION,
+ *     -FDT_ERR_BADSTATE, standard meanings
+ */
+int fdt_get_mem_rsv(const void *fdt, int n, uint64_t *address, uint64_t *size);
+
+/**
+ * fdt_subnode_offset_namelen - find a subnode based on substring
+ * @fdt: pointer to the device tree blob
+ * @parentoffset: structure block offset of a node
+ * @name: name of the subnode to locate
+ * @namelen: number of characters of name to consider
+ *
+ * Identical to fdt_subnode_offset(), but only examine the first
+ * namelen characters of name for matching the subnode name.  This is
+ * useful for finding subnodes based on a portion of a larger string,
+ * such as a full path.
+ */
+#ifndef SWIG /* Not available in Python */
+int fdt_subnode_offset_namelen(const void *fdt, int parentoffset,
+                              const char *name, int namelen);
+#endif
+/**
+ * fdt_subnode_offset - find a subnode of a given node
+ * @fdt: pointer to the device tree blob
+ * @parentoffset: structure block offset of a node
+ * @name: name of the subnode to locate
+ *
+ * fdt_subnode_offset() finds a subnode of the node at structure block
+ * offset parentoffset with the given name.  name may include a unit
+ * address, in which case fdt_subnode_offset() will find the subnode
+ * with that unit address, or the unit address may be omitted, in
+ * which case fdt_subnode_offset() will find an arbitrary subnode
+ * whose name excluding unit address matches the given name.
+ *
+ * returns:
+ *     structure block offset of the requested subnode (>=0), on success
+ *     -FDT_ERR_NOTFOUND, if the requested subnode does not exist
+ *     -FDT_ERR_BADOFFSET, if parentoffset did not point to an FDT_BEGIN_NODE
+ *             tag
+ *     -FDT_ERR_BADMAGIC,
+ *     -FDT_ERR_BADVERSION,
+ *     -FDT_ERR_BADSTATE,
+ *     -FDT_ERR_BADSTRUCTURE,
+ *     -FDT_ERR_TRUNCATED, standard meanings.
+ */
+int fdt_subnode_offset(const void *fdt, int parentoffset, const char *name);
+
+/**
+ * fdt_path_offset_namelen - find a tree node by its full path
+ * @fdt: pointer to the device tree blob
+ * @path: full path of the node to locate
+ * @namelen: number of characters of path to consider
+ *
+ * Identical to fdt_path_offset(), but only consider the first namelen
+ * characters of path as the path name.
+ */
+#ifndef SWIG /* Not available in Python */
+int fdt_path_offset_namelen(const void *fdt, const char *path, int namelen);
+#endif
+
+/**
+ * fdt_path_offset - find a tree node by its full path
+ * @fdt: pointer to the device tree blob
+ * @path: full path of the node to locate
+ *
+ * fdt_path_offset() finds a node of a given path in the device tree.
+ * Each path component may omit the unit address portion, but the
+ * results of this are undefined if any such path component is
+ * ambiguous (that is if there are multiple nodes at the relevant
+ * level matching the given component, differentiated only by unit
+ * address).
+ *
+ * returns:
+ *     structure block offset of the node with the requested path (>=0), on
+ *             success
+ *     -FDT_ERR_BADPATH, given path does not begin with '/' or is invalid
+ *     -FDT_ERR_NOTFOUND, if the requested node does not exist
+ *      -FDT_ERR_BADMAGIC,
+ *     -FDT_ERR_BADVERSION,
+ *     -FDT_ERR_BADSTATE,
+ *     -FDT_ERR_BADSTRUCTURE,
+ *     -FDT_ERR_TRUNCATED, standard meanings.
+ */
+int fdt_path_offset(const void *fdt, const char *path);
+
+/**
+ * fdt_get_name - retrieve the name of a given node
+ * @fdt: pointer to the device tree blob
+ * @nodeoffset: structure block offset of the starting node
+ * @lenp: pointer to an integer variable (will be overwritten) or NULL
+ *
+ * fdt_get_name() retrieves the name (including unit address) of the
+ * device tree node at structure block offset nodeoffset.  If lenp is
+ * non-NULL, the length of this name is also returned, in the integer
+ * pointed to by lenp.
+ *
+ * returns:
+ *     pointer to the node's name, on success
+ *             If lenp is non-NULL, *lenp contains the length of that name
+ *                     (>=0)
+ *     NULL, on error
+ *             if lenp is non-NULL *lenp contains an error code (<0):
+ *             -FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE
+ *                     tag
+ *             -FDT_ERR_BADMAGIC,
+ *             -FDT_ERR_BADVERSION,
+ *             -FDT_ERR_BADSTATE, standard meanings
+ */
+const char *fdt_get_name(const void *fdt, int nodeoffset, int *lenp);
+
+/**
+ * fdt_first_property_offset - find the offset of a node's first property
+ * @fdt: pointer to the device tree blob
+ * @nodeoffset: structure block offset of a node
+ *
+ * fdt_first_property_offset() finds the first property of the node at
+ * the given structure block offset.
+ *
+ * returns:
+ *     structure block offset of the property (>=0), on success
+ *     -FDT_ERR_NOTFOUND, if the requested node has no properties
+ *     -FDT_ERR_BADOFFSET, if nodeoffset did not point to an FDT_BEGIN_NODE tag
+ *      -FDT_ERR_BADMAGIC,
+ *     -FDT_ERR_BADVERSION,
+ *     -FDT_ERR_BADSTATE,
+ *     -FDT_ERR_BADSTRUCTURE,
+ *     -FDT_ERR_TRUNCATED, standard meanings.
+ */
+int fdt_first_property_offset(const void *fdt, int nodeoffset);
+
+/**
+ * fdt_next_property_offset - step through a node's properties
+ * @fdt: pointer to the device tree blob
+ * @offset: structure block offset of a property
+ *
+ * fdt_next_property_offset() finds the property immediately after the
+ * one at the given structure block offset.  This will be a property
+ * of the same node as the given property.
+ *
+ * returns:
+ *     structure block offset of the next property (>=0), on success
+ *     -FDT_ERR_NOTFOUND, if the given property is the last in its node
+ *     -FDT_ERR_BADOFFSET, if nodeoffset did not point to an FDT_PROP tag
+ *      -FDT_ERR_BADMAGIC,
+ *     -FDT_ERR_BADVERSION,
+ *     -FDT_ERR_BADSTATE,
+ *     -FDT_ERR_BADSTRUCTURE,
+ *     -FDT_ERR_TRUNCATED, standard meanings.
+ */
+int fdt_next_property_offset(const void *fdt, int offset);
+
+/**
+ * fdt_for_each_property_offset - iterate over all properties of a node
+ *
+ * @property_offset:   property offset (int, lvalue)
+ * @fdt:               FDT blob (const void *)
+ * @node:              node offset (int)
+ *
+ * This is actually a wrapper around a for loop and would be used like so:
+ *
+ *     fdt_for_each_property_offset(property, fdt, node) {
+ *             Use property
+ *             ...
+ *     }
+ *
+ *     if ((property < 0) && (property != -FDT_ERR_NOT_FOUND)) {
+ *             Error handling
+ *     }
+ *
+ * Note that this is implemented as a macro and property is used as
+ * iterator in the loop. The node variable can be constant or even a
+ * literal.
+ */
+#define fdt_for_each_property_offset(property, fdt, node)      \
+       for (property = fdt_first_property_offset(fdt, node);   \
+            property >= 0;                                     \
+            property = fdt_next_property_offset(fdt, property))
+
+/**
+ * fdt_get_property_by_offset - retrieve the property at a given offset
+ * @fdt: pointer to the device tree blob
+ * @offset: offset of the property to retrieve
+ * @lenp: pointer to an integer variable (will be overwritten) or NULL
+ *
+ * fdt_get_property_by_offset() retrieves a pointer to the
+ * fdt_property structure within the device tree blob at the given
+ * offset.  If lenp is non-NULL, the length of the property value is
+ * also returned, in the integer pointed to by lenp.
+ *
+ * returns:
+ *     pointer to the structure representing the property
+ *             if lenp is non-NULL, *lenp contains the length of the property
+ *             value (>=0)
+ *     NULL, on error
+ *             if lenp is non-NULL, *lenp contains an error code (<0):
+ *             -FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_PROP tag
+ *             -FDT_ERR_BADMAGIC,
+ *             -FDT_ERR_BADVERSION,
+ *             -FDT_ERR_BADSTATE,
+ *             -FDT_ERR_BADSTRUCTURE,
+ *             -FDT_ERR_TRUNCATED, standard meanings
+ */
+const struct fdt_property *fdt_get_property_by_offset(const void *fdt,
+                                                     int offset,
+                                                     int *lenp);
+
+/**
+ * fdt_get_property_namelen - find a property based on substring
+ * @fdt: pointer to the device tree blob
+ * @nodeoffset: offset of the node whose property to find
+ * @name: name of the property to find
+ * @namelen: number of characters of name to consider
+ * @lenp: pointer to an integer variable (will be overwritten) or NULL
+ *
+ * Identical to fdt_get_property(), but only examine the first namelen
+ * characters of name for matching the property name.
+ */
+#ifndef SWIG /* Not available in Python */
+const struct fdt_property *fdt_get_property_namelen(const void *fdt,
+                                                   int nodeoffset,
+                                                   const char *name,
+                                                   int namelen, int *lenp);
+#endif
+
+/**
+ * fdt_get_property - find a given property in a given node
+ * @fdt: pointer to the device tree blob
+ * @nodeoffset: offset of the node whose property to find
+ * @name: name of the property to find
+ * @lenp: pointer to an integer variable (will be overwritten) or NULL
+ *
+ * fdt_get_property() retrieves a pointer to the fdt_property
+ * structure within the device tree blob corresponding to the property
+ * named 'name' of the node at offset nodeoffset.  If lenp is
+ * non-NULL, the length of the property value is also returned, in the
+ * integer pointed to by lenp.
+ *
+ * returns:
+ *     pointer to the structure representing the property
+ *             if lenp is non-NULL, *lenp contains the length of the property
+ *             value (>=0)
+ *     NULL, on error
+ *             if lenp is non-NULL, *lenp contains an error code (<0):
+ *             -FDT_ERR_NOTFOUND, node does not have named property
+ *             -FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE
+ *                     tag
+ *             -FDT_ERR_BADMAGIC,
+ *             -FDT_ERR_BADVERSION,
+ *             -FDT_ERR_BADSTATE,
+ *             -FDT_ERR_BADSTRUCTURE,
+ *             -FDT_ERR_TRUNCATED, standard meanings
+ */
+const struct fdt_property *fdt_get_property(const void *fdt, int nodeoffset,
+                                           const char *name, int *lenp);
+static inline struct fdt_property *fdt_get_property_w(void *fdt, int nodeoffset,
+                                                     const char *name,
+                                                     int *lenp)
+{
+       return (struct fdt_property *)(uintptr_t)
+               fdt_get_property(fdt, nodeoffset, name, lenp);
+}
+
+/**
+ * fdt_getprop_by_offset - retrieve the value of a property at a given offset
+ * @fdt: pointer to the device tree blob
+ * @ffset: offset of the property to read
+ * @namep: pointer to a string variable (will be overwritten) or NULL
+ * @lenp: pointer to an integer variable (will be overwritten) or NULL
+ *
+ * fdt_getprop_by_offset() retrieves a pointer to the value of the
+ * property at structure block offset 'offset' (this will be a pointer
+ * to within the device blob itself, not a copy of the value).  If
+ * lenp is non-NULL, the length of the property value is also
+ * returned, in the integer pointed to by lenp.  If namep is non-NULL,
+ * the property's namne will also be returned in the char * pointed to
+ * by namep (this will be a pointer to within the device tree's string
+ * block, not a new copy of the name).
+ *
+ * returns:
+ *     pointer to the property's value
+ *             if lenp is non-NULL, *lenp contains the length of the property
+ *             value (>=0)
+ *             if namep is non-NULL *namep contiains a pointer to the property
+ *             name.
+ *     NULL, on error
+ *             if lenp is non-NULL, *lenp contains an error code (<0):
+ *             -FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_PROP tag
+ *             -FDT_ERR_BADMAGIC,
+ *             -FDT_ERR_BADVERSION,
+ *             -FDT_ERR_BADSTATE,
+ *             -FDT_ERR_BADSTRUCTURE,
+ *             -FDT_ERR_TRUNCATED, standard meanings
+ */
+#ifndef SWIG /* This function is not useful in Python */
+const void *fdt_getprop_by_offset(const void *fdt, int offset,
+                                 const char **namep, int *lenp);
+#endif
+
+/**
+ * fdt_getprop_namelen - get property value based on substring
+ * @fdt: pointer to the device tree blob
+ * @nodeoffset: offset of the node whose property to find
+ * @name: name of the property to find
+ * @namelen: number of characters of name to consider
+ * @lenp: pointer to an integer variable (will be overwritten) or NULL
+ *
+ * Identical to fdt_getprop(), but only examine the first namelen
+ * characters of name for matching the property name.
+ */
+#ifndef SWIG /* Not available in Python */
+const void *fdt_getprop_namelen(const void *fdt, int nodeoffset,
+                               const char *name, int namelen, int *lenp);
+static inline void *fdt_getprop_namelen_w(void *fdt, int nodeoffset,
+                                         const char *name, int namelen,
+                                         int *lenp)
+{
+       return (void *)(uintptr_t)fdt_getprop_namelen(fdt, nodeoffset, name,
+                                                     namelen, lenp);
+}
+#endif
+
+/**
+ * fdt_getprop - retrieve the value of a given property
+ * @fdt: pointer to the device tree blob
+ * @nodeoffset: offset of the node whose property to find
+ * @name: name of the property to find
+ * @lenp: pointer to an integer variable (will be overwritten) or NULL
+ *
+ * fdt_getprop() retrieves a pointer to the value of the property
+ * named 'name' of the node at offset nodeoffset (this will be a
+ * pointer to within the device blob itself, not a copy of the value).
+ * If lenp is non-NULL, the length of the property value is also
+ * returned, in the integer pointed to by lenp.
+ *
+ * returns:
+ *     pointer to the property's value
+ *             if lenp is non-NULL, *lenp contains the length of the property
+ *             value (>=0)
+ *     NULL, on error
+ *             if lenp is non-NULL, *lenp contains an error code (<0):
+ *             -FDT_ERR_NOTFOUND, node does not have named property
+ *             -FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE
+ *                     tag
+ *             -FDT_ERR_BADMAGIC,
+ *             -FDT_ERR_BADVERSION,
+ *             -FDT_ERR_BADSTATE,
+ *             -FDT_ERR_BADSTRUCTURE,
+ *             -FDT_ERR_TRUNCATED, standard meanings
+ */
+const void *fdt_getprop(const void *fdt, int nodeoffset,
+                       const char *name, int *lenp);
+static inline void *fdt_getprop_w(void *fdt, int nodeoffset,
+                                 const char *name, int *lenp)
+{
+       return (void *)(uintptr_t)fdt_getprop(fdt, nodeoffset, name, lenp);
+}
+
+/**
+ * fdt_get_phandle - retrieve the phandle of a given node
+ * @fdt: pointer to the device tree blob
+ * @nodeoffset: structure block offset of the node
+ *
+ * fdt_get_phandle() retrieves the phandle of the device tree node at
+ * structure block offset nodeoffset.
+ *
+ * returns:
+ *     the phandle of the node at nodeoffset, on success (!= 0, != -1)
+ *     0, if the node has no phandle, or another error occurs
+ */
+uint32_t fdt_get_phandle(const void *fdt, int nodeoffset);
+
+/**
+ * fdt_get_alias_namelen - get alias based on substring
+ * @fdt: pointer to the device tree blob
+ * @name: name of the alias th look up
+ * @namelen: number of characters of name to consider
+ *
+ * Identical to fdt_get_alias(), but only examine the first namelen
+ * characters of name for matching the alias name.
+ */
+#ifndef SWIG /* Not available in Python */
+const char *fdt_get_alias_namelen(const void *fdt,
+                                 const char *name, int namelen);
+#endif
+
+/**
+ * fdt_get_alias - retrieve the path referenced by a given alias
+ * @fdt: pointer to the device tree blob
+ * @name: name of the alias th look up
+ *
+ * fdt_get_alias() retrieves the value of a given alias.  That is, the
+ * value of the property named 'name' in the node /aliases.
+ *
+ * returns:
+ *     a pointer to the expansion of the alias named 'name', if it exists
+ *     NULL, if the given alias or the /aliases node does not exist
+ */
+const char *fdt_get_alias(const void *fdt, const char *name);
+
+/**
+ * fdt_get_path - determine the full path of a node
+ * @fdt: pointer to the device tree blob
+ * @nodeoffset: offset of the node whose path to find
+ * @buf: character buffer to contain the returned path (will be overwritten)
+ * @buflen: size of the character buffer at buf
+ *
+ * fdt_get_path() computes the full path of the node at offset
+ * nodeoffset, and records that path in the buffer at buf.
+ *
+ * NOTE: This function is expensive, as it must scan the device tree
+ * structure from the start to nodeoffset.
+ *
+ * returns:
+ *     0, on success
+ *             buf contains the absolute path of the node at
+ *             nodeoffset, as a NUL-terminated string.
+ *     -FDT_ERR_BADOFFSET, nodeoffset does not refer to a BEGIN_NODE tag
+ *     -FDT_ERR_NOSPACE, the path of the given node is longer than (bufsize-1)
+ *             characters and will not fit in the given buffer.
+ *     -FDT_ERR_BADMAGIC,
+ *     -FDT_ERR_BADVERSION,
+ *     -FDT_ERR_BADSTATE,
+ *     -FDT_ERR_BADSTRUCTURE, standard meanings
+ */
+int fdt_get_path(const void *fdt, int nodeoffset, char *buf, int buflen);
+
+/**
+ * fdt_supernode_atdepth_offset - find a specific ancestor of a node
+ * @fdt: pointer to the device tree blob
+ * @nodeoffset: offset of the node whose parent to find
+ * @supernodedepth: depth of the ancestor to find
+ * @nodedepth: pointer to an integer variable (will be overwritten) or NULL
+ *
+ * fdt_supernode_atdepth_offset() finds an ancestor of the given node
+ * at a specific depth from the root (where the root itself has depth
+ * 0, its immediate subnodes depth 1 and so forth).  So
+ *     fdt_supernode_atdepth_offset(fdt, nodeoffset, 0, NULL);
+ * will always return 0, the offset of the root node.  If the node at
+ * nodeoffset has depth D, then:
+ *     fdt_supernode_atdepth_offset(fdt, nodeoffset, D, NULL);
+ * will return nodeoffset itself.
+ *
+ * NOTE: This function is expensive, as it must scan the device tree
+ * structure from the start to nodeoffset.
+ *
+ * returns:
+ *     structure block offset of the node at node offset's ancestor
+ *             of depth supernodedepth (>=0), on success
+ *     -FDT_ERR_BADOFFSET, nodeoffset does not refer to a BEGIN_NODE tag
+ *     -FDT_ERR_NOTFOUND, supernodedepth was greater than the depth of
+ *             nodeoffset
+ *     -FDT_ERR_BADMAGIC,
+ *     -FDT_ERR_BADVERSION,
+ *     -FDT_ERR_BADSTATE,
+ *     -FDT_ERR_BADSTRUCTURE, standard meanings
+ */
+int fdt_supernode_atdepth_offset(const void *fdt, int nodeoffset,
+                                int supernodedepth, int *nodedepth);
+
+/**
+ * fdt_node_depth - find the depth of a given node
+ * @fdt: pointer to the device tree blob
+ * @nodeoffset: offset of the node whose parent to find
+ *
+ * fdt_node_depth() finds the depth of a given node.  The root node
+ * has depth 0, its immediate subnodes depth 1 and so forth.
+ *
+ * NOTE: This function is expensive, as it must scan the device tree
+ * structure from the start to nodeoffset.
+ *
+ * returns:
+ *     depth of the node at nodeoffset (>=0), on success
+ *     -FDT_ERR_BADOFFSET, nodeoffset does not refer to a BEGIN_NODE tag
+ *     -FDT_ERR_BADMAGIC,
+ *     -FDT_ERR_BADVERSION,
+ *     -FDT_ERR_BADSTATE,
+ *     -FDT_ERR_BADSTRUCTURE, standard meanings
+ */
+int fdt_node_depth(const void *fdt, int nodeoffset);
+
+/**
+ * fdt_parent_offset - find the parent of a given node
+ * @fdt: pointer to the device tree blob
+ * @nodeoffset: offset of the node whose parent to find
+ *
+ * fdt_parent_offset() locates the parent node of a given node (that
+ * is, it finds the offset of the node which contains the node at
+ * nodeoffset as a subnode).
+ *
+ * NOTE: This function is expensive, as it must scan the device tree
+ * structure from the start to nodeoffset, *twice*.
+ *
+ * returns:
+ *     structure block offset of the parent of the node at nodeoffset
+ *             (>=0), on success
+ *     -FDT_ERR_BADOFFSET, nodeoffset does not refer to a BEGIN_NODE tag
+ *     -FDT_ERR_BADMAGIC,
+ *     -FDT_ERR_BADVERSION,
+ *     -FDT_ERR_BADSTATE,
+ *     -FDT_ERR_BADSTRUCTURE, standard meanings
+ */
+int fdt_parent_offset(const void *fdt, int nodeoffset);
+
+/**
+ * fdt_node_offset_by_prop_value - find nodes with a given property value
+ * @fdt: pointer to the device tree blob
+ * @startoffset: only find nodes after this offset
+ * @propname: property name to check
+ * @propval: property value to search for
+ * @proplen: length of the value in propval
+ *
+ * fdt_node_offset_by_prop_value() returns the offset of the first
+ * node after startoffset, which has a property named propname whose
+ * value is of length proplen and has value equal to propval; or if
+ * startoffset is -1, the very first such node in the tree.
+ *
+ * To iterate through all nodes matching the criterion, the following
+ * idiom can be used:
+ *     offset = fdt_node_offset_by_prop_value(fdt, -1, propname,
+ *                                            propval, proplen);
+ *     while (offset != -FDT_ERR_NOTFOUND) {
+ *             // other code here
+ *             offset = fdt_node_offset_by_prop_value(fdt, offset, propname,
+ *                                                    propval, proplen);
+ *     }
+ *
+ * Note the -1 in the first call to the function, if 0 is used here
+ * instead, the function will never locate the root node, even if it
+ * matches the criterion.
+ *
+ * returns:
+ *     structure block offset of the located node (>= 0, >startoffset),
+ *              on success
+ *     -FDT_ERR_NOTFOUND, no node matching the criterion exists in the
+ *             tree after startoffset
+ *     -FDT_ERR_BADOFFSET, nodeoffset does not refer to a BEGIN_NODE tag
+ *     -FDT_ERR_BADMAGIC,
+ *     -FDT_ERR_BADVERSION,
+ *     -FDT_ERR_BADSTATE,
+ *     -FDT_ERR_BADSTRUCTURE, standard meanings
+ */
+int fdt_node_offset_by_prop_value(const void *fdt, int startoffset,
+                                 const char *propname,
+                                 const void *propval, int proplen);
+
+/**
+ * fdt_node_offset_by_phandle - find the node with a given phandle
+ * @fdt: pointer to the device tree blob
+ * @phandle: phandle value
+ *
+ * fdt_node_offset_by_phandle() returns the offset of the node
+ * which has the given phandle value.  If there is more than one node
+ * in the tree with the given phandle (an invalid tree), results are
+ * undefined.
+ *
+ * returns:
+ *     structure block offset of the located node (>= 0), on success
+ *     -FDT_ERR_NOTFOUND, no node with that phandle exists
+ *     -FDT_ERR_BADPHANDLE, given phandle value was invalid (0 or -1)
+ *     -FDT_ERR_BADMAGIC,
+ *     -FDT_ERR_BADVERSION,
+ *     -FDT_ERR_BADSTATE,
+ *     -FDT_ERR_BADSTRUCTURE, standard meanings
+ */
+int fdt_node_offset_by_phandle(const void *fdt, uint32_t phandle);
+
+/**
+ * fdt_node_check_compatible: check a node's compatible property
+ * @fdt: pointer to the device tree blob
+ * @nodeoffset: offset of a tree node
+ * @compatible: string to match against
+ *
+ *
+ * fdt_node_check_compatible() returns 0 if the given node contains a
+ * 'compatible' property with the given string as one of its elements,
+ * it returns non-zero otherwise, or on error.
+ *
+ * returns:
+ *     0, if the node has a 'compatible' property listing the given string
+ *     1, if the node has a 'compatible' property, but it does not list
+ *             the given string
+ *     -FDT_ERR_NOTFOUND, if the given node has no 'compatible' property
+ *     -FDT_ERR_BADOFFSET, if nodeoffset does not refer to a BEGIN_NODE tag
+ *     -FDT_ERR_BADMAGIC,
+ *     -FDT_ERR_BADVERSION,
+ *     -FDT_ERR_BADSTATE,
+ *     -FDT_ERR_BADSTRUCTURE, standard meanings
+ */
+int fdt_node_check_compatible(const void *fdt, int nodeoffset,
+                             const char *compatible);
+
+/**
+ * fdt_node_offset_by_compatible - find nodes with a given 'compatible' value
+ * @fdt: pointer to the device tree blob
+ * @startoffset: only find nodes after this offset
+ * @compatible: 'compatible' string to match against
+ *
+ * fdt_node_offset_by_compatible() returns the offset of the first
+ * node after startoffset, which has a 'compatible' property which
+ * lists the given compatible string; or if startoffset is -1, the
+ * very first such node in the tree.
+ *
+ * To iterate through all nodes matching the criterion, the following
+ * idiom can be used:
+ *     offset = fdt_node_offset_by_compatible(fdt, -1, compatible);
+ *     while (offset != -FDT_ERR_NOTFOUND) {
+ *             // other code here
+ *             offset = fdt_node_offset_by_compatible(fdt, offset, compatible);
+ *     }
+ *
+ * Note the -1 in the first call to the function, if 0 is used here
+ * instead, the function will never locate the root node, even if it
+ * matches the criterion.
+ *
+ * returns:
+ *     structure block offset of the located node (>= 0, >startoffset),
+ *              on success
+ *     -FDT_ERR_NOTFOUND, no node matching the criterion exists in the
+ *             tree after startoffset
+ *     -FDT_ERR_BADOFFSET, nodeoffset does not refer to a BEGIN_NODE tag
+ *     -FDT_ERR_BADMAGIC,
+ *     -FDT_ERR_BADVERSION,
+ *     -FDT_ERR_BADSTATE,
+ *     -FDT_ERR_BADSTRUCTURE, standard meanings
+ */
+int fdt_node_offset_by_compatible(const void *fdt, int startoffset,
+                                 const char *compatible);
+
+/**
+ * fdt_stringlist_contains - check a string list property for a string
+ * @strlist: Property containing a list of strings to check
+ * @listlen: Length of property
+ * @str: String to search for
+ *
+ * This is a utility function provided for convenience. The list contains
+ * one or more strings, each terminated by \0, as is found in a device tree
+ * "compatible" property.
+ *
+ * @return: 1 if the string is found in the list, 0 not found, or invalid list
+ */
+int fdt_stringlist_contains(const char *strlist, int listlen, const char *str);
+
+/**
+ * fdt_stringlist_count - count the number of strings in a string list
+ * @fdt: pointer to the device tree blob
+ * @nodeoffset: offset of a tree node
+ * @property: name of the property containing the string list
+ * @return:
+ *   the number of strings in the given property
+ *   -FDT_ERR_BADVALUE if the property value is not NUL-terminated
+ *   -FDT_ERR_NOTFOUND if the property does not exist
+ */
+int fdt_stringlist_count(const void *fdt, int nodeoffset, const char *property);
+
+/**
+ * fdt_stringlist_search - find a string in a string list and return its index
+ * @fdt: pointer to the device tree blob
+ * @nodeoffset: offset of a tree node
+ * @property: name of the property containing the string list
+ * @string: string to look up in the string list
+ *
+ * Note that it is possible for this function to succeed on property values
+ * that are not NUL-terminated. That's because the function will stop after
+ * finding the first occurrence of @string. This can for example happen with
+ * small-valued cell properties, such as #address-cells, when searching for
+ * the empty string.
+ *
+ * @return:
+ *   the index of the string in the list of strings
+ *   -FDT_ERR_BADVALUE if the property value is not NUL-terminated
+ *   -FDT_ERR_NOTFOUND if the property does not exist or does not contain
+ *                     the given string
+ */
+int fdt_stringlist_search(const void *fdt, int nodeoffset, const char *property,
+                         const char *string);
+
+/**
+ * fdt_stringlist_get() - obtain the string at a given index in a string list
+ * @fdt: pointer to the device tree blob
+ * @nodeoffset: offset of a tree node
+ * @property: name of the property containing the string list
+ * @index: index of the string to return
+ * @lenp: return location for the string length or an error code on failure
+ *
+ * Note that this will successfully extract strings from properties with
+ * non-NUL-terminated values. For example on small-valued cell properties
+ * this function will return the empty string.
+ *
+ * If non-NULL, the length of the string (on success) or a negative error-code
+ * (on failure) will be stored in the integer pointer to by lenp.
+ *
+ * @return:
+ *   A pointer to the string at the given index in the string list or NULL on
+ *   failure. On success the length of the string will be stored in the memory
+ *   location pointed to by the lenp parameter, if non-NULL. On failure one of
+ *   the following negative error codes will be returned in the lenp parameter
+ *   (if non-NULL):
+ *     -FDT_ERR_BADVALUE if the property value is not NUL-terminated
+ *     -FDT_ERR_NOTFOUND if the property does not exist
+ */
+const char *fdt_stringlist_get(const void *fdt, int nodeoffset,
+                              const char *property, int index,
+                              int *lenp);
+
+/**********************************************************************/
+/* Read-only functions (addressing related)                           */
+/**********************************************************************/
+
+/**
+ * FDT_MAX_NCELLS - maximum value for #address-cells and #size-cells
+ *
+ * This is the maximum value for #address-cells, #size-cells and
+ * similar properties that will be processed by libfdt.  IEE1275
+ * requires that OF implementations handle values up to 4.
+ * Implementations may support larger values, but in practice higher
+ * values aren't used.
+ */
+#define FDT_MAX_NCELLS         4
+
+/**
+ * fdt_address_cells - retrieve address size for a bus represented in the tree
+ * @fdt: pointer to the device tree blob
+ * @nodeoffset: offset of the node to find the address size for
+ *
+ * When the node has a valid #address-cells property, returns its value.
+ *
+ * returns:
+ *     0 <= n < FDT_MAX_NCELLS, on success
+ *      2, if the node has no #address-cells property
+ *      -FDT_ERR_BADNCELLS, if the node has a badly formatted or invalid
+ *             #address-cells property
+ *     -FDT_ERR_BADMAGIC,
+ *     -FDT_ERR_BADVERSION,
+ *     -FDT_ERR_BADSTATE,
+ *     -FDT_ERR_BADSTRUCTURE,
+ *     -FDT_ERR_TRUNCATED, standard meanings
+ */
+int fdt_address_cells(const void *fdt, int nodeoffset);
+
+/**
+ * fdt_size_cells - retrieve address range size for a bus represented in the
+ *                  tree
+ * @fdt: pointer to the device tree blob
+ * @nodeoffset: offset of the node to find the address range size for
+ *
+ * When the node has a valid #size-cells property, returns its value.
+ *
+ * returns:
+ *     0 <= n < FDT_MAX_NCELLS, on success
+ *      2, if the node has no #address-cells property
+ *      -FDT_ERR_BADNCELLS, if the node has a badly formatted or invalid
+ *             #size-cells property
+ *     -FDT_ERR_BADMAGIC,
+ *     -FDT_ERR_BADVERSION,
+ *     -FDT_ERR_BADSTATE,
+ *     -FDT_ERR_BADSTRUCTURE,
+ *     -FDT_ERR_TRUNCATED, standard meanings
+ */
+int fdt_size_cells(const void *fdt, int nodeoffset);
+
+
+/**********************************************************************/
+/* Write-in-place functions                                           */
+/**********************************************************************/
+
+/**
+ * fdt_setprop_inplace_namelen_partial - change a property's value,
+ *                                       but not its size
+ * @fdt: pointer to the device tree blob
+ * @nodeoffset: offset of the node whose property to change
+ * @name: name of the property to change
+ * @namelen: number of characters of name to consider
+ * @idx: index of the property to change in the array
+ * @val: pointer to data to replace the property value with
+ * @len: length of the property value
+ *
+ * Identical to fdt_setprop_inplace(), but modifies the given property
+ * starting from the given index, and using only the first characters
+ * of the name. It is useful when you want to manipulate only one value of
+ * an array and you have a string that doesn't end with \0.
+ */
+#ifndef SWIG /* Not available in Python */
+int fdt_setprop_inplace_namelen_partial(void *fdt, int nodeoffset,
+                                       const char *name, int namelen,
+                                       uint32_t idx, const void *val,
+                                       int len);
+#endif
+
+/**
+ * fdt_setprop_inplace - change a property's value, but not its size
+ * @fdt: pointer to the device tree blob
+ * @nodeoffset: offset of the node whose property to change
+ * @name: name of the property to change
+ * @val: pointer to data to replace the property value with
+ * @len: length of the property value
+ *
+ * fdt_setprop_inplace() replaces the value of a given property with
+ * the data in val, of length len.  This function cannot change the
+ * size of a property, and so will only work if len is equal to the
+ * current length of the property.
+ *
+ * This function will alter only the bytes in the blob which contain
+ * the given property value, and will not alter or move any other part
+ * of the tree.
+ *
+ * returns:
+ *     0, on success
+ *     -FDT_ERR_NOSPACE, if len is not equal to the property's current length
+ *     -FDT_ERR_NOTFOUND, node does not have the named property
+ *     -FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE tag
+ *     -FDT_ERR_BADMAGIC,
+ *     -FDT_ERR_BADVERSION,
+ *     -FDT_ERR_BADSTATE,
+ *     -FDT_ERR_BADSTRUCTURE,
+ *     -FDT_ERR_TRUNCATED, standard meanings
+ */
+#ifndef SWIG /* Not available in Python */
+int fdt_setprop_inplace(void *fdt, int nodeoffset, const char *name,
+                       const void *val, int len);
+#endif
+
+/**
+ * fdt_setprop_inplace_u32 - change the value of a 32-bit integer property
+ * @fdt: pointer to the device tree blob
+ * @nodeoffset: offset of the node whose property to change
+ * @name: name of the property to change
+ * @val: 32-bit integer value to replace the property with
+ *
+ * fdt_setprop_inplace_u32() replaces the value of a given property
+ * with the 32-bit integer value in val, converting val to big-endian
+ * if necessary.  This function cannot change the size of a property,
+ * and so will only work if the property already exists and has length
+ * 4.
+ *
+ * This function will alter only the bytes in the blob which contain
+ * the given property value, and will not alter or move any other part
+ * of the tree.
+ *
+ * returns:
+ *     0, on success
+ *     -FDT_ERR_NOSPACE, if the property's length is not equal to 4
+ *     -FDT_ERR_NOTFOUND, node does not have the named property
+ *     -FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE tag
+ *     -FDT_ERR_BADMAGIC,
+ *     -FDT_ERR_BADVERSION,
+ *     -FDT_ERR_BADSTATE,
+ *     -FDT_ERR_BADSTRUCTURE,
+ *     -FDT_ERR_TRUNCATED, standard meanings
+ */
+static inline int fdt_setprop_inplace_u32(void *fdt, int nodeoffset,
+                                         const char *name, uint32_t val)
+{
+       fdt32_t tmp = cpu_to_fdt32(val);
+       return fdt_setprop_inplace(fdt, nodeoffset, name, &tmp, sizeof(tmp));
+}
+
+/**
+ * fdt_setprop_inplace_u64 - change the value of a 64-bit integer property
+ * @fdt: pointer to the device tree blob
+ * @nodeoffset: offset of the node whose property to change
+ * @name: name of the property to change
+ * @val: 64-bit integer value to replace the property with
+ *
+ * fdt_setprop_inplace_u64() replaces the value of a given property
+ * with the 64-bit integer value in val, converting val to big-endian
+ * if necessary.  This function cannot change the size of a property,
+ * and so will only work if the property already exists and has length
+ * 8.
+ *
+ * This function will alter only the bytes in the blob which contain
+ * the given property value, and will not alter or move any other part
+ * of the tree.
+ *
+ * returns:
+ *     0, on success
+ *     -FDT_ERR_NOSPACE, if the property's length is not equal to 8
+ *     -FDT_ERR_NOTFOUND, node does not have the named property
+ *     -FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE tag
+ *     -FDT_ERR_BADMAGIC,
+ *     -FDT_ERR_BADVERSION,
+ *     -FDT_ERR_BADSTATE,
+ *     -FDT_ERR_BADSTRUCTURE,
+ *     -FDT_ERR_TRUNCATED, standard meanings
+ */
+static inline int fdt_setprop_inplace_u64(void *fdt, int nodeoffset,
+                                         const char *name, uint64_t val)
+{
+       fdt64_t tmp = cpu_to_fdt64(val);
+       return fdt_setprop_inplace(fdt, nodeoffset, name, &tmp, sizeof(tmp));
+}
+
+/**
+ * fdt_setprop_inplace_cell - change the value of a single-cell property
+ *
+ * This is an alternative name for fdt_setprop_inplace_u32()
+ */
+static inline int fdt_setprop_inplace_cell(void *fdt, int nodeoffset,
+                                          const char *name, uint32_t val)
+{
+       return fdt_setprop_inplace_u32(fdt, nodeoffset, name, val);
+}
+
+/**
+ * fdt_nop_property - replace a property with nop tags
+ * @fdt: pointer to the device tree blob
+ * @nodeoffset: offset of the node whose property to nop
+ * @name: name of the property to nop
+ *
+ * fdt_nop_property() will replace a given property's representation
+ * in the blob with FDT_NOP tags, effectively removing it from the
+ * tree.
+ *
+ * This function will alter only the bytes in the blob which contain
+ * the property, and will not alter or move any other part of the
+ * tree.
+ *
+ * returns:
+ *     0, on success
+ *     -FDT_ERR_NOTFOUND, node does not have the named property
+ *     -FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE tag
+ *     -FDT_ERR_BADMAGIC,
+ *     -FDT_ERR_BADVERSION,
+ *     -FDT_ERR_BADSTATE,
+ *     -FDT_ERR_BADSTRUCTURE,
+ *     -FDT_ERR_TRUNCATED, standard meanings
+ */
+int fdt_nop_property(void *fdt, int nodeoffset, const char *name);
+
+/**
+ * fdt_nop_node - replace a node (subtree) with nop tags
+ * @fdt: pointer to the device tree blob
+ * @nodeoffset: offset of the node to nop
+ *
+ * fdt_nop_node() will replace a given node's representation in the
+ * blob, including all its subnodes, if any, with FDT_NOP tags,
+ * effectively removing it from the tree.
+ *
+ * This function will alter only the bytes in the blob which contain
+ * the node and its properties and subnodes, and will not alter or
+ * move any other part of the tree.
+ *
+ * returns:
+ *     0, on success
+ *     -FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE tag
+ *     -FDT_ERR_BADMAGIC,
+ *     -FDT_ERR_BADVERSION,
+ *     -FDT_ERR_BADSTATE,
+ *     -FDT_ERR_BADSTRUCTURE,
+ *     -FDT_ERR_TRUNCATED, standard meanings
+ */
+int fdt_nop_node(void *fdt, int nodeoffset);
+
+/**********************************************************************/
+/* Sequential write functions                                         */
+/**********************************************************************/
+
+int fdt_create(void *buf, int bufsize);
+int fdt_resize(void *fdt, void *buf, int bufsize);
+int fdt_add_reservemap_entry(void *fdt, uint64_t addr, uint64_t size);
+int fdt_finish_reservemap(void *fdt);
+int fdt_begin_node(void *fdt, const char *name);
+int fdt_property(void *fdt, const char *name, const void *val, int len);
+static inline int fdt_property_u32(void *fdt, const char *name, uint32_t val)
+{
+       fdt32_t tmp = cpu_to_fdt32(val);
+       return fdt_property(fdt, name, &tmp, sizeof(tmp));
+}
+static inline int fdt_property_u64(void *fdt, const char *name, uint64_t val)
+{
+       fdt64_t tmp = cpu_to_fdt64(val);
+       return fdt_property(fdt, name, &tmp, sizeof(tmp));
+}
+static inline int fdt_property_cell(void *fdt, const char *name, uint32_t val)
+{
+       return fdt_property_u32(fdt, name, val);
+}
+
+/**
+ * fdt_property_placeholder - add a new property and return a ptr to its value
+ *
+ * @fdt: pointer to the device tree blob
+ * @name: name of property to add
+ * @len: length of property value in bytes
+ * @valp: returns a pointer to where where the value should be placed
+ *
+ * returns:
+ *     0, on success
+ *     -FDT_ERR_BADMAGIC,
+ *     -FDT_ERR_NOSPACE, standard meanings
+ */
+int fdt_property_placeholder(void *fdt, const char *name, int len, void **valp);
+
+#define fdt_property_string(fdt, name, str) \
+       fdt_property(fdt, name, str, strlen(str)+1)
+int fdt_end_node(void *fdt);
+int fdt_finish(void *fdt);
+
+/**********************************************************************/
+/* Read-write functions                                               */
+/**********************************************************************/
+
+int fdt_create_empty_tree(void *buf, int bufsize);
+int fdt_open_into(const void *fdt, void *buf, int bufsize);
+int fdt_pack(void *fdt);
+
+/**
+ * fdt_add_mem_rsv - add one memory reserve map entry
+ * @fdt: pointer to the device tree blob
+ * @address, @size: 64-bit values (native endian)
+ *
+ * Adds a reserve map entry to the given blob reserving a region at
+ * address address of length size.
+ *
+ * This function will insert data into the reserve map and will
+ * therefore change the indexes of some entries in the table.
+ *
+ * returns:
+ *     0, on success
+ *     -FDT_ERR_NOSPACE, there is insufficient free space in the blob to
+ *             contain the new reservation entry
+ *     -FDT_ERR_BADMAGIC,
+ *     -FDT_ERR_BADVERSION,
+ *     -FDT_ERR_BADSTATE,
+ *     -FDT_ERR_BADSTRUCTURE,
+ *     -FDT_ERR_BADLAYOUT,
+ *     -FDT_ERR_TRUNCATED, standard meanings
+ */
+int fdt_add_mem_rsv(void *fdt, uint64_t address, uint64_t size);
+
+/**
+ * fdt_del_mem_rsv - remove a memory reserve map entry
+ * @fdt: pointer to the device tree blob
+ * @n: entry to remove
+ *
+ * fdt_del_mem_rsv() removes the n-th memory reserve map entry from
+ * the blob.
+ *
+ * This function will delete data from the reservation table and will
+ * therefore change the indexes of some entries in the table.
+ *
+ * returns:
+ *     0, on success
+ *     -FDT_ERR_NOTFOUND, there is no entry of the given index (i.e. there
+ *             are less than n+1 reserve map entries)
+ *     -FDT_ERR_BADMAGIC,
+ *     -FDT_ERR_BADVERSION,
+ *     -FDT_ERR_BADSTATE,
+ *     -FDT_ERR_BADSTRUCTURE,
+ *     -FDT_ERR_BADLAYOUT,
+ *     -FDT_ERR_TRUNCATED, standard meanings
+ */
+int fdt_del_mem_rsv(void *fdt, int n);
+
+/**
+ * fdt_set_name - change the name of a given node
+ * @fdt: pointer to the device tree blob
+ * @nodeoffset: structure block offset of a node
+ * @name: name to give the node
+ *
+ * fdt_set_name() replaces the name (including unit address, if any)
+ * of the given node with the given string.  NOTE: this function can't
+ * efficiently check if the new name is unique amongst the given
+ * node's siblings; results are undefined if this function is invoked
+ * with a name equal to one of the given node's siblings.
+ *
+ * This function may insert or delete data from the blob, and will
+ * therefore change the offsets of some existing nodes.
+ *
+ * returns:
+ *     0, on success
+ *     -FDT_ERR_NOSPACE, there is insufficient free space in the blob
+ *             to contain the new name
+ *     -FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE tag
+ *     -FDT_ERR_BADMAGIC,
+ *     -FDT_ERR_BADVERSION,
+ *     -FDT_ERR_BADSTATE, standard meanings
+ */
+int fdt_set_name(void *fdt, int nodeoffset, const char *name);
+
+/**
+ * fdt_setprop - create or change a property
+ * @fdt: pointer to the device tree blob
+ * @nodeoffset: offset of the node whose property to change
+ * @name: name of the property to change
+ * @val: pointer to data to set the property value to
+ * @len: length of the property value
+ *
+ * fdt_setprop() sets the value of the named property in the given
+ * node to the given value and length, creating the property if it
+ * does not already exist.
+ *
+ * This function may insert or delete data from the blob, and will
+ * therefore change the offsets of some existing nodes.
+ *
+ * returns:
+ *     0, on success
+ *     -FDT_ERR_NOSPACE, there is insufficient free space in the blob to
+ *             contain the new property value
+ *     -FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE tag
+ *     -FDT_ERR_BADLAYOUT,
+ *     -FDT_ERR_BADMAGIC,
+ *     -FDT_ERR_BADVERSION,
+ *     -FDT_ERR_BADSTATE,
+ *     -FDT_ERR_BADSTRUCTURE,
+ *     -FDT_ERR_BADLAYOUT,
+ *     -FDT_ERR_TRUNCATED, standard meanings
+ */
+int fdt_setprop(void *fdt, int nodeoffset, const char *name,
+               const void *val, int len);
+
+/**
+ * fdt_setprop_u32 - set a property to a 32-bit integer
+ * @fdt: pointer to the device tree blob
+ * @nodeoffset: offset of the node whose property to change
+ * @name: name of the property to change
+ * @val: 32-bit integer value for the property (native endian)
+ *
+ * fdt_setprop_u32() sets the value of the named property in the given
+ * node to the given 32-bit integer value (converting to big-endian if
+ * necessary), or creates a new property with that value if it does
+ * not already exist.
+ *
+ * This function may insert or delete data from the blob, and will
+ * therefore change the offsets of some existing nodes.
+ *
+ * returns:
+ *     0, on success
+ *     -FDT_ERR_NOSPACE, there is insufficient free space in the blob to
+ *             contain the new property value
+ *     -FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE tag
+ *     -FDT_ERR_BADLAYOUT,
+ *     -FDT_ERR_BADMAGIC,
+ *     -FDT_ERR_BADVERSION,
+ *     -FDT_ERR_BADSTATE,
+ *     -FDT_ERR_BADSTRUCTURE,
+ *     -FDT_ERR_BADLAYOUT,
+ *     -FDT_ERR_TRUNCATED, standard meanings
+ */
+static inline int fdt_setprop_u32(void *fdt, int nodeoffset, const char *name,
+                                 uint32_t val)
+{
+       fdt32_t tmp = cpu_to_fdt32(val);
+       return fdt_setprop(fdt, nodeoffset, name, &tmp, sizeof(tmp));
+}
+
+/**
+ * fdt_setprop_u64 - set a property to a 64-bit integer
+ * @fdt: pointer to the device tree blob
+ * @nodeoffset: offset of the node whose property to change
+ * @name: name of the property to change
+ * @val: 64-bit integer value for the property (native endian)
+ *
+ * fdt_setprop_u64() sets the value of the named property in the given
+ * node to the given 64-bit integer value (converting to big-endian if
+ * necessary), or creates a new property with that value if it does
+ * not already exist.
+ *
+ * This function may insert or delete data from the blob, and will
+ * therefore change the offsets of some existing nodes.
+ *
+ * returns:
+ *     0, on success
+ *     -FDT_ERR_NOSPACE, there is insufficient free space in the blob to
+ *             contain the new property value
+ *     -FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE tag
+ *     -FDT_ERR_BADLAYOUT,
+ *     -FDT_ERR_BADMAGIC,
+ *     -FDT_ERR_BADVERSION,
+ *     -FDT_ERR_BADSTATE,
+ *     -FDT_ERR_BADSTRUCTURE,
+ *     -FDT_ERR_BADLAYOUT,
+ *     -FDT_ERR_TRUNCATED, standard meanings
+ */
+static inline int fdt_setprop_u64(void *fdt, int nodeoffset, const char *name,
+                                 uint64_t val)
+{
+       fdt64_t tmp = cpu_to_fdt64(val);
+       return fdt_setprop(fdt, nodeoffset, name, &tmp, sizeof(tmp));
+}
+
+/**
+ * fdt_setprop_cell - set a property to a single cell value
+ *
+ * This is an alternative name for fdt_setprop_u32()
+ */
+static inline int fdt_setprop_cell(void *fdt, int nodeoffset, const char *name,
+                                  uint32_t val)
+{
+       return fdt_setprop_u32(fdt, nodeoffset, name, val);
+}
+
+/**
+ * fdt_setprop_string - set a property to a string value
+ * @fdt: pointer to the device tree blob
+ * @nodeoffset: offset of the node whose property to change
+ * @name: name of the property to change
+ * @str: string value for the property
+ *
+ * fdt_setprop_string() sets the value of the named property in the
+ * given node to the given string value (using the length of the
+ * string to determine the new length of the property), or creates a
+ * new property with that value if it does not already exist.
+ *
+ * This function may insert or delete data from the blob, and will
+ * therefore change the offsets of some existing nodes.
+ *
+ * returns:
+ *     0, on success
+ *     -FDT_ERR_NOSPACE, there is insufficient free space in the blob to
+ *             contain the new property value
+ *     -FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE tag
+ *     -FDT_ERR_BADLAYOUT,
+ *     -FDT_ERR_BADMAGIC,
+ *     -FDT_ERR_BADVERSION,
+ *     -FDT_ERR_BADSTATE,
+ *     -FDT_ERR_BADSTRUCTURE,
+ *     -FDT_ERR_BADLAYOUT,
+ *     -FDT_ERR_TRUNCATED, standard meanings
+ */
+#define fdt_setprop_string(fdt, nodeoffset, name, str) \
+       fdt_setprop((fdt), (nodeoffset), (name), (str), strlen(str)+1)
+
+
+/**
+ * fdt_setprop_empty - set a property to an empty value
+ * @fdt: pointer to the device tree blob
+ * @nodeoffset: offset of the node whose property to change
+ * @name: name of the property to change
+ *
+ * fdt_setprop_empty() sets the value of the named property in the
+ * given node to an empty (zero length) value, or creates a new empty
+ * property if it does not already exist.
+ *
+ * This function may insert or delete data from the blob, and will
+ * therefore change the offsets of some existing nodes.
+ *
+ * returns:
+ *     0, on success
+ *     -FDT_ERR_NOSPACE, there is insufficient free space in the blob to
+ *             contain the new property value
+ *     -FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE tag
+ *     -FDT_ERR_BADLAYOUT,
+ *     -FDT_ERR_BADMAGIC,
+ *     -FDT_ERR_BADVERSION,
+ *     -FDT_ERR_BADSTATE,
+ *     -FDT_ERR_BADSTRUCTURE,
+ *     -FDT_ERR_BADLAYOUT,
+ *     -FDT_ERR_TRUNCATED, standard meanings
+ */
+#define fdt_setprop_empty(fdt, nodeoffset, name) \
+       fdt_setprop((fdt), (nodeoffset), (name), NULL, 0)
+
+/**
+ * fdt_appendprop - append to or create a property
+ * @fdt: pointer to the device tree blob
+ * @nodeoffset: offset of the node whose property to change
+ * @name: name of the property to append to
+ * @val: pointer to data to append to the property value
+ * @len: length of the data to append to the property value
+ *
+ * fdt_appendprop() appends the value to the named property in the
+ * given node, creating the property if it does not already exist.
+ *
+ * This function may insert data into the blob, and will therefore
+ * change the offsets of some existing nodes.
+ *
+ * returns:
+ *     0, on success
+ *     -FDT_ERR_NOSPACE, there is insufficient free space in the blob to
+ *             contain the new property value
+ *     -FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE tag
+ *     -FDT_ERR_BADLAYOUT,
+ *     -FDT_ERR_BADMAGIC,
+ *     -FDT_ERR_BADVERSION,
+ *     -FDT_ERR_BADSTATE,
+ *     -FDT_ERR_BADSTRUCTURE,
+ *     -FDT_ERR_BADLAYOUT,
+ *     -FDT_ERR_TRUNCATED, standard meanings
+ */
+int fdt_appendprop(void *fdt, int nodeoffset, const char *name,
+                  const void *val, int len);
+
+/**
+ * fdt_appendprop_u32 - append a 32-bit integer value to a property
+ * @fdt: pointer to the device tree blob
+ * @nodeoffset: offset of the node whose property to change
+ * @name: name of the property to change
+ * @val: 32-bit integer value to append to the property (native endian)
+ *
+ * fdt_appendprop_u32() appends the given 32-bit integer value
+ * (converting to big-endian if necessary) to the value of the named
+ * property in the given node, or creates a new property with that
+ * value if it does not already exist.
+ *
+ * This function may insert data into the blob, and will therefore
+ * change the offsets of some existing nodes.
+ *
+ * returns:
+ *     0, on success
+ *     -FDT_ERR_NOSPACE, there is insufficient free space in the blob to
+ *             contain the new property value
+ *     -FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE tag
+ *     -FDT_ERR_BADLAYOUT,
+ *     -FDT_ERR_BADMAGIC,
+ *     -FDT_ERR_BADVERSION,
+ *     -FDT_ERR_BADSTATE,
+ *     -FDT_ERR_BADSTRUCTURE,
+ *     -FDT_ERR_BADLAYOUT,
+ *     -FDT_ERR_TRUNCATED, standard meanings
+ */
+static inline int fdt_appendprop_u32(void *fdt, int nodeoffset,
+                                    const char *name, uint32_t val)
+{
+       fdt32_t tmp = cpu_to_fdt32(val);
+       return fdt_appendprop(fdt, nodeoffset, name, &tmp, sizeof(tmp));
+}
+
+/**
+ * fdt_appendprop_u64 - append a 64-bit integer value to a property
+ * @fdt: pointer to the device tree blob
+ * @nodeoffset: offset of the node whose property to change
+ * @name: name of the property to change
+ * @val: 64-bit integer value to append to the property (native endian)
+ *
+ * fdt_appendprop_u64() appends the given 64-bit integer value
+ * (converting to big-endian if necessary) to the value of the named
+ * property in the given node, or creates a new property with that
+ * value if it does not already exist.
+ *
+ * This function may insert data into the blob, and will therefore
+ * change the offsets of some existing nodes.
+ *
+ * returns:
+ *     0, on success
+ *     -FDT_ERR_NOSPACE, there is insufficient free space in the blob to
+ *             contain the new property value
+ *     -FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE tag
+ *     -FDT_ERR_BADLAYOUT,
+ *     -FDT_ERR_BADMAGIC,
+ *     -FDT_ERR_BADVERSION,
+ *     -FDT_ERR_BADSTATE,
+ *     -FDT_ERR_BADSTRUCTURE,
+ *     -FDT_ERR_BADLAYOUT,
+ *     -FDT_ERR_TRUNCATED, standard meanings
+ */
+static inline int fdt_appendprop_u64(void *fdt, int nodeoffset,
+                                    const char *name, uint64_t val)
+{
+       fdt64_t tmp = cpu_to_fdt64(val);
+       return fdt_appendprop(fdt, nodeoffset, name, &tmp, sizeof(tmp));
+}
+
+/**
+ * fdt_appendprop_cell - append a single cell value to a property
+ *
+ * This is an alternative name for fdt_appendprop_u32()
+ */
+static inline int fdt_appendprop_cell(void *fdt, int nodeoffset,
+                                     const char *name, uint32_t val)
+{
+       return fdt_appendprop_u32(fdt, nodeoffset, name, val);
+}
+
+/**
+ * fdt_appendprop_string - append a string to a property
+ * @fdt: pointer to the device tree blob
+ * @nodeoffset: offset of the node whose property to change
+ * @name: name of the property to change
+ * @str: string value to append to the property
+ *
+ * fdt_appendprop_string() appends the given string to the value of
+ * the named property in the given node, or creates a new property
+ * with that value if it does not already exist.
+ *
+ * This function may insert data into the blob, and will therefore
+ * change the offsets of some existing nodes.
+ *
+ * returns:
+ *     0, on success
+ *     -FDT_ERR_NOSPACE, there is insufficient free space in the blob to
+ *             contain the new property value
+ *     -FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE tag
+ *     -FDT_ERR_BADLAYOUT,
+ *     -FDT_ERR_BADMAGIC,
+ *     -FDT_ERR_BADVERSION,
+ *     -FDT_ERR_BADSTATE,
+ *     -FDT_ERR_BADSTRUCTURE,
+ *     -FDT_ERR_BADLAYOUT,
+ *     -FDT_ERR_TRUNCATED, standard meanings
+ */
+#define fdt_appendprop_string(fdt, nodeoffset, name, str) \
+       fdt_appendprop((fdt), (nodeoffset), (name), (str), strlen(str)+1)
+
+/**
+ * fdt_delprop - delete a property
+ * @fdt: pointer to the device tree blob
+ * @nodeoffset: offset of the node whose property to nop
+ * @name: name of the property to nop
+ *
+ * fdt_del_property() will delete the given property.
+ *
+ * This function will delete data from the blob, and will therefore
+ * change the offsets of some existing nodes.
+ *
+ * returns:
+ *     0, on success
+ *     -FDT_ERR_NOTFOUND, node does not have the named property
+ *     -FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE tag
+ *     -FDT_ERR_BADLAYOUT,
+ *     -FDT_ERR_BADMAGIC,
+ *     -FDT_ERR_BADVERSION,
+ *     -FDT_ERR_BADSTATE,
+ *     -FDT_ERR_BADSTRUCTURE,
+ *     -FDT_ERR_TRUNCATED, standard meanings
+ */
+int fdt_delprop(void *fdt, int nodeoffset, const char *name);
+
+/**
+ * fdt_add_subnode_namelen - creates a new node based on substring
+ * @fdt: pointer to the device tree blob
+ * @parentoffset: structure block offset of a node
+ * @name: name of the subnode to locate
+ * @namelen: number of characters of name to consider
+ *
+ * Identical to fdt_add_subnode(), but use only the first namelen
+ * characters of name as the name of the new node.  This is useful for
+ * creating subnodes based on a portion of a larger string, such as a
+ * full path.
+ */
+#ifndef SWIG /* Not available in Python */
+int fdt_add_subnode_namelen(void *fdt, int parentoffset,
+                           const char *name, int namelen);
+#endif
+
+/**
+ * fdt_add_subnode - creates a new node
+ * @fdt: pointer to the device tree blob
+ * @parentoffset: structure block offset of a node
+ * @name: name of the subnode to locate
+ *
+ * fdt_add_subnode() creates a new node as a subnode of the node at
+ * structure block offset parentoffset, with the given name (which
+ * should include the unit address, if any).
+ *
+ * This function will insert data into the blob, and will therefore
+ * change the offsets of some existing nodes.
+
+ * returns:
+ *     structure block offset of the created nodeequested subnode (>=0), on
+ *             success
+ *     -FDT_ERR_NOTFOUND, if the requested subnode does not exist
+ *     -FDT_ERR_BADOFFSET, if parentoffset did not point to an FDT_BEGIN_NODE
+ *             tag
+ *     -FDT_ERR_EXISTS, if the node at parentoffset already has a subnode of
+ *             the given name
+ *     -FDT_ERR_NOSPACE, if there is insufficient free space in the
+ *             blob to contain the new node
+ *     -FDT_ERR_NOSPACE
+ *     -FDT_ERR_BADLAYOUT
+ *      -FDT_ERR_BADMAGIC,
+ *     -FDT_ERR_BADVERSION,
+ *     -FDT_ERR_BADSTATE,
+ *     -FDT_ERR_BADSTRUCTURE,
+ *     -FDT_ERR_TRUNCATED, standard meanings.
+ */
+int fdt_add_subnode(void *fdt, int parentoffset, const char *name);
+
+/**
+ * fdt_del_node - delete a node (subtree)
+ * @fdt: pointer to the device tree blob
+ * @nodeoffset: offset of the node to nop
+ *
+ * fdt_del_node() will remove the given node, including all its
+ * subnodes if any, from the blob.
+ *
+ * This function will delete data from the blob, and will therefore
+ * change the offsets of some existing nodes.
+ *
+ * returns:
+ *     0, on success
+ *     -FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE tag
+ *     -FDT_ERR_BADLAYOUT,
+ *     -FDT_ERR_BADMAGIC,
+ *     -FDT_ERR_BADVERSION,
+ *     -FDT_ERR_BADSTATE,
+ *     -FDT_ERR_BADSTRUCTURE,
+ *     -FDT_ERR_TRUNCATED, standard meanings
+ */
+int fdt_del_node(void *fdt, int nodeoffset);
+
+/**
+ * fdt_overlay_apply - Applies a DT overlay on a base DT
+ * @fdt: pointer to the base device tree blob
+ * @fdto: pointer to the device tree overlay blob
+ *
+ * fdt_overlay_apply() will apply the given device tree overlay on the
+ * given base device tree.
+ *
+ * Expect the base device tree to be modified, even if the function
+ * returns an error.
+ *
+ * returns:
+ *     0, on success
+ *     -FDT_ERR_NOSPACE, there's not enough space in the base device tree
+ *     -FDT_ERR_NOTFOUND, the overlay points to some inexistant nodes or
+ *             properties in the base DT
+ *     -FDT_ERR_BADPHANDLE,
+ *     -FDT_ERR_BADOVERLAY,
+ *     -FDT_ERR_NOPHANDLES,
+ *     -FDT_ERR_INTERNAL,
+ *     -FDT_ERR_BADLAYOUT,
+ *     -FDT_ERR_BADMAGIC,
+ *     -FDT_ERR_BADOFFSET,
+ *     -FDT_ERR_BADPATH,
+ *     -FDT_ERR_BADVERSION,
+ *     -FDT_ERR_BADSTRUCTURE,
+ *     -FDT_ERR_BADSTATE,
+ *     -FDT_ERR_TRUNCATED, standard meanings
+ */
+int fdt_overlay_apply(void *fdt, void *fdto);
+
+/**********************************************************************/
+/* Debugging / informational functions                                */
+/**********************************************************************/
+
+#ifndef SWIG /* Not available in Python */
+const char *fdt_strerror(int errval);
+
+/**
+ * fdt_remove_unused_strings() - Remove any unused strings from an FDT
+ *
+ * This creates a new device tree in @new with unused strings removed. The
+ * called can then use fdt_pack() to minimise the space consumed.
+ *
+ * @old:       Old device tree blog
+ * @new:       Place to put new device tree blob, which must be as large as
+ *             @old
+ * @return
+ *     0, on success
+ *     -FDT_ERR_BADOFFSET, corrupt device tree
+ *     -FDT_ERR_NOSPACE, out of space, which should not happen unless there
+ *             is something very wrong with the device tree input
+ */
+int fdt_remove_unused_strings(const void *old, void *new);
+
+struct fdt_region {
+       int offset;
+       int size;
+};
+
+/*
+ * Flags for fdt_find_regions()
+ *
+ * Add a region for the string table (always the last region)
+ */
+#define FDT_REG_ADD_STRING_TAB         (1 << 0)
+
+/*
+ * Add all supernodes of a matching node/property, useful for creating a
+ * valid subset tree
+ */
+#define FDT_REG_SUPERNODES             (1 << 1)
+
+/* Add the FDT_BEGIN_NODE tags of subnodes, including their names */
+#define FDT_REG_DIRECT_SUBNODES        (1 << 2)
+
+/* Add all subnodes of a matching node */
+#define FDT_REG_ALL_SUBNODES           (1 << 3)
+
+/* Add a region for the mem_rsvmap table (always the first region) */
+#define FDT_REG_ADD_MEM_RSVMAP         (1 << 4)
+
+/* Indicates what an fdt part is (node, property, value) */
+#define FDT_IS_NODE                    (1 << 0)
+#define FDT_IS_PROP                    (1 << 1)
+#define FDT_IS_VALUE                   (1 << 2)        /* not supported */
+#define FDT_IS_COMPAT                  (1 << 3)        /* used internally */
+#define FDT_NODE_HAS_PROP              (1 << 4)        /* node contains prop */
+
+#define FDT_ANY_GLOBAL         (FDT_IS_NODE | FDT_IS_PROP | FDT_IS_VALUE | \
+                                       FDT_IS_COMPAT)
+#define FDT_IS_ANY                     0x1f            /* all the above */
+
+/* We set a reasonable limit on the number of nested nodes */
+#define FDT_MAX_DEPTH                  32
+
+/* Decribes what we want to include from the current tag */
+enum want_t {
+       WANT_NOTHING,
+       WANT_NODES_ONLY,                /* No properties */
+       WANT_NODES_AND_PROPS,           /* Everything for one level */
+       WANT_ALL_NODES_AND_PROPS        /* Everything for all levels */
+};
+
+/* Keeps track of the state at parent nodes */
+struct fdt_subnode_stack {
+       int offset;             /* Offset of node */
+       enum want_t want;       /* The 'want' value here */
+       int included;           /* 1 if we included this node, 0 if not */
+};
+
+struct fdt_region_ptrs {
+       int depth;                      /* Current tree depth */
+       int done;                       /* What we have completed scanning */
+       enum want_t want;               /* What we are currently including */
+       char *end;                      /* Pointer to end of full node path */
+       int nextoffset;                 /* Next node offset to check */
+};
+
+/* The state of our finding algortihm */
+struct fdt_region_state {
+       struct fdt_subnode_stack stack[FDT_MAX_DEPTH];  /* node stack */
+       struct fdt_region *region;      /* Contains list of regions found */
+       int count;                      /* Numnber of regions found */
+       const void *fdt;                /* FDT blob */
+       int max_regions;                /* Maximum regions to find */
+       int can_merge;          /* 1 if we can merge with previous region */
+       int start;                      /* Start position of current region */
+       struct fdt_region_ptrs ptrs;    /* Pointers for what we are up to */
+};
+
+/**
+ * fdt_find_regions() - find regions in device tree
+ *
+ * Given a list of nodes to include and properties to exclude, find
+ * the regions of the device tree which describe those included parts.
+ *
+ * The intent is to get a list of regions which will be invariant provided
+ * those parts are invariant. For example, if you request a list of regions
+ * for all nodes but exclude the property "data", then you will get the
+ * same region contents regardless of any change to "data" properties.
+ *
+ * This function can be used to produce a byte-stream to send to a hashing
+ * function to verify that critical parts of the FDT have not changed.
+ *
+ * Nodes which are given in 'inc' are included in the region list, as
+ * are the names of the immediate subnodes nodes (but not the properties
+ * or subnodes of those subnodes).
+ *
+ * For eaxample "/" means to include the root node, all root properties
+ * and the FDT_BEGIN_NODE and FDT_END_NODE of all subnodes of /. The latter
+ * ensures that we capture the names of the subnodes. In a hashing situation
+ * it prevents the root node from changing at all Any change to non-excluded
+ * properties, names of subnodes or number of subnodes would be detected.
+ *
+ * When used with FITs this provides the ability to hash and sign parts of
+ * the FIT based on different configurations in the FIT. Then it is
+ * impossible to change anything about that configuration (include images
+ * attached to the configuration), but it may be possible to add new
+ * configurations, new images or new signatures within the existing
+ * framework.
+ *
+ * Adding new properties to a device tree may result in the string table
+ * being extended (if the new property names are different from those
+ * already added). This function can optionally include a region for
+ * the string table so that this can be part of the hash too.
+ *
+ * The device tree header is not included in the list.
+ *
+ * @fdt:       Device tree to check
+ * @inc:       List of node paths to included
+ * @inc_count: Number of node paths in list
+ * @exc_prop:  List of properties names to exclude
+ * @exc_prop_count:    Number of properties in exclude list
+ * @region:    Returns list of regions
+ * @max_region:        Maximum length of region list
+ * @path:      Pointer to a temporary string for the function to use for
+ *             building path names
+ * @path_len:  Length of path, must be large enough to hold the longest
+ *             path in the tree
+ * @add_string_tab:    1 to add a region for the string table
+ * @return number of regions in list. If this is >max_regions then the
+ * region array was exhausted. You should increase max_regions and try
+ * the call again.
+ */
+int fdt_find_regions(const void *fdt, char * const inc[], int inc_count,
+                    char * const exc_prop[], int exc_prop_count,
+                    struct fdt_region region[], int max_regions,
+                    char *path, int path_len, int add_string_tab);
+
+/**
+ * fdt_first_region() - find regions in device tree
+ *
+ * Given a nodes and properties to include and properties to exclude, find
+ * the regions of the device tree which describe those included parts.
+ *
+ * The use for this function is twofold. Firstly it provides a convenient
+ * way of performing a structure-aware grep of the tree. For example it is
+ * possible to grep for a node and get all the properties associated with
+ * that node. Trees can be subsetted easily, by specifying the nodes that
+ * are required, and then writing out the regions returned by this function.
+ * This is useful for small resource-constrained systems, such as boot
+ * loaders, which want to use an FDT but do not need to know about all of
+ * it.
+ *
+ * Secondly it makes it easy to hash parts of the tree and detect changes.
+ * The intent is to get a list of regions which will be invariant provided
+ * those parts are invariant. For example, if you request a list of regions
+ * for all nodes but exclude the property "data", then you will get the
+ * same region contents regardless of any change to "data" properties.
+ *
+ * This function can be used to produce a byte-stream to send to a hashing
+ * function to verify that critical parts of the FDT have not changed.
+ * Note that semantically null changes in order could still cause false
+ * hash misses. Such reordering might happen if the tree is regenerated
+ * from source, and nodes are reordered (the bytes-stream will be emitted
+ * in a different order and mnay hash functions will detect this). However
+ * if an existing tree is modified using libfdt functions, such as
+ * fdt_add_subnode() and fdt_setprop(), then this problem is avoided.
+ *
+ * The nodes/properties to include/exclude are defined by a function
+ * provided by the caller. This function is called for each node and
+ * property, and must return:
+ *
+ *    0 - to exclude this part
+ *    1 - to include this part
+ *   -1 - for FDT_IS_PROP only: no information is available, so include
+ *             if its containing node is included
+ *
+ * The last case is only used to deal with properties. Often a property is
+ * included if its containing node is included - this is the case where
+ * -1 is returned.. However if the property is specifically required to be
+ * included/excluded, then 0 or 1 can be returned. Note that including a
+ * property when the FDT_REG_SUPERNODES flag is given will force its
+ * containing node to be included since it is not valid to have a property
+ * that is not in a node.
+ *
+ * Using the information provided, the inclusion of a node can be controlled
+ * either by a node name or its compatible string, or any other property
+ * that the function can determine.
+ *
+ * As an example, including node "/" means to include the root node and all
+ * root properties. A flag provides a way of also including supernodes (of
+ * which there is none for the root node), and another flag includes
+ * immediate subnodes, so in this case we would get the FDT_BEGIN_NODE and
+ * FDT_END_NODE of all subnodes of /.
+ *
+ * The subnode feature helps in a hashing situation since it prevents the
+ * root node from changing at all. Any change to non-excluded properties,
+ * names of subnodes or number of subnodes would be detected.
+ *
+ * When used with FITs this provides the ability to hash and sign parts of
+ * the FIT based on different configurations in the FIT. Then it is
+ * impossible to change anything about that configuration (include images
+ * attached to the configuration), but it may be possible to add new
+ * configurations, new images or new signatures within the existing
+ * framework.
+ *
+ * Adding new properties to a device tree may result in the string table
+ * being extended (if the new property names are different from those
+ * already added). This function can optionally include a region for
+ * the string table so that this can be part of the hash too. This is always
+ * the last region.
+ *
+ * The FDT also has a mem_rsvmap table which can also be included, and is
+ * always the first region if so.
+ *
+ * The device tree header is not included in the region list. Since the
+ * contents of the FDT are changing (shrinking, often), the caller will need
+ * to regenerate the header anyway.
+ *
+ * @fdt:       Device tree to check
+ * @h_include: Function to call to determine whether to include a part or
+ *             not:
+ *
+ *             @priv: Private pointer as passed to fdt_find_regions()
+ *             @fdt: Pointer to FDT blob
+ *             @offset: Offset of this node / property
+ *             @type: Type of this part, FDT_IS_...
+ *             @data: Pointer to data (node name, property name, compatible
+ *                     string, value (not yet supported)
+ *             @size: Size of data, or 0 if none
+ *             @return 0 to exclude, 1 to include, -1 if no information is
+ *             available
+ * @priv:      Private pointer passed to h_include
+ * @region:    Returns list of regions, sorted by offset
+ * @max_regions: Maximum length of region list
+ * @path:      Pointer to a temporary string for the function to use for
+ *             building path names
+ * @path_len:  Length of path, must be large enough to hold the longest
+ *             path in the tree
+ * @flags:     Various flags that control the region algortihm, see
+ *             FDT_REG_...
+ * @return number of regions in list. If this is >max_regions then the
+ * region array was exhausted. You should increase max_regions and try
+ * the call again. Only the first max_regions elements are available in the
+ * array.
+ *
+ * On error a -ve value is return, which can be:
+ *
+ *     -FDT_ERR_BADSTRUCTURE (too deep or more END tags than BEGIN tags
+ *     -FDT_ERR_BADLAYOUT
+ *     -FDT_ERR_NOSPACE (path area is too small)
+ */
+int fdt_first_region(const void *fdt,
+               int (*h_include)(void *priv, const void *fdt, int offset,
+                                int type, const char *data, int size),
+               void *priv, struct fdt_region *region,
+               char *path, int path_len, int flags,
+               struct fdt_region_state *info);
+
+/** fdt_next_region() - find next region
+ *
+ * See fdt_first_region() for full description. This function finds the
+ * next region according to the provided parameters, which must be the same
+ * as passed to fdt_first_region().
+ *
+ * This function can additionally return -FDT_ERR_NOTFOUND when there are no
+ * more regions
+ */
+int fdt_next_region(const void *fdt,
+               int (*h_include)(void *priv, const void *fdt, int offset,
+                                int type, const char *data, int size),
+               void *priv, struct fdt_region *region,
+               char *path, int path_len, int flags,
+               struct fdt_region_state *info);
+
+/**
+ * fdt_add_alias_regions() - find aliases that point to existing regions
+ *
+ * Once a device tree grep is complete some of the nodes will be present
+ * and some will have been dropped. This function checks all the alias nodes
+ * to figure out which points point to nodes which are still present. These
+ * aliases need to be kept, along with the nodes they reference.
+ *
+ * Given a list of regions function finds the aliases that still apply and
+ * adds more regions to the list for these. This function is called after
+ * fdt_next_region() has finished returning regions and requires the same
+ * state.
+ *
+ * @fdt:       Device tree file to reference
+ * @region:    List of regions that will be kept
+ * @count:     Number of regions
+ * @max_regions: Number of entries that can fit in @region
+ * @info:      Region state as returned from fdt_next_region()
+ * @return new number of regions in @region (i.e. count + the number added)
+ * or -FDT_ERR_NOSPACE if there was not enough space.
+ */
+int fdt_add_alias_regions(const void *fdt, struct fdt_region *region, int count,
+                         int max_regions, struct fdt_region_state *info);
+#endif /* SWIG */
+
+#endif /* _LIBFDT_H */
diff --git a/lib/libfdt/libfdt.swig b/lib/libfdt/libfdt.swig
deleted file mode 100644 (file)
index b24c72b..0000000
+++ /dev/null
@@ -1,113 +0,0 @@
-/* File: libfdt.i */
-%module libfdt
-
-%{
-#define SWIG_FILE_WITH_INIT
-#include "libfdt.h"
-%}
-
-%pythoncode %{
-def Raise(errnum):
-    raise ValueError('Error %s' % fdt_strerror(errnum))
-
-def Name(fdt, offset):
-    name, len = fdt_get_name(fdt, offset)
-    return name
-
-def String(fdt, offset):
-    offset = fdt32_to_cpu(offset)
-    name = fdt_string(fdt, offset)
-    return name
-
-def swap32(x):
-    return (((x << 24) & 0xFF000000) |
-            ((x <<  8) & 0x00FF0000) |
-            ((x >>  8) & 0x0000FF00) |
-            ((x >> 24) & 0x000000FF))
-
-def fdt32_to_cpu(x):
-    return swap32(x)
-
-def Data(prop):
-    set_prop(prop)
-    return get_prop_data()
-%}
-
-%include "typemaps.i"
-%include "cstring.i"
-
-%typemap(in) void* = char*;
-
-typedef int fdt32_t;
-
-struct fdt_property {
-        fdt32_t tag;
-        fdt32_t len;
-        fdt32_t nameoff;
-        char data[0];
-};
-
-/*
- * This is a work-around since I'm not sure of a better way to copy out the
- * contents of a string. This is used in dtoc/GetProps(). The intent is to
- * pass in a pointer to a property and access the data field at the end of
- * it. Ideally the Data() function above would be able to do this directly,
- * but I'm not sure how to do that.
- */
-#pragma SWIG nowarn=454
-%inline %{
-    static struct fdt_property *cur_prop;
-
-    void set_prop(struct fdt_property *prop) {
-        cur_prop = prop;
-    }
-%}
-
-%cstring_output_allocate_size(char **s, int *sz, free(*$1));
-%inline %{
-    void get_prop_data(char **s, int *sz) {
-        *sz = fdt32_to_cpu(cur_prop->len);
-        *s = (char *)malloc(*sz);
-        if (!*s)
-            *sz = 0;
-        else
-            memcpy(*s, cur_prop + 1, *sz);
-    }
-%}
-
-%typemap(in) (const void *) {
-  if (!PyByteArray_Check($input)) {
-    SWIG_exception_fail(SWIG_TypeError, "in method '" "$symname" "', argument "
-                       "$argnum"" of type '" "$type""'");
-  }
-  $1 = (void *) PyByteArray_AsString($input);
-}
-
-const void *fdt_offset_ptr(const void *fdt, int offset, unsigned int checklen);
-int fdt_path_offset(const void *fdt, const char *path);
-int fdt_first_property_offset(const void *fdt, int nodeoffset);
-int fdt_next_property_offset(const void *fdt, int offset);
-const char *fdt_strerror(int errval);
-const struct fdt_property *fdt_get_property_by_offset(const void *fdt,
-                                                      int offset,
-                                                      int *OUTPUT);
-const char *fdt_get_name(const void *fdt, int nodeoffset, int *OUTPUT);
-const char *fdt_string(const void *fdt, int stroffset);
-int fdt_first_subnode(const void *fdt, int offset);
-int fdt_next_subnode(const void *fdt, int offset);
-
-%typemap(in) (void *) {
-  if (!PyByteArray_Check($input)) {
-    SWIG_exception_fail(SWIG_TypeError, "in method '" "$symname" "', argument "
-                       "$argnum"" of type '" "$type""'");
-  }
-  $1 = PyByteArray_AsString($input);
-}
-
-int fdt_delprop(void *fdt, int nodeoffset, const char *name);
-
-const char *fdt_strerror(int errval);
-int fdt_pack(void *fdt);
-
-int fdt_totalsize(const void *fdt);
-int fdt_off_dt_struct(const void *fdt);
diff --git a/lib/libfdt/pylibfdt/libfdt.i b/lib/libfdt/pylibfdt/libfdt.i
new file mode 100644 (file)
index 0000000..3b11bb0
--- /dev/null
@@ -0,0 +1,389 @@
+/*
+ * pylibfdt - Flat Device Tree manipulation in Python
+ * Copyright (C) 2017 Google, Inc.
+ * Written by Simon Glass <sjg@chromium.org>
+ *
+ * SPDX-License-Identifier:    GPL-2.0+ BSD-2-Clause
+ */
+
+%module libfdt
+
+%{
+#define SWIG_FILE_WITH_INIT
+#include "libfdt.h"
+%}
+
+%pythoncode %{
+
+import struct
+
+# Error codes, corresponding to FDT_ERR_... in libfdt.h
+(NOTFOUND,
+        EXISTS,
+        NOSPACE,
+        BADOFFSET,
+        BADPATH,
+        BADPHANDLE,
+        BADSTATE,
+        TRUNCATED,
+        BADMAGIC,
+        BADVERSION,
+        BADSTRUCTURE,
+        BADLAYOUT,
+        INTERNAL,
+        BADNCELLS,
+        BADVALUE,
+        BADOVERLAY,
+        NOPHANDLES) = QUIET_ALL = range(1, 18)
+# QUIET_ALL can be passed as the 'quiet' parameter to avoid exceptions
+# altogether. All # functions passed this value will return an error instead
+# of raising an exception.
+
+# Pass this as the 'quiet' parameter to return -ENOTFOUND on NOTFOUND errors,
+# instead of raising an exception.
+QUIET_NOTFOUND = (NOTFOUND,)
+
+
+class FdtException(Exception):
+    """An exception caused by an error such as one of the codes above"""
+    def __init__(self, err):
+        self.err = err
+
+    def __str__(self):
+        return 'pylibfdt error %d: %s' % (self.err, fdt_strerror(self.err))
+
+def strerror(fdt_err):
+    """Get the string for an error number
+
+    Args:
+        fdt_err: Error number (-ve)
+
+    Returns:
+        String containing the associated error
+    """
+    return fdt_strerror(fdt_err)
+
+def check_err(val, quiet=()):
+    """Raise an error if the return value is -ve
+
+    This is used to check for errors returned by libfdt C functions.
+
+    Args:
+        val: Return value from a libfdt function
+        quiet: Errors to ignore (empty to raise on all errors)
+
+    Returns:
+        val if val >= 0
+
+    Raises
+        FdtException if val < 0
+    """
+    if val < 0:
+        if -val not in quiet:
+            raise FdtException(val)
+    return val
+
+def check_err_null(val, quiet=()):
+    """Raise an error if the return value is NULL
+
+    This is used to check for a NULL return value from certain libfdt C
+    functions
+
+    Args:
+        val: Return value from a libfdt function
+        quiet: Errors to ignore (empty to raise on all errors)
+
+    Returns:
+        val if val is a list, None if not
+
+    Raises
+        FdtException if val indicates an error was reported and the error
+        is not in @quiet.
+    """
+    # Normally a list is returned which contains the data and its length.
+    # If we get just an integer error code, it means the function failed.
+    if not isinstance(val, list):
+        if -val not in quiet:
+            raise FdtException(val)
+    return val
+
+class Fdt:
+    """Device tree class, supporting all operations
+
+    The Fdt object is created is created from a device tree binary file,
+    e.g. with something like:
+
+       fdt = Fdt(open("filename.dtb").read())
+
+    Operations can then be performed using the methods in this class. Each
+    method xxx(args...) corresponds to a libfdt function fdt_xxx(fdt, args...).
+
+    All methods raise an FdtException if an error occurs. To avoid this
+    behaviour a 'quiet' parameter is provided for some functions. This
+    defaults to empty, but you can pass a list of errors that you expect.
+    If one of these errors occurs, the function will return an error number
+    (e.g. -NOTFOUND).
+    """
+    def __init__(self, data):
+        self._fdt = bytearray(data)
+        check_err(fdt_check_header(self._fdt));
+
+    def path_offset(self, path, quiet=()):
+        """Get the offset for a given path
+
+        Args:
+            path: Path to the required node, e.g. '/node@3/subnode@1'
+            quiet: Errors to ignore (empty to raise on all errors)
+
+        Returns:
+            Node offset
+
+        Raises
+            FdtException if the path is not valid or not found
+        """
+        return check_err(fdt_path_offset(self._fdt, path), quiet)
+
+    def first_property_offset(self, nodeoffset, quiet=()):
+        """Get the offset of the first property in a node offset
+
+        Args:
+            nodeoffset: Offset to the node to check
+            quiet: Errors to ignore (empty to raise on all errors)
+
+        Returns:
+            Offset of the first property
+
+        Raises
+            FdtException if the associated node has no properties, or some
+                other error occurred
+        """
+        return check_err(fdt_first_property_offset(self._fdt, nodeoffset),
+                         quiet)
+
+    def next_property_offset(self, prop_offset, quiet=()):
+        """Get the next property in a node
+
+        Args:
+            prop_offset: Offset of the previous property
+            quiet: Errors to ignore (empty to raise on all errors)
+
+        Returns:
+            Offset of the next property
+
+        Raises:
+            FdtException if the associated node has no more properties, or
+                some other error occurred
+        """
+        return check_err(fdt_next_property_offset(self._fdt, prop_offset),
+                         quiet)
+
+    def get_name(self, nodeoffset):
+        """Get the name of a node
+
+        Args:
+            nodeoffset: Offset of node to check
+
+        Returns:
+            Node name
+
+        Raises:
+            FdtException on error (e.g. nodeoffset is invalid)
+        """
+        return check_err_null(fdt_get_name(self._fdt, nodeoffset))[0]
+
+    def get_property_by_offset(self, prop_offset, quiet=()):
+        """Obtains a property that can be examined
+
+        Args:
+            prop_offset: Offset of property (e.g. from first_property_offset())
+            quiet: Errors to ignore (empty to raise on all errors)
+
+        Returns:
+            Property object, or None if not found
+
+        Raises:
+            FdtException on error (e.g. invalid prop_offset or device
+            tree format)
+        """
+        pdata = check_err_null(
+                fdt_get_property_by_offset(self._fdt, prop_offset), quiet)
+        if isinstance(pdata, (int)):
+            return pdata
+        return Property(pdata[0], pdata[1])
+
+    def first_subnode(self, nodeoffset, quiet=()):
+        """Find the first subnode of a parent node
+
+        Args:
+            nodeoffset: Node offset of parent node
+            quiet: Errors to ignore (empty to raise on all errors)
+
+        Returns:
+            The offset of the first subnode, if any
+
+        Raises:
+            FdtException if no subnode found or other error occurs
+        """
+        return check_err(fdt_first_subnode(self._fdt, nodeoffset), quiet)
+
+    def next_subnode(self, nodeoffset, quiet=()):
+        """Find the next subnode
+
+        Args:
+            nodeoffset: Node offset of previous subnode
+            quiet: Errors to ignore (empty to raise on all errors)
+
+        Returns:
+            The offset of the next subnode, if any
+
+        Raises:
+            FdtException if no more subnode found or other error occurs
+        """
+        return check_err(fdt_next_subnode(self._fdt, nodeoffset), quiet)
+
+    def totalsize(self):
+        """Return the total size of the device tree
+
+        Returns:
+            Total tree size in bytes
+        """
+        return check_err(fdt_totalsize(self._fdt))
+
+    def off_dt_struct(self):
+        """Return the start of the device tree struct area
+
+        Returns:
+            Start offset of struct area
+        """
+        return check_err(fdt_off_dt_struct(self._fdt))
+
+    def pack(self, quiet=()):
+        """Pack the device tree to remove unused space
+
+        This adjusts the tree in place.
+
+        Args:
+            quiet: Errors to ignore (empty to raise on all errors)
+
+        Raises:
+            FdtException if any error occurs
+        """
+        return check_err(fdt_pack(self._fdt), quiet)
+
+    def delprop(self, nodeoffset, prop_name):
+        """Delete a property from a node
+
+        Args:
+            nodeoffset: Node offset containing property to delete
+            prop_name: Name of property to delete
+
+        Raises:
+            FdtError if the property does not exist, or another error occurs
+        """
+        return check_err(fdt_delprop(self._fdt, nodeoffset, prop_name))
+
+    def getprop(self, nodeoffset, prop_name, quiet=()):
+        """Get a property from a node
+
+        Args:
+            nodeoffset: Node offset containing property to get
+            prop_name: Name of property to get
+            quiet: Errors to ignore (empty to raise on all errors)
+
+        Returns:
+            Value of property as a bytearray, or -ve error number
+
+        Raises:
+            FdtError if any error occurs (e.g. the property is not found)
+        """
+        pdata = check_err_null(fdt_getprop(self._fdt, nodeoffset, prop_name),
+                               quiet)
+        if isinstance(pdata, (int)):
+            return pdata
+        return bytearray(pdata[0])
+
+
+class Property:
+    """Holds a device tree property name and value.
+
+    This holds a copy of a property taken from the device tree. It does not
+    reference the device tree, so if anything changes in the device tree,
+    a Property object will remain valid.
+
+    Properties:
+        name: Property name
+        value: Proper value as a bytearray
+    """
+    def __init__(self, name, value):
+        self.name = name
+        self.value = value
+%}
+
+%rename(fdt_property) fdt_property_func;
+
+typedef int fdt32_t;
+
+%include "libfdt/fdt.h"
+
+%include "typemaps.i"
+
+/* Most functions don't change the device tree, so use a const void * */
+%typemap(in) (const void *)(const void *fdt) {
+       if (!PyByteArray_Check($input)) {
+               SWIG_exception_fail(SWIG_TypeError, "in method '" "$symname"
+                       "', argument " "$argnum"" of type '" "$type""'");
+       }
+       $1 = (void *)PyByteArray_AsString($input);
+        fdt = $1;
+        fdt = fdt; /* avoid unused variable warning */
+}
+
+/* Some functions do change the device tree, so use void * */
+%typemap(in) (void *)(const void *fdt) {
+       if (!PyByteArray_Check($input)) {
+               SWIG_exception_fail(SWIG_TypeError, "in method '" "$symname"
+                       "', argument " "$argnum"" of type '" "$type""'");
+       }
+       $1 = PyByteArray_AsString($input);
+        fdt = $1;
+        fdt = fdt; /* avoid unused variable warning */
+}
+
+%typemap(out) (struct fdt_property *) {
+       PyObject *buff;
+
+       if ($1) {
+               resultobj = PyString_FromString(
+                       fdt_string(fdt1, fdt32_to_cpu($1->nameoff)));
+               buff = PyByteArray_FromStringAndSize(
+                       (const char *)($1 + 1), fdt32_to_cpu($1->len));
+               resultobj = SWIG_Python_AppendOutput(resultobj, buff);
+       }
+}
+
+%apply int *OUTPUT { int *lenp };
+
+/* typemap used for fdt_getprop() */
+%typemap(out) (const void *) {
+       if (!$1)
+               $result = Py_None;
+       else
+               $result = Py_BuildValue("s#", $1, *arg4);
+}
+
+/* We have both struct fdt_property and a function fdt_property() */
+%warnfilter(302) fdt_property;
+
+/* These are macros in the header so have to be redefined here */
+int fdt_magic(const void *fdt);
+int fdt_totalsize(const void *fdt);
+int fdt_off_dt_struct(const void *fdt);
+int fdt_off_dt_strings(const void *fdt);
+int fdt_off_mem_rsvmap(const void *fdt);
+int fdt_version(const void *fdt);
+int fdt_last_comp_version(const void *fdt);
+int fdt_boot_cpuid_phys(const void *fdt);
+int fdt_size_dt_strings(const void *fdt);
+int fdt_size_dt_struct(const void *fdt);
+
+%include <../libfdt/libfdt.h>
diff --git a/lib/libfdt/pylibfdt/setup.py b/lib/libfdt/pylibfdt/setup.py
new file mode 100755 (executable)
index 0000000..daf1089
--- /dev/null
@@ -0,0 +1,123 @@
+#!/usr/bin/env python
+
+"""
+setup.py file for SWIG libfdt
+Copyright (C) 2017 Google, Inc.
+Written by Simon Glass <sjg@chromium.org>
+
+SPDX-License-Identifier:       GPL-2.0+ BSD-2-Clause
+
+Files to be built into the extension are provided in SOURCES
+C flags to use are provided in CPPFLAGS
+Object file directory is provided in OBJDIR
+Version is provided in VERSION
+
+If these variables are not given they are parsed from the Makefiles. This
+allows this script to be run stand-alone, e.g.:
+
+    ./pylibfdt/setup.py install [--prefix=...]
+"""
+
+from distutils.core import setup, Extension
+import os
+import re
+import sys
+
+# Decodes a Makefile assignment line into key and value (and plus for +=)
+RE_KEY_VALUE = re.compile('(?P<key>\w+) *(?P<plus>[+])?= *(?P<value>.*)$')
+
+
+def ParseMakefile(fname):
+    """Parse a Makefile to obtain its variables.
+
+    This collects variable assigments of the form:
+
+        VAR = value
+        VAR += more
+
+    It does not pick out := assignments, as these are not needed here. It does
+    handle line continuation.
+
+    Returns a dict:
+        key: Variable name (e.g. 'VAR')
+        value: Variable value (e.g. 'value more')
+    """
+    makevars = {}
+    with open(fname) as fd:
+        prev_text = ''  # Continuation text from previous line(s)
+        for line in fd.read().splitlines():
+          if line and line[-1] == '\\':  # Deal with line continuation
+            prev_text += line[:-1]
+            continue
+          elif prev_text:
+            line = prev_text + line
+            prev_text = ''  # Continuation is now used up
+          m = RE_KEY_VALUE.match(line)
+          if m:
+            value = m.group('value') or ''
+            key = m.group('key')
+
+            # Appending to a variable inserts a space beforehand
+            if 'plus' in m.groupdict() and key in makevars:
+              makevars[key] += ' ' + value
+            else:
+              makevars[key] = value
+    return makevars
+
+def GetEnvFromMakefiles():
+    """Scan the Makefiles to obtain the settings we need.
+
+    This assumes that this script is being run from the top-level directory,
+    not the pylibfdt directory.
+
+    Returns:
+        Tuple with:
+            List of swig options
+            Version string
+            List of files to build
+            List of extra C preprocessor flags needed
+            Object directory to use (always '')
+    """
+    basedir = os.path.dirname(os.path.dirname(os.path.abspath(sys.argv[0])))
+    swig_opts = ['-I%s' % basedir]
+    makevars = ParseMakefile(os.path.join(basedir, 'Makefile'))
+    version = '%s.%s.%s' % (makevars['VERSION'], makevars['PATCHLEVEL'],
+                            makevars['SUBLEVEL'])
+    makevars = ParseMakefile(os.path.join(basedir, 'libfdt', 'Makefile.libfdt'))
+    files = makevars['LIBFDT_SRCS'].split()
+    files = [os.path.join(basedir, 'libfdt', fname) for fname in files]
+    files.append('pylibfdt/libfdt.i')
+    cflags = ['-I%s' % basedir, '-I%s/libfdt' % basedir]
+    objdir = ''
+    return swig_opts, version, files, cflags, objdir
+
+
+progname = sys.argv[0]
+files = os.environ.get('SOURCES', '').split()
+cflags = os.environ.get('CPPFLAGS', '').split()
+objdir = os.environ.get('OBJDIR')
+version = os.environ.get('VERSION')
+swig_opts = os.environ.get('SWIG_OPTS', '').split()
+
+# If we were called directly rather than through our Makefile (which is often
+# the case with Python module installation), read the settings from the
+# Makefile.
+if not all((swig_opts, version, files, cflags, objdir)):
+    swig_opts, version, files, cflags, objdir = GetEnvFromMakefiles()
+
+libfdt_module = Extension(
+    '_libfdt',
+    sources = files,
+    extra_compile_args = cflags,
+    swig_opts = swig_opts,
+)
+
+setup(
+    name='libfdt',
+    version= version,
+    author='Simon Glass <sjg@chromium.org>',
+    description='Python binding for libfdt',
+    ext_modules=[libfdt_module],
+    package_dir={'': objdir},
+    py_modules=['pylibfdt/libfdt'],
+)
diff --git a/lib/libfdt/setup.py b/lib/libfdt/setup.py
deleted file mode 100644 (file)
index 845a0c2..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-#!/usr/bin/env python
-
-"""
-setup.py file for SWIG libfdt
-"""
-
-from distutils.core import setup, Extension
-import os
-import sys
-
-# Don't cross-compile - always use the host compiler.
-del os.environ['CROSS_COMPILE']
-del os.environ['CC']
-
-progname = sys.argv[0]
-cflags = sys.argv[1]
-files = sys.argv[2:]
-
-if cflags:
-    cflags = [flag for flag in cflags.split(' ') if flag]
-else:
-    cflags = None
-
-libfdt_module = Extension(
-    '_libfdt',
-    sources = files,
-    extra_compile_args =  cflags
-)
-
-sys.argv = [progname, '--quiet', 'build_ext', '--inplace', '--force']
-
-setup (name = 'libfdt',
-       version = '0.1',
-       author      = "SWIG Docs",
-       description = """Simple swig libfdt from docs""",
-       ext_modules = [libfdt_module],
-       py_modules = ["libfdt"],
-       )
index 3c49243e6a1ee0f3c7f95d73e9b081581e44be36..aed1a091f27971a6aa0004b4c671f4c5c2069294 100644 (file)
@@ -36,6 +36,23 @@ unsigned long notrace timer_read_counter(void)
        return readl(CONFIG_SYS_TIMER_COUNTER);
 #endif
 }
+
+ulong timer_get_boot_us(void)
+{
+       ulong count = timer_read_counter();
+
+#if CONFIG_SYS_TIMER_RATE == 1000000
+       return count;
+#elif CONFIG_SYS_TIMER_RATE > 1000000
+       return lldiv(count, CONFIG_SYS_TIMER_RATE / 1000000);
+#elif defined(CONFIG_SYS_TIMER_RATE)
+       return (unsigned long long)count * 1000000 / CONFIG_SYS_TIMER_RATE;
+#else
+       /* Assume the counter is in microseconds */
+       return count;
+#endif
+}
+
 #else
 extern unsigned long __weak timer_read_counter(void);
 #endif
index c3cc3152a280155dcb6659cb69570034a3b83dea..b659961a5dd4dd883c933f5dad3e3a2754bc2d89 100644 (file)
@@ -181,7 +181,7 @@ int eth_get_dev_index(void)
 
 static int eth_write_hwaddr(struct udevice *dev)
 {
-       struct eth_pdata *pdata = dev->platdata;
+       struct eth_pdata *pdata;
        int ret = 0;
 
        if (!dev || !device_active(dev))
@@ -189,6 +189,7 @@ static int eth_write_hwaddr(struct udevice *dev)
 
        /* seq is valid since the device is active */
        if (eth_get_ops(dev)->write_hwaddr && !eth_mac_skip(dev->seq)) {
+               pdata = dev->platdata;
                if (!is_valid_ethaddr(pdata->enetaddr)) {
                        printf("\nError: %s address %pM illegal value\n",
                               dev->name, pdata->enetaddr);
index 774aa89a3fe62710450e8e1fc670f892e412aef7..80ddb08474cda68db1fa5249e2528a9a22b7bc49 100644 (file)
@@ -164,14 +164,12 @@ cpp_flags      = -Wp,-MD,$(depfile) $(NOSTDINC_FLAGS) $(UBOOTINCLUDE)     \
 
 ld_flags       = $(LDFLAGS) $(ldflags-y)
 
-dts_dir = $(srctree)/arch/$(ARCH)/dts
-
 # Try these files in order to find the U-Boot-specific .dtsi include file
-u_boot_dtsi_options = $(wildcard $(dts_dir)/$(basename $(notdir $<))-u-boot.dtsi) \
-       $(wildcard $(dts_dir)/$(subst $\",,$(CONFIG_SYS_SOC))-u-boot.dtsi) \
-       $(wildcard $(dts_dir)/$(subst $\",,$(CONFIG_SYS_CPU))-u-boot.dtsi) \
-       $(wildcard $(dts_dir)/$(subst $\",,$(CONFIG_SYS_VENDOR))-u-boot.dtsi) \
-       $(wildcard $(dts_dir)/u-boot.dtsi)
+u_boot_dtsi_options = $(wildcard $(dir $<)$(basename $(notdir $<))-u-boot.dtsi) \
+       $(wildcard $(dir $<)$(subst $\",,$(CONFIG_SYS_SOC))-u-boot.dtsi) \
+       $(wildcard $(dir $<)$(subst $\",,$(CONFIG_SYS_CPU))-u-boot.dtsi) \
+       $(wildcard $(dir $<)$(subst $\",,$(CONFIG_SYS_VENDOR))-u-boot.dtsi) \
+       $(wildcard $(dir $<)u-boot.dtsi)
 
 # Uncomment for debugging
 # $(warning u_boot_dtsi_options: $(u_boot_dtsi_options))
index 135706f21de1e42f435be66d94686d80241f4b93..ac3c2c7f1342dedf6e72d674481350fc8a42d0ac 100644 (file)
@@ -257,14 +257,12 @@ PHONY += dts_dir
 dts_dir:
        $(shell [ -d $(obj)/dts ] || mkdir -p $(obj)/dts)
 
-include/generated/dt-structs.h: $(obj)/$(SPL_BIN).dtb dts_dir dtoc
+include/generated/dt-structs.h: $(obj)/$(SPL_BIN).dtb dts_dir checkdtoc
        $(call if_changed,dtoch)
 
-$(obj)/dts/dt-platdata.c: $(obj)/$(SPL_BIN).dtb dts_dir dtoc
+$(obj)/dts/dt-platdata.c: $(obj)/$(SPL_BIN).dtb dts_dir checkdtoc
        $(call if_changed,dtocc)
 
-dtoc: #$(objtree)/tools/_libfdt.so
-
 ifdef CONFIG_SAMSUNG
 ifdef CONFIG_VAR_SIZE_SPL
 VAR_SIZE_PARAM = --vs
@@ -357,6 +355,17 @@ ifneq ($(cmd_files),)
   include $(cmd_files)
 endif
 
+checkdtoc: tools
+       @if ! ( echo 'import libfdt' | ( PYTHONPATH=tools python )); then \
+               echo '*** dtoc needs the Python libfdt library. Either '; \
+               echo '*** install it on your system, or try:'; \
+               echo '***'; \
+               echo '*** sudo apt-get install swig libpython-dev'; \
+               echo '***'; \
+               echo '*** to have U-Boot build its own version.'; \
+               false; \
+       fi
+
 PHONY += FORCE
 FORCE:
 
index ee95359d7926733c37054a2bd2ef712c0e2db0cc..c8cf428a8601311b5e2e3a50d20276e41b9f2fe5 100644 (file)
@@ -854,7 +854,6 @@ CONFIG_FASTBOOT_FLASH_FILLBUF_SIZE
 CONFIG_FASTBOOT_FLASH_NAND_DEV
 CONFIG_FASTBOOT_FLASH_NAND_TRIMFFS
 CONFIG_FAST_FLASH_BIT
-CONFIG_FAT_WRITE
 CONFIG_FB_ADDR
 CONFIG_FB_BACKLIGHT
 CONFIG_FB_DEFERRED_IO
@@ -985,8 +984,6 @@ CONFIG_FSMC_NAND_BASE
 CONFIG_FSMTDBLK
 CONFIG_FSNOTIFY
 CONFIG_FS_EXT4
-CONFIG_FS_FAT
-CONFIG_FS_FAT_MAX_CLUSTSIZE
 CONFIG_FS_POSIX_ACL
 CONFIG_FTAHBC020S
 CONFIG_FTAHBC020S_BASE
@@ -2298,15 +2295,7 @@ CONFIG_RUN_FROM_DDR1
 CONFIG_RUN_FROM_IRAM_ONLY
 CONFIG_RX_DESCR_NUM
 CONFIG_S32V234
-CONFIG_S3C2400
-CONFIG_S3C2410
-CONFIG_S3C2410_NAND_BBT
-CONFIG_S3C2410_NAND_HWECC
-CONFIG_S3C2440
 CONFIG_S3C24X0
-CONFIG_S3C24XX_TACLS
-CONFIG_S3C24XX_TWRPH0
-CONFIG_S3C24XX_TWRPH1
 CONFIG_S3D2_CLK_FREQ
 CONFIG_S3D4_CLK_FREQ
 CONFIG_S5P
@@ -6037,14 +6026,6 @@ CONFIG_TFTP_TSIZE
 CONFIG_THOR_RESET_OFF
 CONFIG_THUMB2_KERNEL
 CONFIG_THUNDERX
-CONFIG_TI814X
-CONFIG_TI816X
-CONFIG_TI816X_DDR_PLL_796
-CONFIG_TI816X_EVM_DDR2
-CONFIG_TI816X_EVM_DDR3
-CONFIG_TI816X_USE_EMIF0
-CONFIG_TI816X_USE_EMIF1
-CONFIG_TI81XX
 CONFIG_TIMESTAMP
 CONFIG_TIZEN
 CONFIG_TI_KEYSTONE_SERDES
@@ -6252,7 +6233,6 @@ CONFIG_USB_GADGET_NET2280
 CONFIG_USB_GADGET_OMAP
 CONFIG_USB_GADGET_PXA27X
 CONFIG_USB_GADGET_PXA2XX
-CONFIG_USB_GADGET_S3C2410
 CONFIG_USB_GADGET_SA1100
 CONFIG_USB_GADGET_SUPERH
 CONFIG_USB_GADGET_SX2
index b572538528e1055291e6e42d52e647b2301ec55c..c8f4208d31054f1f20432d61bc674b5e9e4da800 100644 (file)
@@ -8,6 +8,8 @@ import os
 import os.path
 import pytest
 
+pytestmark = pytest.mark.buildconfigspec('hush_parser')
+
 # The list of "if test" conditions to test.
 subtests = (
     # Base if functionality.
@@ -109,29 +111,27 @@ def exec_hush_if(u_boot_console, expr, result):
     response = u_boot_console.run_command(cmd)
     assert response.strip() == str(result).lower()
 
-@pytest.mark.buildconfigspec('hush_parser')
 def test_hush_if_test_setup(u_boot_console):
     """Set up environment variables used during the "if" tests."""
 
     u_boot_console.run_command('setenv ut_var_nonexistent')
     u_boot_console.run_command('setenv ut_var_exists 1')
 
-@pytest.mark.buildconfigspec('hush_parser')
+@pytest.mark.buildconfigspec('cmd_echo')
 @pytest.mark.parametrize('expr,result', subtests)
 def test_hush_if_test(u_boot_console, expr, result):
     """Test a single "if test" condition."""
 
     exec_hush_if(u_boot_console, expr, result)
 
-@pytest.mark.buildconfigspec('hush_parser')
 def test_hush_if_test_teardown(u_boot_console):
     """Clean up environment variables used during the "if" tests."""
 
     u_boot_console.run_command('setenv ut_var_exists')
 
-@pytest.mark.buildconfigspec('hush_parser')
 # We might test this on real filesystems via UMS, DFU, 'save', etc.
 # Of those, only UMS currently allows file removal though.
+@pytest.mark.buildconfigspec('cmd_echo')
 @pytest.mark.boardspec('sandbox')
 def test_hush_if_test_host_file_exists(u_boot_console):
     """Test the "if test -e" shell command."""
index 2fc4a583d448638ce03b5d9984f495cd06983306..cb1683e1539ceded1d4c58939b7bb598046fdf7a 100644 (file)
@@ -60,9 +60,21 @@ hostprogs-$(CONFIG_FIT_SIGNATURE) += fit_info fit_check_sign
 
 FIT_SIG_OBJS-$(CONFIG_FIT_SIGNATURE) := common/image-sig.o
 # Flattened device tree objects
-LIBFDT_OBJS := $(addprefix lib/libfdt/, \
-                       fdt.o fdt_ro.o fdt_rw.o fdt_strerror.o fdt_wip.o \
-                       fdt_region.o fdt_sw.o)
+LIBFDT_CSRCS := fdt.c fdt_ro.c fdt_wip.c fdt_sw.c fdt_rw.c fdt_strerror.c  \
+                       fdt_empty_tree.c fdt_addresses.c fdt_overlay.c \
+                       fdt_region.c
+
+# Unfortunately setup.py below cannot handle srctree being ".." which it often
+# is. It fails with an error like:
+# Fatal error: can't create build/temp.linux-x86_64-2.7/../lib/libfdt/fdt.o:
+#    No such file or directory
+# To fix this, use an absolute path.
+libfdt_tree := $(shell readlink -f $(srctree)/lib/libfdt)
+
+LIBFDT_SRCS := $(addprefix $(libfdt_tree)/, $(LIBFDT_CSRCS))
+LIBFDT_SWIG := $(addprefix $(libfdt_tree)/, pylibfdt/libfdt.i)
+LIBFDT_OBJS := $(addprefix lib/libfdt/, $(patsubst %.c, %.o, $(LIBFDT_CSRCS)))
+
 RSA_OBJS-$(CONFIG_FIT_SIGNATURE) := $(addprefix lib/rsa/, \
                                        rsa-sign.o rsa-verify.o rsa-checksum.o \
                                        rsa-mod-exp.o)
@@ -112,22 +124,22 @@ mkimage-objs   := $(dumpimage-mkimage-objs) mkimage.o
 fit_info-objs   := $(dumpimage-mkimage-objs) fit_info.o
 fit_check_sign-objs   := $(dumpimage-mkimage-objs) fit_check_sign.o
 
-# Build a libfdt Python module if swig is available
-# Use 'sudo apt-get install swig libpython-dev' to enable this
-hostprogs-y += \
-       $(if $(shell which swig 2> /dev/null),_libfdt.so)
-_libfdt.so-sharedobjs += $(LIBFDT_OBJS)
-libfdt:
-
-tools/_libfdt.so: $(patsubst %.o,%.c,$(LIBFDT_OBJS)) tools/libfdt_wrap.c
-       LDFLAGS="$(HOSTLDFLAGS)" CFLAGS= ${PYTHON} $(srctree)/lib/libfdt/setup.py \
-               "$(_hostc_flags)" $^
-       mv _libfdt.so $@
-
-tools/libfdt_wrap.c: $(srctree)/lib/libfdt/libfdt.swig
-       swig -python -o $@ $<
-
-# TODO(sjg@chromium.org): Is this correct on Mac OS?
+# Unfortunately setup.py (or actually the Python distutil implementation)
+# puts files into the same directory as the .i file. We cannot touch the source
+# directory, so we copy the .i file into the tools/ build subdirectory before
+# calling setup. This directory is safe to write to. This ensures that we get
+# all three files in $(obj)/tools: _libfdt.so, libfdt.py and libfdt_wrap.c
+# The latter is a temporary file which we could actually remove.
+tools/_libfdt.so: $(LIBFDT_SRCS) $(LIBFDT_SWIG)
+       cp $(LIBFDT_SWIG) tools/.
+       unset CC; \
+       unset CROSS_COMPILE; \
+       LDFLAGS="$(HOSTLDFLAGS)" CFLAGS= VERSION="u-boot-$(UBOOTVERSION)" \
+               CPPFLAGS="$(_hostc_flags)" OBJDIR=tools \
+               SOURCES="$(LIBFDT_SRCS) tools/libfdt.i" \
+               SWIG_OPTS="-I$(srctree)/lib/libfdt -I$(srctree)/lib" \
+               $(libfdt_tree)/pylibfdt/setup.py --quiet build_ext \
+                       --build-lib tools
 
 ifneq ($(CONFIG_MX23)$(CONFIG_MX28),)
 # Add CONFIG_MXS into host CFLAGS, so we can check whether or not register
@@ -216,6 +228,10 @@ clean-dirs := lib common
 
 always := $(hostprogs-y)
 
+# Build a libfdt Python module if swig is available
+# Use 'sudo apt-get install swig libpython-dev' to enable this
+always += $(if $(shell which swig 2> /dev/null),_libfdt.so)
+
 # Generated LCD/video logo
 LOGO_H = $(objtree)/include/bmp_logo.h
 LOGO_DATA_H = $(objtree)/include/bmp_logo_data.h
index 857d698b4c249994dfa0b0321a2a355fef3d1891..95d3a048d86ac05b4c39726eb5292a8cee85205b 100755 (executable)
@@ -21,6 +21,9 @@ sys.path.append(os.path.join(our_path, '../patman'))
 sys.path.append(os.path.join(our_path, '../dtoc'))
 sys.path.append(os.path.join(our_path, '../'))
 
+# Bring in the libfdt module
+sys.path.append('tools')
+
 # Also allow entry-type modules to be brought in from the etype directory.
 sys.path.append(os.path.join(our_path, 'etype'))
 
index e90967807c3d3461994f6f4efe098a27f3fc15a8..e9d48df03014cde346fd9175c5d32fb8b6d75e9a 100644 (file)
@@ -12,7 +12,7 @@ import sys
 import tools
 
 import command
-import fdt_select
+import fdt
 import fdt_util
 from image import Image
 import tout
@@ -40,15 +40,15 @@ def _ReadImageDesc(binman_node):
         images['image'] = Image('image', binman_node)
     return images
 
-def _FindBinmanNode(fdt):
+def _FindBinmanNode(dtb):
     """Find the 'binman' node in the device tree
 
     Args:
-        fdt: Fdt object to scan
+        dtb: Fdt object to scan
     Returns:
         Node object of /binman node, or None if not found
     """
-    for node in fdt.GetRoot().subnodes:
+    for node in dtb.GetRoot().subnodes:
         if node.name == 'binman':
             return node
     return None
@@ -92,8 +92,8 @@ def Binman(options, args):
         try:
             tools.SetInputDirs(options.indir)
             tools.PrepareOutputDir(options.outdir, options.preserve)
-            fdt = fdt_select.FdtScan(dtb_fname)
-            node = _FindBinmanNode(fdt)
+            dtb = fdt.FdtScan(dtb_fname)
+            node = _FindBinmanNode(dtb)
             if not node:
                 raise ValueError("Device tree '%s' does not have a 'binman' "
                                  "node" % dtb_fname)
index fc02c67c14b9a3144a06aff6cc4c2a9ae56fbab1..a384a759c4c73755c49f489ea2076ca796adb529 100644 (file)
@@ -6,7 +6,7 @@
 # Entry-type module for U-Boot device tree with the microcode removed
 #
 
-import fdt_select
+import fdt
 from entry import Entry
 from blob import Entry_blob
 import tools
@@ -44,9 +44,8 @@ class Entry_u_boot_dtb_with_ucode(Entry_blob):
             fd.write(self.data)
 
         # Remove the microcode
-        fdt = fdt_select.FdtScan(fname)
-        fdt.Scan()
-        ucode = fdt.GetNode('/microcode')
+        dtb = fdt.FdtScan(fname)
+        ucode = dtb.GetNode('/microcode')
         if not ucode:
             raise self.Raise("No /microcode node found in '%s'" % fname)
 
@@ -57,20 +56,15 @@ class Entry_u_boot_dtb_with_ucode(Entry_blob):
             data_prop = node.props.get('data')
             if data_prop:
                 self.ucode_data += ''.join(data_prop.bytes)
-                if not self.collate:
-                    poffset = data_prop.GetOffset()
-                    if poffset is None:
-                        # We cannot obtain a property offset. Collate instead.
-                        self.collate = True
-                    else:
-                        # Find the offset in the device tree of the ucode data
-                        self.ucode_offset = poffset + 12
-                        self.ucode_size = len(data_prop.bytes)
                 if self.collate:
                     prop = node.DeleteProp('data')
+                else:
+                    # Find the offset in the device tree of the ucode data
+                    self.ucode_offset = data_prop.GetOffset() + 12
+                    self.ucode_size = len(data_prop.bytes)
         if self.collate:
-            fdt.Pack()
-            fdt.Flush()
+            dtb.Pack()
+            dtb.Flush()
 
             # Make this file the contents of this entry
             self._pathname = fname
index 1d9494e52f470f9dee20670bf6f502b647292ae5..249a9ea388ed50c2d73d97a2857ec90d772858cf 100644 (file)
@@ -11,7 +11,8 @@ import sys
 import tempfile
 import unittest
 
-from fdt_select import FdtScan
+import fdt
+from fdt import FdtScan
 import fdt_util
 import tools
 
@@ -28,21 +29,56 @@ class TestFdt(unittest.TestCase):
     def GetCompiled(self, fname):
         return fdt_util.EnsureCompiled(self.TestFile(fname))
 
-    def _DeleteProp(self, fdt):
-        node = fdt.GetNode('/microcode/update@0')
+    def _DeleteProp(self, dt):
+        node = dt.GetNode('/microcode/update@0')
         node.DeleteProp('data')
 
     def testFdtNormal(self):
         fname = self.GetCompiled('34_x86_ucode.dts')
-        fdt = FdtScan(fname)
-        self._DeleteProp(fdt)
+        dt = FdtScan(fname)
+        self._DeleteProp(dt)
 
-    def testFdtFallback(self):
-        fname = self.GetCompiled('34_x86_ucode.dts')
-        fdt = FdtScan(fname, True)
-        fdt.GetProp('/microcode/update@0', 'data')
-        self.assertEqual('fred',
-            fdt.GetProp('/microcode/update@0', 'none', default='fred'))
-        self.assertEqual('12345678 12345679',
-            fdt.GetProp('/microcode/update@0', 'data', typespec='x'))
-        self._DeleteProp(fdt)
+    def testFdtNormalProp(self):
+        fname = self.GetCompiled('45_prop_test.dts')
+        dt = FdtScan(fname)
+        node = dt.GetNode('/binman/intel-me')
+        self.assertEquals('intel-me', node.name)
+        val = fdt_util.GetString(node, 'filename')
+        self.assertEquals(str, type(val))
+        self.assertEquals('me.bin', val)
+
+        prop = node.props['intval']
+        self.assertEquals(fdt.TYPE_INT, prop.type)
+        self.assertEquals(3, fdt_util.GetInt(node, 'intval'))
+
+        prop = node.props['intarray']
+        self.assertEquals(fdt.TYPE_INT, prop.type)
+        self.assertEquals(list, type(prop.value))
+        self.assertEquals(2, len(prop.value))
+        self.assertEquals([5, 6],
+                          [fdt_util.fdt32_to_cpu(val) for val in prop.value])
+
+        prop = node.props['byteval']
+        self.assertEquals(fdt.TYPE_BYTE, prop.type)
+        self.assertEquals(chr(8), prop.value)
+
+        prop = node.props['bytearray']
+        self.assertEquals(fdt.TYPE_BYTE, prop.type)
+        self.assertEquals(list, type(prop.value))
+        self.assertEquals(str, type(prop.value[0]))
+        self.assertEquals(3, len(prop.value))
+        self.assertEquals([chr(1), '#', '4'], prop.value)
+
+        prop = node.props['longbytearray']
+        self.assertEquals(fdt.TYPE_INT, prop.type)
+        self.assertEquals(0x090a0b0c, fdt_util.GetInt(node, 'longbytearray'))
+
+        prop = node.props['stringval']
+        self.assertEquals(fdt.TYPE_STRING, prop.type)
+        self.assertEquals('message2', fdt_util.GetString(node, 'stringval'))
+
+        prop = node.props['stringarray']
+        self.assertEquals(fdt.TYPE_STRING, prop.type)
+        self.assertEquals(list, type(prop.value))
+        self.assertEquals(3, len(prop.value))
+        self.assertEquals(['another', 'multi-word', 'message'], prop.value)
index 740fa9e4e20616646cae3e83e61a93e12043a91e..8b4db4165970ab5f114729124335a54907a1b44f 100644 (file)
@@ -21,7 +21,7 @@ import cmdline
 import command
 import control
 import entry
-import fdt_select
+import fdt
 import fdt_util
 import tools
 import tout
@@ -658,8 +658,8 @@ class TestFunctional(unittest.TestCase):
         fname = tools.GetOutputFilename('test.dtb')
         with open(fname, 'wb') as fd:
             fd.write(second)
-        fdt = fdt_select.FdtScan(fname)
-        ucode = fdt.GetNode('/microcode')
+        dtb = fdt.FdtScan(fname)
+        ucode = dtb.GetNode('/microcode')
         self.assertTrue(ucode)
         for node in ucode.subnodes:
             self.assertFalse(node.props.get('data'))
@@ -683,7 +683,7 @@ class TestFunctional(unittest.TestCase):
         self.assertEqual('nodtb with microcode' + pos_and_size +
                          ' somewhere in here', first)
 
-    def _RunPackUbootSingleMicrocode(self, collate):
+    def _RunPackUbootSingleMicrocode(self):
         """Test that x86 microcode can be handled correctly
 
         We expect to see the following in the image, in order:
@@ -695,8 +695,6 @@ class TestFunctional(unittest.TestCase):
         # We need the libfdt library to run this test since only that allows
         # finding the offset of a property. This is required by
         # Entry_u_boot_dtb_with_ucode.ObtainContents().
-        if not fdt_select.have_libfdt:
-            return
         data = self._DoReadFile('35_x86_single_ucode.dts', True)
 
         second = data[len(U_BOOT_NODTB_DATA):]
@@ -705,34 +703,22 @@ class TestFunctional(unittest.TestCase):
         third = second[fdt_len:]
         second = second[:fdt_len]
 
-        if not collate:
-            ucode_data = struct.pack('>2L', 0x12345678, 0x12345679)
-            self.assertIn(ucode_data, second)
-            ucode_pos = second.find(ucode_data) + len(U_BOOT_NODTB_DATA)
+        ucode_data = struct.pack('>2L', 0x12345678, 0x12345679)
+        self.assertIn(ucode_data, second)
+        ucode_pos = second.find(ucode_data) + len(U_BOOT_NODTB_DATA)
 
-            # Check that the microcode pointer was inserted. It should match the
-            # expected position and size
-            pos_and_size = struct.pack('<2L', 0xfffffe00 + ucode_pos,
-                                    len(ucode_data))
-            first = data[:len(U_BOOT_NODTB_DATA)]
-            self.assertEqual('nodtb with microcode' + pos_and_size +
-                            ' somewhere in here', first)
+        # Check that the microcode pointer was inserted. It should match the
+        # expected position and size
+        pos_and_size = struct.pack('<2L', 0xfffffe00 + ucode_pos,
+                                   len(ucode_data))
+        first = data[:len(U_BOOT_NODTB_DATA)]
+        self.assertEqual('nodtb with microcode' + pos_and_size +
+                         ' somewhere in here', first)
 
     def testPackUbootSingleMicrocode(self):
         """Test that x86 microcode can be handled correctly with fdt_normal.
         """
-        self._RunPackUbootSingleMicrocode(False)
-
-    def testPackUbootSingleMicrocodeFallback(self):
-        """Test that x86 microcode can be handled correctly with fdt_fallback.
-
-        This only supports collating the microcode.
-        """
-        try:
-            old_val = fdt_select.UseFallback(True)
-            self._RunPackUbootSingleMicrocode(True)
-        finally:
-            fdt_select.UseFallback(old_val)
+        self._RunPackUbootSingleMicrocode()
 
     def testUBootImg(self):
         """Test that u-boot.img can be put in a file"""
@@ -763,14 +749,12 @@ class TestFunctional(unittest.TestCase):
     def testMicrocodeWithoutPtrInElf(self):
         """Test that a U-Boot binary without the microcode symbol is detected"""
         # ELF file without a '_dt_ucode_base_size' symbol
-        if not fdt_select.have_libfdt:
-            return
         try:
             with open(self.TestFile('u_boot_no_ucode_ptr')) as fd:
                 TestFunctional._MakeInputFile('u-boot', fd.read())
 
             with self.assertRaises(ValueError) as e:
-                self._RunPackUbootSingleMicrocode(False)
+                self._RunPackUbootSingleMicrocode()
             self.assertIn("Node '/binman/u-boot-with-ucode-ptr': Cannot locate "
                     "_dt_ucode_base_size symbol in u-boot", str(e.exception))
 
diff --git a/tools/binman/test/45_prop_test.dts b/tools/binman/test/45_prop_test.dts
new file mode 100644 (file)
index 0000000..d22e460
--- /dev/null
@@ -0,0 +1,23 @@
+/dts-v1/;
+
+/ {
+       #address-cells = <1>;
+       #size-cells = <1>;
+
+       binman {
+               sort-by-pos;
+               end-at-4gb;
+               size = <16>;
+               intel-me {
+                       filename = "me.bin";
+                       pos-unset;
+                       intval = <3>;
+                       intarray = <5 6>;
+                       byteval = [08];
+                       bytearray = [01 23 34];
+                       longbytearray = [09 0a 0b 0c];
+                       stringval = "message2";
+                       stringarray = "another", "multi-word", "message";
+               };
+       };
+};
index 2e0b9c04e209e2b9b5297886c66152445b34b676..08e35f148c0d9828b4e3118d230c57abe498676d 100755 (executable)
@@ -17,7 +17,6 @@ our_path = os.path.dirname(os.path.realpath(__file__))
 sys.path.append(os.path.join(our_path, '../patman'))
 
 import fdt
-import fdt_select
 import fdt_util
 
 # When we see these properties we ignore them - i.e. do not create a structure member
@@ -170,7 +169,7 @@ class DtbPlatdata:
         Once this is done, self.fdt.GetRoot() can be called to obtain the
         device tree root node, and progress from there.
         """
-        self.fdt = fdt_select.FdtScan(self._dtb_fname)
+        self.fdt = fdt.FdtScan(self._dtb_fname)
 
     def ScanNode(self, root):
         for node in root.subnodes:
index 816fdbe5258523a0c9f8074bd463229a9f60d302..63a32ea2d7bfcaeb9897406a986ff8dc65ac61c5 100644 (file)
@@ -10,12 +10,15 @@ import struct
 import sys
 
 import fdt_util
+import libfdt
 
 # This deals with a device tree, presenting it as an assortment of Node and
 # Prop objects, representing nodes and properties, respectively. This file
-# contains the base classes and defines the high-level API. Most of the
-# implementation is in the FdtFallback and FdtNormal subclasses. See
-# fdt_select.py for how to create an Fdt object.
+# contains the base classes and defines the high-level API. You can use
+# FdtScan() as a convenience function to create and scan an Fdt.
+
+# This implementation uses a libfdt Python library to access the device tree,
+# so it is fairly efficient.
 
 # A list of types we support
 (TYPE_BYTE, TYPE_INT, TYPE_STRING, TYPE_BOOL) = range(4)
@@ -25,7 +28,7 @@ def CheckErr(errnum, msg):
         raise ValueError('Error %d: %s: %s' %
             (errnum, libfdt.fdt_strerror(errnum), msg))
 
-class PropBase:
+class Prop:
     """A device tree property
 
     Properties:
@@ -34,11 +37,17 @@ class PropBase:
             bytes
         type: Value type
     """
-    def __init__(self, node, offset, name):
+    def __init__(self, node, offset, name, bytes):
         self._node = node
         self._offset = offset
         self.name = name
         self.value = None
+        self.bytes = str(bytes)
+        if not bytes:
+            self.type = TYPE_BOOL
+            self.value = True
+            return
+        self.type, self.value = self.BytesToValue(bytes)
 
     def GetPhandle(self):
         """Get a (single) phandle value from a property
@@ -96,6 +105,7 @@ class PropBase:
                     TYPE_INT: a byte-swapped integer stored as a 4-byte string
                     TYPE_BYTE: a byte stored as a single-byte string
         """
+        bytes = str(bytes)
         size = len(bytes)
         strings = bytes.split('\0')
         is_string = True
@@ -147,15 +157,12 @@ class PropBase:
     def GetOffset(self):
         """Get the offset of a property
 
-        This can be implemented by subclasses.
-
         Returns:
-            The offset of the property (struct fdt_property) within the
-            file, or None if not known.
+            The offset of the property (struct fdt_property) within the file
         """
-        return None
+        return self._node._fdt.GetStructOffset(self._offset)
 
-class NodeBase:
+class Node:
     """A device tree node
 
     Properties:
@@ -188,25 +195,65 @@ class NodeBase:
                 return subnode
         return None
 
+    def Offset(self):
+        """Returns the offset of a node, after checking the cache
+
+        This should be used instead of self._offset directly, to ensure that
+        the cache does not contain invalid offsets.
+        """
+        self._fdt.CheckCache()
+        return self._offset
+
     def Scan(self):
-        """Scan the subnodes of a node
+        """Scan a node's properties and subnodes
 
-        This should be implemented by subclasses
+        This fills in the props and subnodes properties, recursively
+        searching into subnodes so that the entire tree is built.
         """
-        raise NotImplementedError()
+        self.props = self._fdt.GetProps(self)
+
+        offset = libfdt.fdt_first_subnode(self._fdt.GetFdt(), self.Offset())
+        while offset >= 0:
+            sep = '' if self.path[-1] == '/' else '/'
+            name = self._fdt._fdt_obj.get_name(offset)
+            path = self.path + sep + name
+            node = Node(self._fdt, offset, name, path)
+            self.subnodes.append(node)
+
+            node.Scan()
+            offset = libfdt.fdt_next_subnode(self._fdt.GetFdt(), offset)
+
+    def Refresh(self, my_offset):
+        """Fix up the _offset for each node, recursively
+
+        Note: This does not take account of property offsets - these will not
+        be updated.
+        """
+        if self._offset != my_offset:
+            #print '%s: %d -> %d\n' % (self.path, self._offset, my_offset)
+            self._offset = my_offset
+        offset = libfdt.fdt_first_subnode(self._fdt.GetFdt(), self._offset)
+        for subnode in self.subnodes:
+            subnode.Refresh(offset)
+            offset = libfdt.fdt_next_subnode(self._fdt.GetFdt(), offset)
 
     def DeleteProp(self, prop_name):
         """Delete a property of a node
 
-        This should be implemented by subclasses
+        The property is deleted and the offset cache is invalidated.
 
         Args:
             prop_name: Name of the property to delete
+        Raises:
+            ValueError if the property does not exist
         """
-        raise NotImplementedError()
+        CheckErr(libfdt.fdt_delprop(self._fdt.GetFdt(), self.Offset(), prop_name),
+                 "Node '%s': delete property: '%s'" % (self.path, prop_name))
+        del self.props[prop_name]
+        self._fdt.Invalidate()
 
 class Fdt:
-    """Provides simple access to a flat device tree blob.
+    """Provides simple access to a flat device tree blob using libfdts.
 
     Properties:
       fname: Filename of fdt
@@ -214,6 +261,13 @@ class Fdt:
     """
     def __init__(self, fname):
         self._fname = fname
+        self._cached_offsets = False
+        if self._fname:
+            self._fname = fdt_util.EnsureCompiled(self._fname)
+
+            with open(self._fname) as fd:
+                self._fdt = bytearray(fd.read())
+                self._fdt_obj = libfdt.Fdt(self._fdt)
 
     def Scan(self, root='/'):
         """Scan a device tree, building up a tree of Node objects
@@ -255,15 +309,100 @@ class Fdt:
         """Flush device tree changes back to the file
 
         If the device tree has changed in memory, write it back to the file.
-        Subclasses can implement this if needed.
         """
-        pass
+        with open(self._fname, 'wb') as fd:
+            fd.write(self._fdt)
 
     def Pack(self):
         """Pack the device tree down to its minimum size
 
         When nodes and properties shrink or are deleted, wasted space can
-        build up in the device tree binary. Subclasses can implement this
-        to remove that spare space.
+        build up in the device tree binary.
         """
-        pass
+        CheckErr(libfdt.fdt_pack(self._fdt), 'pack')
+        fdt_len = libfdt.fdt_totalsize(self._fdt)
+        del self._fdt[fdt_len:]
+
+    def GetFdt(self):
+        """Get the contents of the FDT
+
+        Returns:
+            The FDT contents as a string of bytes
+        """
+        return self._fdt
+
+    def CheckErr(errnum, msg):
+        if errnum:
+            raise ValueError('Error %d: %s: %s' %
+                (errnum, libfdt.fdt_strerror(errnum), msg))
+
+
+    def GetProps(self, node):
+        """Get all properties from a node.
+
+        Args:
+            node: Full path to node name to look in.
+
+        Returns:
+            A dictionary containing all the properties, indexed by node name.
+            The entries are Prop objects.
+
+        Raises:
+            ValueError: if the node does not exist.
+        """
+        props_dict = {}
+        poffset = libfdt.fdt_first_property_offset(self._fdt, node._offset)
+        while poffset >= 0:
+            p = self._fdt_obj.get_property_by_offset(poffset)
+            prop = Prop(node, poffset, p.name, p.value)
+            props_dict[prop.name] = prop
+
+            poffset = libfdt.fdt_next_property_offset(self._fdt, poffset)
+        return props_dict
+
+    def Invalidate(self):
+        """Mark our offset cache as invalid"""
+        self._cached_offsets = False
+
+    def CheckCache(self):
+        """Refresh the offset cache if needed"""
+        if self._cached_offsets:
+            return
+        self.Refresh()
+        self._cached_offsets = True
+
+    def Refresh(self):
+        """Refresh the offset cache"""
+        self._root.Refresh(0)
+
+    def GetStructOffset(self, offset):
+        """Get the file offset of a given struct offset
+
+        Args:
+            offset: Offset within the 'struct' region of the device tree
+        Returns:
+            Position of @offset within the device tree binary
+        """
+        return libfdt.fdt_off_dt_struct(self._fdt) + offset
+
+    @classmethod
+    def Node(self, fdt, offset, name, path):
+        """Create a new node
+
+        This is used by Fdt.Scan() to create a new node using the correct
+        class.
+
+        Args:
+            fdt: Fdt object
+            offset: Offset of node
+            name: Node name
+            path: Full path to node
+        """
+        node = Node(fdt, offset, name, path)
+        return node
+
+def FdtScan(fname):
+    """Returns a new Fdt object from the implementation we are using"""
+    dtb = Fdt(fname)
+    dtb.Scan()
+    return dtb
diff --git a/tools/dtoc/fdt_fallback.py b/tools/dtoc/fdt_fallback.py
deleted file mode 100644 (file)
index 23e2679..0000000
+++ /dev/null
@@ -1,181 +0,0 @@
-#!/usr/bin/python
-#
-# Copyright (C) 2016 Google, Inc
-# Written by Simon Glass <sjg@chromium.org>
-#
-# SPDX-License-Identifier:      GPL-2.0+
-#
-
-import command
-import fdt
-from fdt import Fdt, NodeBase, PropBase
-import fdt_util
-import sys
-
-# This deals with a device tree, presenting it as a list of Node and Prop
-# objects, representing nodes and properties, respectively.
-#
-# This implementation uses the fdtget tool to access the device tree, so it
-# is not very efficient for larger trees. The tool is called once for each
-# node and property in the tree.
-
-class Prop(PropBase):
-    """A device tree property
-
-    Properties:
-        name: Property name (as per the device tree)
-        value: Property value as a string of bytes, or a list of strings of
-            bytes
-        type: Value type
-    """
-    def __init__(self, node, name, byte_list_str):
-        PropBase.__init__(self, node, 0, name)
-        if not byte_list_str.strip():
-            self.type = fdt.TYPE_BOOL
-            return
-        self.bytes = [chr(int(byte, 16))
-                      for byte in byte_list_str.strip().split(' ')]
-        self.type, self.value = self.BytesToValue(''.join(self.bytes))
-
-
-class Node(NodeBase):
-    """A device tree node
-
-    Properties:
-        name: Device tree node tname
-        path: Full path to node, along with the node name itself
-        _fdt: Device tree object
-        subnodes: A list of subnodes for this node, each a Node object
-        props: A dict of properties for this node, each a Prop object.
-            Keyed by property name
-    """
-    def __init__(self, fdt, offset, name, path):
-        NodeBase.__init__(self, fdt, offset, name, path)
-
-    def Scan(self):
-        """Scan a node's properties and subnodes
-
-        This fills in the props and subnodes properties, recursively
-        searching into subnodes so that the entire tree is built.
-        """
-        for name, byte_list_str in self._fdt.GetProps(self.path).items():
-            prop = Prop(self, name, byte_list_str)
-            self.props[name] = prop
-
-        for name in self._fdt.GetSubNodes(self.path):
-            sep = '' if self.path[-1] == '/' else '/'
-            path = self.path + sep + name
-            node = Node(self._fdt, 0, name, path)
-            self.subnodes.append(node)
-
-            node.Scan()
-
-    def DeleteProp(self, prop_name):
-        """Delete a property of a node
-
-        The property is deleted using fdtput.
-
-        Args:
-            prop_name: Name of the property to delete
-        Raises:
-            CommandError if the property does not exist
-        """
-        args = [self._fdt._fname, '-d', self.path, prop_name]
-        command.Output('fdtput', *args)
-        del self.props[prop_name]
-
-class FdtFallback(Fdt):
-    """Provides simple access to a flat device tree blob using fdtget/fdtput
-
-    Properties:
-        See superclass
-    """
-
-    def __init__(self, fname):
-        Fdt.__init__(self, fname)
-        if self._fname:
-            self._fname = fdt_util.EnsureCompiled(self._fname)
-
-    def GetSubNodes(self, node):
-        """Returns a list of sub-nodes of a given node
-
-        Args:
-            node: Node name to return children from
-
-        Returns:
-            List of children in the node (each a string node name)
-
-        Raises:
-            CmdError: if the node does not exist.
-        """
-        out = command.Output('fdtget', self._fname, '-l', node)
-        return out.strip().splitlines()
-
-    def GetProps(self, node):
-        """Get all properties from a node
-
-        Args:
-            node: full path to node name to look in
-
-        Returns:
-            A dictionary containing all the properties, indexed by node name.
-            The entries are simply strings - no decoding of lists or numbers
-            is done.
-
-        Raises:
-            CmdError: if the node does not exist.
-        """
-        out = command.Output('fdtget', self._fname, node, '-p')
-        props = out.strip().splitlines()
-        props_dict = {}
-        for prop in props:
-            name = prop
-            props_dict[prop] = self.GetProp(node, name)
-        return props_dict
-
-    def GetProp(self, node, prop, default=None, typespec=None):
-        """Get a property from a device tree.
-
-        This looks up the given node and property, and returns the value as a
-        string,
-
-        If the node or property does not exist, this will return the default
-        value.
-
-        Args:
-            node: Full path to node to look up.
-            prop: Property name to look up.
-            default: Default value to return if nothing is present in the fdt,
-                or None to raise in this case. This will be converted to a
-                string.
-            typespec: Type character to use (None for default, 's' for string)
-
-        Returns:
-            string containing the property value.
-
-        Raises:
-            CmdError: if the property does not exist and no default is provided.
-        """
-        args = [self._fname, node, prop, '-t', 'bx']
-        if default is not None:
-          args += ['-d', str(default)]
-        if typespec is not None:
-          args += ['-t', typespec]
-        out = command.Output('fdtget', *args)
-        return out.strip()
-
-    @classmethod
-    def Node(self, fdt, offset, name, path):
-        """Create a new node
-
-        This is used by Fdt.Scan() to create a new node using the correct
-        class.
-
-        Args:
-            fdt: Fdt object
-            offset: Offset of node
-            name: Node name
-            path: Full path to node
-        """
-        node = Node(fdt, offset, name, path)
-        return node
diff --git a/tools/dtoc/fdt_normal.py b/tools/dtoc/fdt_normal.py
deleted file mode 100644 (file)
index cce5c06..0000000
+++ /dev/null
@@ -1,225 +0,0 @@
-#!/usr/bin/python
-#
-# Copyright (C) 2016 Google, Inc
-# Written by Simon Glass <sjg@chromium.org>
-#
-# SPDX-License-Identifier:      GPL-2.0+
-#
-
-import struct
-import sys
-
-import fdt
-from fdt import Fdt, NodeBase, PropBase
-import fdt_util
-import libfdt
-
-# This deals with a device tree, presenting it as a list of Node and Prop
-# objects, representing nodes and properties, respectively.
-#
-# This implementation uses a libfdt Python library to access the device tree,
-# so it is fairly efficient.
-
-def CheckErr(errnum, msg):
-    if errnum:
-        raise ValueError('Error %d: %s: %s' %
-            (errnum, libfdt.fdt_strerror(errnum), msg))
-
-class Prop(PropBase):
-    """A device tree property
-
-    Properties:
-        name: Property name (as per the device tree)
-        value: Property value as a string of bytes, or a list of strings of
-            bytes
-        type: Value type
-    """
-    def __init__(self, node, offset, name, bytes):
-        PropBase.__init__(self, node, offset, name)
-        self.bytes = bytes
-        if not bytes:
-            self.type = fdt.TYPE_BOOL
-            self.value = True
-            return
-        self.type, self.value = self.BytesToValue(bytes)
-
-    def GetOffset(self):
-        """Get the offset of a property
-
-        Returns:
-            The offset of the property (struct fdt_property) within the file
-        """
-        return self._node._fdt.GetStructOffset(self._offset)
-
-class Node(NodeBase):
-    """A device tree node
-
-    Properties:
-        offset: Integer offset in the device tree
-        name: Device tree node tname
-        path: Full path to node, along with the node name itself
-        _fdt: Device tree object
-        subnodes: A list of subnodes for this node, each a Node object
-        props: A dict of properties for this node, each a Prop object.
-            Keyed by property name
-    """
-    def __init__(self, fdt, offset, name, path):
-        NodeBase.__init__(self, fdt, offset, name, path)
-
-    def Offset(self):
-        """Returns the offset of a node, after checking the cache
-
-        This should be used instead of self._offset directly, to ensure that
-        the cache does not contain invalid offsets.
-        """
-        self._fdt.CheckCache()
-        return self._offset
-
-    def Scan(self):
-        """Scan a node's properties and subnodes
-
-        This fills in the props and subnodes properties, recursively
-        searching into subnodes so that the entire tree is built.
-        """
-        self.props = self._fdt.GetProps(self)
-
-        offset = libfdt.fdt_first_subnode(self._fdt.GetFdt(), self.Offset())
-        while offset >= 0:
-            sep = '' if self.path[-1] == '/' else '/'
-            name = libfdt.Name(self._fdt.GetFdt(), offset)
-            path = self.path + sep + name
-            node = Node(self._fdt, offset, name, path)
-            self.subnodes.append(node)
-
-            node.Scan()
-            offset = libfdt.fdt_next_subnode(self._fdt.GetFdt(), offset)
-
-    def Refresh(self, my_offset):
-        """Fix up the _offset for each node, recursively
-
-        Note: This does not take account of property offsets - these will not
-        be updated.
-        """
-        if self._offset != my_offset:
-            #print '%s: %d -> %d\n' % (self.path, self._offset, my_offset)
-            self._offset = my_offset
-        offset = libfdt.fdt_first_subnode(self._fdt.GetFdt(), self._offset)
-        for subnode in self.subnodes:
-            subnode.Refresh(offset)
-            offset = libfdt.fdt_next_subnode(self._fdt.GetFdt(), offset)
-
-    def DeleteProp(self, prop_name):
-        """Delete a property of a node
-
-        The property is deleted and the offset cache is invalidated.
-
-        Args:
-            prop_name: Name of the property to delete
-        Raises:
-            ValueError if the property does not exist
-        """
-        CheckErr(libfdt.fdt_delprop(self._fdt.GetFdt(), self.Offset(), prop_name),
-                 "Node '%s': delete property: '%s'" % (self.path, prop_name))
-        del self.props[prop_name]
-        self._fdt.Invalidate()
-
-class FdtNormal(Fdt):
-    """Provides simple access to a flat device tree blob using libfdt.
-
-    Properties:
-        _fdt: Device tree contents (bytearray)
-        _cached_offsets: True if all the nodes have a valid _offset property,
-            False if something has changed to invalidate the offsets
-    """
-    def __init__(self, fname):
-        Fdt.__init__(self, fname)
-        self._cached_offsets = False
-        if self._fname:
-            self._fname = fdt_util.EnsureCompiled(self._fname)
-
-            with open(self._fname) as fd:
-                self._fdt = bytearray(fd.read())
-
-    def GetFdt(self):
-        """Get the contents of the FDT
-
-        Returns:
-            The FDT contents as a string of bytes
-        """
-        return self._fdt
-
-    def Flush(self):
-        """Flush device tree changes back to the file"""
-        with open(self._fname, 'wb') as fd:
-            fd.write(self._fdt)
-
-    def Pack(self):
-        """Pack the device tree down to its minimum size"""
-        CheckErr(libfdt.fdt_pack(self._fdt), 'pack')
-        fdt_len = libfdt.fdt_totalsize(self._fdt)
-        del self._fdt[fdt_len:]
-
-    def GetProps(self, node):
-        """Get all properties from a node.
-
-        Args:
-            node: Full path to node name to look in.
-
-        Returns:
-            A dictionary containing all the properties, indexed by node name.
-            The entries are Prop objects.
-
-        Raises:
-            ValueError: if the node does not exist.
-        """
-        props_dict = {}
-        poffset = libfdt.fdt_first_property_offset(self._fdt, node._offset)
-        while poffset >= 0:
-            dprop, plen = libfdt.fdt_get_property_by_offset(self._fdt, poffset)
-            prop = Prop(node, poffset, libfdt.String(self._fdt, dprop.nameoff),
-                        libfdt.Data(dprop))
-            props_dict[prop.name] = prop
-
-            poffset = libfdt.fdt_next_property_offset(self._fdt, poffset)
-        return props_dict
-
-    def Invalidate(self):
-        """Mark our offset cache as invalid"""
-        self._cached_offsets = False
-
-    def CheckCache(self):
-        """Refresh the offset cache if needed"""
-        if self._cached_offsets:
-            return
-        self.Refresh()
-        self._cached_offsets = True
-
-    def Refresh(self):
-        """Refresh the offset cache"""
-        self._root.Refresh(0)
-
-    def GetStructOffset(self, offset):
-        """Get the file offset of a given struct offset
-
-        Args:
-            offset: Offset within the 'struct' region of the device tree
-        Returns:
-            Position of @offset within the device tree binary
-        """
-        return libfdt.fdt_off_dt_struct(self._fdt) + offset
-
-    @classmethod
-    def Node(self, fdt, offset, name, path):
-        """Create a new node
-
-        This is used by Fdt.Scan() to create a new node using the correct
-        class.
-
-        Args:
-            fdt: Fdt object
-            offset: Offset of node
-            name: Node name
-            path: Full path to node
-        """
-        node = Node(fdt, offset, name, path)
-        return node
diff --git a/tools/dtoc/fdt_select.py b/tools/dtoc/fdt_select.py
deleted file mode 100644 (file)
index ea78c52..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-#!/usr/bin/python
-#
-# Copyright (C) 2016 Google, Inc
-# Written by Simon Glass <sjg@chromium.org>
-#
-# SPDX-License-Identifier:      GPL-2.0+
-#
-
-import fdt_fallback
-
-# Bring in either the normal fdt library (which relies on libfdt) or the
-# fallback one (which uses fdtget and is slower). Both provide the same
-# interface for this file to use.
-try:
-    import fdt_normal
-    have_libfdt = True
-except ImportError:
-    have_libfdt = False
-
-force_fallback = False
-
-def FdtScan(fname, _force_fallback=False):
-    """Returns a new Fdt object from the implementation we are using"""
-    if have_libfdt and not force_fallback and not _force_fallback:
-        dtb = fdt_normal.FdtNormal(fname)
-    else:
-        dtb = fdt_fallback.FdtFallback(fname)
-    dtb.Scan()
-    return dtb
-
-def UseFallback(fallback):
-    global force_fallback
-
-    old_val = force_fallback
-    force_fallback = fallback
-    return old_val