]> git.sur5r.net Git - u-boot/commitdiff
Merge branch 'master' of git://git.denx.de/u-boot-socfpga
authorTom Rini <trini@konsulko.com>
Thu, 9 Feb 2017 03:04:32 +0000 (22:04 -0500)
committerTom Rini <trini@konsulko.com>
Thu, 9 Feb 2017 03:04:32 +0000 (22:04 -0500)
416 files changed:
Kconfig
Makefile
README
api/Kconfig [new file with mode: 0644]
arch/arm/dts/Makefile
arch/arm/dts/k2e-clocks.dtsi [deleted file]
arch/arm/dts/k2e-evm.dts [deleted file]
arch/arm/dts/k2e-netcp.dtsi [deleted file]
arch/arm/dts/k2e.dtsi [deleted file]
arch/arm/dts/k2g-evm.dts [deleted file]
arch/arm/dts/k2g-netcp.dtsi [deleted file]
arch/arm/dts/k2g.dtsi [deleted file]
arch/arm/dts/k2hk-clocks.dtsi [deleted file]
arch/arm/dts/k2hk-evm.dts [deleted file]
arch/arm/dts/k2hk-netcp.dtsi [deleted file]
arch/arm/dts/k2hk.dtsi [deleted file]
arch/arm/dts/k2l-clocks.dtsi [deleted file]
arch/arm/dts/k2l-evm.dts [deleted file]
arch/arm/dts/k2l-netcp.dtsi [deleted file]
arch/arm/dts/k2l.dtsi [deleted file]
arch/arm/dts/keystone-k2e-clocks.dtsi [new file with mode: 0644]
arch/arm/dts/keystone-k2e-evm.dts [new file with mode: 0644]
arch/arm/dts/keystone-k2e-netcp.dtsi [new file with mode: 0644]
arch/arm/dts/keystone-k2e.dtsi [new file with mode: 0644]
arch/arm/dts/keystone-k2g-evm.dts [new file with mode: 0644]
arch/arm/dts/keystone-k2g-netcp.dtsi [new file with mode: 0644]
arch/arm/dts/keystone-k2g.dtsi [new file with mode: 0644]
arch/arm/dts/keystone-k2hk-clocks.dtsi [new file with mode: 0644]
arch/arm/dts/keystone-k2hk-evm.dts [new file with mode: 0644]
arch/arm/dts/keystone-k2hk-netcp.dtsi [new file with mode: 0644]
arch/arm/dts/keystone-k2hk.dtsi [new file with mode: 0644]
arch/arm/dts/keystone-k2l-clocks.dtsi [new file with mode: 0644]
arch/arm/dts/keystone-k2l-evm.dts [new file with mode: 0644]
arch/arm/dts/keystone-k2l-netcp.dtsi [new file with mode: 0644]
arch/arm/dts/keystone-k2l.dtsi [new file with mode: 0644]
arch/arm/lib/crt0_64.S
arch/arm/lib/relocate_64.S
arch/arm/mach-aspeed/ast2500/sdram_ast2500.c
arch/arm/mach-rockchip/rk3288/sdram_rk3288.c
arch/arm/mach-uniphier/Kconfig
arch/nios2/cpu/cpu.c
arch/sandbox/dts/sandbox.dts
arch/x86/Kconfig
arch/x86/Makefile
arch/x86/config.mk
arch/x86/cpu/Makefile
arch/x86/cpu/broadwell/cpu.c
arch/x86/cpu/broadwell/pch.c
arch/x86/cpu/broadwell/pinctrl_broadwell.c
arch/x86/cpu/broadwell/sata.c
arch/x86/cpu/call64.S [deleted file]
arch/x86/cpu/config.mk
arch/x86/cpu/cpu.c
arch/x86/cpu/cpu_x86.c
arch/x86/cpu/i386/Makefile [new file with mode: 0644]
arch/x86/cpu/i386/call64.S [new file with mode: 0644]
arch/x86/cpu/i386/cpu.c [new file with mode: 0644]
arch/x86/cpu/i386/interrupt.c [new file with mode: 0644]
arch/x86/cpu/i386/setjmp.S [new file with mode: 0644]
arch/x86/cpu/intel_common/Makefile
arch/x86/cpu/intel_common/lpc.c
arch/x86/cpu/intel_common/mrc.c
arch/x86/cpu/interrupts.c [deleted file]
arch/x86/cpu/irq.c
arch/x86/cpu/ivybridge/Makefile
arch/x86/cpu/ivybridge/bd82x6x.c
arch/x86/cpu/ivybridge/cpu.c
arch/x86/cpu/ivybridge/lpc.c
arch/x86/cpu/ivybridge/model_206ax.c
arch/x86/cpu/ivybridge/northbridge.c
arch/x86/cpu/ivybridge/sata.c
arch/x86/cpu/ivybridge/sdram.c
arch/x86/cpu/ivybridge/sdram_nop.c [new file with mode: 0644]
arch/x86/cpu/mp_init.c
arch/x86/cpu/qemu/e820.c
arch/x86/cpu/qemu/qemu.c
arch/x86/cpu/setjmp.S [deleted file]
arch/x86/cpu/start.S
arch/x86/cpu/start64.S [new file with mode: 0644]
arch/x86/cpu/turbo.c
arch/x86/cpu/u-boot-64.lds [new file with mode: 0644]
arch/x86/cpu/u-boot-spl.lds [new file with mode: 0644]
arch/x86/cpu/u-boot.lds
arch/x86/cpu/x86_64/Makefile [new file with mode: 0644]
arch/x86/cpu/x86_64/cpu.c [new file with mode: 0644]
arch/x86/cpu/x86_64/interrupts.c [new file with mode: 0644]
arch/x86/cpu/x86_64/setjmp.c [new file with mode: 0644]
arch/x86/dts/chromebook_link.dts
arch/x86/dts/emulation-u-boot.dtsi
arch/x86/dts/qemu-x86_i440fx.dts
arch/x86/dts/qemu-x86_q35.dts
arch/x86/dts/serial.dtsi
arch/x86/dts/u-boot.dtsi
arch/x86/include/asm/acpi_table.h
arch/x86/include/asm/bootparam.h
arch/x86/include/asm/byteorder.h
arch/x86/include/asm/cpu.h
arch/x86/include/asm/fsp/fsp_hob.h
arch/x86/include/asm/global_data.h
arch/x86/include/asm/mp.h
arch/x86/include/asm/mpspec.h
arch/x86/include/asm/posix_types.h
arch/x86/include/asm/sfi.h
arch/x86/include/asm/spl.h [new file with mode: 0644]
arch/x86/include/asm/tables.h
arch/x86/include/asm/types.h
arch/x86/lib/Makefile
arch/x86/lib/acpi_table.c
arch/x86/lib/bios.c
arch/x86/lib/bootm.c
arch/x86/lib/init_helpers.c
arch/x86/lib/interrupts.c
arch/x86/lib/mpspec.c
arch/x86/lib/pinctrl_ich6.c
arch/x86/lib/pirq_routing.c
arch/x86/lib/relocate.c
arch/x86/lib/sfi.c
arch/x86/lib/spl.c [new file with mode: 0644]
arch/x86/lib/tables.c
arch/x86/lib/zimage.c
board/emulation/Kconfig
board/emulation/qemu-x86/Kconfig
board/emulation/qemu-x86/MAINTAINERS
board/google/Kconfig
board/google/chromebook_link/Kconfig
board/google/chromebook_link/MAINTAINERS
board/phytec/pcm052/pcm052.c
board/qualcomm/dragonboard410c/dragonboard410c.c
cmd/.gitignore [new file with mode: 0644]
cmd/Kconfig
cmd/Makefile
cmd/bootm.c
cmd/config.c [new file with mode: 0644]
cmd/license.c
common/board_f.c
common/board_r.c
common/console.c
common/env_sf.c
common/fdt_support.c
common/iomux.c
common/spl/Kconfig
common/spl/spl_spi.c
common/usb_kbd.c
configs/PMC440_defconfig
configs/brxre1_defconfig
configs/chromebook_link64_defconfig [new file with mode: 0644]
configs/chromebook_link_defconfig
configs/dragonboard410c_defconfig
configs/ethernut5_defconfig
configs/hikey_defconfig
configs/icnova-a20-swac_defconfig
configs/k2e_evm_defconfig
configs/k2g_evm_defconfig
configs/k2hk_evm_defconfig
configs/k2l_evm_defconfig
configs/lsxhl_defconfig
configs/qemu-x86_64_defconfig [new file with mode: 0644]
configs/vexpress_aemv8a_dram_defconfig
configs/vexpress_aemv8a_juno_defconfig
configs/vexpress_aemv8a_semi_defconfig
configs/xilinx_zynqmp_ep_defconfig
configs/xilinx_zynqmp_zc1751_xm015_dc1_defconfig
configs/xilinx_zynqmp_zc1751_xm016_dc2_defconfig
configs/xilinx_zynqmp_zc1751_xm018_dc4_defconfig
configs/xilinx_zynqmp_zc1751_xm019_dc5_defconfig
configs/xilinx_zynqmp_zcu102_defconfig
configs/xilinx_zynqmp_zcu102_revB_defconfig
disk/part_efi.c
doc/driver-model/README.txt
doc/driver-model/of-plat.txt
doc/driver-model/spi-howto.txt
drivers/Makefile
drivers/adc/adc-uclass.c
drivers/clk/aspeed/clk_ast2500.c
drivers/clk/at91/clk-generated.c
drivers/clk/at91/pmc.c
drivers/clk/clk-uclass.c
drivers/clk/clk_fixed_rate.c
drivers/clk/clk_pic32.c
drivers/core/device.c
drivers/core/regmap.c
drivers/core/root.c
drivers/core/simple-bus.c
drivers/core/uclass.c
drivers/demo/demo-shape.c
drivers/demo/demo-uclass.c
drivers/gpio/74x164_gpio.c
drivers/gpio/altera_pio.c
drivers/gpio/atmel_pio4.c
drivers/gpio/db8500_gpio.c
drivers/gpio/dwapb_gpio.c
drivers/gpio/gpio-uclass.c
drivers/gpio/intel_broadwell_gpio.c
drivers/gpio/intel_ich6_gpio.c
drivers/gpio/lpc32xx_gpio.c
drivers/gpio/mpc85xx_gpio.c
drivers/gpio/msm_gpio.c
drivers/gpio/omap_gpio.c
drivers/gpio/pca953x_gpio.c
drivers/gpio/pcf8575_gpio.c
drivers/gpio/pic32_gpio.c
drivers/gpio/pm8916_gpio.c
drivers/gpio/s5p_gpio.c
drivers/gpio/sandbox.c
drivers/gpio/sunxi_gpio.c
drivers/gpio/tegra186_gpio.c
drivers/gpio/tegra_gpio.c
drivers/gpio/vybrid_gpio.c
drivers/i2c/at91_i2c.c
drivers/i2c/cros_ec_tunnel.c
drivers/i2c/exynos_hs_i2c.c
drivers/i2c/fsl_i2c.c
drivers/i2c/i2c-gpio.c
drivers/i2c/i2c-uclass.c
drivers/i2c/muxes/i2c-arb-gpio-challenge.c
drivers/i2c/muxes/i2c-mux-uclass.c
drivers/i2c/muxes/pca954x.c
drivers/i2c/mvtwsi.c
drivers/i2c/mxc_i2c.c
drivers/i2c/s3c24x0_i2c.c
drivers/i2c/tegra186_bpmp_i2c.c
drivers/input/cros_ec_keyb.c
drivers/input/i8042.c
drivers/input/tegra-kbc.c
drivers/led/led_gpio.c
drivers/mailbox/mailbox-uclass.c
drivers/misc/cros_ec.c
drivers/misc/cros_ec_i2c.c
drivers/misc/cros_ec_sandbox.c
drivers/misc/i2c_eeprom_emul.c
drivers/misc/qfw.c
drivers/misc/tegra186_bpmp.c
drivers/misc/tegra_car.c
drivers/mmc/atmel_sdhci.c
drivers/mmc/exynos_dw_mmc.c
drivers/mmc/fsl_esdhc.c
drivers/mmc/msm_sdhci.c
drivers/mmc/omap_hsmmc.c
drivers/mmc/pic32_sdhci.c
drivers/mmc/rockchip_dw_mmc.c
drivers/mmc/rockchip_sdhci.c
drivers/mmc/s5p_sdhci.c
drivers/mmc/socfpga_dw_mmc.c
drivers/mmc/tegra_mmc.c
drivers/mmc/uniphier-sd.c
drivers/mmc/xenon_sdhci.c
drivers/mtd/altera_qspi.c
drivers/mtd/cfi_flash.c
drivers/mtd/pic32_flash.c
drivers/mtd/spi/sandbox.c
drivers/mtd/spi/spi_flash.c
drivers/net/ag7xxx.c
drivers/net/altera_tse.c
drivers/net/cpsw-common.c
drivers/net/cpsw.c
drivers/net/designware.c
drivers/net/fec_mxc.c
drivers/net/gmac_rockchip.c
drivers/net/keystone_net.c
drivers/net/macb.c
drivers/net/mvneta.c
drivers/net/mvpp2.c
drivers/net/phy/micrel.c
drivers/net/phy/ti.c
drivers/net/phy/xilinx_phy.c
drivers/net/pic32_eth.c
drivers/net/sandbox-raw.c
drivers/net/sandbox.c
drivers/net/sun8i_emac.c
drivers/net/tsec.c
drivers/net/xilinx_axi_emac.c
drivers/net/xilinx_emaclite.c
drivers/net/zynq_gem.c
drivers/pci/pci-uclass.c
drivers/pci/pci_rom.c
drivers/pci/pci_tegra.c
drivers/pci/pcie_layerscape.c
drivers/pci/pcie_xilinx.c
drivers/phy/marvell/comphy_core.c
drivers/pinctrl/ath79/pinctrl_ar933x.c
drivers/pinctrl/ath79/pinctrl_qca953x.c
drivers/pinctrl/exynos/pinctrl-exynos.c
drivers/pinctrl/meson/pinctrl-meson.c
drivers/pinctrl/mvebu/pinctrl-mvebu.c
drivers/pinctrl/nxp/pinctrl-imx.c
drivers/pinctrl/pinctrl-at91-pio4.c
drivers/pinctrl/pinctrl-generic.c
drivers/pinctrl/pinctrl-uclass.c
drivers/pinctrl/pinctrl_pic32.c
drivers/pinctrl/rockchip/pinctrl_rk3036.c
drivers/pinctrl/rockchip/pinctrl_rk3288.c
drivers/pinctrl/rockchip/pinctrl_rk3399.c
drivers/power/domain/power-domain-uclass.c
drivers/power/pmic/act8846.c
drivers/power/pmic/i2c_pmic_emul.c
drivers/power/pmic/lp873x.c
drivers/power/pmic/max77686.c
drivers/power/pmic/palmas.c
drivers/power/pmic/pfuze100.c
drivers/power/pmic/pmic-uclass.c
drivers/power/pmic/rk808.c
drivers/power/pmic/s5m8767.c
drivers/power/pmic/sandbox.c
drivers/power/pmic/tps65090.c
drivers/power/regulator/fixed.c
drivers/power/regulator/gpio-regulator.c
drivers/power/regulator/palmas_regulator.c
drivers/power/regulator/pwm_regulator.c
drivers/power/regulator/regulator-uclass.c
drivers/pwm/Makefile
drivers/remoteproc/rproc-uclass.c
drivers/remoteproc/ti_power_proc.c
drivers/reset/reset-uclass.c
drivers/serial/altera_uart.c
drivers/serial/ns16550.c
drivers/serial/sandbox.c
drivers/serial/serial_arc.c
drivers/serial/serial_bcm283x_mu.c
drivers/serial/serial_msm.c
drivers/serial/serial_mxc.c
drivers/serial/serial_pic32.c
drivers/serial/serial_pl01x.c
drivers/serial/serial_s5p.c
drivers/serial/serial_sh.c
drivers/serial/serial_uniphier.c
drivers/spi/cadence_qspi.c
drivers/spi/davinci_spi.c
drivers/spi/designware_spi.c
drivers/spi/exynos_spi.c
drivers/spi/fsl_dspi.c
drivers/spi/fsl_qspi.c
drivers/spi/ich.c
drivers/spi/mvebu_a3700_spi.c
drivers/spi/omap3_spi.c
drivers/spi/pic32_spi.c
drivers/spi/rk_spi.c
drivers/spi/soft_spi.c
drivers/spi/spi-uclass.c
drivers/spi/stm32_qspi.c
drivers/spi/tegra114_spi.c
drivers/spi/tegra20_sflash.c
drivers/spi/tegra20_slink.c
drivers/spi/tegra210_qspi.c
drivers/spi/ti_qspi.c
drivers/spi/zynq_qspi.c
drivers/spi/zynq_spi.c
drivers/spmi/spmi-msm.c
drivers/sysreset/sysreset_sandbox.c
drivers/timer/timer-uclass.c
drivers/usb/emul/sandbox_flash.c
drivers/usb/emul/sandbox_hub.c
drivers/usb/host/dwc2.c
drivers/usb/host/ehci-exynos.c
drivers/usb/host/ehci-fsl.c
drivers/usb/host/ehci-mx6.c
drivers/usb/host/ehci-tegra.c
drivers/usb/host/ehci-vf.c
drivers/usb/host/usb-uclass.c
drivers/usb/host/xhci-exynos5.c
drivers/usb/host/xhci-rockchip.c
drivers/usb/musb-new/pic32.c
drivers/usb/musb-new/ti-musb.c
drivers/video/atmel_lcdfb.c
drivers/video/bridge/ps862x.c
drivers/video/broadwell_igd.c
drivers/video/exynos/exynos_dp.c
drivers/video/exynos/exynos_fb.c
drivers/video/ivybridge_igd.c
drivers/video/pwm_backlight.c
drivers/video/rockchip/rk_lvds.c
drivers/video/rockchip/rk_vop.c
drivers/video/sandbox_sdl.c
drivers/video/tegra.c
drivers/video/tegra124/display.c
drivers/video/tegra124/sor.c
include/.gitignore
include/config_cmd_all.h
include/configs/PMC440.h
include/configs/am3517_crane.h
include/configs/am3517_evm.h
include/configs/brxre1.h
include/configs/chromebook_link.h
include/configs/dragonboard410c.h
include/configs/ethernut5.h
include/configs/hikey.h
include/configs/lsxl.h
include/configs/omap3_evm.h
include/configs/qemu-x86.h
include/configs/tao3530.h
include/configs/ti_armv7_keystone2.h
include/configs/uniphier.h
include/configs/vexpress_aemv8a.h
include/configs/xilinx_zynqmp.h
include/dm/device.h
include/smbios.h
lib/smbios.c
scripts/.gitignore
scripts/Kconfig [new file with mode: 0644]
scripts/Makefile
scripts/Makefile.spl
scripts/bin2c.c [new file with mode: 0644]
scripts/check-config.sh
scripts/checkpatch.pl
scripts/config_whitelist.txt
test/dm/spi.c
test/dm/test-fdt.c
tools/Makefile
tools/bin2header.c [deleted file]
tools/binman/etype/u_boot_spl_with_ucode_ptr.py
tools/binman/etype/u_boot_ucode.py
tools/buildman/README
tools/buildman/board.py
tools/buildman/control.py
tools/dtoc/dtoc.py
tools/patman/checkpatch.py
tools/patman/series.py

diff --git a/Kconfig b/Kconfig
index 8f9ea97f3d363322effd260d23de8aefa65201ec..81b4226463ae0635c87b87ad0e946fd307e250e3 100644 (file)
--- a/Kconfig
+++ b/Kconfig
@@ -308,6 +308,8 @@ config ARCH_FIXUP_FDT_MEMORY
 
 endmenu                # Boot images
 
+source "api/Kconfig"
+
 source "common/Kconfig"
 
 source "cmd/Kconfig"
@@ -325,3 +327,5 @@ source "fs/Kconfig"
 source "lib/Kconfig"
 
 source "test/Kconfig"
+
+source "scripts/Kconfig"
index d3222a086cc4ef1f8f250df3d42a0307c78822b1..0b1e8a6f97297e460d7a0c757ac869752aad2cae 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -482,6 +482,13 @@ else
 # Build targets only - this includes vmlinux, arch specific targets, clean
 # targets and others. In general all targets except *config targets.
 
+# Additional helpers built in scripts/
+# Carefully list dependencies so we do not try to build scripts twice
+# in parallel
+PHONY += scripts
+scripts: scripts_basic include/config/auto.conf
+       $(Q)$(MAKE) $(build)=$(@)
+
 ifeq ($(dot-config),1)
 # Read in config
 -include include/config/auto.conf
@@ -829,6 +836,10 @@ cmd_pad_cat = $(cmd_objcopy) && $(append) || rm -f $@
 
 cfg: u-boot.cfg
 
+quiet_cmd_cfgcheck = CFGCHK  $2
+cmd_cfgcheck = $(srctree)/scripts/check-config.sh $2 \
+               $(srctree)/scripts/config_whitelist.txt $(srctree)
+
 all:           $(ALL-y)
 ifeq ($(CONFIG_DM_I2C_COMPAT)$(CONFIG_SANDBOX),y)
        @echo "===================== WARNING ======================"
@@ -840,8 +851,7 @@ endif
        @# Check that this build does not use CONFIG options that we do not
        @# know about unless they are in Kconfig. All the existing CONFIG
        @# options are whitelisted, so new ones should not be added.
-       $(srctree)/scripts/check-config.sh u-boot.cfg \
-               $(srctree)/scripts/config_whitelist.txt ${srctree} 1>&2
+       $(call cmd,cfgcheck,u-boot.cfg)
 
 PHONY += dtbs
 dtbs: dts/dt.dtb
@@ -883,7 +893,7 @@ u-boot.hex u-boot.srec: u-boot FORCE
        $(call if_changed,objcopy)
 
 OBJCOPYFLAGS_u-boot-nodtb.bin := -O binary \
-               $(if $(CONFIG_X86_RESET_VECTOR),-R .start16 -R .resetvec)
+               $(if $(CONFIG_X86_16BIT_INIT),-R .start16 -R .resetvec)
 
 binary_size_check: u-boot-nodtb.bin FORCE
        @file_size=$(shell wc -c u-boot-nodtb.bin | awk '{print $$1}') ; \
@@ -1077,8 +1087,9 @@ quiet_cmd_ldr = LD      $@
 cmd_ldr = $(LD) $(LDFLAGS_$(@F)) \
               $(filter-out FORCE,$^) -o $@
 
-u-boot.rom: u-boot-x86-16bit.bin u-boot.bin FORCE \
-               $(if $(CONFIG_HAVE_REFCODE),refcode.bin)
+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
        $(call if_changed,binman)
 
 OBJCOPYFLAGS_u-boot-x86-16bit.bin := -O binary -j .start16 -j .resetvec
@@ -1417,7 +1428,7 @@ CLEAN_DIRS  += $(MODVERDIR) \
               $(foreach d, spl tpl, $(patsubst %,$d/%, \
                        $(filter-out include, $(shell ls -1 $d 2>/dev/null))))
 
-CLEAN_FILES += include/bmp_logo.h include/bmp_logo_data.h include/license.h \
+CLEAN_FILES += include/bmp_logo.h include/bmp_logo_data.h \
               boot* u-boot* MLO* SPL System.map
 
 # Directories & files removed with 'make mrproper'
@@ -1538,11 +1549,6 @@ tests:
        $(Q)$(MAKE) $(build)=scripts build_docproc
        $(Q)$(MAKE) $(build)=doc/DocBook $@
 
-# Dummies...
-PHONY += prepare scripts
-prepare: ;
-scripts: ;
-
 endif #ifeq ($(config-targets),1)
 endif #ifeq ($(mixed-targets),1)
 
diff --git a/README b/README
index ecb1710d01cca2decd4286f3584e19aecd3026b4..a3d3ecc75c9b7f19a055c2f5f3105750ac96d329 100644 (file)
--- a/README
+++ b/README
@@ -1771,12 +1771,6 @@ The following options need to be configured:
                can be displayed via the splashscreen support or the
                bmp command.
 
-- Do compressing for memory range:
-               CONFIG_CMD_ZIP
-
-               If this option is set, it would use zlib deflate method
-               to compress the specified memory at its best effort.
-
 - Compression support:
                CONFIG_GZIP
 
diff --git a/api/Kconfig b/api/Kconfig
new file mode 100644 (file)
index 0000000..16731d3
--- /dev/null
@@ -0,0 +1,9 @@
+menu "API"
+
+config API
+       bool "Enable U-Boot API"
+       default n
+       help
+         This option enables the U-Boot API. See api/README for more information.
+
+endmenu
index 397a0aec0b77bd8379f7e5c0aa31431108bc2437..2d75f64269343366c43d313cc1c2a1973a4c80cf 100644 (file)
@@ -320,10 +320,10 @@ dtb-$(CONFIG_MX6) += imx6ull-14x14-evk.dtb \
 
 dtb-$(CONFIG_MX7) += imx7-colibri.dtb
 
-dtb-$(CONFIG_SOC_KEYSTONE) += k2hk-evm.dtb \
-       k2l-evm.dtb \
-       k2e-evm.dtb \
-       k2g-evm.dtb
+dtb-$(CONFIG_SOC_KEYSTONE) += keystone-k2hk-evm.dtb \
+       keystone-k2l-evm.dtb \
+       keystone-k2e-evm.dtb \
+       keystone-k2g-evm.dtb
 
 dtb-$(CONFIG_TARGET_SAMA5D2_XPLAINED) += \
        at91-sama5d2_xplained.dtb
diff --git a/arch/arm/dts/k2e-clocks.dtsi b/arch/arm/dts/k2e-clocks.dtsi
deleted file mode 100644 (file)
index d56d68f..0000000
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * Copyright 2014 Texas Instruments, Inc.
- *
- * Keystone 2 Edison SoC specific device tree
- *
- * 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.
- */
-
-clocks {
-       mainpllclk: mainpllclk@2310110 {
-               #clock-cells = <0>;
-               compatible = "ti,keystone,main-pll-clock";
-               clocks = <&refclksys>;
-               reg = <0x02620350 4>, <0x02310110 4>, <0x02310108 4>;
-               reg-names = "control", "multiplier", "post-divider";
-       };
-
-       papllclk: papllclk@2620358 {
-               #clock-cells = <0>;
-               compatible = "ti,keystone,pll-clock";
-               clocks = <&refclkpass>;
-               clock-output-names = "papllclk";
-               reg = <0x02620358 4>;
-               reg-names = "control";
-       };
-
-       ddr3apllclk: ddr3apllclk@2620360 {
-               #clock-cells = <0>;
-               compatible = "ti,keystone,pll-clock";
-               clocks = <&refclkddr3a>;
-               clock-output-names = "ddr-3a-pll-clk";
-               reg = <0x02620360 4>;
-               reg-names = "control";
-       };
-
-       clkusb1: clkusb1 {
-               #clock-cells = <0>;
-               compatible = "ti,keystone,psc-clock";
-               clocks = <&chipclk16>;
-               clock-output-names = "usb1";
-               reg = <0x02350004 0xb00>, <0x02350000 0x400>;
-               reg-names = "control", "domain";
-               domain-id = <0>;
-       };
-
-       clkhyperlink0: clkhyperlink0 {
-               #clock-cells = <0>;
-               compatible = "ti,keystone,psc-clock";
-               clocks = <&chipclk12>;
-               clock-output-names = "hyperlink-0";
-               reg = <0x02350030 0xb00>, <0x02350014 0x400>;
-               reg-names = "control", "domain";
-               domain-id = <5>;
-       };
-
-       clkpcie1: clkpcie1 {
-               #clock-cells = <0>;
-               compatible = "ti,keystone,psc-clock";
-               clocks = <&chipclk12>;
-               clock-output-names = "pcie1";
-               reg = <0x0235006c 0xb00>, <0x02350048 0x400>;
-               reg-names = "control", "domain";
-               domain-id = <18>;
-       };
-
-       clkxge: clkxge {
-               #clock-cells = <0>;
-               compatible = "ti,keystone,psc-clock";
-               clocks = <&chipclk13>;
-               clock-output-names = "xge";
-               reg = <0x023500c8 0xb00>, <0x02350074 0x400>;
-               reg-names = "control", "domain";
-               domain-id = <29>;
-       };
-};
diff --git a/arch/arm/dts/k2e-evm.dts b/arch/arm/dts/k2e-evm.dts
deleted file mode 100644 (file)
index e2c3fb4..0000000
+++ /dev/null
@@ -1,155 +0,0 @@
-/*
- * Copyright 2013-2014 Texas Instruments, Inc.
- *
- * Keystone 2 Edison EVM device tree
- *
- * 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 "keystone.dtsi"
-#include "k2e.dtsi"
-
-/ {
-       compatible =  "ti,k2e-evm","ti,keystone";
-       model = "Texas Instruments Keystone 2 Edison EVM";
-
-       soc {
-
-               clocks {
-                       refclksys: refclksys {
-                               #clock-cells = <0>;
-                               compatible = "fixed-clock";
-                               clock-frequency = <100000000>;
-                               clock-output-names = "refclk-sys";
-                       };
-
-                       refclkpass: refclkpass {
-                               #clock-cells = <0>;
-                               compatible = "fixed-clock";
-                               clock-frequency = <100000000>;
-                               clock-output-names = "refclk-pass";
-                       };
-
-                       refclkddr3a: refclkddr3a {
-                               #clock-cells = <0>;
-                               compatible = "fixed-clock";
-                               clock-frequency = <100000000>;
-                               clock-output-names = "refclk-ddr3a";
-                       };
-               };
-       };
-};
-
-&usb_phy {
-       status = "okay";
-};
-
-&usb {
-       status = "okay";
-};
-
-&usb1_phy {
-       status = "okay";
-};
-
-&usb1 {
-       status = "okay";
-};
-
-&i2c0 {
-       dtt@50 {
-               compatible = "at,24c1024";
-               reg = <0x50>;
-       };
-};
-
-&aemif {
-       cs0 {
-               #address-cells = <2>;
-               #size-cells = <1>;
-               clock-ranges;
-               ranges;
-
-               ti,cs-chipselect = <0>;
-               /* all timings in nanoseconds */
-               ti,cs-min-turnaround-ns = <12>;
-               ti,cs-read-hold-ns = <6>;
-               ti,cs-read-strobe-ns = <23>;
-               ti,cs-read-setup-ns = <9>;
-               ti,cs-write-hold-ns = <8>;
-               ti,cs-write-strobe-ns = <23>;
-               ti,cs-write-setup-ns = <8>;
-
-               nand@0,0 {
-                       compatible = "ti,keystone-nand","ti,davinci-nand";
-                       #address-cells = <1>;
-                       #size-cells = <1>;
-                       reg = <0 0 0x4000000
-                              1 0 0x0000100>;
-
-                       ti,davinci-chipselect = <0>;
-                       ti,davinci-mask-ale = <0x2000>;
-                       ti,davinci-mask-cle = <0x4000>;
-                       ti,davinci-mask-chipsel = <0>;
-                       nand-ecc-mode = "hw";
-                       ti,davinci-ecc-bits = <4>;
-                       nand-on-flash-bbt;
-
-                       partition@0 {
-                               label = "u-boot";
-                               reg = <0x0 0x100000>;
-                               read-only;
-                       };
-
-                       partition@100000 {
-                               label = "params";
-                               reg = <0x100000 0x80000>;
-                               read-only;
-                       };
-
-                       partition@180000 {
-                               label = "ubifs";
-                               reg = <0x180000 0x1FE80000>;
-                       };
-               };
-       };
-};
-
-&spi0 {
-       status = "okay";
-       nor_flash: n25q128a11@0 {
-               #address-cells = <1>;
-               #size-cells = <1>;
-               compatible = "Micron,n25q128a11", "spi-flash";
-               spi-max-frequency = <54000000>;
-               m25p,fast-read;
-               reg = <0>;
-
-               partition@0 {
-                       label = "u-boot-spl";
-                       reg = <0x0 0x80000>;
-                       read-only;
-               };
-
-               partition@1 {
-                       label = "misc";
-                       reg = <0x80000 0xf80000>;
-               };
-       };
-};
-
-&mdio {
-       status = "ok";
-       ethphy0: ethernet-phy@0 {
-               compatible = "marvell,88E1514", "marvell,88E1510", "ethernet-phy-ieee802.3-c22";
-               reg = <0>;
-       };
-
-       ethphy1: ethernet-phy@1 {
-               compatible = "marvell,88E1514", "marvell,88E1510", "ethernet-phy-ieee802.3-c22";
-               reg = <1>;
-       };
-};
diff --git a/arch/arm/dts/k2e-netcp.dtsi b/arch/arm/dts/k2e-netcp.dtsi
deleted file mode 100644 (file)
index b13b3c9..0000000
+++ /dev/null
@@ -1,206 +0,0 @@
-/*
- * Device Tree Source for Keystone 2 Edison Netcp driver
- *
- * Copyright 2015 Texas Instruments, Inc.
- *
- * 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.
- */
-
-qmss: qmss@2a40000 {
-       compatible = "ti,keystone-navigator-qmss";
-       dma-coherent;
-       #address-cells = <1>;
-       #size-cells = <1>;
-       clocks = <&chipclk13>;
-       ranges;
-       queue-range     = <0 0x2000>;
-       linkram0        = <0x100000 0x4000>;
-       linkram1        = <0 0x10000>;
-
-       qmgrs {
-               #address-cells = <1>;
-               #size-cells = <1>;
-               ranges;
-               qmgr0 {
-                       managed-queues = <0 0x2000>;
-                       reg = <0x2a40000 0x20000>,
-                             <0x2a06000 0x400>,
-                             <0x2a02000 0x1000>,
-                             <0x2a03000 0x1000>,
-                             <0x23a80000 0x20000>,
-                             <0x2a80000 0x20000>;
-                       reg-names = "peek", "status", "config",
-                                   "region", "push", "pop";
-               };
-       };
-       queue-pools {
-               qpend {
-                       qpend-0 {
-                               qrange = <658 8>;
-                               interrupts =<0 40 0xf04 0 41 0xf04 0 42 0xf04
-                                            0 43 0xf04 0 44 0xf04 0 45 0xf04
-                                            0 46 0xf04 0 47 0xf04>;
-                       };
-                       qpend-1 {
-                               qrange = <528 16>;
-                               interrupts = <0 48 0xf04 0 49 0xf04 0 50 0xf04
-                                             0 51 0xf04 0 52 0xf04 0 53 0xf04
-                                             0 54 0xf04 0 55 0xf04 0 56 0xf04
-                                             0 57 0xf04 0 58 0xf04 0 59 0xf04
-                                             0 60 0xf04 0 61 0xf04 0 62 0xf04
-                                             0 63 0xf04>;
-                               qalloc-by-id;
-                       };
-                       qpend-2 {
-                               qrange = <544 16>;
-                               interrupts = <0 64 0xf04 0 65 0xf04 0 66 0xf04
-                                             0 59 0xf04 0 68 0xf04 0 69 0xf04
-                                             0 70 0xf04 0 71 0xf04 0 72 0xf04
-                                             0 73 0xf04 0 74 0xf04 0 75 0xf04
-                                             0 76 0xf04 0 77 0xf04 0 78 0xf04
-                                             0 79 0xf04>;
-                       };
-               };
-               general-purpose {
-                       gp-0 {
-                               qrange = <4000 64>;
-                       };
-                       netcp-tx {
-                               qrange = <896 128>;
-                               qalloc-by-id;
-                       };
-               };
-       };
-       descriptor-regions {
-               #address-cells = <1>;
-               #size-cells = <1>;
-               ranges;
-               region-12 {
-                       id = <12>;
-                       region-spec = <8192 128>;       /* num_desc desc_size */
-                       link-index = <0x4000>;
-               };
-       };
-}; /* qmss */
-
-knav_dmas: knav_dmas@0 {
-       compatible = "ti,keystone-navigator-dma";
-       clocks = <&papllclk>;
-       #address-cells = <1>;
-       #size-cells = <1>;
-       ranges;
-       ti,navigator-cloud-address = <0x23a80000 0x23a90000
-                                0x23a80000 0x23a90000>;
-
-       dma_gbe: dma_gbe@0 {
-               reg = <0x24186000 0x100>,
-                         <0x24187000 0x2a0>,
-                         <0x24188000 0xb60>,
-                         <0x24186100 0x80>,
-                         <0x24189000 0x1000>;
-               reg-names = "global", "txchan", "rxchan",
-                               "txsched", "rxflow";
-       };
-};
-
-netcp: netcp@24000000 {
-       reg = <0x2620110 0x8>;
-       reg-names = "efuse";
-       compatible = "ti,netcp-1.0";
-       #address-cells = <1>;
-       #size-cells = <1>;
-
-       /* NetCP address range */
-       ranges = <0 0x24000000 0x1000000>;
-
-       clocks = <&papllclk>, <&clkcpgmac>, <&chipclk12>;
-       dma-coherent;
-
-       ti,navigator-dmas = <&dma_gbe 0>,
-                       <&dma_gbe 8>,
-                       <&dma_gbe 0>;
-       ti,navigator-dma-names = "netrx0", "netrx1", "nettx";
-
-       netcp-devices {
-               #address-cells = <1>;
-               #size-cells = <1>;
-               ranges;
-               gbe@200000 { /* ETHSS */
-                       label = "netcp-gbe";
-                       compatible = "ti,netcp-gbe-9";
-                       reg = <0x200000 0x900>, <0x220000 0x20000>;
-                       /* enable-ale; */
-                       tx-queue = <896>;
-                       tx-channel = "nettx";
-
-                       interfaces {
-                               gbe0: interface-0 {
-                                       slave-port = <0>;
-                                       link-interface  = <1>;
-                                       phy-handle      = <&ethphy0>;
-                               };
-                               gbe1: interface-1 {
-                                       slave-port = <1>;
-                                       link-interface  = <1>;
-                                       phy-handle      = <&ethphy1>;
-                               };
-                       };
-
-                       secondary-slave-ports {
-                               port-2 {
-                                       slave-port = <2>;
-                                       link-interface  = <2>;
-                               };
-                               port-3 {
-                                       slave-port = <3>;
-                                       link-interface  = <2>;
-                               };
-                               port-4 {
-                                       slave-port = <4>;
-                                       link-interface  = <2>;
-                               };
-                               port-5 {
-                                       slave-port = <5>;
-                                       link-interface  = <2>;
-                               };
-                               port-6 {
-                                       slave-port = <6>;
-                                       link-interface  = <2>;
-                               };
-                               port-7 {
-                                       slave-port = <7>;
-                                       link-interface  = <2>;
-                               };
-                       };
-               };
-       };
-
-       netcp-interfaces {
-               interface-0 {
-                       rx-channel = "netrx0";
-                       rx-pool = <1024 12>;
-                       tx-pool = <1024 12>;
-                       rx-queue-depth = <128 128 0 0>;
-                       rx-buffer-size = <1518 4096 0 0>;
-                       rx-queue = <528>;
-                       tx-completion-queue = <530>;
-                       efuse-mac = <1>;
-                       netcp-gbe = <&gbe0>;
-
-               };
-               interface-1 {
-                       rx-channel = "netrx1";
-                       rx-pool = <1024 12>;
-                       tx-pool = <1024 12>;
-                       rx-queue-depth = <128 128 0 0>;
-                       rx-buffer-size = <1518 4096 0 0>;
-                       rx-queue = <529>;
-                       tx-completion-queue = <531>;
-                       efuse-mac = <0>;
-                       local-mac-address = [02 18 31 7e 3e 00];
-                       netcp-gbe = <&gbe1>;
-               };
-       };
-};
diff --git a/arch/arm/dts/k2e.dtsi b/arch/arm/dts/k2e.dtsi
deleted file mode 100644 (file)
index 675fb8e..0000000
+++ /dev/null
@@ -1,147 +0,0 @@
-/*
- * Copyright 2013-2014 Texas Instruments, Inc.
- *
- * Keystone 2 Edison soc device tree
- *
- * 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.
- */
-
-/ {
-       cpus {
-               #address-cells = <1>;
-               #size-cells = <0>;
-
-               interrupt-parent = <&gic>;
-
-               cpu@0 {
-                       compatible = "arm,cortex-a15";
-                       device_type = "cpu";
-                       reg = <0>;
-               };
-
-               cpu@1 {
-                       compatible = "arm,cortex-a15";
-                       device_type = "cpu";
-                       reg = <1>;
-               };
-
-               cpu@2 {
-                       compatible = "arm,cortex-a15";
-                       device_type = "cpu";
-                       reg = <2>;
-               };
-
-               cpu@3 {
-                       compatible = "arm,cortex-a15";
-                       device_type = "cpu";
-                       reg = <3>;
-               };
-       };
-
-       soc {
-               /include/ "k2e-clocks.dtsi"
-
-               usb: usb@2680000 {
-                       interrupts = <GIC_SPI 152 IRQ_TYPE_EDGE_RISING>;
-                       dwc3@2690000 {
-                               interrupts = <GIC_SPI 152 IRQ_TYPE_EDGE_RISING>;
-                       };
-               };
-
-               usb1_phy: usb_phy@2620750 {
-                       compatible = "ti,keystone-usbphy";
-                       #address-cells = <1>;
-                       #size-cells = <1>;
-                       reg = <0x2620750 24>;
-                       status = "disabled";
-               };
-
-               usb1: usb@25000000 {
-                       compatible = "ti,keystone-dwc3";
-                       #address-cells = <1>;
-                       #size-cells = <1>;
-                       reg = <0x25000000 0x10000>;
-                       clocks = <&clkusb1>;
-                       clock-names = "usb";
-                       interrupts = <GIC_SPI 414 IRQ_TYPE_EDGE_RISING>;
-                       ranges;
-                       dma-coherent;
-                       dma-ranges;
-                       status = "disabled";
-
-                       dwc3@25010000 {
-                               compatible = "synopsys,dwc3";
-                               reg = <0x25010000 0x70000>;
-                               interrupts = <GIC_SPI 414 IRQ_TYPE_EDGE_RISING>;
-                               usb-phy = <&usb1_phy>, <&usb1_phy>;
-                       };
-               };
-
-               dspgpio0: keystone_dsp_gpio@02620240 {
-                       compatible = "ti,keystone-dsp-gpio";
-                       gpio-controller;
-                       #gpio-cells = <2>;
-                       gpio,syscon-dev = <&devctrl 0x240>;
-               };
-
-               pcie1: pcie@21020000 {
-                       compatible = "ti,keystone-pcie","snps,dw-pcie";
-                       clocks = <&clkpcie1>;
-                       clock-names = "pcie";
-                       #address-cells = <3>;
-                       #size-cells = <2>;
-                       reg =  <0x21021000 0x2000>, <0x21020000 0x1000>, <0x02620128 4>;
-                       ranges = <0x81000000 0 0 0x23260000 0x4000 0x4000
-                               0x82000000 0 0x60000000 0x60000000 0 0x10000000>;
-
-                       status = "disabled";
-                       device_type = "pci";
-                       num-lanes = <2>;
-
-                       #interrupt-cells = <1>;
-                       interrupt-map-mask = <0 0 0 7>;
-                       interrupt-map = <0 0 0 1 &pcie_intc1 0>, /* INT A */
-                                       <0 0 0 2 &pcie_intc1 1>, /* INT B */
-                                       <0 0 0 3 &pcie_intc1 2>, /* INT C */
-                                       <0 0 0 4 &pcie_intc1 3>; /* INT D */
-
-                       pcie_msi_intc1: msi-interrupt-controller {
-                               interrupt-controller;
-                               #interrupt-cells = <1>;
-                               interrupt-parent = <&gic>;
-                               interrupts = <GIC_SPI 377 IRQ_TYPE_EDGE_RISING>,
-                                       <GIC_SPI 378 IRQ_TYPE_EDGE_RISING>,
-                                       <GIC_SPI 379 IRQ_TYPE_EDGE_RISING>,
-                                       <GIC_SPI 380 IRQ_TYPE_EDGE_RISING>,
-                                       <GIC_SPI 381 IRQ_TYPE_EDGE_RISING>,
-                                       <GIC_SPI 382 IRQ_TYPE_EDGE_RISING>,
-                                       <GIC_SPI 383 IRQ_TYPE_EDGE_RISING>,
-                                       <GIC_SPI 384 IRQ_TYPE_EDGE_RISING>;
-                       };
-
-                       pcie_intc1: legacy-interrupt-controller {
-                               interrupt-controller;
-                               #interrupt-cells = <1>;
-                               interrupt-parent = <&gic>;
-                               interrupts = <GIC_SPI 373 IRQ_TYPE_EDGE_RISING>,
-                                       <GIC_SPI 374 IRQ_TYPE_EDGE_RISING>,
-                                       <GIC_SPI 375 IRQ_TYPE_EDGE_RISING>,
-                                       <GIC_SPI 376 IRQ_TYPE_EDGE_RISING>;
-                       };
-               };
-
-               mdio: mdio@24200f00 {
-                       compatible      = "ti,keystone_mdio", "ti,davinci_mdio";
-                       #address-cells = <1>;
-                       #size-cells = <0>;
-                       reg = <0x24200f00 0x100>;
-                       status = "disabled";
-                       clocks = <&clkcpgmac>;
-                       clock-names = "fck";
-                       bus_freq        = <2500000>;
-               };
-               /include/ "k2e-netcp.dtsi"
-       };
-};
diff --git a/arch/arm/dts/k2g-evm.dts b/arch/arm/dts/k2g-evm.dts
deleted file mode 100644 (file)
index 61d0d55..0000000
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
- * Copyright 2014 Texas Instruments, Inc.
- *
- * Keystone 2 Galileo EVM device tree
- *
- * 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 "k2g.dtsi"
-
-/ {
-       compatible =  "ti,k2g-evm","ti,keystone";
-       model = "Texas Instruments Keystone 2 Galileo EVM";
-
-       chosen {
-               stdout-path = &uart0;
-       };
-};
-
-&mdio {
-       status = "okay";
-       ethphy0: ethernet-phy@0 {
-               reg = <0>;
-               phy-mode = "rgmii-id";
-       };
-};
-
-&gbe0 {
-       phy-handle = <&ethphy0>;
-};
-
-&spi1 {
-       status = "okay";
-
-       spi_nor: flash@0 {
-               #address-cells = <1>;
-               #size-cells = <1>;
-               compatible = "spi-flash";
-               spi-max-frequency = <50000000>;
-               m25p,fast-read;
-               reg = <0>;
-
-               partition@0 {
-                       label = "u-boot-spl";
-                       reg = <0x0 0x80000>;
-                       read-only;
-               };
-
-               partition@1 {
-                       label = "misc";
-                       reg = <0x80000 0xf80000>;
-               };
-       };
-};
-
-&qspi {
-       status = "okay";
-
-        flash0: m25p80@0 {
-                compatible = "s25fl512s","spi-flash";
-                reg = <0>;
-                spi-tx-bus-width = <1>;
-                spi-rx-bus-width = <4>;
-                spi-max-frequency = <96000000>;
-                #address-cells = <1>;
-                #size-cells = <1>;
-                tshsl-ns = <392>;
-                tsd2d-ns = <392>;
-                tchsh-ns = <100>;
-                tslch-ns = <100>;
-               block-size = <18>;
-
-
-                partition@0 {
-                        label = "QSPI.u-boot-spl-os";
-                        reg = <0x00000000 0x00100000>;
-                };
-                partition@1 {
-                        label = "QSPI.u-boot-env";
-                        reg = <0x00100000 0x00040000>;
-                };
-                partition@2 {
-                        label = "QSPI.skern";
-                        reg = <0x00140000 0x0040000>;
-                };
-                partition@3 {
-                        label = "QSPI.pmmc-firmware";
-                        reg = <0x00180000 0x0040000>;
-                };
-                partition@4 {
-                        label = "QSPI.kernel";
-                        reg = <0x001C0000 0x0800000>;
-                };
-                partition@5 {
-                        label = "QSPI.file-system";
-                        reg = <0x009C0000 0x3640000>;
-                };
-        };
-};
-
-&mmc0 {
-       status = "okay";
-};
-
-&mmc1 {
-       status = "okay";
-};
diff --git a/arch/arm/dts/k2g-netcp.dtsi b/arch/arm/dts/k2g-netcp.dtsi
deleted file mode 100644 (file)
index 6f0ff86..0000000
+++ /dev/null
@@ -1,151 +0,0 @@
-/*
- * Device Tree Source for Keystone 2 Galileo Netcp driver
- *
- * Copyright 2015 Texas Instruments, Inc.
- *
- * 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.
- */
-
-qmss: qmss@4020000 {
-       compatible = "ti,keystone-navigator-qmss-l";
-       dma-coherent;
-       #address-cells = <1>;
-       #size-cells = <1>;
-       /* power-domains = <&k2g_pds K2G_DEV_NSS0>; */
-       /* clocks = <&k2g_clks K2G_DEV_NSS0 K2G_DEV_NSS_VCLK>; */
-       clock-names = "nss_vclk";
-       ranges;
-       queue-range     = <0 0x80>;
-       linkram0        = <0x4020000 0x7ff>;
-
-       qmgrs {
-               #address-cells = <1>;
-               #size-cells = <1>;
-               ranges;
-               qmgr0 {
-                       managed-queues = <0 0x80>;
-                       reg = <0x4100000 0x800>,
-                             <0x4040000 0x100>,
-                             <0x4080000 0x800>,
-                             <0x40c0000 0x800>;
-                       reg-names = "peek", "config",
-                                   "region", "push";
-               };
-
-       };
-       queue-pools {
-               qpend {
-                       qpend-0 {
-                               qrange = <77 8>;
-                               interrupts =<0 308 0xf04 0 309 0xf04 0 310 0xf04
-                                            0 311 0xf04 0 312 0xf04 0 313 0xf04
-                                            0 314 0xf04 0 315 0xf04>;
-                               qalloc-by-id;
-                       };
-               };
-               general-purpose {
-                       gp-0 {
-                               qrange = <112 8>;
-                       };
-                       netcp-tx {
-                               qrange = <5 8>;
-                               qalloc-by-id;
-                       };
-               };
-       };
-
-       descriptor-regions {
-               #address-cells = <1>;
-               #size-cells = <1>;
-               ranges;
-               region-12 {
-                       id = <12>;
-                       region-spec = <1023 128>; /* num_desc desc_size */
-                       link-index = <0x400>;
-               };
-       };
-}; /* qmss */
-
-knav_dmas: knav_dmas@0 {
-       compatible = "ti,keystone-navigator-dma";
-       #address-cells = <1>;
-       #size-cells = <1>;
-       /* power-domains = <&k2g_pds K2G_DEV_NSS0>; */
-       /* clocks = <&k2g_clks K2G_DEV_NSS0 K2G_DEV_NSS_VCLK>; */
-       clock-names = "nss_vclk";
-       ranges;
-       ti,navigator-cloud-address = <0x40c0000 0x40c0000 0x40c0000 0x40c0000>;
-
-       dma_gbe: dma_gbe@0 {
-               reg = <0x4010000 0x100>,
-                         <0x4011000 0x2a0>, /* 21 Tx channels */
-                         <0x4012000 0x400>, /* 32 Rx channels */
-                         <0x4010100 0x80>,
-                         <0x4013000 0x400>; /* 32 Rx flows */
-               reg-names = "global", "txchan", "rxchan",
-                               "txsched", "rxflow";
-       };
-
-};
-
-gbe_subsys: subsys@4200000 {
-       compatible = "syscon";
-       reg = <0x4200000 0x100>;
-};
-
-netcp: netcp@4000000 {
-       reg = <0x2620110 0x8>;
-       reg-names = "efuse";
-       compatible = "ti,netcp-1.0";
-       #address-cells = <1>;
-       #size-cells = <1>;
-       /* power-domains = <&k2g_pds K2G_DEV_NSS0>; */
-       /* clocks = <&k2g_clks K2G_DEV_NSS0 K2G_DEV_NSS_ESW_CLK>; */
-       clock-names = "ethss_clk";
-
-       /* NetCP address range */
-       ranges = <0 0x4000000 0x1000000>;
-
-       dma-coherent;
-
-       ti,navigator-dmas = <&dma_gbe 0>, <&dma_gbe 5>;
-       ti,navigator-dma-names = "netrx0", "nettx";
-
-       netcp-devices {
-               #address-cells = <1>;
-               #size-cells = <1>;
-               ranges;
-               gbe@200000 {
-                       label = "netcp-gbe";
-                       compatible = "ti,netcp-gbe-2";
-                       syscon-subsys = <&gbe_subsys>;
-                       reg = <0x200100 0xe00>, <0x220000 0x20000>;
-                       /* enable-ale; */
-                       tx-queue = <5>;
-                       tx-channel = "nettx";
-
-                       interfaces {
-                               gbe0: interface-0 {
-                                       slave-port = <0>;
-                                       link-interface  = <5>;
-                               };
-                       };
-               };
-       };
-
-       netcp-interfaces {
-               interface-0 {
-                       rx-channel = "netrx0";
-                       rx-pool = <512 12>;
-                       tx-pool = <511 12>;
-                       rx-queue-depth = <128 128 0 0>;
-                       rx-buffer-size = <1518 4096 0 0>;
-                       rx-queue = <77>;
-                       tx-completion-queue = <78>;
-                       efuse-mac = <1>;
-                       netcp-gbe = <&gbe0>;
-               };
-       };
-};
diff --git a/arch/arm/dts/k2g.dtsi b/arch/arm/dts/k2g.dtsi
deleted file mode 100644 (file)
index add03b7..0000000
+++ /dev/null
@@ -1,176 +0,0 @@
-/*
- * Copyright 2014 Texas Instruments, Inc.
- *
- * Keystone 2 Galileo soc device tree
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- */
-
-#include <dt-bindings/interrupt-controller/arm-gic.h>
-#include "skeleton.dtsi"
-
-/ {
-       model = "Texas Instruments Keystone 2 SoC";
-       #address-cells = <1>;
-       #size-cells = <1>;
-       interrupt-parent = <&gic>;
-
-       aliases {
-               serial0 = &uart0;
-               spi0 = &spi0;
-               spi1 = &spi1;
-               spi2 = &spi2;
-               spi3 = &spi3;
-               spi4 = &qspi;
-       };
-
-       memory {
-               device_type = "memory";
-               reg = <0x80000000 0x80000000>;
-       };
-
-       cpus {
-               #address-cells = <1>;
-               #size-cells = <0>;
-
-               interrupt-parent = <&gic>;
-
-               cpu@0 {
-                       compatible = "arm,cortex-a15";
-                       device_type = "cpu";
-                       reg = <0>;
-               };
-       };
-
-       gic: interrupt-controller {
-               compatible = "arm,cortex-a15-gic";
-               #interrupt-cells = <3>;
-               interrupt-controller;
-               reg = <0x0 0x02561000 0x0 0x1000>,
-                     <0x0 0x02562000 0x0 0x2000>,
-                     <0x0 0x02564000 0x0 0x1000>,
-                     <0x0 0x02566000 0x0 0x2000>;
-               interrupts = <GIC_PPI 9 (GIC_CPU_MASK_SIMPLE(4) |
-                               IRQ_TYPE_LEVEL_HIGH)>;
-       };
-
-       soc {
-               #address-cells = <1>;
-               #size-cells = <1>;
-               compatible = "ti,keystone","simple-bus";
-               interrupt-parent = <&gic>;
-               ranges;
-
-               uart0: serial@02530c00 {
-                       compatible = "ns16550a";
-                       current-speed = <115200>;
-                       reg-shift = <2>;
-                       reg-io-width = <4>;
-                       reg = <0x02530c00 0x100>;
-                       clock-names = "uart";
-                       interrupts = <GIC_SPI 164 IRQ_TYPE_EDGE_RISING>;
-               };
-
-               mdio: mdio@4200f00 {
-                       compatible      = "ti,keystone_mdio", "ti,davinci_mdio";
-                       #address-cells = <1>;
-                       #size-cells = <0>;
-                       /* power-domains = <&k2g_pds K2G_DEV_NSS0>; */
-                       /* clocks = <&k2g_clks K2G_DEV_NSS0 K2G_DEV_NSS_ESW_CLK>; */
-                       clock-names = "fck";
-                       reg = <0x04200f00 0x100>;
-                       status = "disabled";
-                       bus_freq = <2500000>;
-               };
-
-               qspi: qspi@2940000 {
-                       compatible =  "cadence,qspi";
-                       #address-cells = <1>;
-                       #size-cells = <0>;
-                       reg = <0x02940000 0x1000>,
-                             <0x24000000 0x4000000>;
-                       interrupts = <GIC_SPI 198 IRQ_TYPE_EDGE_RISING>;
-                       num-cs = <4>;
-                       fifo-depth = <256>;
-                       sram-size = <256>;
-                       status = "disabled";
-               };
-
-               #include "k2g-netcp.dtsi"
-
-               pmmc: pmmc@2900000 {
-                       compatible = "ti,power-processor";
-                       reg = <0x02900000 0x40000>;
-                       ti,lpsc_module = <1>;
-               };
-
-               spi0: spi@21805400 {
-                       compatible = "ti,keystone-spi", "ti,dm6441-spi";
-                       reg = <0x21805400 0x200>;
-                       num-cs = <4>;
-                       ti,davinci-spi-intr-line = <0>;
-                       interrupts = <GIC_SPI 64 IRQ_TYPE_EDGE_RISING>;
-                       #address-cells = <1>;
-                       #size-cells = <0>;
-                       status = "disabled";
-               };
-
-               spi1: spi@21805800 {
-                       compatible = "ti,keystone-spi", "ti,dm6441-spi";
-                       reg = <0x21805800 0x200>;
-                       num-cs = <4>;
-                       ti,davinci-spi-intr-line = <0>;
-                       interrupts = <GIC_SPI 66 IRQ_TYPE_EDGE_RISING>;
-                       #address-cells = <1>;
-                       #size-cells = <0>;
-                       status = "disabled";
-               };
-
-               spi2: spi@21805c00 {
-                       compatible = "ti,keystone-spi", "ti,dm6441-spi";
-                       reg = <0x21805C00 0x200>;
-                       num-cs = <4>;
-                       ti,davinci-spi-intr-line = <0>;
-                       interrupts = <GIC_SPI 68 IRQ_TYPE_EDGE_RISING>;
-                       #address-cells = <1>;
-                       #size-cells = <0>;
-                       status = "disabled";
-               };
-
-               spi3: spi@21806000 {
-                       compatible = "ti,keystone-spi", "ti,dm6441-spi";
-                       reg = <0x21806000 0x200>;
-                       num-cs = <4>;
-                       ti,davinci-spi-intr-line = <0>;
-                       interrupts = <GIC_SPI 70 IRQ_TYPE_EDGE_RISING>;
-                       #address-cells = <1>;
-                       #size-cells = <0>;
-                       status = "disabled";
-               };
-
-               mmc0: mmc@23000000 {
-                       compatible = "ti,omap4-hsmmc";
-                       reg = <0x23000000 0x400>;
-                       interrupts = <GIC_SPI 96 IRQ_TYPE_EDGE_RISING>;
-                       bus-width = <4>;
-                       ti,needs-special-reset;
-                       no-1-8-v;
-                       max-frequency = <96000000>;
-                       status = "disabled";
-               };
-
-               mmc1: mmc@23100000 {
-                       compatible = "ti,omap4-hsmmc";
-                       reg = <0x23100000 0x400>;
-                       interrupts = <GIC_SPI 97 IRQ_TYPE_EDGE_RISING>;
-                       bus-width = <8>;
-                       ti,needs-special-reset;
-                       ti,non-removable;
-                       max-frequency = <96000000>;
-                       status = "disabled";
-                       clock-names = "fck";
-               };
-       };
-};
diff --git a/arch/arm/dts/k2hk-clocks.dtsi b/arch/arm/dts/k2hk-clocks.dtsi
deleted file mode 100644 (file)
index af9b719..0000000
+++ /dev/null
@@ -1,425 +0,0 @@
-/*
- * Copyright 2013-2014 Texas Instruments, Inc.
- *
- * Keystone 2 Kepler/Hawking SoC clock nodes
- *
- * 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.
- */
-
-clocks {
-       armpllclk: armpllclk@2620370 {
-               #clock-cells = <0>;
-               compatible = "ti,keystone,pll-clock";
-               clocks = <&refclkarm>;
-               clock-output-names = "arm-pll-clk";
-               reg = <0x02620370 4>;
-               reg-names = "control";
-       };
-
-       mainpllclk: mainpllclk@2310110 {
-               #clock-cells = <0>;
-               compatible = "ti,keystone,main-pll-clock";
-               clocks = <&refclksys>;
-               reg = <0x02620350 4>, <0x02310110 4>, <0x02310108 4>;
-               reg-names = "control", "multiplier", "post-divider";
-       };
-
-       papllclk: papllclk@2620358 {
-               #clock-cells = <0>;
-               compatible = "ti,keystone,pll-clock";
-               clocks = <&refclkpass>;
-               clock-output-names = "papllclk";
-               reg = <0x02620358 4>;
-               reg-names = "control";
-       };
-
-       ddr3apllclk: ddr3apllclk@2620360 {
-               #clock-cells = <0>;
-               compatible = "ti,keystone,pll-clock";
-               clocks = <&refclkddr3a>;
-               clock-output-names = "ddr-3a-pll-clk";
-               reg = <0x02620360 4>;
-               reg-names = "control";
-       };
-
-       ddr3bpllclk: ddr3bpllclk@2620368 {
-               #clock-cells = <0>;
-               compatible = "ti,keystone,pll-clock";
-               clocks = <&refclkddr3b>;
-               clock-output-names = "ddr-3b-pll-clk";
-               reg = <0x02620368 4>;
-               reg-names = "control";
-       };
-
-       clktsip: clktsip {
-               #clock-cells = <0>;
-               compatible = "ti,keystone,psc-clock";
-               clocks = <&chipclk16>;
-               clock-output-names = "tsip";
-               reg = <0x02350000 0xb00>, <0x02350000 0x400>;
-               reg-names = "control", "domain";
-               domain-id = <0>;
-       };
-
-       clksrio: clksrio {
-               #clock-cells = <0>;
-               compatible = "ti,keystone,psc-clock";
-               clocks = <&chipclk1rstiso13>;
-               clock-output-names = "srio";
-               reg = <0x0235002c 0xb00>, <0x02350010 0x400>;
-               reg-names = "control", "domain";
-               domain-id = <4>;
-       };
-
-       clkhyperlink0: clkhyperlink0 {
-               #clock-cells = <0>;
-               compatible = "ti,keystone,psc-clock";
-               clocks = <&chipclk12>;
-               clock-output-names = "hyperlink-0";
-               reg = <0x02350030 0xb00>, <0x02350014 0x400>;
-               reg-names = "control", "domain";
-               domain-id = <5>;
-       };
-
-       clkgem1: clkgem1 {
-               #clock-cells = <0>;
-               compatible = "ti,keystone,psc-clock";
-               clocks = <&chipclk1>;
-               clock-output-names = "gem1";
-               reg = <0x02350040 0xb00>, <0x02350024 0x400>;
-               reg-names = "control", "domain";
-               domain-id = <9>;
-       };
-
-       clkgem2: clkgem2 {
-               #clock-cells = <0>;
-               compatible = "ti,keystone,psc-clock";
-               clocks = <&chipclk1>;
-               clock-output-names = "gem2";
-               reg = <0x02350044 0xb00>, <0x02350028 0x400>;
-               reg-names = "control", "domain";
-               domain-id = <10>;
-       };
-
-       clkgem3: clkgem3 {
-               #clock-cells = <0>;
-               compatible = "ti,keystone,psc-clock";
-               clocks = <&chipclk1>;
-               clock-output-names = "gem3";
-               reg = <0x02350048 0xb00>, <0x0235002c 0x400>;
-               reg-names = "control", "domain";
-               domain-id = <11>;
-       };
-
-       clkgem4: clkgem4 {
-               #clock-cells = <0>;
-               compatible = "ti,keystone,psc-clock";
-               clocks = <&chipclk1>;
-               clock-output-names = "gem4";
-               reg = <0x0235004c 0xb00>, <0x02350030 0x400>;
-               reg-names = "control", "domain";
-               domain-id = <12>;
-       };
-
-       clkgem5: clkgem5 {
-               #clock-cells = <0>;
-               compatible = "ti,keystone,psc-clock";
-               clocks = <&chipclk1>;
-               clock-output-names = "gem5";
-               reg = <0x02350050 0xb00>, <0x02350034 0x400>;
-               reg-names = "control", "domain";
-               domain-id = <13>;
-       };
-
-       clkgem6: clkgem6 {
-               #clock-cells = <0>;
-               compatible = "ti,keystone,psc-clock";
-               clocks = <&chipclk1>;
-               clock-output-names = "gem6";
-               reg = <0x02350054 0xb00>, <0x02350038 0x400>;
-               reg-names = "control", "domain";
-               domain-id = <14>;
-       };
-
-       clkgem7: clkgem7 {
-               #clock-cells = <0>;
-               compatible = "ti,keystone,psc-clock";
-               clocks = <&chipclk1>;
-               clock-output-names = "gem7";
-               reg = <0x02350058 0xb00>, <0x0235003c 0x400>;
-               reg-names = "control", "domain";
-               domain-id = <15>;
-       };
-
-       clkddr31: clkddr31 {
-               #clock-cells = <0>;
-               compatible = "ti,keystone,psc-clock";
-               clocks = <&chipclk13>;
-               clock-output-names = "ddr3-1";
-               reg = <0x02350060 0xb00>, <0x02350040 0x400>;
-               reg-names = "control", "domain";
-               domain-id = <16>;
-       };
-
-       clktac: clktac {
-               #clock-cells = <0>;
-               compatible = "ti,keystone,psc-clock";
-               clocks = <&chipclk13>;
-               clock-output-names = "tac";
-               reg = <0x02350064 0xb00>, <0x02350044 0x400>;
-               reg-names = "control", "domain";
-               domain-id = <17>;
-       };
-
-       clkrac01: clkrac01 {
-               #clock-cells = <0>;
-               compatible = "ti,keystone,psc-clock";
-               clocks = <&chipclk13>;
-               clock-output-names = "rac-01";
-               reg = <0x02350068 0xb00>, <0x02350044 0x400>;
-               reg-names = "control", "domain";
-               domain-id = <17>;
-       };
-
-       clkrac23: clkrac23 {
-               #clock-cells = <0>;
-               compatible = "ti,keystone,psc-clock";
-               clocks = <&chipclk13>;
-               clock-output-names = "rac-23";
-               reg = <0x0235006c 0xb00>, <0x02350048 0x400>;
-               reg-names = "control", "domain";
-               domain-id = <18>;
-       };
-
-       clkfftc0: clkfftc0 {
-               #clock-cells = <0>;
-               compatible = "ti,keystone,psc-clock";
-               clocks = <&chipclk13>;
-               clock-output-names = "fftc-0";
-               reg = <0x02350070 0xb00>, <0x0235004c 0x400>;
-               reg-names = "control", "domain";
-               domain-id = <19>;
-       };
-
-       clkfftc1: clkfftc1 {
-               #clock-cells = <0>;
-               compatible = "ti,keystone,psc-clock";
-               clocks = <&chipclk13>;
-               clock-output-names = "fftc-1";
-               reg = <0x02350074 0xb00>, <0x0235004c 0x400>;
-               reg-names = "control", "domain";
-               domain-id = <19>;
-       };
-
-       clkfftc2: clkfftc2 {
-               #clock-cells = <0>;
-               compatible = "ti,keystone,psc-clock";
-               clocks = <&chipclk13>;
-               clock-output-names = "fftc-2";
-               reg = <0x02350078 0xb00>, <0x02350050 0x400>;
-               reg-names = "control", "domain";
-               domain-id = <20>;
-       };
-
-       clkfftc3: clkfftc3 {
-               #clock-cells = <0>;
-               compatible = "ti,keystone,psc-clock";
-               clocks = <&chipclk13>;
-               clock-output-names = "fftc-3";
-               reg = <0x0235007c 0xb00>, <0x02350050 0x400>;
-               reg-names = "control", "domain";
-               domain-id = <20>;
-       };
-
-       clkfftc4: clkfftc4 {
-               #clock-cells = <0>;
-               compatible = "ti,keystone,psc-clock";
-               clocks = <&chipclk13>;
-               clock-output-names = "fftc-4";
-               reg = <0x02350080 0xb00>, <0x02350050 0x400>;
-               reg-names = "control", "domain";
-               domain-id = <20>;
-       };
-
-       clkfftc5: clkfftc5 {
-               #clock-cells = <0>;
-               compatible = "ti,keystone,psc-clock";
-               clocks = <&chipclk13>;
-               clock-output-names = "fftc-5";
-               reg = <0x02350084 0xb00>, <0x02350050 0x400>;
-               reg-names = "control", "domain";
-               domain-id = <20>;
-       };
-
-       clkaif: clkaif {
-               #clock-cells = <0>;
-               compatible = "ti,keystone,psc-clock";
-               clocks = <&chipclk13>;
-               clock-output-names = "aif";
-               reg = <0x02350088 0xb00>, <0x02350054 0x400>;
-               reg-names = "control", "domain";
-               domain-id = <21>;
-       };
-
-       clktcp3d0: clktcp3d0 {
-               #clock-cells = <0>;
-               compatible = "ti,keystone,psc-clock";
-               clocks = <&chipclk13>;
-               clock-output-names = "tcp3d-0";
-               reg = <0x0235008c 0xb00>, <0x02350058 0x400>;
-               reg-names = "control", "domain";
-               domain-id = <22>;
-       };
-
-       clktcp3d1: clktcp3d1 {
-               #clock-cells = <0>;
-               compatible = "ti,keystone,psc-clock";
-               clocks = <&chipclk13>;
-               clock-output-names = "tcp3d-1";
-               reg = <0x02350090 0xb00>, <0x02350058 0x400>;
-               reg-names = "control", "domain";
-               domain-id = <22>;
-       };
-
-       clktcp3d2: clktcp3d2 {
-               #clock-cells = <0>;
-               compatible = "ti,keystone,psc-clock";
-               clocks = <&chipclk13>;
-               clock-output-names = "tcp3d-2";
-               reg = <0x02350094 0xb00>, <0x0235005c 0x400>;
-               reg-names = "control", "domain";
-               domain-id = <23>;
-       };
-
-       clktcp3d3: clktcp3d3 {
-               #clock-cells = <0>;
-               compatible = "ti,keystone,psc-clock";
-               clocks = <&chipclk13>;
-               clock-output-names = "tcp3d-3";
-               reg = <0x02350098 0xb00>, <0x0235005c 0x400>;
-               reg-names = "control", "domain";
-               domain-id = <23>;
-       };
-
-       clkvcp0: clkvcp0 {
-               #clock-cells = <0>;
-               compatible = "ti,keystone,psc-clock";
-               clocks = <&chipclk13>;
-               clock-output-names = "vcp-0";
-               reg = <0x0235009c 0xb00>, <0x02350060 0x400>;
-               reg-names = "control", "domain";
-               domain-id = <24>;
-       };
-
-       clkvcp1: clkvcp1 {
-               #clock-cells = <0>;
-               compatible = "ti,keystone,psc-clock";
-               clocks = <&chipclk13>;
-               clock-output-names = "vcp-1";
-               reg = <0x023500a0 0xb00>, <0x02350060 0x400>;
-               reg-names = "control", "domain";
-               domain-id = <24>;
-       };
-
-       clkvcp2: clkvcp2 {
-               #clock-cells = <0>;
-               compatible = "ti,keystone,psc-clock";
-               clocks = <&chipclk13>;
-               clock-output-names = "vcp-2";
-               reg = <0x023500a4 0xb00>, <0x02350060 0x400>;
-               reg-names = "control", "domain";
-               domain-id = <24>;
-       };
-
-       clkvcp3: clkvcp3 {
-               #clock-cells = <0>;
-               compatible = "ti,keystone,psc-clock";
-               clocks = <&chipclk13>;
-               clock-output-names = "vcp-3";
-               reg = <0x023500a8 0xb00>, <0x02350060 0x400>;
-               reg-names = "control", "domain";
-               domain-id = <24>;
-       };
-
-       clkvcp4: clkvcp4 {
-               #clock-cells = <0>;
-               compatible = "ti,keystone,psc-clock";
-               clocks = <&chipclk13>;
-               clock-output-names = "vcp-4";
-               reg = <0x023500ac 0xb00>, <0x02350064 0x400>;
-               reg-names = "control", "domain";
-               domain-id = <25>;
-       };
-
-       clkvcp5: clkvcp5 {
-               #clock-cells = <0>;
-               compatible = "ti,keystone,psc-clock";
-               clocks = <&chipclk13>;
-               clock-output-names = "vcp-5";
-               reg = <0x023500b0 0xb00>, <0x02350064 0x400>;
-               reg-names = "control", "domain";
-               domain-id = <25>;
-       };
-
-       clkvcp6: clkvcp6 {
-               #clock-cells = <0>;
-               compatible = "ti,keystone,psc-clock";
-               clocks = <&chipclk13>;
-               clock-output-names = "vcp-6";
-               reg = <0x023500b4 0xb00>, <0x02350064 0x400>;
-               reg-names = "control", "domain";
-               domain-id = <25>;
-       };
-
-       clkvcp7: clkvcp7 {
-               #clock-cells = <0>;
-               compatible = "ti,keystone,psc-clock";
-               clocks = <&chipclk13>;
-               clock-output-names = "vcp-7";
-               reg = <0x023500b8 0xb00>, <0x02350064 0x400>;
-               reg-names = "control", "domain";
-               domain-id = <25>;
-       };
-
-       clkbcp: clkbcp {
-               #clock-cells = <0>;
-               compatible = "ti,keystone,psc-clock";
-               clocks = <&chipclk13>;
-               clock-output-names = "bcp";
-               reg = <0x023500bc 0xb00>, <0x02350068 0x400>;
-               reg-names = "control", "domain";
-               domain-id = <26>;
-       };
-
-       clkdxb: clkdxb {
-               #clock-cells = <0>;
-               compatible = "ti,keystone,psc-clock";
-               clocks = <&chipclk13>;
-               clock-output-names = "dxb";
-               reg = <0x023500c0 0xb00>, <0x0235006c 0x400>;
-               reg-names = "control", "domain";
-               domain-id = <27>;
-       };
-
-       clkhyperlink1: clkhyperlink1 {
-               #clock-cells = <0>;
-               compatible = "ti,keystone,psc-clock";
-               clocks = <&chipclk12>;
-               clock-output-names = "hyperlink-1";
-               reg = <0x023500c4 0xb00>, <0x02350070 0x400>;
-               reg-names = "control", "domain";
-               domain-id = <28>;
-       };
-
-       clkxge: clkxge {
-               #clock-cells = <0>;
-               compatible = "ti,keystone,psc-clock";
-               clocks = <&chipclk13>;
-               clock-output-names = "xge";
-               reg = <0x023500c8 0xb00>, <0x02350074 0x400>;
-               reg-names = "control", "domain";
-               domain-id = <29>;
-       };
-};
diff --git a/arch/arm/dts/k2hk-evm.dts b/arch/arm/dts/k2hk-evm.dts
deleted file mode 100644 (file)
index c5cad2c..0000000
+++ /dev/null
@@ -1,183 +0,0 @@
-/*
- * Copyright 2013-2014 Texas Instruments, Inc.
- *
- * Keystone 2 Kepler/Hawking EVM device tree
- *
- * 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 "keystone.dtsi"
-#include "k2hk.dtsi"
-
-/ {
-       compatible =  "ti,k2hk-evm","ti,keystone";
-       model = "Texas Instruments Keystone 2 Kepler/Hawking EVM";
-
-       soc {
-               clocks {
-                       refclksys: refclksys {
-                               #clock-cells = <0>;
-                               compatible = "fixed-clock";
-                               clock-frequency = <122880000>;
-                               clock-output-names = "refclk-sys";
-                       };
-
-                       refclkpass: refclkpass {
-                               #clock-cells = <0>;
-                               compatible = "fixed-clock";
-                               clock-frequency = <122880000>;
-                               clock-output-names = "refclk-pass";
-                       };
-
-                       refclkarm: refclkarm {
-                               #clock-cells = <0>;
-                               compatible = "fixed-clock";
-                               clock-frequency = <125000000>;
-                               clock-output-names = "refclk-arm";
-                       };
-
-                       refclkddr3a: refclkddr3a {
-                               #clock-cells = <0>;
-                               compatible = "fixed-clock";
-                               clock-frequency = <100000000>;
-                               clock-output-names = "refclk-ddr3a";
-                       };
-
-                       refclkddr3b: refclkddr3b {
-                               #clock-cells = <0>;
-                               compatible = "fixed-clock";
-                               clock-frequency = <100000000>;
-                               clock-output-names = "refclk-ddr3b";
-                       };
-               };
-       };
-
-       leds {
-               compatible = "gpio-leds";
-               debug1_1 {
-                       label = "keystone:green:debug1";
-                       gpios = <&gpio0 12 GPIO_ACTIVE_HIGH>; /* 12 */
-               };
-
-               debug1_2 {
-                       label = "keystone:red:debug1";
-                       gpios = <&gpio0 13 GPIO_ACTIVE_HIGH>; /* 13 */
-               };
-
-               debug2 {
-                       label = "keystone:blue:debug2";
-                       gpios = <&gpio0 14 GPIO_ACTIVE_HIGH>; /* 14 */
-               };
-
-               debug3 {
-                       label = "keystone:blue:debug3";
-                       gpios = <&gpio0 15 GPIO_ACTIVE_HIGH>; /* 15 */
-               };
-       };
-};
-
-&usb_phy {
-       status = "okay";
-};
-
-&usb {
-       status = "okay";
-};
-
-&aemif {
-       cs0 {
-               #address-cells = <2>;
-               #size-cells = <1>;
-               clock-ranges;
-               ranges;
-
-               ti,cs-chipselect = <0>;
-               /* all timings in nanoseconds */
-               ti,cs-min-turnaround-ns = <12>;
-               ti,cs-read-hold-ns = <6>;
-               ti,cs-read-strobe-ns = <23>;
-               ti,cs-read-setup-ns = <9>;
-               ti,cs-write-hold-ns = <8>;
-               ti,cs-write-strobe-ns = <23>;
-               ti,cs-write-setup-ns = <8>;
-
-               nand@0,0 {
-                       compatible = "ti,keystone-nand","ti,davinci-nand";
-                       #address-cells = <1>;
-                       #size-cells = <1>;
-                       reg = <0 0 0x4000000
-                              1 0 0x0000100>;
-
-                       ti,davinci-chipselect = <0>;
-                       ti,davinci-mask-ale = <0x2000>;
-                       ti,davinci-mask-cle = <0x4000>;
-                       ti,davinci-mask-chipsel = <0>;
-                       nand-ecc-mode = "hw";
-                       ti,davinci-ecc-bits = <4>;
-                       nand-on-flash-bbt;
-
-                       partition@0 {
-                               label = "u-boot";
-                               reg = <0x0 0x100000>;
-                               read-only;
-                       };
-
-                       partition@100000 {
-                               label = "params";
-                               reg = <0x100000 0x80000>;
-                               read-only;
-                       };
-
-                       partition@180000 {
-                               label = "ubifs";
-                               reg = <0x180000 0x1fe80000>;
-                       };
-               };
-       };
-};
-
-&i2c0 {
-       dtt@50 {
-               compatible = "at,24c1024";
-               reg = <0x50>;
-       };
-};
-
-&spi0 {
-       status = "okay";
-       nor_flash: n25q128a11@0 {
-               #address-cells = <1>;
-               #size-cells = <1>;
-               compatible = "Micron,n25q128a11", "spi-flash";
-               spi-max-frequency = <54000000>;
-               m25p,fast-read;
-               reg = <0>;
-
-               partition@0 {
-                       label = "u-boot-spl";
-                       reg = <0x0 0x80000>;
-                       read-only;
-               };
-
-               partition@1 {
-                       label = "misc";
-                       reg = <0x80000 0xf80000>;
-               };
-       };
-};
-
-&mdio {
-       status = "ok";
-       ethphy0: ethernet-phy@0 {
-               compatible = "marvell,88E1111", "ethernet-phy-ieee802.3-c22";
-               reg = <0>;
-       };
-
-       ethphy1: ethernet-phy@1 {
-               compatible = "marvell,88E1111", "ethernet-phy-ieee802.3-c22";
-               reg = <1>;
-       };
-};
diff --git a/arch/arm/dts/k2hk-netcp.dtsi b/arch/arm/dts/k2hk-netcp.dtsi
deleted file mode 100644 (file)
index 77a32c3..0000000
+++ /dev/null
@@ -1,208 +0,0 @@
-/*
- * Device Tree Source for Keystone 2 Hawking Netcp driver
- *
- * Copyright 2015 Texas Instruments, Inc.
- *
- * 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.
- */
-
-qmss: qmss@2a40000 {
-       compatible = "ti,keystone-navigator-qmss";
-       dma-coherent;
-       #address-cells = <1>;
-       #size-cells = <1>;
-       clocks = <&chipclk13>;
-       ranges;
-       queue-range     = <0 0x4000>;
-       linkram0        = <0x100000 0x8000>;
-       linkram1        = <0x0 0x10000>;
-
-       qmgrs {
-               #address-cells = <1>;
-               #size-cells = <1>;
-               ranges;
-               qmgr0 {
-                       managed-queues = <0 0x2000>;
-                       reg = <0x2a40000 0x20000>,
-                             <0x2a06000 0x400>,
-                             <0x2a02000 0x1000>,
-                             <0x2a03000 0x1000>,
-                             <0x23a80000 0x20000>,
-                             <0x2a80000 0x20000>;
-                       reg-names = "peek", "status", "config",
-                                   "region", "push", "pop";
-               };
-
-               qmgr1 {
-                       managed-queues = <0x2000 0x2000>;
-                       reg = <0x2a60000 0x20000>,
-                             <0x2a06400 0x400>,
-                             <0x2a04000 0x1000>,
-                             <0x2a05000 0x1000>,
-                             <0x23aa0000 0x20000>,
-                             <0x2aa0000 0x20000>;
-                       reg-names = "peek", "status", "config",
-                                   "region", "push", "pop";
-               };
-       };
-       queue-pools {
-               qpend {
-                       qpend-0 {
-                               qrange = <658 8>;
-                               interrupts =<0 40 0xf04 0 41 0xf04 0 42 0xf04
-                                            0 43 0xf04 0 44 0xf04 0 45 0xf04
-                                            0 46 0xf04 0 47 0xf04>;
-                       };
-                       qpend-1 {
-                               qrange = <8704 16>;
-                               interrupts = <0 48 0xf04 0 49 0xf04 0 50 0xf04
-                                             0 51 0xf04 0 52 0xf04 0 53 0xf04
-                                             0 54 0xf04 0 55 0xf04 0 56 0xf04
-                                             0 57 0xf04 0 58 0xf04 0 59 0xf04
-                                             0 60 0xf04 0 61 0xf04 0 62 0xf04
-                                             0 63 0xf04>;
-                               qalloc-by-id;
-                       };
-                       qpend-2 {
-                               qrange = <8720 16>;
-                               interrupts = <0 64 0xf04 0 65 0xf04 0 66 0xf04
-                                             0 59 0xf04 0 68 0xf04 0 69 0xf04
-                                             0 70 0xf04 0 71 0xf04 0 72 0xf04
-                                             0 73 0xf04 0 74 0xf04 0 75 0xf04
-                                             0 76 0xf04 0 77 0xf04 0 78 0xf04
-                                             0 79 0xf04>;
-                       };
-               };
-               general-purpose {
-                       gp-0 {
-                               qrange = <4000 64>;
-                       };
-                       netcp-tx {
-                               qrange = <640 9>;
-                               qalloc-by-id;
-                       };
-                       netcpx-tx {
-                               qrange = <8752 8>;
-                               qalloc-by-id;
-                       };
-               };
-       };
-       descriptor-regions {
-               #address-cells = <1>;
-               #size-cells = <1>;
-               ranges;
-               region-12 {
-                       id = <12>;
-                       region-spec = <8192 128>;       /* num_desc desc_size */
-                       link-index = <0x4000>;
-               };
-       };
-}; /* qmss */
-
-knav_dmas: knav_dmas@0 {
-       compatible = "ti,keystone-navigator-dma";
-       clocks = <&papllclk>;
-       #address-cells = <1>;
-       #size-cells = <1>;
-       ranges;
-       ti,navigator-cloud-address = <0x23a80000 0x23a90000
-                                  0x23aa0000 0x23ab0000>;
-
-       dma_gbe: dma_gbe@0 {
-               reg = <0x2004000 0x100>,
-                         <0x2004400 0x120>,
-                         <0x2004800 0x300>,
-                         <0x2004c00 0x120>,
-                         <0x2005000 0x400>;
-               reg-names = "global", "txchan", "rxchan",
-                               "txsched", "rxflow";
-       };
-};
-
-netcp: netcp@2000000 {
-       reg = <0x2620110 0x8>;
-       reg-names = "efuse";
-       compatible = "ti,netcp-1.0";
-       #address-cells = <1>;
-       #size-cells = <1>;
-
-       /* NetCP address range */
-       ranges  = <0 0x2000000 0x100000>;
-
-       clocks = <&papllclk>, <&clkcpgmac>, <&chipclk12>;
-       dma-coherent;
-
-       ti,navigator-dmas = <&dma_gbe 22>,
-                       <&dma_gbe 23>,
-                       <&dma_gbe 8>;
-       ti,navigator-dma-names = "netrx0", "netrx1", "nettx";
-
-       netcp-devices {
-               ranges;
-               #address-cells = <1>;
-               #size-cells = <1>;
-               gbe@90000 { /* ETHSS */
-                       #address-cells = <1>;
-                       #size-cells = <1>;
-                       label = "netcp-gbe";
-                       compatible = "ti,netcp-gbe";
-                       reg = <0x90000 0x300>, <0x90400 0x400>, <0x90800 0x700>;
-                       /* enable-ale; */
-                       tx-queue = <648>;
-                       tx-channel = "nettx";
-
-                       interfaces {
-                               gbe0: interface-0 {
-                                       slave-port = <0>;
-                                       link-interface = <1>;
-                                       phy-handle = <&ethphy0>;
-                               };
-                               gbe1: interface-1 {
-                                       slave-port = <1>;
-                                       link-interface = <1>;
-                                       phy-handle = <&ethphy1>;
-                               };
-                       };
-
-                       secondary-slave-ports {
-                               port-2 {
-                                       slave-port = <2>;
-                                       link-interface  = <2>;
-                               };
-                               port-3 {
-                                       slave-port = <3>;
-                                       link-interface  = <2>;
-                               };
-                       };
-               };
-       };
-
-       netcp-interfaces {
-               interface-0 {
-                       rx-channel = "netrx0";
-                       rx-pool = <1024 12>;
-                       tx-pool = <1024 12>;
-                       rx-queue-depth = <128 128 0 0>;
-                       rx-buffer-size = <1518 4096 0 0>;
-                       rx-queue = <8704>;
-                       tx-completion-queue = <8706>;
-                       efuse-mac = <1>;
-                       netcp-gbe = <&gbe0>;
-
-               };
-               interface-1 {
-                       rx-channel = "netrx1";
-                       rx-pool = <1024 12>;
-                       tx-pool = <1024 12>;
-                       rx-queue-depth = <128 128 0 0>;
-                       rx-buffer-size = <1518 4096 0 0>;
-                       rx-queue = <8705>;
-                       tx-completion-queue = <8707>;
-                       efuse-mac = <0>;
-                       local-mac-address = [02 18 31 7e 3e 6f];
-                       netcp-gbe = <&gbe1>;
-               };
-       };
-};
diff --git a/arch/arm/dts/k2hk.dtsi b/arch/arm/dts/k2hk.dtsi
deleted file mode 100644 (file)
index d0810a5..0000000
+++ /dev/null
@@ -1,114 +0,0 @@
-/*
- * Copyright 2013-2014 Texas Instruments, Inc.
- *
- * Keystone 2 Kepler/Hawking soc specific device tree
- *
- * 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.
- */
-
-/ {
-       cpus {
-               #address-cells = <1>;
-               #size-cells = <0>;
-
-               interrupt-parent = <&gic>;
-
-               cpu@0 {
-                       compatible = "arm,cortex-a15";
-                       device_type = "cpu";
-                       reg = <0>;
-               };
-
-               cpu@1 {
-                       compatible = "arm,cortex-a15";
-                       device_type = "cpu";
-                       reg = <1>;
-               };
-
-               cpu@2 {
-                       compatible = "arm,cortex-a15";
-                       device_type = "cpu";
-                       reg = <2>;
-               };
-
-               cpu@3 {
-                       compatible = "arm,cortex-a15";
-                       device_type = "cpu";
-                       reg = <3>;
-               };
-       };
-
-       soc {
-               /include/ "k2hk-clocks.dtsi"
-
-               dspgpio0: keystone_dsp_gpio@02620240 {
-                       compatible = "ti,keystone-dsp-gpio";
-                       gpio-controller;
-                       #gpio-cells = <2>;
-                       gpio,syscon-dev = <&devctrl 0x240>;
-               };
-
-               dspgpio1: keystone_dsp_gpio@2620244 {
-                       compatible = "ti,keystone-dsp-gpio";
-                       gpio-controller;
-                       #gpio-cells = <2>;
-                       gpio,syscon-dev = <&devctrl 0x244>;
-               };
-
-               dspgpio2: keystone_dsp_gpio@2620248 {
-                       compatible = "ti,keystone-dsp-gpio";
-                       gpio-controller;
-                       #gpio-cells = <2>;
-                       gpio,syscon-dev = <&devctrl 0x248>;
-               };
-
-               dspgpio3: keystone_dsp_gpio@262024c {
-                       compatible = "ti,keystone-dsp-gpio";
-                       gpio-controller;
-                       #gpio-cells = <2>;
-                       gpio,syscon-dev = <&devctrl 0x24c>;
-               };
-
-               dspgpio4: keystone_dsp_gpio@2620250 {
-                       compatible = "ti,keystone-dsp-gpio";
-                       gpio-controller;
-                       #gpio-cells = <2>;
-                       gpio,syscon-dev = <&devctrl 0x250>;
-               };
-
-               dspgpio5: keystone_dsp_gpio@2620254 {
-                       compatible = "ti,keystone-dsp-gpio";
-                       gpio-controller;
-                       #gpio-cells = <2>;
-                       gpio,syscon-dev = <&devctrl 0x254>;
-               };
-
-               dspgpio6: keystone_dsp_gpio@2620258 {
-                       compatible = "ti,keystone-dsp-gpio";
-                       gpio-controller;
-                       #gpio-cells = <2>;
-                       gpio,syscon-dev = <&devctrl 0x258>;
-               };
-
-               dspgpio7: keystone_dsp_gpio@262025c {
-                       compatible = "ti,keystone-dsp-gpio";
-                       gpio-controller;
-                       #gpio-cells = <2>;
-                       gpio,syscon-dev = <&devctrl 0x25c>;
-               };
-
-               mdio: mdio@02090300 {
-                       compatible      = "ti,keystone_mdio", "ti,davinci_mdio";
-                       #address-cells = <1>;
-                       #size-cells = <0>;
-                       reg = <0x02090300 0x100>;
-                       status = "disabled";
-                       clocks = <&clkcpgmac>;
-                       clock-names = "fck";
-                       bus_freq        = <2500000>;
-               };
-               /include/ "k2hk-netcp.dtsi"
-       };
-};
diff --git a/arch/arm/dts/k2l-clocks.dtsi b/arch/arm/dts/k2l-clocks.dtsi
deleted file mode 100644 (file)
index ef8464b..0000000
+++ /dev/null
@@ -1,266 +0,0 @@
-/*
- * Copyright 2013-2014 Texas Instruments, Inc.
- *
- * Keystone 2 lamarr SoC clock nodes
- *
- * 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.
- */
-
-clocks {
-       armpllclk: armpllclk@2620370 {
-               #clock-cells = <0>;
-               compatible = "ti,keystone,pll-clock";
-               clocks = <&refclksys>;
-               clock-output-names = "arm-pll-clk";
-               reg = <0x02620370 4>;
-               reg-names = "control";
-       };
-
-       mainpllclk: mainpllclk@2310110 {
-               #clock-cells = <0>;
-               compatible = "ti,keystone,main-pll-clock";
-               clocks = <&refclksys>;
-               reg = <0x02620350 4>, <0x02310110 4>, <0x02310108 4>;
-               reg-names = "control", "multiplier", "post-divider";
-       };
-
-       papllclk: papllclk@2620358 {
-               #clock-cells = <0>;
-               compatible = "ti,keystone,pll-clock";
-               clocks = <&refclksys>;
-               clock-output-names = "papllclk";
-               reg = <0x02620358 4>;
-               reg-names = "control";
-       };
-
-       ddr3apllclk: ddr3apllclk@2620360 {
-               #clock-cells = <0>;
-               compatible = "ti,keystone,pll-clock";
-               clocks = <&refclksys>;
-               clock-output-names = "ddr-3a-pll-clk";
-               reg = <0x02620360 4>;
-               reg-names = "control";
-       };
-
-       clkdfeiqnsys: clkdfeiqnsys {
-               #clock-cells = <0>;
-               compatible = "ti,keystone,psc-clock";
-               clocks = <&chipclk12>;
-               clock-output-names = "dfe";
-               reg-names = "control", "domain";
-               reg = <0x02350004 0xb00>, <0x02350000 0x400>;
-               domain-id = <0>;
-       };
-
-       clkpcie1: clkpcie1 {
-               #clock-cells = <0>;
-               compatible = "ti,keystone,psc-clock";
-               clocks = <&chipclk12>;
-               clock-output-names = "pcie";
-               reg = <0x0235002c 0xb00>, <0x02350000 0x400>;
-               reg-names = "control", "domain";
-               domain-id = <4>;
-       };
-
-       clkgem1: clkgem1 {
-               #clock-cells = <0>;
-               compatible = "ti,keystone,psc-clock";
-               clocks = <&chipclk1>;
-               clock-output-names = "gem1";
-               reg = <0x02350040 0xb00>, <0x02350024 0x400>;
-               reg-names = "control", "domain";
-               domain-id = <9>;
-       };
-
-       clkgem2: clkgem2 {
-               #clock-cells = <0>;
-               compatible = "ti,keystone,psc-clock";
-               clocks = <&chipclk1>;
-               clock-output-names = "gem2";
-               reg = <0x02350044 0xb00>, <0x02350028 0x400>;
-               reg-names = "control", "domain";
-               domain-id = <10>;
-       };
-
-       clkgem3: clkgem3 {
-               #clock-cells = <0>;
-               compatible = "ti,keystone,psc-clock";
-               clocks = <&chipclk1>;
-               clock-output-names = "gem3";
-               reg = <0x02350048 0xb00>, <0x0235002c 0x400>;
-               reg-names = "control", "domain";
-               domain-id = <11>;
-       };
-
-       clktac: clktac {
-               #clock-cells = <0>;
-               compatible = "ti,keystone,psc-clock";
-               clocks = <&chipclk13>;
-               clock-output-names = "tac";
-               reg = <0x02350064 0xb00>, <0x02350044 0x400>;
-               reg-names = "control", "domain";
-               domain-id = <17>;
-       };
-
-       clkrac: clkrac {
-               #clock-cells = <0>;
-               compatible = "ti,keystone,psc-clock";
-               clocks = <&chipclk13>;
-               clock-output-names = "rac";
-               reg = <0x02350068 0xb00>, <0x02350044 0x400>;
-               reg-names = "control", "domain";
-               domain-id = <17>;
-       };
-
-       clkdfepd0: clkdfepd0 {
-               #clock-cells = <0>;
-               compatible = "ti,keystone,psc-clock";
-               clocks = <&chipclk13>;
-               clock-output-names = "dfe-pd0";
-               reg = <0x0235006c 0xb00>, <0x02350044 0x400>;
-               reg-names = "control", "domain";
-               domain-id = <18>;
-       };
-
-       clkfftc0: clkfftc0 {
-               #clock-cells = <0>;
-               compatible = "ti,keystone,psc-clock";
-               clocks = <&chipclk13>;
-               clock-output-names = "fftc-0";
-               reg = <0x02350070 0xb00>, <0x0235004c 0x400>;
-               reg-names = "control", "domain";
-               domain-id = <19>;
-       };
-
-       clkosr: clkosr {
-               #clock-cells = <0>;
-               compatible = "ti,keystone,psc-clock";
-               clocks = <&chipclk13>;
-               clock-output-names = "osr";
-               reg = <0x02350088 0xb00>, <0x0235004c 0x400>;
-               reg-names = "control", "domain";
-               domain-id = <21>;
-       };
-
-       clktcp3d0: clktcp3d0 {
-               #clock-cells = <0>;
-               compatible = "ti,keystone,psc-clock";
-               clocks = <&chipclk13>;
-               clock-output-names = "tcp3d-0";
-               reg = <0x0235008c 0xb00>, <0x02350058 0x400>;
-               reg-names = "control", "domain";
-               domain-id = <22>;
-       };
-
-       clktcp3d1: clktcp3d1 {
-               #clock-cells = <0>;
-               compatible = "ti,keystone,psc-clock";
-               clocks = <&chipclk13>;
-               clock-output-names = "tcp3d-1";
-               reg = <0x02350094 0xb00>, <0x02350058 0x400>;
-               reg-names = "control", "domain";
-               domain-id = <23>;
-       };
-
-       clkvcp0: clkvcp0 {
-               #clock-cells = <0>;
-               compatible = "ti,keystone,psc-clock";
-               clocks = <&chipclk13>;
-               clock-output-names = "vcp-0";
-               reg = <0x0235009c 0xb00>, <0x02350060 0x400>;
-               reg-names = "control", "domain";
-               domain-id = <24>;
-       };
-
-       clkvcp1: clkvcp1 {
-               #clock-cells = <0>;
-               compatible = "ti,keystone,psc-clock";
-               clocks = <&chipclk13>;
-               clock-output-names = "vcp-1";
-               reg = <0x023500a0 0xb00>, <0x02350060 0x400>;
-               reg-names = "control", "domain";
-               domain-id = <24>;
-       };
-
-       clkvcp2: clkvcp2 {
-               #clock-cells = <0>;
-               compatible = "ti,keystone,psc-clock";
-               clocks = <&chipclk13>;
-               clock-output-names = "vcp-2";
-               reg = <0x023500a4 0xb00>, <0x02350060 0x400>;
-               reg-names = "control", "domain";
-               domain-id = <24>;
-       };
-
-       clkvcp3: clkvcp3 {
-               #clock-cells = <0>;
-               compatible = "ti,keystone,psc-clock";
-               clocks = <&chipclk13>;
-               clock-output-names = "vcp-3";
-               reg = <0x023500a8 0xb00>, <0x02350060 0x400>;
-               reg-names = "control", "domain";
-               domain-id = <24>;
-       };
-
-       clkbcp: clkbcp {
-               #clock-cells = <0>;
-               compatible = "ti,keystone,psc-clock";
-               clocks = <&chipclk13>;
-               clock-output-names = "bcp";
-               reg = <0x023500bc 0xb00>, <0x02350068 0x400>;
-               reg-names = "control", "domain";
-               domain-id = <26>;
-       };
-
-       clkdfepd1: clkdfepd1 {
-               #clock-cells = <0>;
-               compatible = "ti,keystone,psc-clock";
-               clocks = <&chipclk13>;
-               clock-output-names = "dfe-pd1";
-               reg = <0x023500c0 0xb00>, <0x02350044 0x400>;
-               reg-names = "control", "domain";
-               domain-id = <27>;
-       };
-
-       clkfftc1: clkfftc1 {
-               #clock-cells = <0>;
-               compatible = "ti,keystone,psc-clock";
-               clocks = <&chipclk13>;
-               clock-output-names = "fftc-1";
-               reg = <0x023500c4 0xb00>, <0x023504c0 0x400>;
-               reg-names = "control", "domain";
-               domain-id = <28>;
-       };
-
-       clkiqnail: clkiqnail {
-               #clock-cells = <0>;
-               compatible = "ti,keystone,psc-clock";
-               clocks = <&chipclk13>;
-               clock-output-names = "iqn-ail";
-               reg = <0x023500c8 0xb00>, <0x0235004c 0x400>;
-               reg-names = "control", "domain";
-               domain-id = <29>;
-       };
-
-       clkuart2: clkuart2 {
-               #clock-cells = <0>;
-               compatible = "ti,keystone,psc-clock";
-               clocks = <&clkmodrst0>;
-               clock-output-names = "uart2";
-               reg = <0x02350000 0xb00>, <0x02350000 0x400>;
-               reg-names = "control", "domain";
-               domain-id = <0>;
-       };
-
-       clkuart3: clkuart3 {
-               #clock-cells = <0>;
-               compatible = "ti,keystone,psc-clock";
-               clocks = <&clkmodrst0>;
-               clock-output-names = "uart3";
-               reg = <0x02350000 0xb00>, <0x02350000 0x400>;
-               reg-names = "control", "domain";
-               domain-id = <0>;
-       };
-};
diff --git a/arch/arm/dts/k2l-evm.dts b/arch/arm/dts/k2l-evm.dts
deleted file mode 100644 (file)
index da0661b..0000000
+++ /dev/null
@@ -1,132 +0,0 @@
-/*
- * Copyright 2014 Texas Instruments, Inc.
- *
- * Keystone 2 Lamarr EVM device tree
- *
- * 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 "keystone.dtsi"
-#include "k2l.dtsi"
-
-/ {
-       compatible =  "ti,k2l-evm","ti,keystone";
-       model = "Texas Instruments Keystone 2 Lamarr EVM";
-
-       soc {
-               clocks {
-                       refclksys: refclksys {
-                               #clock-cells = <0>;
-                               compatible = "fixed-clock";
-                               clock-frequency = <122880000>;
-                               clock-output-names = "refclk-sys";
-                       };
-               };
-       };
-};
-
-&usb_phy {
-       status = "okay";
-};
-
-&usb {
-       status = "okay";
-};
-
-&i2c0 {
-       dtt@50 {
-               compatible = "at,24c1024";
-               reg = <0x50>;
-       };
-};
-
-&aemif {
-       cs0 {
-               #address-cells = <2>;
-               #size-cells = <1>;
-               clock-ranges;
-               ranges;
-
-               ti,cs-chipselect = <0>;
-               /* all timings in nanoseconds */
-               ti,cs-min-turnaround-ns = <12>;
-               ti,cs-read-hold-ns = <6>;
-               ti,cs-read-strobe-ns = <23>;
-               ti,cs-read-setup-ns = <9>;
-               ti,cs-write-hold-ns = <8>;
-               ti,cs-write-strobe-ns = <23>;
-               ti,cs-write-setup-ns = <8>;
-
-               nand@0,0 {
-                       compatible = "ti,keystone-nand","ti,davinci-nand";
-                       #address-cells = <1>;
-                       #size-cells = <1>;
-                       reg = <0 0 0x4000000
-                              1 0 0x0000100>;
-
-                       ti,davinci-chipselect = <0>;
-                       ti,davinci-mask-ale = <0x2000>;
-                       ti,davinci-mask-cle = <0x4000>;
-                       ti,davinci-mask-chipsel = <0>;
-                       nand-ecc-mode = "hw";
-                       ti,davinci-ecc-bits = <4>;
-                       nand-on-flash-bbt;
-
-                       partition@0 {
-                               label = "u-boot";
-                               reg = <0x0 0x100000>;
-                               read-only;
-                       };
-
-                       partition@100000 {
-                               label = "params";
-                               reg = <0x100000 0x80000>;
-                               read-only;
-                       };
-
-                       partition@180000 {
-                               label = "ubifs";
-                               reg = <0x180000 0x7FE80000>;
-                       };
-               };
-       };
-};
-
-&spi0 {
-       status ="okay";
-       nor_flash: n25q128a11@0 {
-               #address-cells = <1>;
-               #size-cells = <1>;
-               compatible = "Micron,n25q128a11", "spi-flash";
-               spi-max-frequency = <54000000>;
-               m25p,fast-read;
-               reg = <0>;
-
-               partition@0 {
-                       label = "u-boot-spl";
-                       reg = <0x0 0x80000>;
-                       read-only;
-               };
-
-               partition@1 {
-                       label = "misc";
-                       reg = <0x80000 0xf80000>;
-               };
-       };
-};
-
-&mdio {
-       status = "ok";
-       ethphy0: ethernet-phy@0 {
-               compatible = "marvell,88E1514", "marvell,88E1510", "ethernet-phy-ieee802.3-c22";
-               reg = <0>;
-       };
-
-       ethphy1: ethernet-phy@1 {
-               compatible = "marvell,88E1514", "marvell,88E1510", "ethernet-phy-ieee802.3-c22";
-               reg = <1>;
-       };
-};
diff --git a/arch/arm/dts/k2l-netcp.dtsi b/arch/arm/dts/k2l-netcp.dtsi
deleted file mode 100644 (file)
index 6b95284..0000000
+++ /dev/null
@@ -1,189 +0,0 @@
-/*
- * Device Tree Source for Keystone 2 Lamarr Netcp driver
- *
- * Copyright 2015 Texas Instruments, Inc.
- *
- * 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.
- */
-
-qmss: qmss@2a40000 {
-       compatible = "ti,keystone-navigator-qmss";
-       dma-coherent;
-       #address-cells = <1>;
-       #size-cells = <1>;
-       clocks = <&chipclk13>;
-       ranges;
-       queue-range     = <0 0x2000>;
-       linkram0        = <0x100000 0x4000>;
-       linkram1        = <0x70000000 0x10000>; /* 1MB OSR mem */
-
-       qmgrs {
-               #address-cells = <1>;
-               #size-cells = <1>;
-               ranges;
-               qmgr0 {
-                       managed-queues = <0 0x2000>;
-                       reg = <0x2a40000 0x20000>,
-                             <0x2a06000 0x400>,
-                             <0x2a02000 0x1000>,
-                             <0x2a03000 0x1000>,
-                             <0x23a80000 0x20000>,
-                             <0x2a80000 0x20000>;
-                       reg-names = "peek", "status", "config",
-                                   "region", "push", "pop";
-               };
-       };
-       queue-pools {
-               qpend {
-                       qpend-0 {
-                               qrange = <658 8>;
-                               interrupts =<0 40 0xf04 0 41 0xf04 0 42 0xf04
-                                            0 43 0xf04 0 44 0xf04 0 45 0xf04
-                                            0 46 0xf04 0 47 0xf04>;
-                       };
-                       qpend-1 {
-                               qrange = <528 16>;
-                               interrupts = <0 48 0xf04 0 49 0xf04 0 50 0xf04
-                                             0 51 0xf04 0 52 0xf04 0 53 0xf04
-                                             0 54 0xf04 0 55 0xf04 0 56 0xf04
-                                             0 57 0xf04 0 58 0xf04 0 59 0xf04
-                                             0 60 0xf04 0 61 0xf04 0 62 0xf04
-                                             0 63 0xf04>;
-                               qalloc-by-id;
-                       };
-                       qpend-2 {
-                               qrange = <544 16>;
-                               interrupts = <0 64 0xf04 0 65 0xf04 0 66 0xf04
-                                             0 59 0xf04 0 68 0xf04 0 69 0xf04
-                                             0 70 0xf04 0 71 0xf04 0 72 0xf04
-                                             0 73 0xf04 0 74 0xf04 0 75 0xf04
-                                             0 76 0xf04 0 77 0xf04 0 78 0xf04
-                                             0 79 0xf04>;
-                       };
-               };
-               general-purpose {
-                       gp-0 {
-                               qrange = <4000 64>;
-                       };
-                       netcp-tx {
-                               qrange = <896 128>;
-                               qalloc-by-id;
-                       };
-               };
-       };
-       descriptor-regions {
-               #address-cells = <1>;
-               #size-cells = <1>;
-               ranges;
-               region-12 {
-                       id = <12>;
-                       region-spec = <8192 128>;       /* num_desc desc_size */
-                       link-index = <0x4000>;
-               };
-       };
-}; /* qmss */
-
-knav_dmas: knav_dmas@0 {
-       compatible = "ti,keystone-navigator-dma";
-       clocks = <&papllclk>;
-       #address-cells = <1>;
-       #size-cells = <1>;
-       ranges;
-       ti,navigator-cloud-address = <0x23a80000 0x23a90000>;
-
-       dma_gbe: dma_gbe@0 {
-               reg = <0x26186000 0x100>,
-                         <0x26187000 0x2a0>,
-                         <0x26188000 0xb60>,
-                         <0x26186100 0x80>,
-                         <0x26189000 0x1000>;
-               reg-names = "global", "txchan", "rxchan",
-                               "txsched", "rxflow";
-       };
-};
-
-netcp: netcp@26000000 {
-       reg = <0x2620110 0x8>;
-       reg-names = "efuse";
-       compatible = "ti,netcp-1.0";
-       #address-cells = <1>;
-       #size-cells = <1>;
-
-       /* NetCP address range */
-       ranges = <0 0x26000000 0x1000000>;
-
-       clocks = <&papllclk>, <&clkcpgmac>, <&chipclk12>;
-       dma-coherent;
-
-       ti,navigator-dmas = <&dma_gbe 0>,
-                       <&dma_gbe 8>,
-                       <&dma_gbe 0>;
-       ti,navigator-dma-names = "netrx0", "netrx1", "nettx";
-
-       netcp-devices {
-               #address-cells = <1>;
-               #size-cells = <1>;
-               ranges;
-               gbe@200000 { /* ETHSS */
-                       label = "netcp-gbe";
-                       compatible = "ti,netcp-gbe-5";
-                       reg = <0x200000 0x900>, <0x220000 0x20000>;
-                       /* enable-ale; */
-                       tx-queue = <896>;
-                       tx-channel = "nettx";
-
-                       interfaces {
-                               gbe0: interface-0 {
-                                       slave-port = <0>;
-                                       link-interface  = <1>;
-                                       phy-handle      = <&ethphy0>;
-                               };
-                               gbe1: interface-1 {
-                                       slave-port = <1>;
-                                       link-interface  = <1>;
-                                       phy-handle      = <&ethphy1>;
-                               };
-                       };
-
-                       secondary-slave-ports {
-                               port-2 {
-                                       slave-port = <2>;
-                                       link-interface  = <2>;
-                               };
-                               port-3 {
-                                       slave-port = <3>;
-                                       link-interface  = <2>;
-                               };
-                       };
-               };
-       };
-
-       netcp-interfaces {
-               interface-0 {
-                       rx-channel = "netrx0";
-                       rx-pool = <1024 12>;
-                       tx-pool = <1024 12>;
-                       rx-queue-depth = <128 128 0 0>;
-                       rx-buffer-size = <1518 4096 0 0>;
-                       rx-queue = <528>;
-                       tx-completion-queue = <530>;
-                       efuse-mac = <1>;
-                       netcp-gbe = <&gbe0>;
-
-               };
-               interface-1 {
-                       rx-channel = "netrx1";
-                       rx-pool = <1024 12>;
-                       tx-pool = <1024 12>;
-                       rx-queue-depth = <128 128 0 0>;
-                       rx-buffer-size = <1518 4096 0 0>;
-                       rx-queue = <529>;
-                       tx-completion-queue = <531>;
-                       efuse-mac = <0>;
-                       local-mac-address = [02 18 31 7e 3e 7f];
-                       netcp-gbe = <&gbe1>;
-               };
-       };
-};
diff --git a/arch/arm/dts/k2l.dtsi b/arch/arm/dts/k2l.dtsi
deleted file mode 100644 (file)
index 49fd414..0000000
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
- * Copyright 2014 Texas Instruments, Inc.
- *
- * Keystone 2 Lamarr SoC specific device tree
- *
- * 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.
- */
-
-/ {
-       cpus {
-               #address-cells = <1>;
-               #size-cells = <0>;
-
-               interrupt-parent = <&gic>;
-
-               cpu@0 {
-                       compatible = "arm,cortex-a15";
-                       device_type = "cpu";
-                       reg = <0>;
-               };
-
-               cpu@1 {
-                       compatible = "arm,cortex-a15";
-                       device_type = "cpu";
-                       reg = <1>;
-               };
-       };
-
-       soc {
-               /include/ "k2l-clocks.dtsi"
-
-               uart2: serial@02348400 {
-                       compatible = "ns16550a";
-                       current-speed = <115200>;
-                       reg-shift = <2>;
-                       reg-io-width = <4>;
-                       reg = <0x02348400 0x100>;
-                       clocks  = <&clkuart2>;
-                       interrupts = <GIC_SPI 432 IRQ_TYPE_EDGE_RISING>;
-               };
-
-               uart3:  serial@02348800 {
-                       compatible = "ns16550a";
-                       current-speed = <115200>;
-                       reg-shift = <2>;
-                       reg-io-width = <4>;
-                       reg = <0x02348800 0x100>;
-                       clocks  = <&clkuart3>;
-                       interrupts = <GIC_SPI 435 IRQ_TYPE_EDGE_RISING>;
-               };
-
-               dspgpio0: keystone_dsp_gpio@02620240 {
-                       compatible = "ti,keystone-dsp-gpio";
-                       gpio-controller;
-                       #gpio-cells = <2>;
-                       gpio,syscon-dev = <&devctrl 0x240>;
-               };
-
-               dspgpio1: keystone_dsp_gpio@2620244 {
-                       compatible = "ti,keystone-dsp-gpio";
-                       gpio-controller;
-                       #gpio-cells = <2>;
-                       gpio,syscon-dev = <&devctrl 0x244>;
-               };
-
-               dspgpio2: keystone_dsp_gpio@2620248 {
-                       compatible = "ti,keystone-dsp-gpio";
-                       gpio-controller;
-                       #gpio-cells = <2>;
-                       gpio,syscon-dev = <&devctrl 0x248>;
-               };
-
-               dspgpio3: keystone_dsp_gpio@262024c {
-                       compatible = "ti,keystone-dsp-gpio";
-                       gpio-controller;
-                       #gpio-cells = <2>;
-                       gpio,syscon-dev = <&devctrl 0x24c>;
-               };
-
-               mdio: mdio@26200f00 {
-                       compatible      = "ti,keystone_mdio", "ti,davinci_mdio";
-                       #address-cells = <1>;
-                       #size-cells = <0>;
-                       reg = <0x26200f00 0x100>;
-                       status = "disabled";
-                       clocks = <&clkcpgmac>;
-                       clock-names = "fck";
-                       bus_freq        = <2500000>;
-               };
-               /include/ "k2l-netcp.dtsi"
-       };
-};
-
-&spi0 {
-       ti,davinci-spi-num-cs = <5>;
-};
-
-&spi1 {
-       ti,davinci-spi-num-cs = <3>;
-};
-
-&spi2 {
-       ti,davinci-spi-num-cs = <5>;
-       /* Pin muxed. Enabled and configured by Bootloader */
-       status = "disabled";
-};
diff --git a/arch/arm/dts/keystone-k2e-clocks.dtsi b/arch/arm/dts/keystone-k2e-clocks.dtsi
new file mode 100644 (file)
index 0000000..d56d68f
--- /dev/null
@@ -0,0 +1,77 @@
+/*
+ * Copyright 2014 Texas Instruments, Inc.
+ *
+ * Keystone 2 Edison SoC specific device tree
+ *
+ * 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.
+ */
+
+clocks {
+       mainpllclk: mainpllclk@2310110 {
+               #clock-cells = <0>;
+               compatible = "ti,keystone,main-pll-clock";
+               clocks = <&refclksys>;
+               reg = <0x02620350 4>, <0x02310110 4>, <0x02310108 4>;
+               reg-names = "control", "multiplier", "post-divider";
+       };
+
+       papllclk: papllclk@2620358 {
+               #clock-cells = <0>;
+               compatible = "ti,keystone,pll-clock";
+               clocks = <&refclkpass>;
+               clock-output-names = "papllclk";
+               reg = <0x02620358 4>;
+               reg-names = "control";
+       };
+
+       ddr3apllclk: ddr3apllclk@2620360 {
+               #clock-cells = <0>;
+               compatible = "ti,keystone,pll-clock";
+               clocks = <&refclkddr3a>;
+               clock-output-names = "ddr-3a-pll-clk";
+               reg = <0x02620360 4>;
+               reg-names = "control";
+       };
+
+       clkusb1: clkusb1 {
+               #clock-cells = <0>;
+               compatible = "ti,keystone,psc-clock";
+               clocks = <&chipclk16>;
+               clock-output-names = "usb1";
+               reg = <0x02350004 0xb00>, <0x02350000 0x400>;
+               reg-names = "control", "domain";
+               domain-id = <0>;
+       };
+
+       clkhyperlink0: clkhyperlink0 {
+               #clock-cells = <0>;
+               compatible = "ti,keystone,psc-clock";
+               clocks = <&chipclk12>;
+               clock-output-names = "hyperlink-0";
+               reg = <0x02350030 0xb00>, <0x02350014 0x400>;
+               reg-names = "control", "domain";
+               domain-id = <5>;
+       };
+
+       clkpcie1: clkpcie1 {
+               #clock-cells = <0>;
+               compatible = "ti,keystone,psc-clock";
+               clocks = <&chipclk12>;
+               clock-output-names = "pcie1";
+               reg = <0x0235006c 0xb00>, <0x02350048 0x400>;
+               reg-names = "control", "domain";
+               domain-id = <18>;
+       };
+
+       clkxge: clkxge {
+               #clock-cells = <0>;
+               compatible = "ti,keystone,psc-clock";
+               clocks = <&chipclk13>;
+               clock-output-names = "xge";
+               reg = <0x023500c8 0xb00>, <0x02350074 0x400>;
+               reg-names = "control", "domain";
+               domain-id = <29>;
+       };
+};
diff --git a/arch/arm/dts/keystone-k2e-evm.dts b/arch/arm/dts/keystone-k2e-evm.dts
new file mode 100644 (file)
index 0000000..3be8b53
--- /dev/null
@@ -0,0 +1,155 @@
+/*
+ * Copyright 2013-2014 Texas Instruments, Inc.
+ *
+ * Keystone 2 Edison EVM device tree
+ *
+ * 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 "keystone.dtsi"
+#include "keystone-k2e.dtsi"
+
+/ {
+       compatible =  "ti,k2e-evm","ti,keystone";
+       model = "Texas Instruments Keystone 2 Edison EVM";
+
+       soc {
+
+               clocks {
+                       refclksys: refclksys {
+                               #clock-cells = <0>;
+                               compatible = "fixed-clock";
+                               clock-frequency = <100000000>;
+                               clock-output-names = "refclk-sys";
+                       };
+
+                       refclkpass: refclkpass {
+                               #clock-cells = <0>;
+                               compatible = "fixed-clock";
+                               clock-frequency = <100000000>;
+                               clock-output-names = "refclk-pass";
+                       };
+
+                       refclkddr3a: refclkddr3a {
+                               #clock-cells = <0>;
+                               compatible = "fixed-clock";
+                               clock-frequency = <100000000>;
+                               clock-output-names = "refclk-ddr3a";
+                       };
+               };
+       };
+};
+
+&usb_phy {
+       status = "okay";
+};
+
+&usb {
+       status = "okay";
+};
+
+&usb1_phy {
+       status = "okay";
+};
+
+&usb1 {
+       status = "okay";
+};
+
+&i2c0 {
+       dtt@50 {
+               compatible = "at,24c1024";
+               reg = <0x50>;
+       };
+};
+
+&aemif {
+       cs0 {
+               #address-cells = <2>;
+               #size-cells = <1>;
+               clock-ranges;
+               ranges;
+
+               ti,cs-chipselect = <0>;
+               /* all timings in nanoseconds */
+               ti,cs-min-turnaround-ns = <12>;
+               ti,cs-read-hold-ns = <6>;
+               ti,cs-read-strobe-ns = <23>;
+               ti,cs-read-setup-ns = <9>;
+               ti,cs-write-hold-ns = <8>;
+               ti,cs-write-strobe-ns = <23>;
+               ti,cs-write-setup-ns = <8>;
+
+               nand@0,0 {
+                       compatible = "ti,keystone-nand","ti,davinci-nand";
+                       #address-cells = <1>;
+                       #size-cells = <1>;
+                       reg = <0 0 0x4000000
+                              1 0 0x0000100>;
+
+                       ti,davinci-chipselect = <0>;
+                       ti,davinci-mask-ale = <0x2000>;
+                       ti,davinci-mask-cle = <0x4000>;
+                       ti,davinci-mask-chipsel = <0>;
+                       nand-ecc-mode = "hw";
+                       ti,davinci-ecc-bits = <4>;
+                       nand-on-flash-bbt;
+
+                       partition@0 {
+                               label = "u-boot";
+                               reg = <0x0 0x100000>;
+                               read-only;
+                       };
+
+                       partition@100000 {
+                               label = "params";
+                               reg = <0x100000 0x80000>;
+                               read-only;
+                       };
+
+                       partition@180000 {
+                               label = "ubifs";
+                               reg = <0x180000 0x1FE80000>;
+                       };
+               };
+       };
+};
+
+&spi0 {
+       status = "okay";
+       nor_flash: n25q128a11@0 {
+               #address-cells = <1>;
+               #size-cells = <1>;
+               compatible = "Micron,n25q128a11", "spi-flash";
+               spi-max-frequency = <54000000>;
+               m25p,fast-read;
+               reg = <0>;
+
+               partition@0 {
+                       label = "u-boot-spl";
+                       reg = <0x0 0x80000>;
+                       read-only;
+               };
+
+               partition@1 {
+                       label = "misc";
+                       reg = <0x80000 0xf80000>;
+               };
+       };
+};
+
+&mdio {
+       status = "ok";
+       ethphy0: ethernet-phy@0 {
+               compatible = "marvell,88E1514", "marvell,88E1510", "ethernet-phy-ieee802.3-c22";
+               reg = <0>;
+       };
+
+       ethphy1: ethernet-phy@1 {
+               compatible = "marvell,88E1514", "marvell,88E1510", "ethernet-phy-ieee802.3-c22";
+               reg = <1>;
+       };
+};
diff --git a/arch/arm/dts/keystone-k2e-netcp.dtsi b/arch/arm/dts/keystone-k2e-netcp.dtsi
new file mode 100644 (file)
index 0000000..b13b3c9
--- /dev/null
@@ -0,0 +1,206 @@
+/*
+ * Device Tree Source for Keystone 2 Edison Netcp driver
+ *
+ * Copyright 2015 Texas Instruments, Inc.
+ *
+ * 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.
+ */
+
+qmss: qmss@2a40000 {
+       compatible = "ti,keystone-navigator-qmss";
+       dma-coherent;
+       #address-cells = <1>;
+       #size-cells = <1>;
+       clocks = <&chipclk13>;
+       ranges;
+       queue-range     = <0 0x2000>;
+       linkram0        = <0x100000 0x4000>;
+       linkram1        = <0 0x10000>;
+
+       qmgrs {
+               #address-cells = <1>;
+               #size-cells = <1>;
+               ranges;
+               qmgr0 {
+                       managed-queues = <0 0x2000>;
+                       reg = <0x2a40000 0x20000>,
+                             <0x2a06000 0x400>,
+                             <0x2a02000 0x1000>,
+                             <0x2a03000 0x1000>,
+                             <0x23a80000 0x20000>,
+                             <0x2a80000 0x20000>;
+                       reg-names = "peek", "status", "config",
+                                   "region", "push", "pop";
+               };
+       };
+       queue-pools {
+               qpend {
+                       qpend-0 {
+                               qrange = <658 8>;
+                               interrupts =<0 40 0xf04 0 41 0xf04 0 42 0xf04
+                                            0 43 0xf04 0 44 0xf04 0 45 0xf04
+                                            0 46 0xf04 0 47 0xf04>;
+                       };
+                       qpend-1 {
+                               qrange = <528 16>;
+                               interrupts = <0 48 0xf04 0 49 0xf04 0 50 0xf04
+                                             0 51 0xf04 0 52 0xf04 0 53 0xf04
+                                             0 54 0xf04 0 55 0xf04 0 56 0xf04
+                                             0 57 0xf04 0 58 0xf04 0 59 0xf04
+                                             0 60 0xf04 0 61 0xf04 0 62 0xf04
+                                             0 63 0xf04>;
+                               qalloc-by-id;
+                       };
+                       qpend-2 {
+                               qrange = <544 16>;
+                               interrupts = <0 64 0xf04 0 65 0xf04 0 66 0xf04
+                                             0 59 0xf04 0 68 0xf04 0 69 0xf04
+                                             0 70 0xf04 0 71 0xf04 0 72 0xf04
+                                             0 73 0xf04 0 74 0xf04 0 75 0xf04
+                                             0 76 0xf04 0 77 0xf04 0 78 0xf04
+                                             0 79 0xf04>;
+                       };
+               };
+               general-purpose {
+                       gp-0 {
+                               qrange = <4000 64>;
+                       };
+                       netcp-tx {
+                               qrange = <896 128>;
+                               qalloc-by-id;
+                       };
+               };
+       };
+       descriptor-regions {
+               #address-cells = <1>;
+               #size-cells = <1>;
+               ranges;
+               region-12 {
+                       id = <12>;
+                       region-spec = <8192 128>;       /* num_desc desc_size */
+                       link-index = <0x4000>;
+               };
+       };
+}; /* qmss */
+
+knav_dmas: knav_dmas@0 {
+       compatible = "ti,keystone-navigator-dma";
+       clocks = <&papllclk>;
+       #address-cells = <1>;
+       #size-cells = <1>;
+       ranges;
+       ti,navigator-cloud-address = <0x23a80000 0x23a90000
+                                0x23a80000 0x23a90000>;
+
+       dma_gbe: dma_gbe@0 {
+               reg = <0x24186000 0x100>,
+                         <0x24187000 0x2a0>,
+                         <0x24188000 0xb60>,
+                         <0x24186100 0x80>,
+                         <0x24189000 0x1000>;
+               reg-names = "global", "txchan", "rxchan",
+                               "txsched", "rxflow";
+       };
+};
+
+netcp: netcp@24000000 {
+       reg = <0x2620110 0x8>;
+       reg-names = "efuse";
+       compatible = "ti,netcp-1.0";
+       #address-cells = <1>;
+       #size-cells = <1>;
+
+       /* NetCP address range */
+       ranges = <0 0x24000000 0x1000000>;
+
+       clocks = <&papllclk>, <&clkcpgmac>, <&chipclk12>;
+       dma-coherent;
+
+       ti,navigator-dmas = <&dma_gbe 0>,
+                       <&dma_gbe 8>,
+                       <&dma_gbe 0>;
+       ti,navigator-dma-names = "netrx0", "netrx1", "nettx";
+
+       netcp-devices {
+               #address-cells = <1>;
+               #size-cells = <1>;
+               ranges;
+               gbe@200000 { /* ETHSS */
+                       label = "netcp-gbe";
+                       compatible = "ti,netcp-gbe-9";
+                       reg = <0x200000 0x900>, <0x220000 0x20000>;
+                       /* enable-ale; */
+                       tx-queue = <896>;
+                       tx-channel = "nettx";
+
+                       interfaces {
+                               gbe0: interface-0 {
+                                       slave-port = <0>;
+                                       link-interface  = <1>;
+                                       phy-handle      = <&ethphy0>;
+                               };
+                               gbe1: interface-1 {
+                                       slave-port = <1>;
+                                       link-interface  = <1>;
+                                       phy-handle      = <&ethphy1>;
+                               };
+                       };
+
+                       secondary-slave-ports {
+                               port-2 {
+                                       slave-port = <2>;
+                                       link-interface  = <2>;
+                               };
+                               port-3 {
+                                       slave-port = <3>;
+                                       link-interface  = <2>;
+                               };
+                               port-4 {
+                                       slave-port = <4>;
+                                       link-interface  = <2>;
+                               };
+                               port-5 {
+                                       slave-port = <5>;
+                                       link-interface  = <2>;
+                               };
+                               port-6 {
+                                       slave-port = <6>;
+                                       link-interface  = <2>;
+                               };
+                               port-7 {
+                                       slave-port = <7>;
+                                       link-interface  = <2>;
+                               };
+                       };
+               };
+       };
+
+       netcp-interfaces {
+               interface-0 {
+                       rx-channel = "netrx0";
+                       rx-pool = <1024 12>;
+                       tx-pool = <1024 12>;
+                       rx-queue-depth = <128 128 0 0>;
+                       rx-buffer-size = <1518 4096 0 0>;
+                       rx-queue = <528>;
+                       tx-completion-queue = <530>;
+                       efuse-mac = <1>;
+                       netcp-gbe = <&gbe0>;
+
+               };
+               interface-1 {
+                       rx-channel = "netrx1";
+                       rx-pool = <1024 12>;
+                       tx-pool = <1024 12>;
+                       rx-queue-depth = <128 128 0 0>;
+                       rx-buffer-size = <1518 4096 0 0>;
+                       rx-queue = <529>;
+                       tx-completion-queue = <531>;
+                       efuse-mac = <0>;
+                       local-mac-address = [02 18 31 7e 3e 00];
+                       netcp-gbe = <&gbe1>;
+               };
+       };
+};
diff --git a/arch/arm/dts/keystone-k2e.dtsi b/arch/arm/dts/keystone-k2e.dtsi
new file mode 100644 (file)
index 0000000..b5d9061
--- /dev/null
@@ -0,0 +1,147 @@
+/*
+ * Copyright 2013-2014 Texas Instruments, Inc.
+ *
+ * Keystone 2 Edison soc device tree
+ *
+ * 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.
+ */
+
+/ {
+       cpus {
+               #address-cells = <1>;
+               #size-cells = <0>;
+
+               interrupt-parent = <&gic>;
+
+               cpu@0 {
+                       compatible = "arm,cortex-a15";
+                       device_type = "cpu";
+                       reg = <0>;
+               };
+
+               cpu@1 {
+                       compatible = "arm,cortex-a15";
+                       device_type = "cpu";
+                       reg = <1>;
+               };
+
+               cpu@2 {
+                       compatible = "arm,cortex-a15";
+                       device_type = "cpu";
+                       reg = <2>;
+               };
+
+               cpu@3 {
+                       compatible = "arm,cortex-a15";
+                       device_type = "cpu";
+                       reg = <3>;
+               };
+       };
+
+       soc {
+               /include/ "keystone-k2e-clocks.dtsi"
+
+               usb: usb@2680000 {
+                       interrupts = <GIC_SPI 152 IRQ_TYPE_EDGE_RISING>;
+                       dwc3@2690000 {
+                               interrupts = <GIC_SPI 152 IRQ_TYPE_EDGE_RISING>;
+                       };
+               };
+
+               usb1_phy: usb_phy@2620750 {
+                       compatible = "ti,keystone-usbphy";
+                       #address-cells = <1>;
+                       #size-cells = <1>;
+                       reg = <0x2620750 24>;
+                       status = "disabled";
+               };
+
+               usb1: usb@25000000 {
+                       compatible = "ti,keystone-dwc3";
+                       #address-cells = <1>;
+                       #size-cells = <1>;
+                       reg = <0x25000000 0x10000>;
+                       clocks = <&clkusb1>;
+                       clock-names = "usb";
+                       interrupts = <GIC_SPI 414 IRQ_TYPE_EDGE_RISING>;
+                       ranges;
+                       dma-coherent;
+                       dma-ranges;
+                       status = "disabled";
+
+                       dwc3@25010000 {
+                               compatible = "synopsys,dwc3";
+                               reg = <0x25010000 0x70000>;
+                               interrupts = <GIC_SPI 414 IRQ_TYPE_EDGE_RISING>;
+                               usb-phy = <&usb1_phy>, <&usb1_phy>;
+                       };
+               };
+
+               dspgpio0: keystone_dsp_gpio@02620240 {
+                       compatible = "ti,keystone-dsp-gpio";
+                       gpio-controller;
+                       #gpio-cells = <2>;
+                       gpio,syscon-dev = <&devctrl 0x240>;
+               };
+
+               pcie1: pcie@21020000 {
+                       compatible = "ti,keystone-pcie","snps,dw-pcie";
+                       clocks = <&clkpcie1>;
+                       clock-names = "pcie";
+                       #address-cells = <3>;
+                       #size-cells = <2>;
+                       reg =  <0x21021000 0x2000>, <0x21020000 0x1000>, <0x02620128 4>;
+                       ranges = <0x81000000 0 0 0x23260000 0x4000 0x4000
+                               0x82000000 0 0x60000000 0x60000000 0 0x10000000>;
+
+                       status = "disabled";
+                       device_type = "pci";
+                       num-lanes = <2>;
+
+                       #interrupt-cells = <1>;
+                       interrupt-map-mask = <0 0 0 7>;
+                       interrupt-map = <0 0 0 1 &pcie_intc1 0>, /* INT A */
+                                       <0 0 0 2 &pcie_intc1 1>, /* INT B */
+                                       <0 0 0 3 &pcie_intc1 2>, /* INT C */
+                                       <0 0 0 4 &pcie_intc1 3>; /* INT D */
+
+                       pcie_msi_intc1: msi-interrupt-controller {
+                               interrupt-controller;
+                               #interrupt-cells = <1>;
+                               interrupt-parent = <&gic>;
+                               interrupts = <GIC_SPI 377 IRQ_TYPE_EDGE_RISING>,
+                                       <GIC_SPI 378 IRQ_TYPE_EDGE_RISING>,
+                                       <GIC_SPI 379 IRQ_TYPE_EDGE_RISING>,
+                                       <GIC_SPI 380 IRQ_TYPE_EDGE_RISING>,
+                                       <GIC_SPI 381 IRQ_TYPE_EDGE_RISING>,
+                                       <GIC_SPI 382 IRQ_TYPE_EDGE_RISING>,
+                                       <GIC_SPI 383 IRQ_TYPE_EDGE_RISING>,
+                                       <GIC_SPI 384 IRQ_TYPE_EDGE_RISING>;
+                       };
+
+                       pcie_intc1: legacy-interrupt-controller {
+                               interrupt-controller;
+                               #interrupt-cells = <1>;
+                               interrupt-parent = <&gic>;
+                               interrupts = <GIC_SPI 373 IRQ_TYPE_EDGE_RISING>,
+                                       <GIC_SPI 374 IRQ_TYPE_EDGE_RISING>,
+                                       <GIC_SPI 375 IRQ_TYPE_EDGE_RISING>,
+                                       <GIC_SPI 376 IRQ_TYPE_EDGE_RISING>;
+                       };
+               };
+
+               mdio: mdio@24200f00 {
+                       compatible      = "ti,keystone_mdio", "ti,davinci_mdio";
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+                       reg = <0x24200f00 0x100>;
+                       status = "disabled";
+                       clocks = <&clkcpgmac>;
+                       clock-names = "fck";
+                       bus_freq        = <2500000>;
+               };
+               /include/ "keystone-k2e-netcp.dtsi"
+       };
+};
diff --git a/arch/arm/dts/keystone-k2g-evm.dts b/arch/arm/dts/keystone-k2g-evm.dts
new file mode 100644 (file)
index 0000000..696a0d7
--- /dev/null
@@ -0,0 +1,110 @@
+/*
+ * Copyright 2014 Texas Instruments, Inc.
+ *
+ * Device Tree Source for K2G EVM
+ *
+ * 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 "keystone-k2g.dtsi"
+
+/ {
+       compatible =  "ti,k2g-evm","ti,keystone";
+       model = "Texas Instruments K2G General Purpose EVM";
+
+       chosen {
+               stdout-path = &uart0;
+       };
+};
+
+&mdio {
+       status = "okay";
+       ethphy0: ethernet-phy@0 {
+               reg = <0>;
+               phy-mode = "rgmii-id";
+       };
+};
+
+&gbe0 {
+       phy-handle = <&ethphy0>;
+};
+
+&spi1 {
+       status = "okay";
+
+       spi_nor: flash@0 {
+               #address-cells = <1>;
+               #size-cells = <1>;
+               compatible = "spi-flash";
+               spi-max-frequency = <50000000>;
+               m25p,fast-read;
+               reg = <0>;
+
+               partition@0 {
+                       label = "u-boot-spl";
+                       reg = <0x0 0x80000>;
+                       read-only;
+               };
+
+               partition@1 {
+                       label = "misc";
+                       reg = <0x80000 0xf80000>;
+               };
+       };
+};
+
+&qspi {
+       status = "okay";
+
+        flash0: m25p80@0 {
+                compatible = "s25fl512s","spi-flash";
+                reg = <0>;
+                spi-tx-bus-width = <1>;
+                spi-rx-bus-width = <4>;
+                spi-max-frequency = <96000000>;
+                #address-cells = <1>;
+                #size-cells = <1>;
+                tshsl-ns = <392>;
+                tsd2d-ns = <392>;
+                tchsh-ns = <100>;
+                tslch-ns = <100>;
+               block-size = <18>;
+
+
+                partition@0 {
+                        label = "QSPI.u-boot-spl-os";
+                        reg = <0x00000000 0x00100000>;
+                };
+                partition@1 {
+                        label = "QSPI.u-boot-env";
+                        reg = <0x00100000 0x00040000>;
+                };
+                partition@2 {
+                        label = "QSPI.skern";
+                        reg = <0x00140000 0x0040000>;
+                };
+                partition@3 {
+                        label = "QSPI.pmmc-firmware";
+                        reg = <0x00180000 0x0040000>;
+                };
+                partition@4 {
+                        label = "QSPI.kernel";
+                        reg = <0x001C0000 0x0800000>;
+                };
+                partition@5 {
+                        label = "QSPI.file-system";
+                        reg = <0x009C0000 0x3640000>;
+                };
+        };
+};
+
+&mmc0 {
+       status = "okay";
+};
+
+&mmc1 {
+       status = "okay";
+};
diff --git a/arch/arm/dts/keystone-k2g-netcp.dtsi b/arch/arm/dts/keystone-k2g-netcp.dtsi
new file mode 100644 (file)
index 0000000..a9b26c3
--- /dev/null
@@ -0,0 +1,151 @@
+/*
+ * Device Tree Source for K2G Netcp driver
+ *
+ * Copyright 2015 Texas Instruments, Inc.
+ *
+ * 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.
+ */
+
+qmss: qmss@4020000 {
+       compatible = "ti,keystone-navigator-qmss-l";
+       dma-coherent;
+       #address-cells = <1>;
+       #size-cells = <1>;
+       /* power-domains = <&k2g_pds K2G_DEV_NSS0>; */
+       /* clocks = <&k2g_clks K2G_DEV_NSS0 K2G_DEV_NSS_VCLK>; */
+       clock-names = "nss_vclk";
+       ranges;
+       queue-range     = <0 0x80>;
+       linkram0        = <0x4020000 0x7ff>;
+
+       qmgrs {
+               #address-cells = <1>;
+               #size-cells = <1>;
+               ranges;
+               qmgr0 {
+                       managed-queues = <0 0x80>;
+                       reg = <0x4100000 0x800>,
+                             <0x4040000 0x100>,
+                             <0x4080000 0x800>,
+                             <0x40c0000 0x800>;
+                       reg-names = "peek", "config",
+                                   "region", "push";
+               };
+
+       };
+       queue-pools {
+               qpend {
+                       qpend-0 {
+                               qrange = <77 8>;
+                               interrupts =<0 308 0xf04 0 309 0xf04 0 310 0xf04
+                                            0 311 0xf04 0 312 0xf04 0 313 0xf04
+                                            0 314 0xf04 0 315 0xf04>;
+                               qalloc-by-id;
+                       };
+               };
+               general-purpose {
+                       gp-0 {
+                               qrange = <112 8>;
+                       };
+                       netcp-tx {
+                               qrange = <5 8>;
+                               qalloc-by-id;
+                       };
+               };
+       };
+
+       descriptor-regions {
+               #address-cells = <1>;
+               #size-cells = <1>;
+               ranges;
+               region-12 {
+                       id = <12>;
+                       region-spec = <1023 128>; /* num_desc desc_size */
+                       link-index = <0x400>;
+               };
+       };
+}; /* qmss */
+
+knav_dmas: knav_dmas@0 {
+       compatible = "ti,keystone-navigator-dma";
+       #address-cells = <1>;
+       #size-cells = <1>;
+       /* power-domains = <&k2g_pds K2G_DEV_NSS0>; */
+       /* clocks = <&k2g_clks K2G_DEV_NSS0 K2G_DEV_NSS_VCLK>; */
+       clock-names = "nss_vclk";
+       ranges;
+       ti,navigator-cloud-address = <0x40c0000 0x40c0000 0x40c0000 0x40c0000>;
+
+       dma_gbe: dma_gbe@0 {
+               reg = <0x4010000 0x100>,
+                         <0x4011000 0x2a0>, /* 21 Tx channels */
+                         <0x4012000 0x400>, /* 32 Rx channels */
+                         <0x4010100 0x80>,
+                         <0x4013000 0x400>; /* 32 Rx flows */
+               reg-names = "global", "txchan", "rxchan",
+                               "txsched", "rxflow";
+       };
+
+};
+
+gbe_subsys: subsys@4200000 {
+       compatible = "syscon";
+       reg = <0x4200000 0x100>;
+};
+
+netcp: netcp@4000000 {
+       reg = <0x2620110 0x8>;
+       reg-names = "efuse";
+       compatible = "ti,netcp-1.0";
+       #address-cells = <1>;
+       #size-cells = <1>;
+       /* power-domains = <&k2g_pds K2G_DEV_NSS0>; */
+       /* clocks = <&k2g_clks K2G_DEV_NSS0 K2G_DEV_NSS_ESW_CLK>; */
+       clock-names = "ethss_clk";
+
+       /* NetCP address range */
+       ranges = <0 0x4000000 0x1000000>;
+
+       dma-coherent;
+
+       ti,navigator-dmas = <&dma_gbe 0>, <&dma_gbe 5>;
+       ti,navigator-dma-names = "netrx0", "nettx";
+
+       netcp-devices {
+               #address-cells = <1>;
+               #size-cells = <1>;
+               ranges;
+               gbe@200000 {
+                       label = "netcp-gbe";
+                       compatible = "ti,netcp-gbe-2";
+                       syscon-subsys = <&gbe_subsys>;
+                       reg = <0x200100 0xe00>, <0x220000 0x20000>;
+                       /* enable-ale; */
+                       tx-queue = <5>;
+                       tx-channel = "nettx";
+
+                       interfaces {
+                               gbe0: interface-0 {
+                                       slave-port = <0>;
+                                       link-interface  = <5>;
+                               };
+                       };
+               };
+       };
+
+       netcp-interfaces {
+               interface-0 {
+                       rx-channel = "netrx0";
+                       rx-pool = <512 12>;
+                       tx-pool = <511 12>;
+                       rx-queue-depth = <128 128 0 0>;
+                       rx-buffer-size = <1518 4096 0 0>;
+                       rx-queue = <77>;
+                       tx-completion-queue = <78>;
+                       efuse-mac = <1>;
+                       netcp-gbe = <&gbe0>;
+               };
+       };
+};
diff --git a/arch/arm/dts/keystone-k2g.dtsi b/arch/arm/dts/keystone-k2g.dtsi
new file mode 100644 (file)
index 0000000..2193f9f
--- /dev/null
@@ -0,0 +1,176 @@
+/*
+ * Copyright 2014 Texas Instruments, Inc.
+ *
+ * Device Tree Source for K2G SOC
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#include <dt-bindings/interrupt-controller/arm-gic.h>
+#include "skeleton.dtsi"
+
+/ {
+       model = "Texas Instruments K2G SoC";
+       #address-cells = <1>;
+       #size-cells = <1>;
+       interrupt-parent = <&gic>;
+
+       aliases {
+               serial0 = &uart0;
+               spi0 = &spi0;
+               spi1 = &spi1;
+               spi2 = &spi2;
+               spi3 = &spi3;
+               spi4 = &qspi;
+       };
+
+       memory {
+               device_type = "memory";
+               reg = <0x80000000 0x80000000>;
+       };
+
+       cpus {
+               #address-cells = <1>;
+               #size-cells = <0>;
+
+               interrupt-parent = <&gic>;
+
+               cpu@0 {
+                       compatible = "arm,cortex-a15";
+                       device_type = "cpu";
+                       reg = <0>;
+               };
+       };
+
+       gic: interrupt-controller {
+               compatible = "arm,cortex-a15-gic";
+               #interrupt-cells = <3>;
+               interrupt-controller;
+               reg = <0x0 0x02561000 0x0 0x1000>,
+                     <0x0 0x02562000 0x0 0x2000>,
+                     <0x0 0x02564000 0x0 0x1000>,
+                     <0x0 0x02566000 0x0 0x2000>;
+               interrupts = <GIC_PPI 9 (GIC_CPU_MASK_SIMPLE(4) |
+                               IRQ_TYPE_LEVEL_HIGH)>;
+       };
+
+       soc {
+               #address-cells = <1>;
+               #size-cells = <1>;
+               compatible = "ti,keystone","simple-bus";
+               interrupt-parent = <&gic>;
+               ranges;
+
+               uart0: serial@02530c00 {
+                       compatible = "ns16550a";
+                       current-speed = <115200>;
+                       reg-shift = <2>;
+                       reg-io-width = <4>;
+                       reg = <0x02530c00 0x100>;
+                       clock-names = "uart";
+                       interrupts = <GIC_SPI 164 IRQ_TYPE_EDGE_RISING>;
+               };
+
+               mdio: mdio@4200f00 {
+                       compatible      = "ti,keystone_mdio", "ti,davinci_mdio";
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+                       /* power-domains = <&k2g_pds K2G_DEV_NSS0>; */
+                       /* clocks = <&k2g_clks K2G_DEV_NSS0 K2G_DEV_NSS_ESW_CLK>; */
+                       clock-names = "fck";
+                       reg = <0x04200f00 0x100>;
+                       status = "disabled";
+                       bus_freq = <2500000>;
+               };
+
+               qspi: qspi@2940000 {
+                       compatible =  "cadence,qspi";
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+                       reg = <0x02940000 0x1000>,
+                             <0x24000000 0x4000000>;
+                       interrupts = <GIC_SPI 198 IRQ_TYPE_EDGE_RISING>;
+                       num-cs = <4>;
+                       fifo-depth = <256>;
+                       sram-size = <256>;
+                       status = "disabled";
+               };
+
+               #include "keystone-k2g-netcp.dtsi"
+
+               pmmc: pmmc@2900000 {
+                       compatible = "ti,power-processor";
+                       reg = <0x02900000 0x40000>;
+                       ti,lpsc_module = <1>;
+               };
+
+               spi0: spi@21805400 {
+                       compatible = "ti,keystone-spi", "ti,dm6441-spi";
+                       reg = <0x21805400 0x200>;
+                       num-cs = <4>;
+                       ti,davinci-spi-intr-line = <0>;
+                       interrupts = <GIC_SPI 64 IRQ_TYPE_EDGE_RISING>;
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+                       status = "disabled";
+               };
+
+               spi1: spi@21805800 {
+                       compatible = "ti,keystone-spi", "ti,dm6441-spi";
+                       reg = <0x21805800 0x200>;
+                       num-cs = <4>;
+                       ti,davinci-spi-intr-line = <0>;
+                       interrupts = <GIC_SPI 66 IRQ_TYPE_EDGE_RISING>;
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+                       status = "disabled";
+               };
+
+               spi2: spi@21805c00 {
+                       compatible = "ti,keystone-spi", "ti,dm6441-spi";
+                       reg = <0x21805C00 0x200>;
+                       num-cs = <4>;
+                       ti,davinci-spi-intr-line = <0>;
+                       interrupts = <GIC_SPI 68 IRQ_TYPE_EDGE_RISING>;
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+                       status = "disabled";
+               };
+
+               spi3: spi@21806000 {
+                       compatible = "ti,keystone-spi", "ti,dm6441-spi";
+                       reg = <0x21806000 0x200>;
+                       num-cs = <4>;
+                       ti,davinci-spi-intr-line = <0>;
+                       interrupts = <GIC_SPI 70 IRQ_TYPE_EDGE_RISING>;
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+                       status = "disabled";
+               };
+
+               mmc0: mmc@23000000 {
+                       compatible = "ti,omap4-hsmmc";
+                       reg = <0x23000000 0x400>;
+                       interrupts = <GIC_SPI 96 IRQ_TYPE_EDGE_RISING>;
+                       bus-width = <4>;
+                       ti,needs-special-reset;
+                       no-1-8-v;
+                       max-frequency = <96000000>;
+                       status = "disabled";
+               };
+
+               mmc1: mmc@23100000 {
+                       compatible = "ti,omap4-hsmmc";
+                       reg = <0x23100000 0x400>;
+                       interrupts = <GIC_SPI 97 IRQ_TYPE_EDGE_RISING>;
+                       bus-width = <8>;
+                       ti,needs-special-reset;
+                       ti,non-removable;
+                       max-frequency = <96000000>;
+                       status = "disabled";
+                       clock-names = "fck";
+               };
+       };
+};
diff --git a/arch/arm/dts/keystone-k2hk-clocks.dtsi b/arch/arm/dts/keystone-k2hk-clocks.dtsi
new file mode 100644 (file)
index 0000000..af9b719
--- /dev/null
@@ -0,0 +1,425 @@
+/*
+ * Copyright 2013-2014 Texas Instruments, Inc.
+ *
+ * Keystone 2 Kepler/Hawking SoC clock nodes
+ *
+ * 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.
+ */
+
+clocks {
+       armpllclk: armpllclk@2620370 {
+               #clock-cells = <0>;
+               compatible = "ti,keystone,pll-clock";
+               clocks = <&refclkarm>;
+               clock-output-names = "arm-pll-clk";
+               reg = <0x02620370 4>;
+               reg-names = "control";
+       };
+
+       mainpllclk: mainpllclk@2310110 {
+               #clock-cells = <0>;
+               compatible = "ti,keystone,main-pll-clock";
+               clocks = <&refclksys>;
+               reg = <0x02620350 4>, <0x02310110 4>, <0x02310108 4>;
+               reg-names = "control", "multiplier", "post-divider";
+       };
+
+       papllclk: papllclk@2620358 {
+               #clock-cells = <0>;
+               compatible = "ti,keystone,pll-clock";
+               clocks = <&refclkpass>;
+               clock-output-names = "papllclk";
+               reg = <0x02620358 4>;
+               reg-names = "control";
+       };
+
+       ddr3apllclk: ddr3apllclk@2620360 {
+               #clock-cells = <0>;
+               compatible = "ti,keystone,pll-clock";
+               clocks = <&refclkddr3a>;
+               clock-output-names = "ddr-3a-pll-clk";
+               reg = <0x02620360 4>;
+               reg-names = "control";
+       };
+
+       ddr3bpllclk: ddr3bpllclk@2620368 {
+               #clock-cells = <0>;
+               compatible = "ti,keystone,pll-clock";
+               clocks = <&refclkddr3b>;
+               clock-output-names = "ddr-3b-pll-clk";
+               reg = <0x02620368 4>;
+               reg-names = "control";
+       };
+
+       clktsip: clktsip {
+               #clock-cells = <0>;
+               compatible = "ti,keystone,psc-clock";
+               clocks = <&chipclk16>;
+               clock-output-names = "tsip";
+               reg = <0x02350000 0xb00>, <0x02350000 0x400>;
+               reg-names = "control", "domain";
+               domain-id = <0>;
+       };
+
+       clksrio: clksrio {
+               #clock-cells = <0>;
+               compatible = "ti,keystone,psc-clock";
+               clocks = <&chipclk1rstiso13>;
+               clock-output-names = "srio";
+               reg = <0x0235002c 0xb00>, <0x02350010 0x400>;
+               reg-names = "control", "domain";
+               domain-id = <4>;
+       };
+
+       clkhyperlink0: clkhyperlink0 {
+               #clock-cells = <0>;
+               compatible = "ti,keystone,psc-clock";
+               clocks = <&chipclk12>;
+               clock-output-names = "hyperlink-0";
+               reg = <0x02350030 0xb00>, <0x02350014 0x400>;
+               reg-names = "control", "domain";
+               domain-id = <5>;
+       };
+
+       clkgem1: clkgem1 {
+               #clock-cells = <0>;
+               compatible = "ti,keystone,psc-clock";
+               clocks = <&chipclk1>;
+               clock-output-names = "gem1";
+               reg = <0x02350040 0xb00>, <0x02350024 0x400>;
+               reg-names = "control", "domain";
+               domain-id = <9>;
+       };
+
+       clkgem2: clkgem2 {
+               #clock-cells = <0>;
+               compatible = "ti,keystone,psc-clock";
+               clocks = <&chipclk1>;
+               clock-output-names = "gem2";
+               reg = <0x02350044 0xb00>, <0x02350028 0x400>;
+               reg-names = "control", "domain";
+               domain-id = <10>;
+       };
+
+       clkgem3: clkgem3 {
+               #clock-cells = <0>;
+               compatible = "ti,keystone,psc-clock";
+               clocks = <&chipclk1>;
+               clock-output-names = "gem3";
+               reg = <0x02350048 0xb00>, <0x0235002c 0x400>;
+               reg-names = "control", "domain";
+               domain-id = <11>;
+       };
+
+       clkgem4: clkgem4 {
+               #clock-cells = <0>;
+               compatible = "ti,keystone,psc-clock";
+               clocks = <&chipclk1>;
+               clock-output-names = "gem4";
+               reg = <0x0235004c 0xb00>, <0x02350030 0x400>;
+               reg-names = "control", "domain";
+               domain-id = <12>;
+       };
+
+       clkgem5: clkgem5 {
+               #clock-cells = <0>;
+               compatible = "ti,keystone,psc-clock";
+               clocks = <&chipclk1>;
+               clock-output-names = "gem5";
+               reg = <0x02350050 0xb00>, <0x02350034 0x400>;
+               reg-names = "control", "domain";
+               domain-id = <13>;
+       };
+
+       clkgem6: clkgem6 {
+               #clock-cells = <0>;
+               compatible = "ti,keystone,psc-clock";
+               clocks = <&chipclk1>;
+               clock-output-names = "gem6";
+               reg = <0x02350054 0xb00>, <0x02350038 0x400>;
+               reg-names = "control", "domain";
+               domain-id = <14>;
+       };
+
+       clkgem7: clkgem7 {
+               #clock-cells = <0>;
+               compatible = "ti,keystone,psc-clock";
+               clocks = <&chipclk1>;
+               clock-output-names = "gem7";
+               reg = <0x02350058 0xb00>, <0x0235003c 0x400>;
+               reg-names = "control", "domain";
+               domain-id = <15>;
+       };
+
+       clkddr31: clkddr31 {
+               #clock-cells = <0>;
+               compatible = "ti,keystone,psc-clock";
+               clocks = <&chipclk13>;
+               clock-output-names = "ddr3-1";
+               reg = <0x02350060 0xb00>, <0x02350040 0x400>;
+               reg-names = "control", "domain";
+               domain-id = <16>;
+       };
+
+       clktac: clktac {
+               #clock-cells = <0>;
+               compatible = "ti,keystone,psc-clock";
+               clocks = <&chipclk13>;
+               clock-output-names = "tac";
+               reg = <0x02350064 0xb00>, <0x02350044 0x400>;
+               reg-names = "control", "domain";
+               domain-id = <17>;
+       };
+
+       clkrac01: clkrac01 {
+               #clock-cells = <0>;
+               compatible = "ti,keystone,psc-clock";
+               clocks = <&chipclk13>;
+               clock-output-names = "rac-01";
+               reg = <0x02350068 0xb00>, <0x02350044 0x400>;
+               reg-names = "control", "domain";
+               domain-id = <17>;
+       };
+
+       clkrac23: clkrac23 {
+               #clock-cells = <0>;
+               compatible = "ti,keystone,psc-clock";
+               clocks = <&chipclk13>;
+               clock-output-names = "rac-23";
+               reg = <0x0235006c 0xb00>, <0x02350048 0x400>;
+               reg-names = "control", "domain";
+               domain-id = <18>;
+       };
+
+       clkfftc0: clkfftc0 {
+               #clock-cells = <0>;
+               compatible = "ti,keystone,psc-clock";
+               clocks = <&chipclk13>;
+               clock-output-names = "fftc-0";
+               reg = <0x02350070 0xb00>, <0x0235004c 0x400>;
+               reg-names = "control", "domain";
+               domain-id = <19>;
+       };
+
+       clkfftc1: clkfftc1 {
+               #clock-cells = <0>;
+               compatible = "ti,keystone,psc-clock";
+               clocks = <&chipclk13>;
+               clock-output-names = "fftc-1";
+               reg = <0x02350074 0xb00>, <0x0235004c 0x400>;
+               reg-names = "control", "domain";
+               domain-id = <19>;
+       };
+
+       clkfftc2: clkfftc2 {
+               #clock-cells = <0>;
+               compatible = "ti,keystone,psc-clock";
+               clocks = <&chipclk13>;
+               clock-output-names = "fftc-2";
+               reg = <0x02350078 0xb00>, <0x02350050 0x400>;
+               reg-names = "control", "domain";
+               domain-id = <20>;
+       };
+
+       clkfftc3: clkfftc3 {
+               #clock-cells = <0>;
+               compatible = "ti,keystone,psc-clock";
+               clocks = <&chipclk13>;
+               clock-output-names = "fftc-3";
+               reg = <0x0235007c 0xb00>, <0x02350050 0x400>;
+               reg-names = "control", "domain";
+               domain-id = <20>;
+       };
+
+       clkfftc4: clkfftc4 {
+               #clock-cells = <0>;
+               compatible = "ti,keystone,psc-clock";
+               clocks = <&chipclk13>;
+               clock-output-names = "fftc-4";
+               reg = <0x02350080 0xb00>, <0x02350050 0x400>;
+               reg-names = "control", "domain";
+               domain-id = <20>;
+       };
+
+       clkfftc5: clkfftc5 {
+               #clock-cells = <0>;
+               compatible = "ti,keystone,psc-clock";
+               clocks = <&chipclk13>;
+               clock-output-names = "fftc-5";
+               reg = <0x02350084 0xb00>, <0x02350050 0x400>;
+               reg-names = "control", "domain";
+               domain-id = <20>;
+       };
+
+       clkaif: clkaif {
+               #clock-cells = <0>;
+               compatible = "ti,keystone,psc-clock";
+               clocks = <&chipclk13>;
+               clock-output-names = "aif";
+               reg = <0x02350088 0xb00>, <0x02350054 0x400>;
+               reg-names = "control", "domain";
+               domain-id = <21>;
+       };
+
+       clktcp3d0: clktcp3d0 {
+               #clock-cells = <0>;
+               compatible = "ti,keystone,psc-clock";
+               clocks = <&chipclk13>;
+               clock-output-names = "tcp3d-0";
+               reg = <0x0235008c 0xb00>, <0x02350058 0x400>;
+               reg-names = "control", "domain";
+               domain-id = <22>;
+       };
+
+       clktcp3d1: clktcp3d1 {
+               #clock-cells = <0>;
+               compatible = "ti,keystone,psc-clock";
+               clocks = <&chipclk13>;
+               clock-output-names = "tcp3d-1";
+               reg = <0x02350090 0xb00>, <0x02350058 0x400>;
+               reg-names = "control", "domain";
+               domain-id = <22>;
+       };
+
+       clktcp3d2: clktcp3d2 {
+               #clock-cells = <0>;
+               compatible = "ti,keystone,psc-clock";
+               clocks = <&chipclk13>;
+               clock-output-names = "tcp3d-2";
+               reg = <0x02350094 0xb00>, <0x0235005c 0x400>;
+               reg-names = "control", "domain";
+               domain-id = <23>;
+       };
+
+       clktcp3d3: clktcp3d3 {
+               #clock-cells = <0>;
+               compatible = "ti,keystone,psc-clock";
+               clocks = <&chipclk13>;
+               clock-output-names = "tcp3d-3";
+               reg = <0x02350098 0xb00>, <0x0235005c 0x400>;
+               reg-names = "control", "domain";
+               domain-id = <23>;
+       };
+
+       clkvcp0: clkvcp0 {
+               #clock-cells = <0>;
+               compatible = "ti,keystone,psc-clock";
+               clocks = <&chipclk13>;
+               clock-output-names = "vcp-0";
+               reg = <0x0235009c 0xb00>, <0x02350060 0x400>;
+               reg-names = "control", "domain";
+               domain-id = <24>;
+       };
+
+       clkvcp1: clkvcp1 {
+               #clock-cells = <0>;
+               compatible = "ti,keystone,psc-clock";
+               clocks = <&chipclk13>;
+               clock-output-names = "vcp-1";
+               reg = <0x023500a0 0xb00>, <0x02350060 0x400>;
+               reg-names = "control", "domain";
+               domain-id = <24>;
+       };
+
+       clkvcp2: clkvcp2 {
+               #clock-cells = <0>;
+               compatible = "ti,keystone,psc-clock";
+               clocks = <&chipclk13>;
+               clock-output-names = "vcp-2";
+               reg = <0x023500a4 0xb00>, <0x02350060 0x400>;
+               reg-names = "control", "domain";
+               domain-id = <24>;
+       };
+
+       clkvcp3: clkvcp3 {
+               #clock-cells = <0>;
+               compatible = "ti,keystone,psc-clock";
+               clocks = <&chipclk13>;
+               clock-output-names = "vcp-3";
+               reg = <0x023500a8 0xb00>, <0x02350060 0x400>;
+               reg-names = "control", "domain";
+               domain-id = <24>;
+       };
+
+       clkvcp4: clkvcp4 {
+               #clock-cells = <0>;
+               compatible = "ti,keystone,psc-clock";
+               clocks = <&chipclk13>;
+               clock-output-names = "vcp-4";
+               reg = <0x023500ac 0xb00>, <0x02350064 0x400>;
+               reg-names = "control", "domain";
+               domain-id = <25>;
+       };
+
+       clkvcp5: clkvcp5 {
+               #clock-cells = <0>;
+               compatible = "ti,keystone,psc-clock";
+               clocks = <&chipclk13>;
+               clock-output-names = "vcp-5";
+               reg = <0x023500b0 0xb00>, <0x02350064 0x400>;
+               reg-names = "control", "domain";
+               domain-id = <25>;
+       };
+
+       clkvcp6: clkvcp6 {
+               #clock-cells = <0>;
+               compatible = "ti,keystone,psc-clock";
+               clocks = <&chipclk13>;
+               clock-output-names = "vcp-6";
+               reg = <0x023500b4 0xb00>, <0x02350064 0x400>;
+               reg-names = "control", "domain";
+               domain-id = <25>;
+       };
+
+       clkvcp7: clkvcp7 {
+               #clock-cells = <0>;
+               compatible = "ti,keystone,psc-clock";
+               clocks = <&chipclk13>;
+               clock-output-names = "vcp-7";
+               reg = <0x023500b8 0xb00>, <0x02350064 0x400>;
+               reg-names = "control", "domain";
+               domain-id = <25>;
+       };
+
+       clkbcp: clkbcp {
+               #clock-cells = <0>;
+               compatible = "ti,keystone,psc-clock";
+               clocks = <&chipclk13>;
+               clock-output-names = "bcp";
+               reg = <0x023500bc 0xb00>, <0x02350068 0x400>;
+               reg-names = "control", "domain";
+               domain-id = <26>;
+       };
+
+       clkdxb: clkdxb {
+               #clock-cells = <0>;
+               compatible = "ti,keystone,psc-clock";
+               clocks = <&chipclk13>;
+               clock-output-names = "dxb";
+               reg = <0x023500c0 0xb00>, <0x0235006c 0x400>;
+               reg-names = "control", "domain";
+               domain-id = <27>;
+       };
+
+       clkhyperlink1: clkhyperlink1 {
+               #clock-cells = <0>;
+               compatible = "ti,keystone,psc-clock";
+               clocks = <&chipclk12>;
+               clock-output-names = "hyperlink-1";
+               reg = <0x023500c4 0xb00>, <0x02350070 0x400>;
+               reg-names = "control", "domain";
+               domain-id = <28>;
+       };
+
+       clkxge: clkxge {
+               #clock-cells = <0>;
+               compatible = "ti,keystone,psc-clock";
+               clocks = <&chipclk13>;
+               clock-output-names = "xge";
+               reg = <0x023500c8 0xb00>, <0x02350074 0x400>;
+               reg-names = "control", "domain";
+               domain-id = <29>;
+       };
+};
diff --git a/arch/arm/dts/keystone-k2hk-evm.dts b/arch/arm/dts/keystone-k2hk-evm.dts
new file mode 100644 (file)
index 0000000..76a675f
--- /dev/null
@@ -0,0 +1,183 @@
+/*
+ * Copyright 2013-2014 Texas Instruments, Inc.
+ *
+ * Keystone 2 Kepler/Hawking EVM device tree
+ *
+ * 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 "keystone.dtsi"
+#include "keystone-k2hk.dtsi"
+
+/ {
+       compatible =  "ti,k2hk-evm","ti,keystone";
+       model = "Texas Instruments Keystone 2 Kepler/Hawking EVM";
+
+       soc {
+               clocks {
+                       refclksys: refclksys {
+                               #clock-cells = <0>;
+                               compatible = "fixed-clock";
+                               clock-frequency = <122880000>;
+                               clock-output-names = "refclk-sys";
+                       };
+
+                       refclkpass: refclkpass {
+                               #clock-cells = <0>;
+                               compatible = "fixed-clock";
+                               clock-frequency = <122880000>;
+                               clock-output-names = "refclk-pass";
+                       };
+
+                       refclkarm: refclkarm {
+                               #clock-cells = <0>;
+                               compatible = "fixed-clock";
+                               clock-frequency = <125000000>;
+                               clock-output-names = "refclk-arm";
+                       };
+
+                       refclkddr3a: refclkddr3a {
+                               #clock-cells = <0>;
+                               compatible = "fixed-clock";
+                               clock-frequency = <100000000>;
+                               clock-output-names = "refclk-ddr3a";
+                       };
+
+                       refclkddr3b: refclkddr3b {
+                               #clock-cells = <0>;
+                               compatible = "fixed-clock";
+                               clock-frequency = <100000000>;
+                               clock-output-names = "refclk-ddr3b";
+                       };
+               };
+       };
+
+       leds {
+               compatible = "gpio-leds";
+               debug1_1 {
+                       label = "keystone:green:debug1";
+                       gpios = <&gpio0 12 GPIO_ACTIVE_HIGH>; /* 12 */
+               };
+
+               debug1_2 {
+                       label = "keystone:red:debug1";
+                       gpios = <&gpio0 13 GPIO_ACTIVE_HIGH>; /* 13 */
+               };
+
+               debug2 {
+                       label = "keystone:blue:debug2";
+                       gpios = <&gpio0 14 GPIO_ACTIVE_HIGH>; /* 14 */
+               };
+
+               debug3 {
+                       label = "keystone:blue:debug3";
+                       gpios = <&gpio0 15 GPIO_ACTIVE_HIGH>; /* 15 */
+               };
+       };
+};
+
+&usb_phy {
+       status = "okay";
+};
+
+&usb {
+       status = "okay";
+};
+
+&aemif {
+       cs0 {
+               #address-cells = <2>;
+               #size-cells = <1>;
+               clock-ranges;
+               ranges;
+
+               ti,cs-chipselect = <0>;
+               /* all timings in nanoseconds */
+               ti,cs-min-turnaround-ns = <12>;
+               ti,cs-read-hold-ns = <6>;
+               ti,cs-read-strobe-ns = <23>;
+               ti,cs-read-setup-ns = <9>;
+               ti,cs-write-hold-ns = <8>;
+               ti,cs-write-strobe-ns = <23>;
+               ti,cs-write-setup-ns = <8>;
+
+               nand@0,0 {
+                       compatible = "ti,keystone-nand","ti,davinci-nand";
+                       #address-cells = <1>;
+                       #size-cells = <1>;
+                       reg = <0 0 0x4000000
+                              1 0 0x0000100>;
+
+                       ti,davinci-chipselect = <0>;
+                       ti,davinci-mask-ale = <0x2000>;
+                       ti,davinci-mask-cle = <0x4000>;
+                       ti,davinci-mask-chipsel = <0>;
+                       nand-ecc-mode = "hw";
+                       ti,davinci-ecc-bits = <4>;
+                       nand-on-flash-bbt;
+
+                       partition@0 {
+                               label = "u-boot";
+                               reg = <0x0 0x100000>;
+                               read-only;
+                       };
+
+                       partition@100000 {
+                               label = "params";
+                               reg = <0x100000 0x80000>;
+                               read-only;
+                       };
+
+                       partition@180000 {
+                               label = "ubifs";
+                               reg = <0x180000 0x1fe80000>;
+                       };
+               };
+       };
+};
+
+&i2c0 {
+       dtt@50 {
+               compatible = "at,24c1024";
+               reg = <0x50>;
+       };
+};
+
+&spi0 {
+       status = "okay";
+       nor_flash: n25q128a11@0 {
+               #address-cells = <1>;
+               #size-cells = <1>;
+               compatible = "Micron,n25q128a11", "spi-flash";
+               spi-max-frequency = <54000000>;
+               m25p,fast-read;
+               reg = <0>;
+
+               partition@0 {
+                       label = "u-boot-spl";
+                       reg = <0x0 0x80000>;
+                       read-only;
+               };
+
+               partition@1 {
+                       label = "misc";
+                       reg = <0x80000 0xf80000>;
+               };
+       };
+};
+
+&mdio {
+       status = "ok";
+       ethphy0: ethernet-phy@0 {
+               compatible = "marvell,88E1111", "ethernet-phy-ieee802.3-c22";
+               reg = <0>;
+       };
+
+       ethphy1: ethernet-phy@1 {
+               compatible = "marvell,88E1111", "ethernet-phy-ieee802.3-c22";
+               reg = <1>;
+       };
+};
diff --git a/arch/arm/dts/keystone-k2hk-netcp.dtsi b/arch/arm/dts/keystone-k2hk-netcp.dtsi
new file mode 100644 (file)
index 0000000..77a32c3
--- /dev/null
@@ -0,0 +1,208 @@
+/*
+ * Device Tree Source for Keystone 2 Hawking Netcp driver
+ *
+ * Copyright 2015 Texas Instruments, Inc.
+ *
+ * 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.
+ */
+
+qmss: qmss@2a40000 {
+       compatible = "ti,keystone-navigator-qmss";
+       dma-coherent;
+       #address-cells = <1>;
+       #size-cells = <1>;
+       clocks = <&chipclk13>;
+       ranges;
+       queue-range     = <0 0x4000>;
+       linkram0        = <0x100000 0x8000>;
+       linkram1        = <0x0 0x10000>;
+
+       qmgrs {
+               #address-cells = <1>;
+               #size-cells = <1>;
+               ranges;
+               qmgr0 {
+                       managed-queues = <0 0x2000>;
+                       reg = <0x2a40000 0x20000>,
+                             <0x2a06000 0x400>,
+                             <0x2a02000 0x1000>,
+                             <0x2a03000 0x1000>,
+                             <0x23a80000 0x20000>,
+                             <0x2a80000 0x20000>;
+                       reg-names = "peek", "status", "config",
+                                   "region", "push", "pop";
+               };
+
+               qmgr1 {
+                       managed-queues = <0x2000 0x2000>;
+                       reg = <0x2a60000 0x20000>,
+                             <0x2a06400 0x400>,
+                             <0x2a04000 0x1000>,
+                             <0x2a05000 0x1000>,
+                             <0x23aa0000 0x20000>,
+                             <0x2aa0000 0x20000>;
+                       reg-names = "peek", "status", "config",
+                                   "region", "push", "pop";
+               };
+       };
+       queue-pools {
+               qpend {
+                       qpend-0 {
+                               qrange = <658 8>;
+                               interrupts =<0 40 0xf04 0 41 0xf04 0 42 0xf04
+                                            0 43 0xf04 0 44 0xf04 0 45 0xf04
+                                            0 46 0xf04 0 47 0xf04>;
+                       };
+                       qpend-1 {
+                               qrange = <8704 16>;
+                               interrupts = <0 48 0xf04 0 49 0xf04 0 50 0xf04
+                                             0 51 0xf04 0 52 0xf04 0 53 0xf04
+                                             0 54 0xf04 0 55 0xf04 0 56 0xf04
+                                             0 57 0xf04 0 58 0xf04 0 59 0xf04
+                                             0 60 0xf04 0 61 0xf04 0 62 0xf04
+                                             0 63 0xf04>;
+                               qalloc-by-id;
+                       };
+                       qpend-2 {
+                               qrange = <8720 16>;
+                               interrupts = <0 64 0xf04 0 65 0xf04 0 66 0xf04
+                                             0 59 0xf04 0 68 0xf04 0 69 0xf04
+                                             0 70 0xf04 0 71 0xf04 0 72 0xf04
+                                             0 73 0xf04 0 74 0xf04 0 75 0xf04
+                                             0 76 0xf04 0 77 0xf04 0 78 0xf04
+                                             0 79 0xf04>;
+                       };
+               };
+               general-purpose {
+                       gp-0 {
+                               qrange = <4000 64>;
+                       };
+                       netcp-tx {
+                               qrange = <640 9>;
+                               qalloc-by-id;
+                       };
+                       netcpx-tx {
+                               qrange = <8752 8>;
+                               qalloc-by-id;
+                       };
+               };
+       };
+       descriptor-regions {
+               #address-cells = <1>;
+               #size-cells = <1>;
+               ranges;
+               region-12 {
+                       id = <12>;
+                       region-spec = <8192 128>;       /* num_desc desc_size */
+                       link-index = <0x4000>;
+               };
+       };
+}; /* qmss */
+
+knav_dmas: knav_dmas@0 {
+       compatible = "ti,keystone-navigator-dma";
+       clocks = <&papllclk>;
+       #address-cells = <1>;
+       #size-cells = <1>;
+       ranges;
+       ti,navigator-cloud-address = <0x23a80000 0x23a90000
+                                  0x23aa0000 0x23ab0000>;
+
+       dma_gbe: dma_gbe@0 {
+               reg = <0x2004000 0x100>,
+                         <0x2004400 0x120>,
+                         <0x2004800 0x300>,
+                         <0x2004c00 0x120>,
+                         <0x2005000 0x400>;
+               reg-names = "global", "txchan", "rxchan",
+                               "txsched", "rxflow";
+       };
+};
+
+netcp: netcp@2000000 {
+       reg = <0x2620110 0x8>;
+       reg-names = "efuse";
+       compatible = "ti,netcp-1.0";
+       #address-cells = <1>;
+       #size-cells = <1>;
+
+       /* NetCP address range */
+       ranges  = <0 0x2000000 0x100000>;
+
+       clocks = <&papllclk>, <&clkcpgmac>, <&chipclk12>;
+       dma-coherent;
+
+       ti,navigator-dmas = <&dma_gbe 22>,
+                       <&dma_gbe 23>,
+                       <&dma_gbe 8>;
+       ti,navigator-dma-names = "netrx0", "netrx1", "nettx";
+
+       netcp-devices {
+               ranges;
+               #address-cells = <1>;
+               #size-cells = <1>;
+               gbe@90000 { /* ETHSS */
+                       #address-cells = <1>;
+                       #size-cells = <1>;
+                       label = "netcp-gbe";
+                       compatible = "ti,netcp-gbe";
+                       reg = <0x90000 0x300>, <0x90400 0x400>, <0x90800 0x700>;
+                       /* enable-ale; */
+                       tx-queue = <648>;
+                       tx-channel = "nettx";
+
+                       interfaces {
+                               gbe0: interface-0 {
+                                       slave-port = <0>;
+                                       link-interface = <1>;
+                                       phy-handle = <&ethphy0>;
+                               };
+                               gbe1: interface-1 {
+                                       slave-port = <1>;
+                                       link-interface = <1>;
+                                       phy-handle = <&ethphy1>;
+                               };
+                       };
+
+                       secondary-slave-ports {
+                               port-2 {
+                                       slave-port = <2>;
+                                       link-interface  = <2>;
+                               };
+                               port-3 {
+                                       slave-port = <3>;
+                                       link-interface  = <2>;
+                               };
+                       };
+               };
+       };
+
+       netcp-interfaces {
+               interface-0 {
+                       rx-channel = "netrx0";
+                       rx-pool = <1024 12>;
+                       tx-pool = <1024 12>;
+                       rx-queue-depth = <128 128 0 0>;
+                       rx-buffer-size = <1518 4096 0 0>;
+                       rx-queue = <8704>;
+                       tx-completion-queue = <8706>;
+                       efuse-mac = <1>;
+                       netcp-gbe = <&gbe0>;
+
+               };
+               interface-1 {
+                       rx-channel = "netrx1";
+                       rx-pool = <1024 12>;
+                       tx-pool = <1024 12>;
+                       rx-queue-depth = <128 128 0 0>;
+                       rx-buffer-size = <1518 4096 0 0>;
+                       rx-queue = <8705>;
+                       tx-completion-queue = <8707>;
+                       efuse-mac = <0>;
+                       local-mac-address = [02 18 31 7e 3e 6f];
+                       netcp-gbe = <&gbe1>;
+               };
+       };
+};
diff --git a/arch/arm/dts/keystone-k2hk.dtsi b/arch/arm/dts/keystone-k2hk.dtsi
new file mode 100644 (file)
index 0000000..fc78696
--- /dev/null
@@ -0,0 +1,114 @@
+/*
+ * Copyright 2013-2014 Texas Instruments, Inc.
+ *
+ * Keystone 2 Kepler/Hawking soc specific device tree
+ *
+ * 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.
+ */
+
+/ {
+       cpus {
+               #address-cells = <1>;
+               #size-cells = <0>;
+
+               interrupt-parent = <&gic>;
+
+               cpu@0 {
+                       compatible = "arm,cortex-a15";
+                       device_type = "cpu";
+                       reg = <0>;
+               };
+
+               cpu@1 {
+                       compatible = "arm,cortex-a15";
+                       device_type = "cpu";
+                       reg = <1>;
+               };
+
+               cpu@2 {
+                       compatible = "arm,cortex-a15";
+                       device_type = "cpu";
+                       reg = <2>;
+               };
+
+               cpu@3 {
+                       compatible = "arm,cortex-a15";
+                       device_type = "cpu";
+                       reg = <3>;
+               };
+       };
+
+       soc {
+               /include/ "keystone-k2hk-clocks.dtsi"
+
+               dspgpio0: keystone_dsp_gpio@02620240 {
+                       compatible = "ti,keystone-dsp-gpio";
+                       gpio-controller;
+                       #gpio-cells = <2>;
+                       gpio,syscon-dev = <&devctrl 0x240>;
+               };
+
+               dspgpio1: keystone_dsp_gpio@2620244 {
+                       compatible = "ti,keystone-dsp-gpio";
+                       gpio-controller;
+                       #gpio-cells = <2>;
+                       gpio,syscon-dev = <&devctrl 0x244>;
+               };
+
+               dspgpio2: keystone_dsp_gpio@2620248 {
+                       compatible = "ti,keystone-dsp-gpio";
+                       gpio-controller;
+                       #gpio-cells = <2>;
+                       gpio,syscon-dev = <&devctrl 0x248>;
+               };
+
+               dspgpio3: keystone_dsp_gpio@262024c {
+                       compatible = "ti,keystone-dsp-gpio";
+                       gpio-controller;
+                       #gpio-cells = <2>;
+                       gpio,syscon-dev = <&devctrl 0x24c>;
+               };
+
+               dspgpio4: keystone_dsp_gpio@2620250 {
+                       compatible = "ti,keystone-dsp-gpio";
+                       gpio-controller;
+                       #gpio-cells = <2>;
+                       gpio,syscon-dev = <&devctrl 0x250>;
+               };
+
+               dspgpio5: keystone_dsp_gpio@2620254 {
+                       compatible = "ti,keystone-dsp-gpio";
+                       gpio-controller;
+                       #gpio-cells = <2>;
+                       gpio,syscon-dev = <&devctrl 0x254>;
+               };
+
+               dspgpio6: keystone_dsp_gpio@2620258 {
+                       compatible = "ti,keystone-dsp-gpio";
+                       gpio-controller;
+                       #gpio-cells = <2>;
+                       gpio,syscon-dev = <&devctrl 0x258>;
+               };
+
+               dspgpio7: keystone_dsp_gpio@262025c {
+                       compatible = "ti,keystone-dsp-gpio";
+                       gpio-controller;
+                       #gpio-cells = <2>;
+                       gpio,syscon-dev = <&devctrl 0x25c>;
+               };
+
+               mdio: mdio@02090300 {
+                       compatible      = "ti,keystone_mdio", "ti,davinci_mdio";
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+                       reg = <0x02090300 0x100>;
+                       status = "disabled";
+                       clocks = <&clkcpgmac>;
+                       clock-names = "fck";
+                       bus_freq        = <2500000>;
+               };
+               /include/ "keystone-k2hk-netcp.dtsi"
+       };
+};
diff --git a/arch/arm/dts/keystone-k2l-clocks.dtsi b/arch/arm/dts/keystone-k2l-clocks.dtsi
new file mode 100644 (file)
index 0000000..ef8464b
--- /dev/null
@@ -0,0 +1,266 @@
+/*
+ * Copyright 2013-2014 Texas Instruments, Inc.
+ *
+ * Keystone 2 lamarr SoC clock nodes
+ *
+ * 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.
+ */
+
+clocks {
+       armpllclk: armpllclk@2620370 {
+               #clock-cells = <0>;
+               compatible = "ti,keystone,pll-clock";
+               clocks = <&refclksys>;
+               clock-output-names = "arm-pll-clk";
+               reg = <0x02620370 4>;
+               reg-names = "control";
+       };
+
+       mainpllclk: mainpllclk@2310110 {
+               #clock-cells = <0>;
+               compatible = "ti,keystone,main-pll-clock";
+               clocks = <&refclksys>;
+               reg = <0x02620350 4>, <0x02310110 4>, <0x02310108 4>;
+               reg-names = "control", "multiplier", "post-divider";
+       };
+
+       papllclk: papllclk@2620358 {
+               #clock-cells = <0>;
+               compatible = "ti,keystone,pll-clock";
+               clocks = <&refclksys>;
+               clock-output-names = "papllclk";
+               reg = <0x02620358 4>;
+               reg-names = "control";
+       };
+
+       ddr3apllclk: ddr3apllclk@2620360 {
+               #clock-cells = <0>;
+               compatible = "ti,keystone,pll-clock";
+               clocks = <&refclksys>;
+               clock-output-names = "ddr-3a-pll-clk";
+               reg = <0x02620360 4>;
+               reg-names = "control";
+       };
+
+       clkdfeiqnsys: clkdfeiqnsys {
+               #clock-cells = <0>;
+               compatible = "ti,keystone,psc-clock";
+               clocks = <&chipclk12>;
+               clock-output-names = "dfe";
+               reg-names = "control", "domain";
+               reg = <0x02350004 0xb00>, <0x02350000 0x400>;
+               domain-id = <0>;
+       };
+
+       clkpcie1: clkpcie1 {
+               #clock-cells = <0>;
+               compatible = "ti,keystone,psc-clock";
+               clocks = <&chipclk12>;
+               clock-output-names = "pcie";
+               reg = <0x0235002c 0xb00>, <0x02350000 0x400>;
+               reg-names = "control", "domain";
+               domain-id = <4>;
+       };
+
+       clkgem1: clkgem1 {
+               #clock-cells = <0>;
+               compatible = "ti,keystone,psc-clock";
+               clocks = <&chipclk1>;
+               clock-output-names = "gem1";
+               reg = <0x02350040 0xb00>, <0x02350024 0x400>;
+               reg-names = "control", "domain";
+               domain-id = <9>;
+       };
+
+       clkgem2: clkgem2 {
+               #clock-cells = <0>;
+               compatible = "ti,keystone,psc-clock";
+               clocks = <&chipclk1>;
+               clock-output-names = "gem2";
+               reg = <0x02350044 0xb00>, <0x02350028 0x400>;
+               reg-names = "control", "domain";
+               domain-id = <10>;
+       };
+
+       clkgem3: clkgem3 {
+               #clock-cells = <0>;
+               compatible = "ti,keystone,psc-clock";
+               clocks = <&chipclk1>;
+               clock-output-names = "gem3";
+               reg = <0x02350048 0xb00>, <0x0235002c 0x400>;
+               reg-names = "control", "domain";
+               domain-id = <11>;
+       };
+
+       clktac: clktac {
+               #clock-cells = <0>;
+               compatible = "ti,keystone,psc-clock";
+               clocks = <&chipclk13>;
+               clock-output-names = "tac";
+               reg = <0x02350064 0xb00>, <0x02350044 0x400>;
+               reg-names = "control", "domain";
+               domain-id = <17>;
+       };
+
+       clkrac: clkrac {
+               #clock-cells = <0>;
+               compatible = "ti,keystone,psc-clock";
+               clocks = <&chipclk13>;
+               clock-output-names = "rac";
+               reg = <0x02350068 0xb00>, <0x02350044 0x400>;
+               reg-names = "control", "domain";
+               domain-id = <17>;
+       };
+
+       clkdfepd0: clkdfepd0 {
+               #clock-cells = <0>;
+               compatible = "ti,keystone,psc-clock";
+               clocks = <&chipclk13>;
+               clock-output-names = "dfe-pd0";
+               reg = <0x0235006c 0xb00>, <0x02350044 0x400>;
+               reg-names = "control", "domain";
+               domain-id = <18>;
+       };
+
+       clkfftc0: clkfftc0 {
+               #clock-cells = <0>;
+               compatible = "ti,keystone,psc-clock";
+               clocks = <&chipclk13>;
+               clock-output-names = "fftc-0";
+               reg = <0x02350070 0xb00>, <0x0235004c 0x400>;
+               reg-names = "control", "domain";
+               domain-id = <19>;
+       };
+
+       clkosr: clkosr {
+               #clock-cells = <0>;
+               compatible = "ti,keystone,psc-clock";
+               clocks = <&chipclk13>;
+               clock-output-names = "osr";
+               reg = <0x02350088 0xb00>, <0x0235004c 0x400>;
+               reg-names = "control", "domain";
+               domain-id = <21>;
+       };
+
+       clktcp3d0: clktcp3d0 {
+               #clock-cells = <0>;
+               compatible = "ti,keystone,psc-clock";
+               clocks = <&chipclk13>;
+               clock-output-names = "tcp3d-0";
+               reg = <0x0235008c 0xb00>, <0x02350058 0x400>;
+               reg-names = "control", "domain";
+               domain-id = <22>;
+       };
+
+       clktcp3d1: clktcp3d1 {
+               #clock-cells = <0>;
+               compatible = "ti,keystone,psc-clock";
+               clocks = <&chipclk13>;
+               clock-output-names = "tcp3d-1";
+               reg = <0x02350094 0xb00>, <0x02350058 0x400>;
+               reg-names = "control", "domain";
+               domain-id = <23>;
+       };
+
+       clkvcp0: clkvcp0 {
+               #clock-cells = <0>;
+               compatible = "ti,keystone,psc-clock";
+               clocks = <&chipclk13>;
+               clock-output-names = "vcp-0";
+               reg = <0x0235009c 0xb00>, <0x02350060 0x400>;
+               reg-names = "control", "domain";
+               domain-id = <24>;
+       };
+
+       clkvcp1: clkvcp1 {
+               #clock-cells = <0>;
+               compatible = "ti,keystone,psc-clock";
+               clocks = <&chipclk13>;
+               clock-output-names = "vcp-1";
+               reg = <0x023500a0 0xb00>, <0x02350060 0x400>;
+               reg-names = "control", "domain";
+               domain-id = <24>;
+       };
+
+       clkvcp2: clkvcp2 {
+               #clock-cells = <0>;
+               compatible = "ti,keystone,psc-clock";
+               clocks = <&chipclk13>;
+               clock-output-names = "vcp-2";
+               reg = <0x023500a4 0xb00>, <0x02350060 0x400>;
+               reg-names = "control", "domain";
+               domain-id = <24>;
+       };
+
+       clkvcp3: clkvcp3 {
+               #clock-cells = <0>;
+               compatible = "ti,keystone,psc-clock";
+               clocks = <&chipclk13>;
+               clock-output-names = "vcp-3";
+               reg = <0x023500a8 0xb00>, <0x02350060 0x400>;
+               reg-names = "control", "domain";
+               domain-id = <24>;
+       };
+
+       clkbcp: clkbcp {
+               #clock-cells = <0>;
+               compatible = "ti,keystone,psc-clock";
+               clocks = <&chipclk13>;
+               clock-output-names = "bcp";
+               reg = <0x023500bc 0xb00>, <0x02350068 0x400>;
+               reg-names = "control", "domain";
+               domain-id = <26>;
+       };
+
+       clkdfepd1: clkdfepd1 {
+               #clock-cells = <0>;
+               compatible = "ti,keystone,psc-clock";
+               clocks = <&chipclk13>;
+               clock-output-names = "dfe-pd1";
+               reg = <0x023500c0 0xb00>, <0x02350044 0x400>;
+               reg-names = "control", "domain";
+               domain-id = <27>;
+       };
+
+       clkfftc1: clkfftc1 {
+               #clock-cells = <0>;
+               compatible = "ti,keystone,psc-clock";
+               clocks = <&chipclk13>;
+               clock-output-names = "fftc-1";
+               reg = <0x023500c4 0xb00>, <0x023504c0 0x400>;
+               reg-names = "control", "domain";
+               domain-id = <28>;
+       };
+
+       clkiqnail: clkiqnail {
+               #clock-cells = <0>;
+               compatible = "ti,keystone,psc-clock";
+               clocks = <&chipclk13>;
+               clock-output-names = "iqn-ail";
+               reg = <0x023500c8 0xb00>, <0x0235004c 0x400>;
+               reg-names = "control", "domain";
+               domain-id = <29>;
+       };
+
+       clkuart2: clkuart2 {
+               #clock-cells = <0>;
+               compatible = "ti,keystone,psc-clock";
+               clocks = <&clkmodrst0>;
+               clock-output-names = "uart2";
+               reg = <0x02350000 0xb00>, <0x02350000 0x400>;
+               reg-names = "control", "domain";
+               domain-id = <0>;
+       };
+
+       clkuart3: clkuart3 {
+               #clock-cells = <0>;
+               compatible = "ti,keystone,psc-clock";
+               clocks = <&clkmodrst0>;
+               clock-output-names = "uart3";
+               reg = <0x02350000 0xb00>, <0x02350000 0x400>;
+               reg-names = "control", "domain";
+               domain-id = <0>;
+       };
+};
diff --git a/arch/arm/dts/keystone-k2l-evm.dts b/arch/arm/dts/keystone-k2l-evm.dts
new file mode 100644 (file)
index 0000000..b5c5617
--- /dev/null
@@ -0,0 +1,132 @@
+/*
+ * Copyright 2014 Texas Instruments, Inc.
+ *
+ * Keystone 2 Lamarr EVM device tree
+ *
+ * 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 "keystone.dtsi"
+#include "keystone-k2l.dtsi"
+
+/ {
+       compatible =  "ti,k2l-evm","ti,keystone";
+       model = "Texas Instruments Keystone 2 Lamarr EVM";
+
+       soc {
+               clocks {
+                       refclksys: refclksys {
+                               #clock-cells = <0>;
+                               compatible = "fixed-clock";
+                               clock-frequency = <122880000>;
+                               clock-output-names = "refclk-sys";
+                       };
+               };
+       };
+};
+
+&usb_phy {
+       status = "okay";
+};
+
+&usb {
+       status = "okay";
+};
+
+&i2c0 {
+       dtt@50 {
+               compatible = "at,24c1024";
+               reg = <0x50>;
+       };
+};
+
+&aemif {
+       cs0 {
+               #address-cells = <2>;
+               #size-cells = <1>;
+               clock-ranges;
+               ranges;
+
+               ti,cs-chipselect = <0>;
+               /* all timings in nanoseconds */
+               ti,cs-min-turnaround-ns = <12>;
+               ti,cs-read-hold-ns = <6>;
+               ti,cs-read-strobe-ns = <23>;
+               ti,cs-read-setup-ns = <9>;
+               ti,cs-write-hold-ns = <8>;
+               ti,cs-write-strobe-ns = <23>;
+               ti,cs-write-setup-ns = <8>;
+
+               nand@0,0 {
+                       compatible = "ti,keystone-nand","ti,davinci-nand";
+                       #address-cells = <1>;
+                       #size-cells = <1>;
+                       reg = <0 0 0x4000000
+                              1 0 0x0000100>;
+
+                       ti,davinci-chipselect = <0>;
+                       ti,davinci-mask-ale = <0x2000>;
+                       ti,davinci-mask-cle = <0x4000>;
+                       ti,davinci-mask-chipsel = <0>;
+                       nand-ecc-mode = "hw";
+                       ti,davinci-ecc-bits = <4>;
+                       nand-on-flash-bbt;
+
+                       partition@0 {
+                               label = "u-boot";
+                               reg = <0x0 0x100000>;
+                               read-only;
+                       };
+
+                       partition@100000 {
+                               label = "params";
+                               reg = <0x100000 0x80000>;
+                               read-only;
+                       };
+
+                       partition@180000 {
+                               label = "ubifs";
+                               reg = <0x180000 0x7FE80000>;
+                       };
+               };
+       };
+};
+
+&spi0 {
+       status ="okay";
+       nor_flash: n25q128a11@0 {
+               #address-cells = <1>;
+               #size-cells = <1>;
+               compatible = "Micron,n25q128a11", "spi-flash";
+               spi-max-frequency = <54000000>;
+               m25p,fast-read;
+               reg = <0>;
+
+               partition@0 {
+                       label = "u-boot-spl";
+                       reg = <0x0 0x80000>;
+                       read-only;
+               };
+
+               partition@1 {
+                       label = "misc";
+                       reg = <0x80000 0xf80000>;
+               };
+       };
+};
+
+&mdio {
+       status = "ok";
+       ethphy0: ethernet-phy@0 {
+               compatible = "marvell,88E1514", "marvell,88E1510", "ethernet-phy-ieee802.3-c22";
+               reg = <0>;
+       };
+
+       ethphy1: ethernet-phy@1 {
+               compatible = "marvell,88E1514", "marvell,88E1510", "ethernet-phy-ieee802.3-c22";
+               reg = <1>;
+       };
+};
diff --git a/arch/arm/dts/keystone-k2l-netcp.dtsi b/arch/arm/dts/keystone-k2l-netcp.dtsi
new file mode 100644 (file)
index 0000000..6b95284
--- /dev/null
@@ -0,0 +1,189 @@
+/*
+ * Device Tree Source for Keystone 2 Lamarr Netcp driver
+ *
+ * Copyright 2015 Texas Instruments, Inc.
+ *
+ * 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.
+ */
+
+qmss: qmss@2a40000 {
+       compatible = "ti,keystone-navigator-qmss";
+       dma-coherent;
+       #address-cells = <1>;
+       #size-cells = <1>;
+       clocks = <&chipclk13>;
+       ranges;
+       queue-range     = <0 0x2000>;
+       linkram0        = <0x100000 0x4000>;
+       linkram1        = <0x70000000 0x10000>; /* 1MB OSR mem */
+
+       qmgrs {
+               #address-cells = <1>;
+               #size-cells = <1>;
+               ranges;
+               qmgr0 {
+                       managed-queues = <0 0x2000>;
+                       reg = <0x2a40000 0x20000>,
+                             <0x2a06000 0x400>,
+                             <0x2a02000 0x1000>,
+                             <0x2a03000 0x1000>,
+                             <0x23a80000 0x20000>,
+                             <0x2a80000 0x20000>;
+                       reg-names = "peek", "status", "config",
+                                   "region", "push", "pop";
+               };
+       };
+       queue-pools {
+               qpend {
+                       qpend-0 {
+                               qrange = <658 8>;
+                               interrupts =<0 40 0xf04 0 41 0xf04 0 42 0xf04
+                                            0 43 0xf04 0 44 0xf04 0 45 0xf04
+                                            0 46 0xf04 0 47 0xf04>;
+                       };
+                       qpend-1 {
+                               qrange = <528 16>;
+                               interrupts = <0 48 0xf04 0 49 0xf04 0 50 0xf04
+                                             0 51 0xf04 0 52 0xf04 0 53 0xf04
+                                             0 54 0xf04 0 55 0xf04 0 56 0xf04
+                                             0 57 0xf04 0 58 0xf04 0 59 0xf04
+                                             0 60 0xf04 0 61 0xf04 0 62 0xf04
+                                             0 63 0xf04>;
+                               qalloc-by-id;
+                       };
+                       qpend-2 {
+                               qrange = <544 16>;
+                               interrupts = <0 64 0xf04 0 65 0xf04 0 66 0xf04
+                                             0 59 0xf04 0 68 0xf04 0 69 0xf04
+                                             0 70 0xf04 0 71 0xf04 0 72 0xf04
+                                             0 73 0xf04 0 74 0xf04 0 75 0xf04
+                                             0 76 0xf04 0 77 0xf04 0 78 0xf04
+                                             0 79 0xf04>;
+                       };
+               };
+               general-purpose {
+                       gp-0 {
+                               qrange = <4000 64>;
+                       };
+                       netcp-tx {
+                               qrange = <896 128>;
+                               qalloc-by-id;
+                       };
+               };
+       };
+       descriptor-regions {
+               #address-cells = <1>;
+               #size-cells = <1>;
+               ranges;
+               region-12 {
+                       id = <12>;
+                       region-spec = <8192 128>;       /* num_desc desc_size */
+                       link-index = <0x4000>;
+               };
+       };
+}; /* qmss */
+
+knav_dmas: knav_dmas@0 {
+       compatible = "ti,keystone-navigator-dma";
+       clocks = <&papllclk>;
+       #address-cells = <1>;
+       #size-cells = <1>;
+       ranges;
+       ti,navigator-cloud-address = <0x23a80000 0x23a90000>;
+
+       dma_gbe: dma_gbe@0 {
+               reg = <0x26186000 0x100>,
+                         <0x26187000 0x2a0>,
+                         <0x26188000 0xb60>,
+                         <0x26186100 0x80>,
+                         <0x26189000 0x1000>;
+               reg-names = "global", "txchan", "rxchan",
+                               "txsched", "rxflow";
+       };
+};
+
+netcp: netcp@26000000 {
+       reg = <0x2620110 0x8>;
+       reg-names = "efuse";
+       compatible = "ti,netcp-1.0";
+       #address-cells = <1>;
+       #size-cells = <1>;
+
+       /* NetCP address range */
+       ranges = <0 0x26000000 0x1000000>;
+
+       clocks = <&papllclk>, <&clkcpgmac>, <&chipclk12>;
+       dma-coherent;
+
+       ti,navigator-dmas = <&dma_gbe 0>,
+                       <&dma_gbe 8>,
+                       <&dma_gbe 0>;
+       ti,navigator-dma-names = "netrx0", "netrx1", "nettx";
+
+       netcp-devices {
+               #address-cells = <1>;
+               #size-cells = <1>;
+               ranges;
+               gbe@200000 { /* ETHSS */
+                       label = "netcp-gbe";
+                       compatible = "ti,netcp-gbe-5";
+                       reg = <0x200000 0x900>, <0x220000 0x20000>;
+                       /* enable-ale; */
+                       tx-queue = <896>;
+                       tx-channel = "nettx";
+
+                       interfaces {
+                               gbe0: interface-0 {
+                                       slave-port = <0>;
+                                       link-interface  = <1>;
+                                       phy-handle      = <&ethphy0>;
+                               };
+                               gbe1: interface-1 {
+                                       slave-port = <1>;
+                                       link-interface  = <1>;
+                                       phy-handle      = <&ethphy1>;
+                               };
+                       };
+
+                       secondary-slave-ports {
+                               port-2 {
+                                       slave-port = <2>;
+                                       link-interface  = <2>;
+                               };
+                               port-3 {
+                                       slave-port = <3>;
+                                       link-interface  = <2>;
+                               };
+                       };
+               };
+       };
+
+       netcp-interfaces {
+               interface-0 {
+                       rx-channel = "netrx0";
+                       rx-pool = <1024 12>;
+                       tx-pool = <1024 12>;
+                       rx-queue-depth = <128 128 0 0>;
+                       rx-buffer-size = <1518 4096 0 0>;
+                       rx-queue = <528>;
+                       tx-completion-queue = <530>;
+                       efuse-mac = <1>;
+                       netcp-gbe = <&gbe0>;
+
+               };
+               interface-1 {
+                       rx-channel = "netrx1";
+                       rx-pool = <1024 12>;
+                       tx-pool = <1024 12>;
+                       rx-queue-depth = <128 128 0 0>;
+                       rx-buffer-size = <1518 4096 0 0>;
+                       rx-queue = <529>;
+                       tx-completion-queue = <531>;
+                       efuse-mac = <0>;
+                       local-mac-address = [02 18 31 7e 3e 7f];
+                       netcp-gbe = <&gbe1>;
+               };
+       };
+};
diff --git a/arch/arm/dts/keystone-k2l.dtsi b/arch/arm/dts/keystone-k2l.dtsi
new file mode 100644 (file)
index 0000000..d681cab
--- /dev/null
@@ -0,0 +1,108 @@
+/*
+ * Copyright 2014 Texas Instruments, Inc.
+ *
+ * Keystone 2 Lamarr SoC specific device tree
+ *
+ * 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.
+ */
+
+/ {
+       cpus {
+               #address-cells = <1>;
+               #size-cells = <0>;
+
+               interrupt-parent = <&gic>;
+
+               cpu@0 {
+                       compatible = "arm,cortex-a15";
+                       device_type = "cpu";
+                       reg = <0>;
+               };
+
+               cpu@1 {
+                       compatible = "arm,cortex-a15";
+                       device_type = "cpu";
+                       reg = <1>;
+               };
+       };
+
+       soc {
+               /include/ "keystone-k2l-clocks.dtsi"
+
+               uart2: serial@02348400 {
+                       compatible = "ns16550a";
+                       current-speed = <115200>;
+                       reg-shift = <2>;
+                       reg-io-width = <4>;
+                       reg = <0x02348400 0x100>;
+                       clocks  = <&clkuart2>;
+                       interrupts = <GIC_SPI 432 IRQ_TYPE_EDGE_RISING>;
+               };
+
+               uart3:  serial@02348800 {
+                       compatible = "ns16550a";
+                       current-speed = <115200>;
+                       reg-shift = <2>;
+                       reg-io-width = <4>;
+                       reg = <0x02348800 0x100>;
+                       clocks  = <&clkuart3>;
+                       interrupts = <GIC_SPI 435 IRQ_TYPE_EDGE_RISING>;
+               };
+
+               dspgpio0: keystone_dsp_gpio@02620240 {
+                       compatible = "ti,keystone-dsp-gpio";
+                       gpio-controller;
+                       #gpio-cells = <2>;
+                       gpio,syscon-dev = <&devctrl 0x240>;
+               };
+
+               dspgpio1: keystone_dsp_gpio@2620244 {
+                       compatible = "ti,keystone-dsp-gpio";
+                       gpio-controller;
+                       #gpio-cells = <2>;
+                       gpio,syscon-dev = <&devctrl 0x244>;
+               };
+
+               dspgpio2: keystone_dsp_gpio@2620248 {
+                       compatible = "ti,keystone-dsp-gpio";
+                       gpio-controller;
+                       #gpio-cells = <2>;
+                       gpio,syscon-dev = <&devctrl 0x248>;
+               };
+
+               dspgpio3: keystone_dsp_gpio@262024c {
+                       compatible = "ti,keystone-dsp-gpio";
+                       gpio-controller;
+                       #gpio-cells = <2>;
+                       gpio,syscon-dev = <&devctrl 0x24c>;
+               };
+
+               mdio: mdio@26200f00 {
+                       compatible      = "ti,keystone_mdio", "ti,davinci_mdio";
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+                       reg = <0x26200f00 0x100>;
+                       status = "disabled";
+                       clocks = <&clkcpgmac>;
+                       clock-names = "fck";
+                       bus_freq        = <2500000>;
+               };
+               /include/ "keystone-k2l-netcp.dtsi"
+       };
+};
+
+&spi0 {
+       ti,davinci-spi-num-cs = <5>;
+};
+
+&spi1 {
+       ti,davinci-spi-num-cs = <3>;
+};
+
+&spi2 {
+       ti,davinci-spi-num-cs = <5>;
+       /* Pin muxed. Enabled and configured by Bootloader */
+       status = "disabled";
+};
index 91b19e00da22cd12a68991cc40680de0736651ca..19c6a985cdf43f228e71a54a316f0d2ffd8915e1 100644 (file)
@@ -117,10 +117,8 @@ relocation_return:
  */
        ldr     x0, =__bss_start                /* this is auto-relocated! */
        ldr     x1, =__bss_end                  /* this is auto-relocated! */
-       mov     x2, #0
 clear_loop:
-       str     x2, [x0]
-       add     x0, x0, #8
+       str     xzr, [x0], #8
        cmp     x0, x1
        b.lo    clear_loop
 
index 242e56e960848136fb2c61bb2eea12fd249f1d77..c7600537063f86b3297bc8a8a34af6db88e0bdca 100644 (file)
@@ -68,7 +68,7 @@ relocate_done:
        b       0f
 1:     mrs     x0, sctlr_el1
 0:     tbz     w0, #2, 5f      /* skip flushing cache if disabled */
-       tbz     w0, #12, 4f     /* invalide i-cache is enabled */
+       tbz     w0, #12, 4f     /* skip invalidating i-cache if disabled */
        ic      iallu           /* i-cache invalidate all */
        isb     sy
 4:     ldp     x0, x1, [sp, #16]
index ace102811661215e1d9089129e92786abd0a58d5..cb6e03fa3426afa1d0a452e156aef8ec24ad0f43 100644 (file)
@@ -392,7 +392,7 @@ static int ast2500_sdrammc_ofdata_to_platdata(struct udevice *dev)
        priv->regs = regmap_get_range(map, 0);
        priv->phy = regmap_get_range(map, 1);
 
-       priv->clock_rate = fdtdec_get_int(gd->fdt_blob, dev->of_offset,
+       priv->clock_rate = fdtdec_get_int(gd->fdt_blob, dev_of_offset(dev),
                                          "clock-frequency", 0);
 
        if (!priv->clock_rate) {
index be3d7132020f3999f83ec3dbcd3ec2c236fbec2b..89fd8e6bff1114a80727e44102dccf62358b9124 100644 (file)
@@ -1016,7 +1016,7 @@ static int rk3288_dmc_ofdata_to_platdata(struct udevice *dev)
 #if !CONFIG_IS_ENABLED(OF_PLATDATA)
        struct rk3288_sdram_params *params = dev_get_platdata(dev);
        const void *blob = gd->fdt_blob;
-       int node = dev->of_offset;
+       int node = dev_of_offset(dev);
        int ret;
 
        /* Rk3288 supports dual-channel, set default channel num to 2 */
index cd9ba6ba9e6def4370916448fbf43f4dd9b76c04..5739325da71b91004a4b168970647525120670c7 100644 (file)
@@ -13,6 +13,7 @@ config ARCH_UNIPHIER_32BIT
 config ARCH_UNIPHIER_64BIT
        bool
        select ARM64
+       select CMD_UNZIP
        select SPL_SEPARATE_BSS if SPL
        select ARMV8_MULTIENTRY if SPL
        select ARMV8_SPIN_TABLE if SPL
index 4f0f8fc5f8bb7c103776c89459feeccf390945c4..c1caa651742bbfb7c922a3bbc736086876150b92 100644 (file)
@@ -103,7 +103,7 @@ static int altera_nios2_get_count(struct udevice *dev)
 static int altera_nios2_probe(struct udevice *dev)
 {
        const void *blob = gd->fdt_blob;
-       int node = dev->of_offset;
+       int node = dev_of_offset(dev);
 
        gd->cpu_clk = fdtdec_get_int(blob, node,
                "clock-frequency", 0);
index e6d336f16ab3357f25fdef2e7cf06b3245e353b5..20614646f7fa608feec1f1e207c9e705b64a7212 100644 (file)
                stringarray = "one";
        };
 
+       spl-test4 {
+               u-boot,dm-pre-reloc;
+               compatible = "sandbox,spl-test.2";
+       };
+
        square {
                compatible = "demo-shape";
                colour = "blue";
index 0884af22a79edf3b245fb1c1c8a39d9eb871f1eb..5f9597b230fe6b7b0abe7aec7a142ec7a7eff80f 100644 (file)
@@ -4,6 +4,52 @@ menu "x86 architecture"
 config SYS_ARCH
        default "x86"
 
+choice
+       prompt "Run U-Boot in 32/64-bit mode"
+       default X86_RUN_32BIT
+       help
+         U-Boot can be built as a 32-bit binary which runs in 32-bit mode
+         even on 64-bit machines. In this case SPL is not used, and U-Boot
+         runs directly from the reset vector (via 16-bit start-up).
+
+         Alternatively it can be run as a 64-bit binary, thus requiring a
+         64-bit machine. In this case SPL runs in 32-bit mode (via 16-bit
+         start-up) then jumps to U-Boot in 64-bit mode.
+
+         For now, 32-bit mode is recommended, as 64-bit is still
+         experimental and is missing a lot of features.
+
+config X86_RUN_32BIT
+       bool "32-bit"
+       help
+         Build U-Boot as a 32-bit binary with no SPL. This is the currently
+         supported normal setup. U-Boot will stay in 32-bit mode even on
+         64-bit machines. When booting a 64-bit kernel, U-Boot will switch
+         to 64-bit just before starting the kernel. Only the bottom 4GB of
+         memory can be accessed through normal means, although
+         arch_phys_memset() can be used for basic access to other memory.
+
+config X86_RUN_64BIT
+       bool "64-bit"
+       select X86_64
+       select SUPPORT_SPL
+       select SPL
+       select SPL_SEPARATE_BSS
+       help
+         Build U-Boot as a 64-bit binary with a 32-bit SPL. This is
+         experimental and many features are missing. U-Boot SPL starts up,
+         runs through the 16-bit and 32-bit init, then switches to 64-bit
+         mode and jumps to U-Boot proper.
+
+endchoice
+
+config X86_64
+       bool
+
+config SPL_X86_64
+       bool
+       depends on SPL
+
 choice
        prompt "Mainboard vendor"
        default VENDOR_EMULATION
@@ -89,6 +135,46 @@ config X86_RESET_VECTOR
        bool
        default n
 
+# The following options control where the 16-bit and 32-bit init lies
+# If SPL is enabled then it normally holds this init code, and U-Boot proper
+# is normally a 64-bit build.
+#
+# The 16-bit init refers to the reset vector and the small amount of code to
+# get the processor into 32-bit mode. It may be in SPL or in U-Boot proper,
+# or missing altogether if U-Boot is started from EFI or coreboot.
+#
+# The 32-bit init refers to processor init, running binary blobs including
+# FSP, setting up interrupts and anything else that needs to be done in
+# 32-bit code. It is normally in the same place as 16-bit init if that is
+# enabled (i.e. they are both in SPL, or both in U-Boot proper).
+config X86_16BIT_INIT
+       bool
+       depends on X86_RESET_VECTOR
+       default y if X86_RESET_VECTOR && !SPL
+       help
+         This is enabled when 16-bit init is in U-Boot proper
+
+config SPL_X86_16BIT_INIT
+       bool
+       depends on X86_RESET_VECTOR
+       default y if X86_RESET_VECTOR && SPL
+       help
+         This is enabled when 16-bit init is in SPL
+
+config X86_32BIT_INIT
+       bool
+       depends on X86_RESET_VECTOR
+       default y if X86_RESET_VECTOR && !SPL
+       help
+         This is enabled when 32-bit init is in U-Boot proper
+
+config SPL_X86_32BIT_INIT
+       bool
+       depends on X86_RESET_VECTOR
+       default y if X86_RESET_VECTOR && SPL
+       help
+         This is enabled when 32-bit init is in SPL
+
 config RESET_SEG_START
        hex
        depends on X86_RESET_VECTOR
@@ -109,6 +195,14 @@ config SYS_X86_START16
        depends on X86_RESET_VECTOR
        default 0xfffff800
 
+config X86_LOAD_FROM_32_BIT
+       bool "Boot from a 32-bit program"
+       help
+         Define this to boot U-Boot from a 32-bit program which sets
+         the GDT differently. This can be used to boot directly from
+         any stage of coreboot, for example, bypassing the normal
+         payload-loading feature.
+
 config BOARD_ROMSIZE_KB_512
        bool
 config BOARD_ROMSIZE_KB_1024
index d104a497301dd3e41b828a03beda6178e40fbae8..4be1c353cc9e2bcb1a396938a28f355136a1caaf 100644 (file)
@@ -3,12 +3,15 @@
 #
 
 ifeq ($(CONFIG_EFI_APP),)
+ifdef CONFIG_$(SPL_)X86_64
+head-y := arch/x86/cpu/start64.o
+else
 head-y := arch/x86/cpu/start.o
 endif
-ifeq ($(CONFIG_SPL_BUILD),y)
-head-y += arch/x86/cpu/start16.o
-head-y += arch/x86/cpu/resetvec.o
 endif
 
+head-$(CONFIG_$(SPL_)X86_16BIT_INIT) += arch/x86/cpu/start16.o
+head-$(CONFIG_$(SPL_)X86_16BIT_INIT) += arch/x86/cpu/resetvec.o
+
 libs-y += arch/x86/cpu/
 libs-y += arch/x86/lib/
index 1697dca47fb2b9c78fa07ddb83c016bec6972720..74b87ceac54b646fa17bfd34b50b5cf3defb67a6 100644 (file)
@@ -15,11 +15,25 @@ PF_CPPFLAGS_X86   := $(call cc-option, -fno-toplevel-reorder, \
 
 PLATFORM_CPPFLAGS += $(PF_CPPFLAGS_X86)
 PLATFORM_CPPFLAGS += -fno-dwarf2-cfi-asm
+
+ifdef CONFIG_SPL_BUILD
+IS_32BIT := y
+else
+ifndef CONFIG_X86_64
+IS_32BIT := y
+endif
+endif
+
+ifeq ($(IS_32BIT),y)
 PLATFORM_CPPFLAGS += -march=i386 -m32
+else
+PLATFORM_CPPFLAGS += $(if $(CONFIG_SPL_BUILD),,-fpic) -fno-common
+endif
 
 PLATFORM_RELFLAGS += -ffunction-sections -fvisibility=hidden
 
-PLATFORM_LDFLAGS += -Bsymbolic -Bsymbolic-functions -m elf_i386
+PLATFORM_LDFLAGS += -Bsymbolic -Bsymbolic-functions
+PLATFORM_LDFLAGS += -m $(if $(IS_32BIT),elf_i386,elf_x86_64)
 
 LDFLAGS_FINAL += --wrap=__divdi3 --wrap=__udivdi3
 LDFLAGS_FINAL += --wrap=__moddi3 --wrap=__umoddi3
@@ -31,7 +45,9 @@ LDFLAGS_EFI_PAYLOAD := -Bsymbolic -Bsymbolic-functions -shared --no-undefined
 OBJCOPYFLAGS_EFI := -j .text -j .sdata -j .data -j .dynamic -j .dynsym \
        -j .rel -j .rela -j .reloc
 
+ifeq ($(IS_32BIT),y)
 CFLAGS_NON_EFI := -mregparm=3
+endif
 CFLAGS_EFI := -fpic -fshort-wchar
 
 ifeq ($(CONFIG_EFI_STUB_64BIT),)
@@ -62,8 +78,18 @@ else
 
 PLATFORM_CPPFLAGS += $(CFLAGS_NON_EFI)
 PLATFORM_LDFLAGS += --emit-relocs
-LDFLAGS_FINAL += --gc-sections -pie
+LDFLAGS_FINAL += --gc-sections $(if $(CONFIG_SPL_BUILD),,-pie)
+
+endif
 
+ifdef CONFIG_X86_64
+ifndef CONFIG_SPL_BUILD
+PLATFORM_CPPFLAGS += -D__x86_64__
+else
+PLATFORM_CPPFLAGS += -D__I386__
+endif
+else
+PLATFORM_CPPFLAGS += -D__I386__
 endif
 
 ifneq ($(CONFIG_EFI_STUB)$(CONFIG_CMD_BOOTEFI_HELLO_COMPILE),)
index f5b8c9e36320ecd06db471acc38ed9d5cc7cb650..92a9023b0b2f1369a82c817b5a83c2104eef54fb 100644 (file)
@@ -8,15 +8,22 @@
 # SPDX-License-Identifier:     GPL-2.0+
 #
 
+ifeq ($(CONFIG_$(SPL_)X86_64),y)
+extra-y        = start64.o
+else
 extra-y        = start.o
-obj-$(CONFIG_X86_RESET_VECTOR) += resetvec.o start16.o
-obj-y  += interrupts.o cpu.o cpu_x86.o call64.o setjmp.o
+endif
+extra-$(CONFIG_$(SPL_)X86_16BIT_INIT) += resetvec.o start16.o
 
+obj-y  += cpu.o cpu_x86.o
+
+ifndef CONFIG_$(SPL_)X86_64
 AFLAGS_REMOVE_call32.o := -mregparm=3 \
        $(if $(CONFIG_EFI_STUB_64BIT),-march=i386 -m32)
 AFLAGS_call32.o := -fpic -fshort-wchar
 
 extra-y += call32.o
+endif
 
 obj-y += intel_common/
 obj-$(CONFIG_INTEL_BAYTRAIL) += baytrail/
@@ -27,9 +34,20 @@ obj-$(CONFIG_QEMU) += qemu/
 obj-$(CONFIG_NORTHBRIDGE_INTEL_IVYBRIDGE) += ivybridge/
 obj-$(CONFIG_INTEL_QUARK) += quark/
 obj-$(CONFIG_INTEL_QUEENSBAY) += queensbay/
-obj-y += irq.o lapic.o ioapic.o
+obj-y += lapic.o ioapic.o
+obj-y += irq.o
+ifndef CONFIG_$(SPL_)X86_64
 obj-$(CONFIG_SMP) += mp_init.o
+endif
 obj-y += mtrr.o
 obj-$(CONFIG_PCI) += pci.o
+ifndef CONFIG_$(SPL_)X86_64
 obj-$(CONFIG_SMP) += sipi_vector.o
+endif
 obj-y += turbo.o
+
+ifeq ($(CONFIG_$(SPL_)X86_64),y)
+obj-y += x86_64/
+else
+obj-y += i386/
+endif
index 6977e860321fa3d83187c45ff41f7f1c75c8b99f..1b71d566c950829a4acba505e23284c3685eb661 100644 (file)
@@ -256,8 +256,8 @@ static void initialize_vr_config(struct udevice *dev)
        /* Set the slow ramp rate */
        msr.hi &= ~(0x3 << (53 - 32));
        /* Configure the C-state exit ramp rate */
-       ramp = fdtdec_get_int(gd->fdt_blob, dev->of_offset, "intel,slow-ramp",
-                             -1);
+       ramp = fdtdec_get_int(gd->fdt_blob, dev_of_offset(dev),
+                             "intel,slow-ramp", -1);
        if (ramp != -1) {
                /* Configured slow ramp rate */
                msr.hi |= ((ramp & 0x3) << (53 - 32));
@@ -271,8 +271,8 @@ static void initialize_vr_config(struct udevice *dev)
        }
        /* Set MIN_VID (31:24) to allow CPU to have full control */
        msr.lo &= ~0xff000000;
-       min_vid = fdtdec_get_int(gd->fdt_blob, dev->of_offset, "intel,min-vid",
-                                0);
+       min_vid = fdtdec_get_int(gd->fdt_blob, dev_of_offset(dev),
+                                "intel,min-vid", 0);
        msr.lo |= (min_vid & 0xff) << 24;
        msr_write(MSR_VR_MISC_CONFIG, msr);
 
@@ -562,7 +562,7 @@ static void configure_thermal_target(struct udevice *dev)
        int tcc_offset;
        msr_t msr;
 
-       tcc_offset = fdtdec_get_int(gd->fdt_blob, dev->of_offset,
+       tcc_offset = fdtdec_get_int(gd->fdt_blob, dev_of_offset(dev),
                                    "intel,tcc-offset", 0);
 
        /* Set TCC activaiton offset if supported */
index 317f57d3f9819f3a2de1185955fd200c196536bd..16eac3daae6f73640ae7f7e86e74ecfad477102e 100644 (file)
@@ -190,14 +190,14 @@ static int pch_power_options(struct udevice *dev)
        debug("Set power %s after power failure.\n", state);
 
        /* GPE setup based on device tree configuration */
-       ret = fdtdec_get_int_array(gd->fdt_blob, dev->of_offset,
+       ret = fdtdec_get_int_array(gd->fdt_blob, dev_of_offset(dev),
                                   "intel,gpe0-en", enable, ARRAY_SIZE(enable));
        if (ret)
                return -EINVAL;
        enable_all_gpe(enable[0], enable[1], enable[2], enable[3]);
 
        /* SMI setup based on device tree configuration */
-       enable_alt_smi(dev, fdtdec_get_int(gd->fdt_blob, dev->of_offset,
+       enable_alt_smi(dev, fdtdec_get_int(gd->fdt_blob, dev_of_offset(dev),
                                           "intel,alt-gp-smi-enable", 0));
 
        return 0;
index 2a3fcedd0dbc9de38e6311ad570a8a0ff46c078c..881413f476977b1e1fb4aa5ace018c6f9449a767 100644 (file)
@@ -51,7 +51,7 @@ static int broadwell_pinctrl_read_configs(struct udevice *dev,
        int node;
 
        debug("%s: starting\n", __func__);
-       for (node = fdt_first_subnode(blob, dev->of_offset);
+       for (node = fdt_first_subnode(blob, dev_of_offset(dev));
             node > 0;
             node = fdt_next_subnode(blob, node)) {
                int phandle = fdt_get_phandle(blob, node);
@@ -115,7 +115,7 @@ static int broadwell_pinctrl_read_pins(struct udevice *dev,
        int count = 0;
        int node;
 
-       for (node = fdt_first_subnode(blob, dev->of_offset);
+       for (node = fdt_first_subnode(blob, dev_of_offset(dev));
             node > 0;
             node = fdt_next_subnode(blob, node)) {
                int len, i;
index 2e4708262c1daa41411a7acc9b3b1e37778d3fbe..10461d99a8c10c30a890fb52134b19a3fc713dd8 100644 (file)
@@ -235,7 +235,7 @@ static int broadwell_sata_ofdata_to_platdata(struct udevice *dev)
 {
        struct sata_platdata *plat = dev_get_platdata(dev);
        const void *blob = gd->fdt_blob;
-       int node = dev->of_offset;
+       int node = dev_of_offset(dev);
 
        plat->port_map = fdtdec_get_int(blob, node, "intel,sata-port-map", 0);
        plat->port0_gen3_tx = fdtdec_get_int(blob, node,
diff --git a/arch/x86/cpu/call64.S b/arch/x86/cpu/call64.S
deleted file mode 100644 (file)
index 08dc473..0000000
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * (C) Copyright 2014 Google, Inc
- * Copyright (C) 1991, 1992, 1993  Linus Torvalds
- *
- * Parts of this copied from Linux arch/x86/boot/compressed/head_64.S
- *
- * SPDX-License-Identifier:    GPL-2.0+
- */
-
-#include <asm/global_data.h>
-#include <asm/msr-index.h>
-#include <asm/processor-flags.h>
-
-.code32
-.globl cpu_call64
-cpu_call64:
-       /*
-        * cpu_call64(ulong pgtable, ulong setup_base, ulong target)
-        *
-        * eax - pgtable
-        * edx - setup_base
-        * ecx - target
-        */
-       cli
-       push    %ecx            /* arg2 = target */
-       push    %edx            /* arg1 = setup_base */
-       mov     %eax, %ebx
-
-       /* Load new GDT with the 64bit segments using 32bit descriptor */
-       leal    gdt, %eax
-       movl    %eax, gdt+2
-       lgdt    gdt
-
-       /* Enable PAE mode */
-       movl    $(X86_CR4_PAE), %eax
-       movl    %eax, %cr4
-
-       /* Enable the boot page tables */
-       leal    (%ebx), %eax
-       movl    %eax, %cr3
-
-       /* Enable Long mode in EFER (Extended Feature Enable Register) */
-       movl    $MSR_EFER, %ecx
-       rdmsr
-       btsl    $_EFER_LME, %eax
-       wrmsr
-
-       /* After gdt is loaded */
-       xorl    %eax, %eax
-       lldt    %ax
-       movl    $0x20, %eax
-       ltr     %ax
-
-       /*
-        * Setup for the jump to 64bit mode
-        *
-        * When the jump is performed we will be in long mode but
-        * in 32bit compatibility mode with EFER.LME = 1, CS.L = 0, CS.D = 1
-        * (and in turn EFER.LMA = 1). To jump into 64bit mode we use
-        * the new gdt/idt that has __KERNEL_CS with CS.L = 1.
-        * We place all of the values on our mini stack so lret can
-        * used to perform that far jump. See the gdt below.
-        */
-       pop     %esi                    /* setup_base */
-
-       pushl   $0x10
-       leal    lret_target, %eax
-       pushl   %eax
-
-       /* Enter paged protected Mode, activating Long Mode */
-       movl    $(X86_CR0_PG | X86_CR0_PE), %eax
-       movl    %eax, %cr0
-
-       /* Jump from 32bit compatibility mode into 64bit mode. */
-       lret
-
-code64:
-lret_target:
-       pop     %eax                    /* target */
-       mov     %eax, %eax              /* Clear bits 63:32 */
-       jmp     *%eax                   /* Jump to the 64-bit target */
-
-       .data
-gdt:
-       .word   gdt_end - gdt - 1
-       .long   gdt                     /* Fixed up by code above */
-       .word   0
-       .quad   0x0000000000000000      /* NULL descriptor */
-       .quad   0x00af9a000000ffff      /* __KERNEL_CS */
-       .quad   0x00cf92000000ffff      /* __KERNEL_DS */
-       .quad   0x0080890000000000      /* TS descriptor */
-       .quad   0x0000000000000000      /* TS continued */
-gdt_end:
index 1263221e699493aa95b487cb2df962ecea2110cc..b519f433acf7cce841534ade1d102823cc62dc90 100644 (file)
@@ -7,11 +7,15 @@
 
 CROSS_COMPILE ?= i386-linux-
 
-PLATFORM_CPPFLAGS += -D__I386__
-
 # DO NOT MODIFY THE FOLLOWING UNLESS YOU REALLY KNOW WHAT YOU ARE DOING!
 LDPPFLAGS += -DRESET_SEG_START=$(CONFIG_RESET_SEG_START)
 LDPPFLAGS += -DRESET_SEG_SIZE=$(CONFIG_RESET_SEG_SIZE)
 LDPPFLAGS += -DRESET_VEC_LOC=$(CONFIG_RESET_VEC_LOC)
 LDPPFLAGS += -DSTART_16=$(CONFIG_SYS_X86_START16)
 LDPPFLAGS += -DRESET_BASE="CONFIG_SYS_TEXT_BASE + (CONFIG_SYS_MONITOR_LEN - RESET_SEG_SIZE)"
+
+ifdef CONFIG_X86_64
+ifndef CONFIG_SPL_BUILD
+LDSCRIPT = $(srctree)/arch/x86/cpu/u-boot-64.lds
+endif
+endif
index 7c1d6deda9d497d801777679a05f8ad3f8d22621..8fa6953588b51537c90dc81aa662b1694f2d208e 100644 (file)
 
 DECLARE_GLOBAL_DATA_PTR;
 
-/*
- * Constructor for a conventional segment GDT (or LDT) entry
- * This is a macro so it can be used in initialisers
- */
-#define GDT_ENTRY(flags, base, limit)                  \
-       ((((base)  & 0xff000000ULL) << (56-24)) |       \
-        (((flags) & 0x0000f0ffULL) << 40) |            \
-        (((limit) & 0x000f0000ULL) << (48-16)) |       \
-        (((base)  & 0x00ffffffULL) << 16) |            \
-        (((limit) & 0x0000ffffULL)))
-
-struct gdt_ptr {
-       u16 len;
-       u32 ptr;
-} __packed;
-
-struct cpu_device_id {
-       unsigned vendor;
-       unsigned device;
-};
-
-struct cpuinfo_x86 {
-       uint8_t x86;            /* CPU family */
-       uint8_t x86_vendor;     /* CPU vendor */
-       uint8_t x86_model;
-       uint8_t x86_mask;
-};
-
-/*
- * List of cpu vendor strings along with their normalized
- * id values.
- */
-static const struct {
-       int vendor;
-       const char *name;
-} x86_vendors[] = {
-       { X86_VENDOR_INTEL,     "GenuineIntel", },
-       { X86_VENDOR_CYRIX,     "CyrixInstead", },
-       { X86_VENDOR_AMD,       "AuthenticAMD", },
-       { X86_VENDOR_UMC,       "UMC UMC UMC ", },
-       { X86_VENDOR_NEXGEN,    "NexGenDriven", },
-       { X86_VENDOR_CENTAUR,   "CentaurHauls", },
-       { X86_VENDOR_RISE,      "RiseRiseRise", },
-       { X86_VENDOR_TRANSMETA, "GenuineTMx86", },
-       { X86_VENDOR_TRANSMETA, "TransmetaCPU", },
-       { X86_VENDOR_NSC,       "Geode by NSC", },
-       { X86_VENDOR_SIS,       "SiS SiS SiS ", },
-};
-
 static const char *const x86_vendor_name[] = {
        [X86_VENDOR_INTEL]     = "Intel",
        [X86_VENDOR_CYRIX]     = "Cyrix",
@@ -105,100 +56,6 @@ static const char *const x86_vendor_name[] = {
        [X86_VENDOR_SIS]       = "SiS",
 };
 
-static void load_ds(u32 segment)
-{
-       asm volatile("movl %0, %%ds" : : "r" (segment * X86_GDT_ENTRY_SIZE));
-}
-
-static void load_es(u32 segment)
-{
-       asm volatile("movl %0, %%es" : : "r" (segment * X86_GDT_ENTRY_SIZE));
-}
-
-static void load_fs(u32 segment)
-{
-       asm volatile("movl %0, %%fs" : : "r" (segment * X86_GDT_ENTRY_SIZE));
-}
-
-static void load_gs(u32 segment)
-{
-       asm volatile("movl %0, %%gs" : : "r" (segment * X86_GDT_ENTRY_SIZE));
-}
-
-static void load_ss(u32 segment)
-{
-       asm volatile("movl %0, %%ss" : : "r" (segment * X86_GDT_ENTRY_SIZE));
-}
-
-static void load_gdt(const u64 *boot_gdt, u16 num_entries)
-{
-       struct gdt_ptr gdt;
-
-       gdt.len = (num_entries * X86_GDT_ENTRY_SIZE) - 1;
-       gdt.ptr = (ulong)boot_gdt;
-
-       asm volatile("lgdtl %0\n" : : "m" (gdt));
-}
-
-void arch_setup_gd(gd_t *new_gd)
-{
-       u64 *gdt_addr;
-
-       gdt_addr = new_gd->arch.gdt;
-
-       /*
-        * CS: code, read/execute, 4 GB, base 0
-        *
-        * Some OS (like VxWorks) requires GDT entry 1 to be the 32-bit CS
-        */
-       gdt_addr[X86_GDT_ENTRY_UNUSED] = GDT_ENTRY(0xc09b, 0, 0xfffff);
-       gdt_addr[X86_GDT_ENTRY_32BIT_CS] = GDT_ENTRY(0xc09b, 0, 0xfffff);
-
-       /* DS: data, read/write, 4 GB, base 0 */
-       gdt_addr[X86_GDT_ENTRY_32BIT_DS] = GDT_ENTRY(0xc093, 0, 0xfffff);
-
-       /* FS: data, read/write, 4 GB, base (Global Data Pointer) */
-       new_gd->arch.gd_addr = new_gd;
-       gdt_addr[X86_GDT_ENTRY_32BIT_FS] = GDT_ENTRY(0xc093,
-                    (ulong)&new_gd->arch.gd_addr, 0xfffff);
-
-       /* 16-bit CS: code, read/execute, 64 kB, base 0 */
-       gdt_addr[X86_GDT_ENTRY_16BIT_CS] = GDT_ENTRY(0x009b, 0, 0x0ffff);
-
-       /* 16-bit DS: data, read/write, 64 kB, base 0 */
-       gdt_addr[X86_GDT_ENTRY_16BIT_DS] = GDT_ENTRY(0x0093, 0, 0x0ffff);
-
-       gdt_addr[X86_GDT_ENTRY_16BIT_FLAT_CS] = GDT_ENTRY(0x809b, 0, 0xfffff);
-       gdt_addr[X86_GDT_ENTRY_16BIT_FLAT_DS] = GDT_ENTRY(0x8093, 0, 0xfffff);
-
-       load_gdt(gdt_addr, X86_GDT_NUM_ENTRIES);
-       load_ds(X86_GDT_ENTRY_32BIT_DS);
-       load_es(X86_GDT_ENTRY_32BIT_DS);
-       load_gs(X86_GDT_ENTRY_32BIT_DS);
-       load_ss(X86_GDT_ENTRY_32BIT_DS);
-       load_fs(X86_GDT_ENTRY_32BIT_FS);
-}
-
-#ifdef CONFIG_HAVE_FSP
-/*
- * Setup FSP execution environment GDT
- *
- * Per Intel FSP external architecture specification, before calling any FSP
- * APIs, we need make sure the system is in flat 32-bit mode and both the code
- * and data selectors should have full 4GB access range. Here we reuse the one
- * we used in arch/x86/cpu/start16.S, and reload the segement registers.
- */
-void setup_fsp_gdt(void)
-{
-       load_gdt((const u64 *)(gdt_rom + CONFIG_RESET_SEG_START), 4);
-       load_ds(X86_GDT_ENTRY_32BIT_DS);
-       load_ss(X86_GDT_ENTRY_32BIT_DS);
-       load_es(X86_GDT_ENTRY_32BIT_DS);
-       load_fs(X86_GDT_ENTRY_32BIT_DS);
-       load_gs(X86_GDT_ENTRY_32BIT_DS);
-}
-#endif
-
 int __weak x86_cleanup_before_linux(void)
 {
 #ifdef CONFIG_BOOTSTAGE_STASH
@@ -209,241 +66,6 @@ int __weak x86_cleanup_before_linux(void)
        return 0;
 }
 
-/*
- * Cyrix CPUs without cpuid or with cpuid not yet enabled can be detected
- * by the fact that they preserve the flags across the division of 5/2.
- * PII and PPro exhibit this behavior too, but they have cpuid available.
- */
-
-/*
- * Perform the Cyrix 5/2 test. A Cyrix won't change
- * the flags, while other 486 chips will.
- */
-static inline int test_cyrix_52div(void)
-{
-       unsigned int test;
-
-       __asm__ __volatile__(
-            "sahf\n\t"         /* clear flags (%eax = 0x0005) */
-            "div %b2\n\t"      /* divide 5 by 2 */
-            "lahf"             /* store flags into %ah */
-            : "=a" (test)
-            : "0" (5), "q" (2)
-            : "cc");
-
-       /* AH is 0x02 on Cyrix after the divide.. */
-       return (unsigned char) (test >> 8) == 0x02;
-}
-
-/*
- *     Detect a NexGen CPU running without BIOS hypercode new enough
- *     to have CPUID. (Thanks to Herbert Oppmann)
- */
-
-static int deep_magic_nexgen_probe(void)
-{
-       int ret;
-
-       __asm__ __volatile__ (
-               "       movw    $0x5555, %%ax\n"
-               "       xorw    %%dx,%%dx\n"
-               "       movw    $2, %%cx\n"
-               "       divw    %%cx\n"
-               "       movl    $0, %%eax\n"
-               "       jnz     1f\n"
-               "       movl    $1, %%eax\n"
-               "1:\n"
-               : "=a" (ret) : : "cx", "dx");
-       return  ret;
-}
-
-static bool has_cpuid(void)
-{
-       return flag_is_changeable_p(X86_EFLAGS_ID);
-}
-
-static bool has_mtrr(void)
-{
-       return cpuid_edx(0x00000001) & (1 << 12) ? true : false;
-}
-
-static int build_vendor_name(char *vendor_name)
-{
-       struct cpuid_result result;
-       result = cpuid(0x00000000);
-       unsigned int *name_as_ints = (unsigned int *)vendor_name;
-
-       name_as_ints[0] = result.ebx;
-       name_as_ints[1] = result.edx;
-       name_as_ints[2] = result.ecx;
-
-       return result.eax;
-}
-
-static void identify_cpu(struct cpu_device_id *cpu)
-{
-       char vendor_name[16];
-       int i;
-
-       vendor_name[0] = '\0'; /* Unset */
-       cpu->device = 0; /* fix gcc 4.4.4 warning */
-
-       /* Find the id and vendor_name */
-       if (!has_cpuid()) {
-               /* Its a 486 if we can modify the AC flag */
-               if (flag_is_changeable_p(X86_EFLAGS_AC))
-                       cpu->device = 0x00000400; /* 486 */
-               else
-                       cpu->device = 0x00000300; /* 386 */
-               if ((cpu->device == 0x00000400) && test_cyrix_52div()) {
-                       memcpy(vendor_name, "CyrixInstead", 13);
-                       /* If we ever care we can enable cpuid here */
-               }
-               /* Detect NexGen with old hypercode */
-               else if (deep_magic_nexgen_probe())
-                       memcpy(vendor_name, "NexGenDriven", 13);
-       }
-       if (has_cpuid()) {
-               int  cpuid_level;
-
-               cpuid_level = build_vendor_name(vendor_name);
-               vendor_name[12] = '\0';
-
-               /* Intel-defined flags: level 0x00000001 */
-               if (cpuid_level >= 0x00000001) {
-                       cpu->device = cpuid_eax(0x00000001);
-               } else {
-                       /* Have CPUID level 0 only unheard of */
-                       cpu->device = 0x00000400;
-               }
-       }
-       cpu->vendor = X86_VENDOR_UNKNOWN;
-       for (i = 0; i < ARRAY_SIZE(x86_vendors); i++) {
-               if (memcmp(vendor_name, x86_vendors[i].name, 12) == 0) {
-                       cpu->vendor = x86_vendors[i].vendor;
-                       break;
-               }
-       }
-}
-
-static inline void get_fms(struct cpuinfo_x86 *c, uint32_t tfms)
-{
-       c->x86 = (tfms >> 8) & 0xf;
-       c->x86_model = (tfms >> 4) & 0xf;
-       c->x86_mask = tfms & 0xf;
-       if (c->x86 == 0xf)
-               c->x86 += (tfms >> 20) & 0xff;
-       if (c->x86 >= 0x6)
-               c->x86_model += ((tfms >> 16) & 0xF) << 4;
-}
-
-u32 cpu_get_family_model(void)
-{
-       return gd->arch.x86_device & 0x0fff0ff0;
-}
-
-u32 cpu_get_stepping(void)
-{
-       return gd->arch.x86_mask;
-}
-
-int x86_cpu_init_f(void)
-{
-       const u32 em_rst = ~X86_CR0_EM;
-       const u32 mp_ne_set = X86_CR0_MP | X86_CR0_NE;
-
-       if (ll_boot_init()) {
-               /* initialize FPU, reset EM, set MP and NE */
-               asm ("fninit\n" \
-               "movl %%cr0, %%eax\n" \
-               "andl %0, %%eax\n" \
-               "orl  %1, %%eax\n" \
-               "movl %%eax, %%cr0\n" \
-               : : "i" (em_rst), "i" (mp_ne_set) : "eax");
-       }
-
-       /* identify CPU via cpuid and store the decoded info into gd->arch */
-       if (has_cpuid()) {
-               struct cpu_device_id cpu;
-               struct cpuinfo_x86 c;
-
-               identify_cpu(&cpu);
-               get_fms(&c, cpu.device);
-               gd->arch.x86 = c.x86;
-               gd->arch.x86_vendor = cpu.vendor;
-               gd->arch.x86_model = c.x86_model;
-               gd->arch.x86_mask = c.x86_mask;
-               gd->arch.x86_device = cpu.device;
-
-               gd->arch.has_mtrr = has_mtrr();
-       }
-       /* Don't allow PCI region 3 to use memory in the 2-4GB memory hole */
-       gd->pci_ram_top = 0x80000000U;
-
-       /* Configure fixed range MTRRs for some legacy regions */
-       if (gd->arch.has_mtrr) {
-               u64 mtrr_cap;
-
-               mtrr_cap = native_read_msr(MTRR_CAP_MSR);
-               if (mtrr_cap & MTRR_CAP_FIX) {
-                       /* Mark the VGA RAM area as uncacheable */
-                       native_write_msr(MTRR_FIX_16K_A0000_MSR,
-                                        MTRR_FIX_TYPE(MTRR_TYPE_UNCACHEABLE),
-                                        MTRR_FIX_TYPE(MTRR_TYPE_UNCACHEABLE));
-
-                       /*
-                        * Mark the PCI ROM area as cacheable to improve ROM
-                        * execution performance.
-                        */
-                       native_write_msr(MTRR_FIX_4K_C0000_MSR,
-                                        MTRR_FIX_TYPE(MTRR_TYPE_WRBACK),
-                                        MTRR_FIX_TYPE(MTRR_TYPE_WRBACK));
-                       native_write_msr(MTRR_FIX_4K_C8000_MSR,
-                                        MTRR_FIX_TYPE(MTRR_TYPE_WRBACK),
-                                        MTRR_FIX_TYPE(MTRR_TYPE_WRBACK));
-                       native_write_msr(MTRR_FIX_4K_D0000_MSR,
-                                        MTRR_FIX_TYPE(MTRR_TYPE_WRBACK),
-                                        MTRR_FIX_TYPE(MTRR_TYPE_WRBACK));
-                       native_write_msr(MTRR_FIX_4K_D8000_MSR,
-                                        MTRR_FIX_TYPE(MTRR_TYPE_WRBACK),
-                                        MTRR_FIX_TYPE(MTRR_TYPE_WRBACK));
-
-                       /* Enable the fixed range MTRRs */
-                       msr_setbits_64(MTRR_DEF_TYPE_MSR, MTRR_DEF_TYPE_FIX_EN);
-               }
-       }
-
-#ifdef CONFIG_I8254_TIMER
-       /* Set up the i8254 timer if required */
-       i8254_init();
-#endif
-
-       return 0;
-}
-
-void x86_enable_caches(void)
-{
-       unsigned long cr0;
-
-       cr0 = read_cr0();
-       cr0 &= ~(X86_CR0_NW | X86_CR0_CD);
-       write_cr0(cr0);
-       wbinvd();
-}
-void enable_caches(void) __attribute__((weak, alias("x86_enable_caches")));
-
-void x86_disable_caches(void)
-{
-       unsigned long cr0;
-
-       cr0 = read_cr0();
-       cr0 |= X86_CR0_NW | X86_CR0_CD;
-       wbinvd();
-       write_cr0(cr0);
-       wbinvd();
-}
-void disable_caches(void) __attribute__((weak, alias("x86_disable_caches")));
-
 int x86_init_cache(void)
 {
        enable_caches();
@@ -483,11 +105,6 @@ void x86_full_reset(void)
        outb(FULL_RST | SYS_RST | RST_CPU, IO_PORT_RESET);
 }
 
-int dcache_status(void)
-{
-       return !(read_cr0() & X86_CR0_CD);
-}
-
 /* Define these functions to allow ehch-hcd to function */
 void flush_dcache_range(unsigned long start, unsigned long stop)
 {
@@ -520,57 +137,6 @@ int icache_status(void)
        return 1;
 }
 
-void cpu_enable_paging_pae(ulong cr3)
-{
-       __asm__ __volatile__(
-               /* Load the page table address */
-               "movl   %0, %%cr3\n"
-               /* Enable pae */
-               "movl   %%cr4, %%eax\n"
-               "orl    $0x00000020, %%eax\n"
-               "movl   %%eax, %%cr4\n"
-               /* Enable paging */
-               "movl   %%cr0, %%eax\n"
-               "orl    $0x80000000, %%eax\n"
-               "movl   %%eax, %%cr0\n"
-               :
-               : "r" (cr3)
-               : "eax");
-}
-
-void cpu_disable_paging_pae(void)
-{
-       /* Turn off paging */
-       __asm__ __volatile__ (
-               /* Disable paging */
-               "movl   %%cr0, %%eax\n"
-               "andl   $0x7fffffff, %%eax\n"
-               "movl   %%eax, %%cr0\n"
-               /* Disable pae */
-               "movl   %%cr4, %%eax\n"
-               "andl   $0xffffffdf, %%eax\n"
-               "movl   %%eax, %%cr4\n"
-               :
-               :
-               : "eax");
-}
-
-static bool can_detect_long_mode(void)
-{
-       return cpuid_eax(0x80000000) > 0x80000000UL;
-}
-
-static bool has_long_mode(void)
-{
-       return cpuid_edx(0x80000001) & (1 << 29) ? true : false;
-}
-
-int cpu_has_64bit(void)
-{
-       return has_cpuid() && can_detect_long_mode() &&
-               has_long_mode();
-}
-
 const char *cpu_vendor_name(int vendor)
 {
        const char *name;
@@ -616,46 +182,6 @@ int default_print_cpuinfo(void)
        return 0;
 }
 
-#define PAGETABLE_SIZE         (6 * 4096)
-
-/**
- * build_pagetable() - build a flat 4GiB page table structure for 64-bti mode
- *
- * @pgtable: Pointer to a 24iKB block of memory
- */
-static void build_pagetable(uint32_t *pgtable)
-{
-       uint i;
-
-       memset(pgtable, '\0', PAGETABLE_SIZE);
-
-       /* Level 4 needs a single entry */
-       pgtable[0] = (ulong)&pgtable[1024] + 7;
-
-       /* Level 3 has one 64-bit entry for each GiB of memory */
-       for (i = 0; i < 4; i++)
-               pgtable[1024 + i * 2] = (ulong)&pgtable[2048] + 0x1000 * i + 7;
-
-       /* Level 2 has 2048 64-bit entries, each repesenting 2MiB */
-       for (i = 0; i < 2048; i++)
-               pgtable[2048 + i * 2] = 0x183 + (i << 21UL);
-}
-
-int cpu_jump_to_64bit(ulong setup_base, ulong target)
-{
-       uint32_t *pgtable;
-
-       pgtable = memalign(4096, PAGETABLE_SIZE);
-       if (!pgtable)
-               return -ENOMEM;
-
-       build_pagetable(pgtable);
-       cpu_call64((ulong)pgtable, setup_base, target);
-       free(pgtable);
-
-       return -EFAULT;
-}
-
 void show_boot_progress(int val)
 {
        outb(val, POST_PORT);
@@ -680,36 +206,6 @@ int last_stage_init(void)
 }
 #endif
 
-#ifdef CONFIG_SMP
-static int enable_smis(struct udevice *cpu, void *unused)
-{
-       return 0;
-}
-
-static struct mp_flight_record mp_steps[] = {
-       MP_FR_BLOCK_APS(mp_init_cpu, NULL, mp_init_cpu, NULL),
-       /* Wait for APs to finish initialization before proceeding */
-       MP_FR_BLOCK_APS(NULL, NULL, enable_smis, NULL),
-};
-
-static int x86_mp_init(void)
-{
-       struct mp_params mp_params;
-
-       mp_params.parallel_microcode_load = 0,
-       mp_params.flight_plan = &mp_steps[0];
-       mp_params.num_records = ARRAY_SIZE(mp_steps);
-       mp_params.microcode_pointer = 0;
-
-       if (mp_init(&mp_params)) {
-               printf("Warning: MP init failure\n");
-               return -EIO;
-       }
-
-       return 0;
-}
-#endif
-
 static int x86_init_cpus(void)
 {
 #ifdef CONFIG_SMP
index 157f3de6d81e00dbd2f2e3651157fd84d389dbe1..8be14b5929110dd4dd29d107d4168630fb6b4065 100644 (file)
@@ -17,7 +17,7 @@ int cpu_x86_bind(struct udevice *dev)
        struct cpu_platdata *plat = dev_get_parent_platdata(dev);
        struct cpuid_result res;
 
-       plat->cpu_id = fdtdec_get_int(gd->fdt_blob, dev->of_offset,
+       plat->cpu_id = fdtdec_get_int(gd->fdt_blob, dev_of_offset(dev),
                                      "intel,apic-id", -1);
        plat->family = gd->arch.x86;
        res = cpuid(1);
diff --git a/arch/x86/cpu/i386/Makefile b/arch/x86/cpu/i386/Makefile
new file mode 100644 (file)
index 0000000..0c47252
--- /dev/null
@@ -0,0 +1,9 @@
+#
+# (C) Copyright 2016 Google, Inc
+# Written by Simon Glass <sjg@chromium.org>
+#
+
+obj-y += call64.o
+obj-y += cpu.o
+obj-y += interrupt.o
+obj-y += setjmp.o
diff --git a/arch/x86/cpu/i386/call64.S b/arch/x86/cpu/i386/call64.S
new file mode 100644 (file)
index 0000000..970c461
--- /dev/null
@@ -0,0 +1,96 @@
+/*
+ * (C) Copyright 2014 Google, Inc
+ * Copyright (C) 1991, 1992, 1993  Linus Torvalds
+ *
+ * Parts of this copied from Linux arch/x86/boot/compressed/head_64.S
+ *
+ * SPDX-License-Identifier:    GPL-2.0+
+ */
+
+#include <asm/global_data.h>
+#include <asm/msr-index.h>
+#include <asm/processor-flags.h>
+
+.code32
+.globl cpu_call64
+cpu_call64:
+       /*
+        * cpu_call64(ulong pgtable, ulong setup_base, ulong target)
+        *
+        * eax - pgtable
+        * edx - setup_base
+        * ecx - target
+        */
+       cli
+       push    %ecx            /* arg2 = target */
+       push    %edx            /* arg1 = setup_base */
+       mov     %eax, %ebx
+
+       /* Load new GDT with the 64bit segments using 32bit descriptor */
+       leal    gdt, %eax
+       movl    %eax, gdt+2
+       lgdt    gdt
+
+       /* Enable PAE mode */
+       movl    $(X86_CR4_PAE), %eax
+       movl    %eax, %cr4
+
+       /* Enable the boot page tables */
+       leal    (%ebx), %eax
+       movl    %eax, %cr3
+
+       /* Enable Long mode in EFER (Extended Feature Enable Register) */
+       movl    $MSR_EFER, %ecx
+       rdmsr
+       btsl    $_EFER_LME, %eax
+       wrmsr
+
+       /* After gdt is loaded */
+       xorl    %eax, %eax
+       lldt    %ax
+       movl    $0x20, %eax
+       ltr     %ax
+
+       /*
+        * Setup for the jump to 64bit mode
+        *
+        * When the jump is performed we will be in long mode but
+        * in 32bit compatibility mode with EFER.LME = 1, CS.L = 0, CS.D = 1
+        * (and in turn EFER.LMA = 1). To jump into 64bit mode we use
+        * the new gdt/idt that has __KERNEL_CS with CS.L = 1.
+        * We place all of the values on our mini stack so lret can
+        * used to perform that far jump. See the gdt below.
+        */
+       pop     %esi                    /* setup_base */
+
+       pushl   $0x10
+       leal    lret_target, %eax
+       pushl   %eax
+
+       /* Enter paged protected Mode, activating Long Mode */
+       movl    $(X86_CR0_PG | X86_CR0_PE), %eax
+       movl    %eax, %cr0
+
+       /* Jump from 32bit compatibility mode into 64bit mode. */
+       lret
+
+code64:
+lret_target:
+       pop     %eax                    /* target */
+       mov     %eax, %eax              /* Clear bits 63:32 */
+       jmp     *%eax                   /* Jump to the 64-bit target */
+
+       .data
+       .align  16
+       .globl  gdt64
+gdt64:
+gdt:
+       .word   gdt_end - gdt - 1
+       .long   gdt                     /* Fixed up by code above */
+       .word   0
+       .quad   0x0000000000000000      /* NULL descriptor */
+       .quad   0x00af9a000000ffff      /* __KERNEL_CS */
+       .quad   0x00cf92000000ffff      /* __KERNEL_DS */
+       .quad   0x0080890000000000      /* TS descriptor */
+       .quad   0x0000000000000000      /* TS continued */
+gdt_end:
diff --git a/arch/x86/cpu/i386/cpu.c b/arch/x86/cpu/i386/cpu.c
new file mode 100644 (file)
index 0000000..aabdc94
--- /dev/null
@@ -0,0 +1,598 @@
+/*
+ * (C) Copyright 2008-2011
+ * Graeme Russ, <graeme.russ@gmail.com>
+ *
+ * (C) Copyright 2002
+ * Daniel Engström, Omicron Ceti AB, <daniel@omicron.se>
+ *
+ * (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>
+ *
+ * Part of this file is adapted from coreboot
+ * src/arch/x86/lib/cpu.c
+ *
+ * SPDX-License-Identifier:    GPL-2.0+
+ */
+
+#include <common.h>
+#include <malloc.h>
+#include <asm/control_regs.h>
+#include <asm/cpu.h>
+#include <asm/mp.h>
+#include <asm/msr.h>
+#include <asm/mtrr.h>
+#include <asm/processor-flags.h>
+
+DECLARE_GLOBAL_DATA_PTR;
+
+/*
+ * Constructor for a conventional segment GDT (or LDT) entry
+ * This is a macro so it can be used in initialisers
+ */
+#define GDT_ENTRY(flags, base, limit)                  \
+       ((((base)  & 0xff000000ULL) << (56-24)) |       \
+        (((flags) & 0x0000f0ffULL) << 40) |            \
+        (((limit) & 0x000f0000ULL) << (48-16)) |       \
+        (((base)  & 0x00ffffffULL) << 16) |            \
+        (((limit) & 0x0000ffffULL)))
+
+struct gdt_ptr {
+       u16 len;
+       u32 ptr;
+} __packed;
+
+struct cpu_device_id {
+       unsigned vendor;
+       unsigned device;
+};
+
+struct cpuinfo_x86 {
+       uint8_t x86;            /* CPU family */
+       uint8_t x86_vendor;     /* CPU vendor */
+       uint8_t x86_model;
+       uint8_t x86_mask;
+};
+
+/*
+ * List of cpu vendor strings along with their normalized
+ * id values.
+ */
+static const struct {
+       int vendor;
+       const char *name;
+} x86_vendors[] = {
+       { X86_VENDOR_INTEL,     "GenuineIntel", },
+       { X86_VENDOR_CYRIX,     "CyrixInstead", },
+       { X86_VENDOR_AMD,       "AuthenticAMD", },
+       { X86_VENDOR_UMC,       "UMC UMC UMC ", },
+       { X86_VENDOR_NEXGEN,    "NexGenDriven", },
+       { X86_VENDOR_CENTAUR,   "CentaurHauls", },
+       { X86_VENDOR_RISE,      "RiseRiseRise", },
+       { X86_VENDOR_TRANSMETA, "GenuineTMx86", },
+       { X86_VENDOR_TRANSMETA, "TransmetaCPU", },
+       { X86_VENDOR_NSC,       "Geode by NSC", },
+       { X86_VENDOR_SIS,       "SiS SiS SiS ", },
+};
+
+static void load_ds(u32 segment)
+{
+       asm volatile("movl %0, %%ds" : : "r" (segment * X86_GDT_ENTRY_SIZE));
+}
+
+static void load_es(u32 segment)
+{
+       asm volatile("movl %0, %%es" : : "r" (segment * X86_GDT_ENTRY_SIZE));
+}
+
+static void load_fs(u32 segment)
+{
+       asm volatile("movl %0, %%fs" : : "r" (segment * X86_GDT_ENTRY_SIZE));
+}
+
+static void load_gs(u32 segment)
+{
+       asm volatile("movl %0, %%gs" : : "r" (segment * X86_GDT_ENTRY_SIZE));
+}
+
+static void load_ss(u32 segment)
+{
+       asm volatile("movl %0, %%ss" : : "r" (segment * X86_GDT_ENTRY_SIZE));
+}
+
+static void load_gdt(const u64 *boot_gdt, u16 num_entries)
+{
+       struct gdt_ptr gdt;
+
+       gdt.len = (num_entries * X86_GDT_ENTRY_SIZE) - 1;
+       gdt.ptr = (ulong)boot_gdt;
+
+       asm volatile("lgdtl %0\n" : : "m" (gdt));
+}
+
+void arch_setup_gd(gd_t *new_gd)
+{
+       u64 *gdt_addr;
+
+       gdt_addr = new_gd->arch.gdt;
+
+       /*
+        * CS: code, read/execute, 4 GB, base 0
+        *
+        * Some OS (like VxWorks) requires GDT entry 1 to be the 32-bit CS
+        */
+       gdt_addr[X86_GDT_ENTRY_UNUSED] = GDT_ENTRY(0xc09b, 0, 0xfffff);
+       gdt_addr[X86_GDT_ENTRY_32BIT_CS] = GDT_ENTRY(0xc09b, 0, 0xfffff);
+
+       /* DS: data, read/write, 4 GB, base 0 */
+       gdt_addr[X86_GDT_ENTRY_32BIT_DS] = GDT_ENTRY(0xc093, 0, 0xfffff);
+
+       /* FS: data, read/write, 4 GB, base (Global Data Pointer) */
+       new_gd->arch.gd_addr = new_gd;
+       gdt_addr[X86_GDT_ENTRY_32BIT_FS] = GDT_ENTRY(0xc093,
+                    (ulong)&new_gd->arch.gd_addr, 0xfffff);
+
+       /* 16-bit CS: code, read/execute, 64 kB, base 0 */
+       gdt_addr[X86_GDT_ENTRY_16BIT_CS] = GDT_ENTRY(0x009b, 0, 0x0ffff);
+
+       /* 16-bit DS: data, read/write, 64 kB, base 0 */
+       gdt_addr[X86_GDT_ENTRY_16BIT_DS] = GDT_ENTRY(0x0093, 0, 0x0ffff);
+
+       gdt_addr[X86_GDT_ENTRY_16BIT_FLAT_CS] = GDT_ENTRY(0x809b, 0, 0xfffff);
+       gdt_addr[X86_GDT_ENTRY_16BIT_FLAT_DS] = GDT_ENTRY(0x8093, 0, 0xfffff);
+
+       load_gdt(gdt_addr, X86_GDT_NUM_ENTRIES);
+       load_ds(X86_GDT_ENTRY_32BIT_DS);
+       load_es(X86_GDT_ENTRY_32BIT_DS);
+       load_gs(X86_GDT_ENTRY_32BIT_DS);
+       load_ss(X86_GDT_ENTRY_32BIT_DS);
+       load_fs(X86_GDT_ENTRY_32BIT_FS);
+}
+
+#ifdef CONFIG_HAVE_FSP
+/*
+ * Setup FSP execution environment GDT
+ *
+ * Per Intel FSP external architecture specification, before calling any FSP
+ * APIs, we need make sure the system is in flat 32-bit mode and both the code
+ * and data selectors should have full 4GB access range. Here we reuse the one
+ * we used in arch/x86/cpu/start16.S, and reload the segement registers.
+ */
+void setup_fsp_gdt(void)
+{
+       load_gdt((const u64 *)(gdt_rom + CONFIG_RESET_SEG_START), 4);
+       load_ds(X86_GDT_ENTRY_32BIT_DS);
+       load_ss(X86_GDT_ENTRY_32BIT_DS);
+       load_es(X86_GDT_ENTRY_32BIT_DS);
+       load_fs(X86_GDT_ENTRY_32BIT_DS);
+       load_gs(X86_GDT_ENTRY_32BIT_DS);
+}
+#endif
+
+/*
+ * Cyrix CPUs without cpuid or with cpuid not yet enabled can be detected
+ * by the fact that they preserve the flags across the division of 5/2.
+ * PII and PPro exhibit this behavior too, but they have cpuid available.
+ */
+
+/*
+ * Perform the Cyrix 5/2 test. A Cyrix won't change
+ * the flags, while other 486 chips will.
+ */
+static inline int test_cyrix_52div(void)
+{
+       unsigned int test;
+
+       __asm__ __volatile__(
+            "sahf\n\t"         /* clear flags (%eax = 0x0005) */
+            "div %b2\n\t"      /* divide 5 by 2 */
+            "lahf"             /* store flags into %ah */
+            : "=a" (test)
+            : "0" (5), "q" (2)
+            : "cc");
+
+       /* AH is 0x02 on Cyrix after the divide.. */
+       return (unsigned char) (test >> 8) == 0x02;
+}
+
+/*
+ *     Detect a NexGen CPU running without BIOS hypercode new enough
+ *     to have CPUID. (Thanks to Herbert Oppmann)
+ */
+static int deep_magic_nexgen_probe(void)
+{
+       int ret;
+
+       __asm__ __volatile__ (
+               "       movw    $0x5555, %%ax\n"
+               "       xorw    %%dx,%%dx\n"
+               "       movw    $2, %%cx\n"
+               "       divw    %%cx\n"
+               "       movl    $0, %%eax\n"
+               "       jnz     1f\n"
+               "       movl    $1, %%eax\n"
+               "1:\n"
+               : "=a" (ret) : : "cx", "dx");
+       return  ret;
+}
+
+static bool has_cpuid(void)
+{
+       return flag_is_changeable_p(X86_EFLAGS_ID);
+}
+
+static bool has_mtrr(void)
+{
+       return cpuid_edx(0x00000001) & (1 << 12) ? true : false;
+}
+
+static int build_vendor_name(char *vendor_name)
+{
+       struct cpuid_result result;
+       result = cpuid(0x00000000);
+       unsigned int *name_as_ints = (unsigned int *)vendor_name;
+
+       name_as_ints[0] = result.ebx;
+       name_as_ints[1] = result.edx;
+       name_as_ints[2] = result.ecx;
+
+       return result.eax;
+}
+
+static void identify_cpu(struct cpu_device_id *cpu)
+{
+       char vendor_name[16];
+       int i;
+
+       vendor_name[0] = '\0'; /* Unset */
+       cpu->device = 0; /* fix gcc 4.4.4 warning */
+
+       /* Find the id and vendor_name */
+       if (!has_cpuid()) {
+               /* Its a 486 if we can modify the AC flag */
+               if (flag_is_changeable_p(X86_EFLAGS_AC))
+                       cpu->device = 0x00000400; /* 486 */
+               else
+                       cpu->device = 0x00000300; /* 386 */
+               if ((cpu->device == 0x00000400) && test_cyrix_52div()) {
+                       memcpy(vendor_name, "CyrixInstead", 13);
+                       /* If we ever care we can enable cpuid here */
+               }
+               /* Detect NexGen with old hypercode */
+               else if (deep_magic_nexgen_probe())
+                       memcpy(vendor_name, "NexGenDriven", 13);
+       }
+       if (has_cpuid()) {
+               int  cpuid_level;
+
+               cpuid_level = build_vendor_name(vendor_name);
+               vendor_name[12] = '\0';
+
+               /* Intel-defined flags: level 0x00000001 */
+               if (cpuid_level >= 0x00000001) {
+                       cpu->device = cpuid_eax(0x00000001);
+               } else {
+                       /* Have CPUID level 0 only unheard of */
+                       cpu->device = 0x00000400;
+               }
+       }
+       cpu->vendor = X86_VENDOR_UNKNOWN;
+       for (i = 0; i < ARRAY_SIZE(x86_vendors); i++) {
+               if (memcmp(vendor_name, x86_vendors[i].name, 12) == 0) {
+                       cpu->vendor = x86_vendors[i].vendor;
+                       break;
+               }
+       }
+}
+
+static inline void get_fms(struct cpuinfo_x86 *c, uint32_t tfms)
+{
+       c->x86 = (tfms >> 8) & 0xf;
+       c->x86_model = (tfms >> 4) & 0xf;
+       c->x86_mask = tfms & 0xf;
+       if (c->x86 == 0xf)
+               c->x86 += (tfms >> 20) & 0xff;
+       if (c->x86 >= 0x6)
+               c->x86_model += ((tfms >> 16) & 0xF) << 4;
+}
+
+u32 cpu_get_family_model(void)
+{
+       return gd->arch.x86_device & 0x0fff0ff0;
+}
+
+u32 cpu_get_stepping(void)
+{
+       return gd->arch.x86_mask;
+}
+
+int x86_cpu_init_f(void)
+{
+       const u32 em_rst = ~X86_CR0_EM;
+       const u32 mp_ne_set = X86_CR0_MP | X86_CR0_NE;
+
+       if (ll_boot_init()) {
+               /* initialize FPU, reset EM, set MP and NE */
+               asm ("fninit\n" \
+               "movl %%cr0, %%eax\n" \
+               "andl %0, %%eax\n" \
+               "orl  %1, %%eax\n" \
+               "movl %%eax, %%cr0\n" \
+               : : "i" (em_rst), "i" (mp_ne_set) : "eax");
+       }
+
+       /* identify CPU via cpuid and store the decoded info into gd->arch */
+       if (has_cpuid()) {
+               struct cpu_device_id cpu;
+               struct cpuinfo_x86 c;
+
+               identify_cpu(&cpu);
+               get_fms(&c, cpu.device);
+               gd->arch.x86 = c.x86;
+               gd->arch.x86_vendor = cpu.vendor;
+               gd->arch.x86_model = c.x86_model;
+               gd->arch.x86_mask = c.x86_mask;
+               gd->arch.x86_device = cpu.device;
+
+               gd->arch.has_mtrr = has_mtrr();
+       }
+       /* Don't allow PCI region 3 to use memory in the 2-4GB memory hole */
+       gd->pci_ram_top = 0x80000000U;
+
+       /* Configure fixed range MTRRs for some legacy regions */
+       if (gd->arch.has_mtrr) {
+               u64 mtrr_cap;
+
+               mtrr_cap = native_read_msr(MTRR_CAP_MSR);
+               if (mtrr_cap & MTRR_CAP_FIX) {
+                       /* Mark the VGA RAM area as uncacheable */
+                       native_write_msr(MTRR_FIX_16K_A0000_MSR,
+                                        MTRR_FIX_TYPE(MTRR_TYPE_UNCACHEABLE),
+                                        MTRR_FIX_TYPE(MTRR_TYPE_UNCACHEABLE));
+
+                       /*
+                        * Mark the PCI ROM area as cacheable to improve ROM
+                        * execution performance.
+                        */
+                       native_write_msr(MTRR_FIX_4K_C0000_MSR,
+                                        MTRR_FIX_TYPE(MTRR_TYPE_WRBACK),
+                                        MTRR_FIX_TYPE(MTRR_TYPE_WRBACK));
+                       native_write_msr(MTRR_FIX_4K_C8000_MSR,
+                                        MTRR_FIX_TYPE(MTRR_TYPE_WRBACK),
+                                        MTRR_FIX_TYPE(MTRR_TYPE_WRBACK));
+                       native_write_msr(MTRR_FIX_4K_D0000_MSR,
+                                        MTRR_FIX_TYPE(MTRR_TYPE_WRBACK),
+                                        MTRR_FIX_TYPE(MTRR_TYPE_WRBACK));
+                       native_write_msr(MTRR_FIX_4K_D8000_MSR,
+                                        MTRR_FIX_TYPE(MTRR_TYPE_WRBACK),
+                                        MTRR_FIX_TYPE(MTRR_TYPE_WRBACK));
+
+                       /* Enable the fixed range MTRRs */
+                       msr_setbits_64(MTRR_DEF_TYPE_MSR, MTRR_DEF_TYPE_FIX_EN);
+               }
+       }
+
+#ifdef CONFIG_I8254_TIMER
+       /* Set up the i8254 timer if required */
+       i8254_init();
+#endif
+
+       return 0;
+}
+
+void x86_enable_caches(void)
+{
+       unsigned long cr0;
+
+       cr0 = read_cr0();
+       cr0 &= ~(X86_CR0_NW | X86_CR0_CD);
+       write_cr0(cr0);
+       wbinvd();
+}
+void enable_caches(void) __attribute__((weak, alias("x86_enable_caches")));
+
+void x86_disable_caches(void)
+{
+       unsigned long cr0;
+
+       cr0 = read_cr0();
+       cr0 |= X86_CR0_NW | X86_CR0_CD;
+       wbinvd();
+       write_cr0(cr0);
+       wbinvd();
+}
+void disable_caches(void) __attribute__((weak, alias("x86_disable_caches")));
+
+int dcache_status(void)
+{
+       return !(read_cr0() & X86_CR0_CD);
+}
+
+void cpu_enable_paging_pae(ulong cr3)
+{
+       __asm__ __volatile__(
+               /* Load the page table address */
+               "movl   %0, %%cr3\n"
+               /* Enable pae */
+               "movl   %%cr4, %%eax\n"
+               "orl    $0x00000020, %%eax\n"
+               "movl   %%eax, %%cr4\n"
+               /* Enable paging */
+               "movl   %%cr0, %%eax\n"
+               "orl    $0x80000000, %%eax\n"
+               "movl   %%eax, %%cr0\n"
+               :
+               : "r" (cr3)
+               : "eax");
+}
+
+void cpu_disable_paging_pae(void)
+{
+       /* Turn off paging */
+       __asm__ __volatile__ (
+               /* Disable paging */
+               "movl   %%cr0, %%eax\n"
+               "andl   $0x7fffffff, %%eax\n"
+               "movl   %%eax, %%cr0\n"
+               /* Disable pae */
+               "movl   %%cr4, %%eax\n"
+               "andl   $0xffffffdf, %%eax\n"
+               "movl   %%eax, %%cr4\n"
+               :
+               :
+               : "eax");
+}
+
+static bool can_detect_long_mode(void)
+{
+       return cpuid_eax(0x80000000) > 0x80000000UL;
+}
+
+static bool has_long_mode(void)
+{
+       return cpuid_edx(0x80000001) & (1 << 29) ? true : false;
+}
+
+int cpu_has_64bit(void)
+{
+       return has_cpuid() && can_detect_long_mode() &&
+               has_long_mode();
+}
+
+#define PAGETABLE_SIZE         (6 * 4096)
+
+/**
+ * build_pagetable() - build a flat 4GiB page table structure for 64-bti mode
+ *
+ * @pgtable: Pointer to a 24iKB block of memory
+ */
+static void build_pagetable(uint32_t *pgtable)
+{
+       uint i;
+
+       memset(pgtable, '\0', PAGETABLE_SIZE);
+
+       /* Level 4 needs a single entry */
+       pgtable[0] = (ulong)&pgtable[1024] + 7;
+
+       /* Level 3 has one 64-bit entry for each GiB of memory */
+       for (i = 0; i < 4; i++)
+               pgtable[1024 + i * 2] = (ulong)&pgtable[2048] + 0x1000 * i + 7;
+
+       /* Level 2 has 2048 64-bit entries, each repesenting 2MiB */
+       for (i = 0; i < 2048; i++)
+               pgtable[2048 + i * 2] = 0x183 + (i << 21UL);
+}
+
+int cpu_jump_to_64bit(ulong setup_base, ulong target)
+{
+       uint32_t *pgtable;
+
+       pgtable = memalign(4096, PAGETABLE_SIZE);
+       if (!pgtable)
+               return -ENOMEM;
+
+       build_pagetable(pgtable);
+       cpu_call64((ulong)pgtable, setup_base, target);
+       free(pgtable);
+
+       return -EFAULT;
+}
+
+/*
+ * Jump from SPL to U-Boot
+ *
+ * This function is work-in-progress with many issues to resolve.
+ *
+ * It works by setting up several regions:
+ *   ptr      - a place to put the code that jumps into 64-bit mode
+ *   gdt      - a place to put the global descriptor table
+ *   pgtable  - a place to put the page tables
+ *
+ * The cpu_call64() code is copied from ROM and then manually patched so that
+ * it has the correct GDT address in RAM. U-Boot is copied from ROM into
+ * its pre-relocation address. Then we jump to the cpu_call64() code in RAM,
+ * which changes to 64-bit mode and starts U-Boot.
+ */
+int cpu_jump_to_64bit_uboot(ulong target)
+{
+       typedef void (*func_t)(ulong pgtable, ulong setup_base, ulong target);
+       uint32_t *pgtable;
+       func_t func;
+
+       /* TODO(sjg@chromium.org): Find a better place for this */
+       pgtable = (uint32_t *)0x1000000;
+       if (!pgtable)
+               return -ENOMEM;
+
+       build_pagetable(pgtable);
+
+       /* TODO(sjg@chromium.org): Find a better place for this */
+       char *ptr = (char *)0x3000000;
+       char *gdt = (char *)0x3100000;
+
+       extern char gdt64[];
+
+       memcpy(ptr, cpu_call64, 0x1000);
+       memcpy(gdt, gdt64, 0x100);
+
+       /*
+        * TODO(sjg@chromium.org): This manually inserts the pointers into
+        * the code. Tidy this up to avoid this.
+        */
+       func = (func_t)ptr;
+       ulong ofs = (ulong)cpu_call64 - (ulong)ptr;
+       *(ulong *)(ptr + 7) = (ulong)gdt;
+       *(ulong *)(ptr + 0xc) = (ulong)gdt + 2;
+       *(ulong *)(ptr + 0x13) = (ulong)gdt;
+       *(ulong *)(ptr + 0x117 - 0xd4) -= ofs;
+
+       /*
+        * Copy U-Boot from ROM
+        * TODO(sjg@chromium.org): Figure out a way to get the text base
+        * correctly here, and in the device-tree binman definition.
+        *
+        * Also consider using FIT so we get the correct image length and
+        * parameters.
+        */
+       memcpy((char *)target, (char *)0xfff00000, 0x100000);
+
+       /* Jump to U-Boot */
+       func((ulong)pgtable, 0, (ulong)target);
+
+       return -EFAULT;
+}
+
+#ifdef CONFIG_SMP
+static int enable_smis(struct udevice *cpu, void *unused)
+{
+       return 0;
+}
+
+static struct mp_flight_record mp_steps[] = {
+       MP_FR_BLOCK_APS(mp_init_cpu, NULL, mp_init_cpu, NULL),
+       /* Wait for APs to finish initialization before proceeding */
+       MP_FR_BLOCK_APS(NULL, NULL, enable_smis, NULL),
+};
+
+int x86_mp_init(void)
+{
+       struct mp_params mp_params;
+
+       mp_params.parallel_microcode_load = 0,
+       mp_params.flight_plan = &mp_steps[0];
+       mp_params.num_records = ARRAY_SIZE(mp_steps);
+       mp_params.microcode_pointer = 0;
+
+       if (mp_init(&mp_params)) {
+               printf("Warning: MP init failure\n");
+               return -EIO;
+       }
+
+       return 0;
+}
+#endif
diff --git a/arch/x86/cpu/i386/interrupt.c b/arch/x86/cpu/i386/interrupt.c
new file mode 100644 (file)
index 0000000..a058303
--- /dev/null
@@ -0,0 +1,615 @@
+/*
+ * (C) Copyright 2008-2011
+ * Graeme Russ, <graeme.russ@gmail.com>
+ *
+ * (C) Copyright 2002
+ * Daniel Engström, Omicron Ceti AB, <daniel@omicron.se>
+ *
+ * Portions of this file are derived from the Linux kernel source
+ *  Copyright (C) 1991, 1992  Linus Torvalds
+ *
+ * SPDX-License-Identifier:    GPL-2.0+
+ */
+
+#include <common.h>
+#include <dm.h>
+#include <asm/control_regs.h>
+#include <asm/i8259.h>
+#include <asm/interrupt.h>
+#include <asm/io.h>
+#include <asm/lapic.h>
+#include <asm/processor-flags.h>
+
+DECLARE_GLOBAL_DATA_PTR;
+
+#define DECLARE_INTERRUPT(x) \
+       ".globl irq_"#x"\n" \
+       ".hidden irq_"#x"\n" \
+       ".type irq_"#x", @function\n" \
+       "irq_"#x":\n" \
+       "pushl $"#x"\n" \
+       "jmp irq_common_entry\n"
+
+static char *exceptions[] = {
+       "Divide Error",
+       "Debug",
+       "NMI Interrupt",
+       "Breakpoint",
+       "Overflow",
+       "BOUND Range Exceeded",
+       "Invalid Opcode (Undefined Opcode)",
+       "Device Not Avaiable (No Math Coprocessor)",
+       "Double Fault",
+       "Coprocessor Segment Overrun",
+       "Invalid TSS",
+       "Segment Not Present",
+       "Stack Segment Fault",
+       "General Protection",
+       "Page Fault",
+       "Reserved",
+       "x87 FPU Floating-Point Error",
+       "Alignment Check",
+       "Machine Check",
+       "SIMD Floating-Point Exception",
+       "Virtualization Exception",
+       "Reserved",
+       "Reserved",
+       "Reserved",
+       "Reserved",
+       "Reserved",
+       "Reserved",
+       "Reserved",
+       "Reserved",
+       "Reserved",
+       "Reserved",
+       "Reserved"
+};
+
+static void dump_regs(struct irq_regs *regs)
+{
+       unsigned long cs, eip, eflags;
+       unsigned long cr0 = 0L, cr2 = 0L, cr3 = 0L, cr4 = 0L;
+       unsigned long d0, d1, d2, d3, d6, d7;
+       unsigned long sp;
+
+       /*
+        * Some exceptions cause an error code to be saved on the current stack
+        * after the EIP value. We should extract CS/EIP/EFLAGS from different
+        * position on the stack based on the exception number.
+        */
+       switch (regs->irq_id) {
+       case EXC_DF:
+       case EXC_TS:
+       case EXC_NP:
+       case EXC_SS:
+       case EXC_GP:
+       case EXC_PF:
+       case EXC_AC:
+               cs = regs->context.ctx2.xcs;
+               eip = regs->context.ctx2.eip;
+               eflags = regs->context.ctx2.eflags;
+               /* We should fix up the ESP due to error code */
+               regs->esp += 4;
+               break;
+       default:
+               cs = regs->context.ctx1.xcs;
+               eip = regs->context.ctx1.eip;
+               eflags = regs->context.ctx1.eflags;
+               break;
+       }
+
+       printf("EIP: %04x:[<%08lx>] EFLAGS: %08lx\n",
+                       (u16)cs, eip, eflags);
+       if (gd->flags & GD_FLG_RELOC)
+               printf("Original EIP :[<%08lx>]\n", eip - gd->reloc_off);
+
+       printf("EAX: %08lx EBX: %08lx ECX: %08lx EDX: %08lx\n",
+               regs->eax, regs->ebx, regs->ecx, regs->edx);
+       printf("ESI: %08lx EDI: %08lx EBP: %08lx ESP: %08lx\n",
+               regs->esi, regs->edi, regs->ebp, regs->esp);
+       printf(" DS: %04x ES: %04x FS: %04x GS: %04x SS: %04x\n",
+              (u16)regs->xds, (u16)regs->xes, (u16)regs->xfs,
+              (u16)regs->xgs, (u16)regs->xss);
+
+       cr0 = read_cr0();
+       cr2 = read_cr2();
+       cr3 = read_cr3();
+       cr4 = read_cr4();
+
+       printf("CR0: %08lx CR2: %08lx CR3: %08lx CR4: %08lx\n",
+                       cr0, cr2, cr3, cr4);
+
+       d0 = get_debugreg(0);
+       d1 = get_debugreg(1);
+       d2 = get_debugreg(2);
+       d3 = get_debugreg(3);
+
+       printf("DR0: %08lx DR1: %08lx DR2: %08lx DR3: %08lx\n",
+                       d0, d1, d2, d3);
+
+       d6 = get_debugreg(6);
+       d7 = get_debugreg(7);
+       printf("DR6: %08lx DR7: %08lx\n",
+                       d6, d7);
+
+       printf("Stack:\n");
+       sp = regs->esp;
+
+       sp += 64;
+
+       while (sp > (regs->esp - 16)) {
+               if (sp == regs->esp)
+                       printf("--->");
+               else
+                       printf("    ");
+               printf("0x%8.8lx : 0x%8.8lx\n", sp, (ulong)readl(sp));
+               sp -= 4;
+       }
+}
+
+static void do_exception(struct irq_regs *regs)
+{
+       printf("%s\n", exceptions[regs->irq_id]);
+       dump_regs(regs);
+       hang();
+}
+
+struct idt_entry {
+       u16     base_low;
+       u16     selector;
+       u8      res;
+       u8      access;
+       u16     base_high;
+} __packed;
+
+struct desc_ptr {
+       unsigned short size;
+       unsigned long address;
+} __packed;
+
+struct idt_entry idt[256] __aligned(16);
+
+struct desc_ptr idt_ptr;
+
+static inline void load_idt(const struct desc_ptr *dtr)
+{
+       asm volatile("cs lidt %0" : : "m" (*dtr));
+}
+
+void set_vector(u8 intnum, void *routine)
+{
+       idt[intnum].base_high = (u16)((ulong)(routine) >> 16);
+       idt[intnum].base_low = (u16)((ulong)(routine) & 0xffff);
+}
+
+/*
+ * Ideally these would be defined static to avoid a checkpatch warning, but
+ * the compiler cannot see them in the inline asm and complains that they
+ * aren't defined
+ */
+void irq_0(void);
+void irq_1(void);
+
+int cpu_init_interrupts(void)
+{
+       int i;
+
+       int irq_entry_size = irq_1 - irq_0;
+       void *irq_entry = (void *)irq_0;
+
+       /* Setup the IDT */
+       for (i = 0; i < 256; i++) {
+               idt[i].access = 0x8e;
+               idt[i].res = 0;
+               idt[i].selector = X86_GDT_ENTRY_32BIT_CS * X86_GDT_ENTRY_SIZE;
+               set_vector(i, irq_entry);
+               irq_entry += irq_entry_size;
+       }
+
+       idt_ptr.size = 256 * 8 - 1;
+       idt_ptr.address = (unsigned long) idt;
+
+       load_idt(&idt_ptr);
+
+       return 0;
+}
+
+void *x86_get_idt(void)
+{
+       return &idt_ptr;
+}
+
+void __do_irq(int irq)
+{
+       printf("Unhandled IRQ : %d\n", irq);
+}
+void do_irq(int irq) __attribute__((weak, alias("__do_irq")));
+
+void enable_interrupts(void)
+{
+       asm("sti\n");
+}
+
+int disable_interrupts(void)
+{
+       long flags;
+
+#if CONFIG_IS_ENABLED(X86_64)
+       asm volatile ("pushfq ; popq %0 ; cli\n" : "=g" (flags) : );
+#else
+       asm volatile ("pushfl ; popl %0 ; cli\n" : "=g" (flags) : );
+#endif
+       return flags & X86_EFLAGS_IF;
+}
+
+int interrupt_init(void)
+{
+       struct udevice *dev;
+       int ret;
+
+       /* Try to set up the interrupt router, but don't require one */
+       ret = uclass_first_device_err(UCLASS_IRQ, &dev);
+       if (ret && ret != -ENODEV)
+               return ret;
+
+       /*
+        * When running as an EFI application we are not in control of
+        * interrupts and should leave them alone.
+        */
+#ifndef CONFIG_EFI_APP
+       /* Just in case... */
+       disable_interrupts();
+
+#ifdef CONFIG_I8259_PIC
+       /* Initialize the master/slave i8259 pic */
+       i8259_init();
+#endif
+
+       lapic_setup();
+
+       /* Initialize core interrupt and exception functionality of CPU */
+       cpu_init_interrupts();
+
+       /*
+        * It is now safe to enable interrupts.
+        *
+        * TODO(sjg@chromium.org): But we don't handle these correctly when
+        * booted from EFI.
+        */
+       if (ll_boot_init())
+               enable_interrupts();
+#endif
+
+       return 0;
+}
+
+/* IRQ Low-Level Service Routine */
+void irq_llsr(struct irq_regs *regs)
+{
+       /*
+        * For detailed description of each exception, refer to:
+        * Intel® 64 and IA-32 Architectures Software Developer's Manual
+        * Volume 1: Basic Architecture
+        * Order Number: 253665-029US, November 2008
+        * Table 6-1. Exceptions and Interrupts
+        */
+       if (regs->irq_id < 32) {
+               /* Architecture defined exception */
+               do_exception(regs);
+       } else {
+               /* Hardware or User IRQ */
+               do_irq(regs->irq_id);
+       }
+}
+
+/*
+ * OK - This looks really horrible, but it serves a purpose - It helps create
+ * fully relocatable code.
+ *  - The call to irq_llsr will be a relative jump
+ *  - The IRQ entries will be guaranteed to be in order
+ *  Interrupt entries are now very small (a push and a jump) but they are
+ *  now slower (all registers pushed on stack which provides complete
+ *  crash dumps in the low level handlers
+ *
+ * Interrupt Entry Point:
+ *  - Interrupt has caused eflags, CS and EIP to be pushed
+ *  - Interrupt Vector Handler has pushed orig_eax
+ *  - pt_regs.esp needs to be adjusted by 40 bytes:
+ *      12 bytes pushed by CPU (EFLAGSF, CS, EIP)
+ *      4 bytes pushed by vector handler (irq_id)
+ *      24 bytes pushed before SP (SS, GS, FS, ES, DS, EAX)
+ *      NOTE: Only longs are pushed on/popped off the stack!
+ */
+asm(".globl irq_common_entry\n" \
+       ".hidden irq_common_entry\n" \
+       ".type irq_common_entry, @function\n" \
+       "irq_common_entry:\n" \
+       "cld\n" \
+       "pushl %ss\n" \
+       "pushl %gs\n" \
+       "pushl %fs\n" \
+       "pushl %es\n" \
+       "pushl %ds\n" \
+       "pushl %eax\n" \
+       "movl  %esp, %eax\n" \
+       "addl  $40, %eax\n" \
+       "pushl %eax\n" \
+       "pushl %ebp\n" \
+       "pushl %edi\n" \
+       "pushl %esi\n" \
+       "pushl %edx\n" \
+       "pushl %ecx\n" \
+       "pushl %ebx\n" \
+       "mov   %esp, %eax\n" \
+       "call irq_llsr\n" \
+       "popl %ebx\n" \
+       "popl %ecx\n" \
+       "popl %edx\n" \
+       "popl %esi\n" \
+       "popl %edi\n" \
+       "popl %ebp\n" \
+       "popl %eax\n" \
+       "popl %eax\n" \
+       "popl %ds\n" \
+       "popl %es\n" \
+       "popl %fs\n" \
+       "popl %gs\n" \
+       "popl %ss\n" \
+       "add  $4, %esp\n" \
+       "iret\n" \
+       DECLARE_INTERRUPT(0) \
+       DECLARE_INTERRUPT(1) \
+       DECLARE_INTERRUPT(2) \
+       DECLARE_INTERRUPT(3) \
+       DECLARE_INTERRUPT(4) \
+       DECLARE_INTERRUPT(5) \
+       DECLARE_INTERRUPT(6) \
+       DECLARE_INTERRUPT(7) \
+       DECLARE_INTERRUPT(8) \
+       DECLARE_INTERRUPT(9) \
+       DECLARE_INTERRUPT(10) \
+       DECLARE_INTERRUPT(11) \
+       DECLARE_INTERRUPT(12) \
+       DECLARE_INTERRUPT(13) \
+       DECLARE_INTERRUPT(14) \
+       DECLARE_INTERRUPT(15) \
+       DECLARE_INTERRUPT(16) \
+       DECLARE_INTERRUPT(17) \
+       DECLARE_INTERRUPT(18) \
+       DECLARE_INTERRUPT(19) \
+       DECLARE_INTERRUPT(20) \
+       DECLARE_INTERRUPT(21) \
+       DECLARE_INTERRUPT(22) \
+       DECLARE_INTERRUPT(23) \
+       DECLARE_INTERRUPT(24) \
+       DECLARE_INTERRUPT(25) \
+       DECLARE_INTERRUPT(26) \
+       DECLARE_INTERRUPT(27) \
+       DECLARE_INTERRUPT(28) \
+       DECLARE_INTERRUPT(29) \
+       DECLARE_INTERRUPT(30) \
+       DECLARE_INTERRUPT(31) \
+       DECLARE_INTERRUPT(32) \
+       DECLARE_INTERRUPT(33) \
+       DECLARE_INTERRUPT(34) \
+       DECLARE_INTERRUPT(35) \
+       DECLARE_INTERRUPT(36) \
+       DECLARE_INTERRUPT(37) \
+       DECLARE_INTERRUPT(38) \
+       DECLARE_INTERRUPT(39) \
+       DECLARE_INTERRUPT(40) \
+       DECLARE_INTERRUPT(41) \
+       DECLARE_INTERRUPT(42) \
+       DECLARE_INTERRUPT(43) \
+       DECLARE_INTERRUPT(44) \
+       DECLARE_INTERRUPT(45) \
+       DECLARE_INTERRUPT(46) \
+       DECLARE_INTERRUPT(47) \
+       DECLARE_INTERRUPT(48) \
+       DECLARE_INTERRUPT(49) \
+       DECLARE_INTERRUPT(50) \
+       DECLARE_INTERRUPT(51) \
+       DECLARE_INTERRUPT(52) \
+       DECLARE_INTERRUPT(53) \
+       DECLARE_INTERRUPT(54) \
+       DECLARE_INTERRUPT(55) \
+       DECLARE_INTERRUPT(56) \
+       DECLARE_INTERRUPT(57) \
+       DECLARE_INTERRUPT(58) \
+       DECLARE_INTERRUPT(59) \
+       DECLARE_INTERRUPT(60) \
+       DECLARE_INTERRUPT(61) \
+       DECLARE_INTERRUPT(62) \
+       DECLARE_INTERRUPT(63) \
+       DECLARE_INTERRUPT(64) \
+       DECLARE_INTERRUPT(65) \
+       DECLARE_INTERRUPT(66) \
+       DECLARE_INTERRUPT(67) \
+       DECLARE_INTERRUPT(68) \
+       DECLARE_INTERRUPT(69) \
+       DECLARE_INTERRUPT(70) \
+       DECLARE_INTERRUPT(71) \
+       DECLARE_INTERRUPT(72) \
+       DECLARE_INTERRUPT(73) \
+       DECLARE_INTERRUPT(74) \
+       DECLARE_INTERRUPT(75) \
+       DECLARE_INTERRUPT(76) \
+       DECLARE_INTERRUPT(77) \
+       DECLARE_INTERRUPT(78) \
+       DECLARE_INTERRUPT(79) \
+       DECLARE_INTERRUPT(80) \
+       DECLARE_INTERRUPT(81) \
+       DECLARE_INTERRUPT(82) \
+       DECLARE_INTERRUPT(83) \
+       DECLARE_INTERRUPT(84) \
+       DECLARE_INTERRUPT(85) \
+       DECLARE_INTERRUPT(86) \
+       DECLARE_INTERRUPT(87) \
+       DECLARE_INTERRUPT(88) \
+       DECLARE_INTERRUPT(89) \
+       DECLARE_INTERRUPT(90) \
+       DECLARE_INTERRUPT(91) \
+       DECLARE_INTERRUPT(92) \
+       DECLARE_INTERRUPT(93) \
+       DECLARE_INTERRUPT(94) \
+       DECLARE_INTERRUPT(95) \
+       DECLARE_INTERRUPT(97) \
+       DECLARE_INTERRUPT(96) \
+       DECLARE_INTERRUPT(98) \
+       DECLARE_INTERRUPT(99) \
+       DECLARE_INTERRUPT(100) \
+       DECLARE_INTERRUPT(101) \
+       DECLARE_INTERRUPT(102) \
+       DECLARE_INTERRUPT(103) \
+       DECLARE_INTERRUPT(104) \
+       DECLARE_INTERRUPT(105) \
+       DECLARE_INTERRUPT(106) \
+       DECLARE_INTERRUPT(107) \
+       DECLARE_INTERRUPT(108) \
+       DECLARE_INTERRUPT(109) \
+       DECLARE_INTERRUPT(110) \
+       DECLARE_INTERRUPT(111) \
+       DECLARE_INTERRUPT(112) \
+       DECLARE_INTERRUPT(113) \
+       DECLARE_INTERRUPT(114) \
+       DECLARE_INTERRUPT(115) \
+       DECLARE_INTERRUPT(116) \
+       DECLARE_INTERRUPT(117) \
+       DECLARE_INTERRUPT(118) \
+       DECLARE_INTERRUPT(119) \
+       DECLARE_INTERRUPT(120) \
+       DECLARE_INTERRUPT(121) \
+       DECLARE_INTERRUPT(122) \
+       DECLARE_INTERRUPT(123) \
+       DECLARE_INTERRUPT(124) \
+       DECLARE_INTERRUPT(125) \
+       DECLARE_INTERRUPT(126) \
+       DECLARE_INTERRUPT(127) \
+       DECLARE_INTERRUPT(128) \
+       DECLARE_INTERRUPT(129) \
+       DECLARE_INTERRUPT(130) \
+       DECLARE_INTERRUPT(131) \
+       DECLARE_INTERRUPT(132) \
+       DECLARE_INTERRUPT(133) \
+       DECLARE_INTERRUPT(134) \
+       DECLARE_INTERRUPT(135) \
+       DECLARE_INTERRUPT(136) \
+       DECLARE_INTERRUPT(137) \
+       DECLARE_INTERRUPT(138) \
+       DECLARE_INTERRUPT(139) \
+       DECLARE_INTERRUPT(140) \
+       DECLARE_INTERRUPT(141) \
+       DECLARE_INTERRUPT(142) \
+       DECLARE_INTERRUPT(143) \
+       DECLARE_INTERRUPT(144) \
+       DECLARE_INTERRUPT(145) \
+       DECLARE_INTERRUPT(146) \
+       DECLARE_INTERRUPT(147) \
+       DECLARE_INTERRUPT(148) \
+       DECLARE_INTERRUPT(149) \
+       DECLARE_INTERRUPT(150) \
+       DECLARE_INTERRUPT(151) \
+       DECLARE_INTERRUPT(152) \
+       DECLARE_INTERRUPT(153) \
+       DECLARE_INTERRUPT(154) \
+       DECLARE_INTERRUPT(155) \
+       DECLARE_INTERRUPT(156) \
+       DECLARE_INTERRUPT(157) \
+       DECLARE_INTERRUPT(158) \
+       DECLARE_INTERRUPT(159) \
+       DECLARE_INTERRUPT(160) \
+       DECLARE_INTERRUPT(161) \
+       DECLARE_INTERRUPT(162) \
+       DECLARE_INTERRUPT(163) \
+       DECLARE_INTERRUPT(164) \
+       DECLARE_INTERRUPT(165) \
+       DECLARE_INTERRUPT(166) \
+       DECLARE_INTERRUPT(167) \
+       DECLARE_INTERRUPT(168) \
+       DECLARE_INTERRUPT(169) \
+       DECLARE_INTERRUPT(170) \
+       DECLARE_INTERRUPT(171) \
+       DECLARE_INTERRUPT(172) \
+       DECLARE_INTERRUPT(173) \
+       DECLARE_INTERRUPT(174) \
+       DECLARE_INTERRUPT(175) \
+       DECLARE_INTERRUPT(176) \
+       DECLARE_INTERRUPT(177) \
+       DECLARE_INTERRUPT(178) \
+       DECLARE_INTERRUPT(179) \
+       DECLARE_INTERRUPT(180) \
+       DECLARE_INTERRUPT(181) \
+       DECLARE_INTERRUPT(182) \
+       DECLARE_INTERRUPT(183) \
+       DECLARE_INTERRUPT(184) \
+       DECLARE_INTERRUPT(185) \
+       DECLARE_INTERRUPT(186) \
+       DECLARE_INTERRUPT(187) \
+       DECLARE_INTERRUPT(188) \
+       DECLARE_INTERRUPT(189) \
+       DECLARE_INTERRUPT(190) \
+       DECLARE_INTERRUPT(191) \
+       DECLARE_INTERRUPT(192) \
+       DECLARE_INTERRUPT(193) \
+       DECLARE_INTERRUPT(194) \
+       DECLARE_INTERRUPT(195) \
+       DECLARE_INTERRUPT(196) \
+       DECLARE_INTERRUPT(197) \
+       DECLARE_INTERRUPT(198) \
+       DECLARE_INTERRUPT(199) \
+       DECLARE_INTERRUPT(200) \
+       DECLARE_INTERRUPT(201) \
+       DECLARE_INTERRUPT(202) \
+       DECLARE_INTERRUPT(203) \
+       DECLARE_INTERRUPT(204) \
+       DECLARE_INTERRUPT(205) \
+       DECLARE_INTERRUPT(206) \
+       DECLARE_INTERRUPT(207) \
+       DECLARE_INTERRUPT(208) \
+       DECLARE_INTERRUPT(209) \
+       DECLARE_INTERRUPT(210) \
+       DECLARE_INTERRUPT(211) \
+       DECLARE_INTERRUPT(212) \
+       DECLARE_INTERRUPT(213) \
+       DECLARE_INTERRUPT(214) \
+       DECLARE_INTERRUPT(215) \
+       DECLARE_INTERRUPT(216) \
+       DECLARE_INTERRUPT(217) \
+       DECLARE_INTERRUPT(218) \
+       DECLARE_INTERRUPT(219) \
+       DECLARE_INTERRUPT(220) \
+       DECLARE_INTERRUPT(221) \
+       DECLARE_INTERRUPT(222) \
+       DECLARE_INTERRUPT(223) \
+       DECLARE_INTERRUPT(224) \
+       DECLARE_INTERRUPT(225) \
+       DECLARE_INTERRUPT(226) \
+       DECLARE_INTERRUPT(227) \
+       DECLARE_INTERRUPT(228) \
+       DECLARE_INTERRUPT(229) \
+       DECLARE_INTERRUPT(230) \
+       DECLARE_INTERRUPT(231) \
+       DECLARE_INTERRUPT(232) \
+       DECLARE_INTERRUPT(233) \
+       DECLARE_INTERRUPT(234) \
+       DECLARE_INTERRUPT(235) \
+       DECLARE_INTERRUPT(236) \
+       DECLARE_INTERRUPT(237) \
+       DECLARE_INTERRUPT(238) \
+       DECLARE_INTERRUPT(239) \
+       DECLARE_INTERRUPT(240) \
+       DECLARE_INTERRUPT(241) \
+       DECLARE_INTERRUPT(242) \
+       DECLARE_INTERRUPT(243) \
+       DECLARE_INTERRUPT(244) \
+       DECLARE_INTERRUPT(245) \
+       DECLARE_INTERRUPT(246) \
+       DECLARE_INTERRUPT(247) \
+       DECLARE_INTERRUPT(248) \
+       DECLARE_INTERRUPT(249) \
+       DECLARE_INTERRUPT(250) \
+       DECLARE_INTERRUPT(251) \
+       DECLARE_INTERRUPT(252) \
+       DECLARE_INTERRUPT(253) \
+       DECLARE_INTERRUPT(254) \
+       DECLARE_INTERRUPT(255));
diff --git a/arch/x86/cpu/i386/setjmp.S b/arch/x86/cpu/i386/setjmp.S
new file mode 100644 (file)
index 0000000..2ea1c6c
--- /dev/null
@@ -0,0 +1,61 @@
+/*
+ * Written by H. Peter Anvin <hpa@zytor.com>
+ * Brought in from Linux v4.4 and modified for U-Boot
+ * From Linux arch/um/sys-i386/setjmp.S
+ *
+ * SPDX-License-Identifier:    GPL-2.0
+ */
+
+#define _REGPARM
+
+/*
+ * The jmp_buf is assumed to contain the following, in order:
+ *     %ebx
+ *     %esp
+ *     %ebp
+ *     %esi
+ *     %edi
+ *     <return address>
+ */
+
+       .text
+       .align 4
+       .globl setjmp
+       .type setjmp, @function
+setjmp:
+#ifdef _REGPARM
+       movl %eax, %edx
+#else
+       movl 4(%esp), %edx
+#endif
+       popl %ecx               /* Return address, and adjust the stack */
+       xorl %eax, %eax         /* Return value */
+       movl %ebx, (%edx)
+       movl %esp, 4(%edx)      /* Post-return %esp! */
+       pushl %ecx              /* Make the call/return stack happy */
+       movl %ebp, 8(%edx)
+       movl %esi, 12(%edx)
+       movl %edi, 16(%edx)
+       movl %ecx, 20(%edx)     /* Return address */
+       ret
+
+       /* Provide function size if needed */
+       .size setjmp, .-setjmp
+
+       .align 4
+       .globl longjmp
+       .type longjmp, @function
+longjmp:
+#ifdef _REGPARM
+       xchgl %eax, %edx
+#else
+       movl 4(%esp), %edx      /* jmp_ptr address */
+#endif
+       movl (%edx), %ebx
+       movl 4(%edx), %esp
+       movl 8(%edx), %ebp
+       movl 12(%edx), %esi
+       movl 16(%edx), %edi
+       jmp *20(%edx)
+
+       .size longjmp, .-longjmp
index 804c539ca4bd4d30a7665f004b60065bedd708da..1145e7896cc4bc9f6f549d3bc05cd6c982dd3478 100644 (file)
@@ -4,13 +4,15 @@
 # SPDX-License-Identifier:     GPL-2.0+
 #
 
-obj-$(CONFIG_HAVE_MRC) += car.o
+ifdef CONFIG_HAVE_MRC
+obj-$(CONFIG_$(SPL_)X86_32BIT_INIT) += car.o
+obj-$(CONFIG_$(SPL_)X86_32BIT_INIT) += me_status.o
+obj-$(CONFIG_$(SPL_)X86_32BIT_INIT) += report_platform.o
+obj-$(CONFIG_$(SPL_)X86_32BIT_INIT) += mrc.o
+endif
 obj-y += cpu.o
 obj-y += lpc.o
-obj-$(CONFIG_HAVE_MRC) += me_status.o
 ifndef CONFIG_TARGET_EFI
 obj-y += microcode.o
 endif
 obj-y += pch.o
-obj-$(CONFIG_HAVE_MRC) += report_platform.o
-obj-$(CONFIG_HAVE_MRC) += mrc.o
index 03cb45b636912ddc59407c89e7bc790dfb1f8e3f..696b6304fe1a4fd96fae03534f6f0ef30587763e 100644 (file)
@@ -50,7 +50,7 @@ int lpc_common_early_init(struct udevice *dev)
        int count;
        int i;
 
-       count = fdtdec_get_int_array_count(gd->fdt_blob, dev->of_offset,
+       count = fdtdec_get_int_array_count(gd->fdt_blob, dev_of_offset(dev),
                        "intel,gen-dec", (u32 *)values,
                        sizeof(values) / sizeof(u32));
        if (count < 0)
index 01b6e866b5b71e5c130e220a2b1305ad39ea1362..f1a249af72ce402c4bf3558e9612ec2239c6acd7 100644 (file)
@@ -149,7 +149,7 @@ int mrc_locate_spd(struct udevice *dev, int size, const void **spd_datap)
        spd_index = dm_gpio_get_values_as_int(desc, ret);
        debug("spd index %d\n", spd_index);
 
-       node = fdt_first_subnode(blob, dev->of_offset);
+       node = fdt_first_subnode(blob, dev_of_offset(dev));
        if (node < 0)
                return -EINVAL;
        for (spd_node = fdt_first_subnode(blob, node);
diff --git a/arch/x86/cpu/interrupts.c b/arch/x86/cpu/interrupts.c
deleted file mode 100644 (file)
index 5f6cdd3..0000000
+++ /dev/null
@@ -1,619 +0,0 @@
-/*
- * (C) Copyright 2008-2011
- * Graeme Russ, <graeme.russ@gmail.com>
- *
- * (C) Copyright 2002
- * Daniel Engström, Omicron Ceti AB, <daniel@omicron.se>
- *
- * Portions of this file are derived from the Linux kernel source
- *  Copyright (C) 1991, 1992  Linus Torvalds
- *
- * SPDX-License-Identifier:    GPL-2.0+
- */
-
-#include <common.h>
-#include <dm.h>
-#include <asm/cache.h>
-#include <asm/control_regs.h>
-#include <asm/i8259.h>
-#include <asm/interrupt.h>
-#include <asm/io.h>
-#include <asm/lapic.h>
-#include <asm/msr.h>
-#include <asm/processor-flags.h>
-#include <asm/processor.h>
-#include <asm/u-boot-x86.h>
-
-DECLARE_GLOBAL_DATA_PTR;
-
-#define DECLARE_INTERRUPT(x) \
-       ".globl irq_"#x"\n" \
-       ".hidden irq_"#x"\n" \
-       ".type irq_"#x", @function\n" \
-       "irq_"#x":\n" \
-       "pushl $"#x"\n" \
-       "jmp irq_common_entry\n"
-
-static char *exceptions[] = {
-       "Divide Error",
-       "Debug",
-       "NMI Interrupt",
-       "Breakpoint",
-       "Overflow",
-       "BOUND Range Exceeded",
-       "Invalid Opcode (Undefined Opcode)",
-       "Device Not Avaiable (No Math Coprocessor)",
-       "Double Fault",
-       "Coprocessor Segment Overrun",
-       "Invalid TSS",
-       "Segment Not Present",
-       "Stack Segment Fault",
-       "General Protection",
-       "Page Fault",
-       "Reserved",
-       "x87 FPU Floating-Point Error",
-       "Alignment Check",
-       "Machine Check",
-       "SIMD Floating-Point Exception",
-       "Virtualization Exception",
-       "Reserved",
-       "Reserved",
-       "Reserved",
-       "Reserved",
-       "Reserved",
-       "Reserved",
-       "Reserved",
-       "Reserved",
-       "Reserved",
-       "Reserved",
-       "Reserved"
-};
-
-static void dump_regs(struct irq_regs *regs)
-{
-       unsigned long cs, eip, eflags;
-       unsigned long cr0 = 0L, cr2 = 0L, cr3 = 0L, cr4 = 0L;
-       unsigned long d0, d1, d2, d3, d6, d7;
-       unsigned long sp;
-
-       /*
-        * Some exceptions cause an error code to be saved on the current stack
-        * after the EIP value. We should extract CS/EIP/EFLAGS from different
-        * position on the stack based on the exception number.
-        */
-       switch (regs->irq_id) {
-       case EXC_DF:
-       case EXC_TS:
-       case EXC_NP:
-       case EXC_SS:
-       case EXC_GP:
-       case EXC_PF:
-       case EXC_AC:
-               cs = regs->context.ctx2.xcs;
-               eip = regs->context.ctx2.eip;
-               eflags = regs->context.ctx2.eflags;
-               /* We should fix up the ESP due to error code */
-               regs->esp += 4;
-               break;
-       default:
-               cs = regs->context.ctx1.xcs;
-               eip = regs->context.ctx1.eip;
-               eflags = regs->context.ctx1.eflags;
-               break;
-       }
-
-       printf("EIP: %04x:[<%08lx>] EFLAGS: %08lx\n",
-                       (u16)cs, eip, eflags);
-       if (gd->flags & GD_FLG_RELOC)
-               printf("Original EIP :[<%08lx>]\n", eip - gd->reloc_off);
-
-       printf("EAX: %08lx EBX: %08lx ECX: %08lx EDX: %08lx\n",
-               regs->eax, regs->ebx, regs->ecx, regs->edx);
-       printf("ESI: %08lx EDI: %08lx EBP: %08lx ESP: %08lx\n",
-               regs->esi, regs->edi, regs->ebp, regs->esp);
-       printf(" DS: %04x ES: %04x FS: %04x GS: %04x SS: %04x\n",
-              (u16)regs->xds, (u16)regs->xes, (u16)regs->xfs,
-              (u16)regs->xgs, (u16)regs->xss);
-
-       cr0 = read_cr0();
-       cr2 = read_cr2();
-       cr3 = read_cr3();
-       cr4 = read_cr4();
-
-       printf("CR0: %08lx CR2: %08lx CR3: %08lx CR4: %08lx\n",
-                       cr0, cr2, cr3, cr4);
-
-       d0 = get_debugreg(0);
-       d1 = get_debugreg(1);
-       d2 = get_debugreg(2);
-       d3 = get_debugreg(3);
-
-       printf("DR0: %08lx DR1: %08lx DR2: %08lx DR3: %08lx\n",
-                       d0, d1, d2, d3);
-
-       d6 = get_debugreg(6);
-       d7 = get_debugreg(7);
-       printf("DR6: %08lx DR7: %08lx\n",
-                       d6, d7);
-
-       printf("Stack:\n");
-       sp = regs->esp;
-
-       sp += 64;
-
-       while (sp > (regs->esp - 16)) {
-               if (sp == regs->esp)
-                       printf("--->");
-               else
-                       printf("    ");
-               printf("0x%8.8lx : 0x%8.8lx\n", sp, (ulong)readl(sp));
-               sp -= 4;
-       }
-}
-
-static void do_exception(struct irq_regs *regs)
-{
-       printf("%s\n", exceptions[regs->irq_id]);
-       dump_regs(regs);
-       hang();
-}
-
-struct idt_entry {
-       u16     base_low;
-       u16     selector;
-       u8      res;
-       u8      access;
-       u16     base_high;
-} __packed;
-
-struct desc_ptr {
-       unsigned short size;
-       unsigned long address;
-} __packed;
-
-struct idt_entry idt[256] __aligned(16);
-
-struct desc_ptr idt_ptr;
-
-static inline void load_idt(const struct desc_ptr *dtr)
-{
-       asm volatile("cs lidt %0" : : "m" (*dtr));
-}
-
-void set_vector(u8 intnum, void *routine)
-{
-       idt[intnum].base_high = (u16)((ulong)(routine) >> 16);
-       idt[intnum].base_low = (u16)((ulong)(routine) & 0xffff);
-}
-
-/*
- * Ideally these would be defined static to avoid a checkpatch warning, but
- * the compiler cannot see them in the inline asm and complains that they
- * aren't defined
- */
-void irq_0(void);
-void irq_1(void);
-
-int cpu_init_interrupts(void)
-{
-       int i;
-
-       int irq_entry_size = irq_1 - irq_0;
-       void *irq_entry = (void *)irq_0;
-
-       /* Setup the IDT */
-       for (i = 0; i < 256; i++) {
-               idt[i].access = 0x8e;
-               idt[i].res = 0;
-               idt[i].selector = X86_GDT_ENTRY_32BIT_CS * X86_GDT_ENTRY_SIZE;
-               set_vector(i, irq_entry);
-               irq_entry += irq_entry_size;
-       }
-
-       idt_ptr.size = 256 * 8 - 1;
-       idt_ptr.address = (unsigned long) idt;
-
-       load_idt(&idt_ptr);
-
-       return 0;
-}
-
-void *x86_get_idt(void)
-{
-       return &idt_ptr;
-}
-
-void __do_irq(int irq)
-{
-       printf("Unhandled IRQ : %d\n", irq);
-}
-void do_irq(int irq) __attribute__((weak, alias("__do_irq")));
-
-void enable_interrupts(void)
-{
-       asm("sti\n");
-}
-
-int disable_interrupts(void)
-{
-       long flags;
-
-#ifdef CONFIG_X86_64
-       asm volatile ("pushfq ; popq %0 ; cli\n" : "=g" (flags) : );
-#else
-       asm volatile ("pushfl ; popl %0 ; cli\n" : "=g" (flags) : );
-#endif
-       return flags & X86_EFLAGS_IF;
-}
-
-int interrupt_init(void)
-{
-       struct udevice *dev;
-       int ret;
-
-       /* Try to set up the interrupt router, but don't require one */
-       ret = uclass_first_device_err(UCLASS_IRQ, &dev);
-       if (ret && ret != -ENODEV)
-               return ret;
-
-       /*
-        * When running as an EFI application we are not in control of
-        * interrupts and should leave them alone.
-        */
-#ifndef CONFIG_EFI_APP
-       /* Just in case... */
-       disable_interrupts();
-
-#ifdef CONFIG_I8259_PIC
-       /* Initialize the master/slave i8259 pic */
-       i8259_init();
-#endif
-
-       lapic_setup();
-
-       /* Initialize core interrupt and exception functionality of CPU */
-       cpu_init_interrupts();
-
-       /*
-        * It is now safe to enable interrupts.
-        *
-        * TODO(sjg@chromium.org): But we don't handle these correctly when
-        * booted from EFI.
-        */
-       if (ll_boot_init())
-               enable_interrupts();
-#endif
-
-       return 0;
-}
-
-/* IRQ Low-Level Service Routine */
-void irq_llsr(struct irq_regs *regs)
-{
-       /*
-        * For detailed description of each exception, refer to:
-        * Intel® 64 and IA-32 Architectures Software Developer's Manual
-        * Volume 1: Basic Architecture
-        * Order Number: 253665-029US, November 2008
-        * Table 6-1. Exceptions and Interrupts
-        */
-       if (regs->irq_id < 32) {
-               /* Architecture defined exception */
-               do_exception(regs);
-       } else {
-               /* Hardware or User IRQ */
-               do_irq(regs->irq_id);
-       }
-}
-
-/*
- * OK - This looks really horrible, but it serves a purpose - It helps create
- * fully relocatable code.
- *  - The call to irq_llsr will be a relative jump
- *  - The IRQ entries will be guaranteed to be in order
- *  Interrupt entries are now very small (a push and a jump) but they are
- *  now slower (all registers pushed on stack which provides complete
- *  crash dumps in the low level handlers
- *
- * Interrupt Entry Point:
- *  - Interrupt has caused eflags, CS and EIP to be pushed
- *  - Interrupt Vector Handler has pushed orig_eax
- *  - pt_regs.esp needs to be adjusted by 40 bytes:
- *      12 bytes pushed by CPU (EFLAGSF, CS, EIP)
- *      4 bytes pushed by vector handler (irq_id)
- *      24 bytes pushed before SP (SS, GS, FS, ES, DS, EAX)
- *      NOTE: Only longs are pushed on/popped off the stack!
- */
-asm(".globl irq_common_entry\n" \
-       ".hidden irq_common_entry\n" \
-       ".type irq_common_entry, @function\n" \
-       "irq_common_entry:\n" \
-       "cld\n" \
-       "pushl %ss\n" \
-       "pushl %gs\n" \
-       "pushl %fs\n" \
-       "pushl %es\n" \
-       "pushl %ds\n" \
-       "pushl %eax\n" \
-       "movl  %esp, %eax\n" \
-       "addl  $40, %eax\n" \
-       "pushl %eax\n" \
-       "pushl %ebp\n" \
-       "pushl %edi\n" \
-       "pushl %esi\n" \
-       "pushl %edx\n" \
-       "pushl %ecx\n" \
-       "pushl %ebx\n" \
-       "mov   %esp, %eax\n" \
-       "call irq_llsr\n" \
-       "popl %ebx\n" \
-       "popl %ecx\n" \
-       "popl %edx\n" \
-       "popl %esi\n" \
-       "popl %edi\n" \
-       "popl %ebp\n" \
-       "popl %eax\n" \
-       "popl %eax\n" \
-       "popl %ds\n" \
-       "popl %es\n" \
-       "popl %fs\n" \
-       "popl %gs\n" \
-       "popl %ss\n" \
-       "add  $4, %esp\n" \
-       "iret\n" \
-       DECLARE_INTERRUPT(0) \
-       DECLARE_INTERRUPT(1) \
-       DECLARE_INTERRUPT(2) \
-       DECLARE_INTERRUPT(3) \
-       DECLARE_INTERRUPT(4) \
-       DECLARE_INTERRUPT(5) \
-       DECLARE_INTERRUPT(6) \
-       DECLARE_INTERRUPT(7) \
-       DECLARE_INTERRUPT(8) \
-       DECLARE_INTERRUPT(9) \
-       DECLARE_INTERRUPT(10) \
-       DECLARE_INTERRUPT(11) \
-       DECLARE_INTERRUPT(12) \
-       DECLARE_INTERRUPT(13) \
-       DECLARE_INTERRUPT(14) \
-       DECLARE_INTERRUPT(15) \
-       DECLARE_INTERRUPT(16) \
-       DECLARE_INTERRUPT(17) \
-       DECLARE_INTERRUPT(18) \
-       DECLARE_INTERRUPT(19) \
-       DECLARE_INTERRUPT(20) \
-       DECLARE_INTERRUPT(21) \
-       DECLARE_INTERRUPT(22) \
-       DECLARE_INTERRUPT(23) \
-       DECLARE_INTERRUPT(24) \
-       DECLARE_INTERRUPT(25) \
-       DECLARE_INTERRUPT(26) \
-       DECLARE_INTERRUPT(27) \
-       DECLARE_INTERRUPT(28) \
-       DECLARE_INTERRUPT(29) \
-       DECLARE_INTERRUPT(30) \
-       DECLARE_INTERRUPT(31) \
-       DECLARE_INTERRUPT(32) \
-       DECLARE_INTERRUPT(33) \
-       DECLARE_INTERRUPT(34) \
-       DECLARE_INTERRUPT(35) \
-       DECLARE_INTERRUPT(36) \
-       DECLARE_INTERRUPT(37) \
-       DECLARE_INTERRUPT(38) \
-       DECLARE_INTERRUPT(39) \
-       DECLARE_INTERRUPT(40) \
-       DECLARE_INTERRUPT(41) \
-       DECLARE_INTERRUPT(42) \
-       DECLARE_INTERRUPT(43) \
-       DECLARE_INTERRUPT(44) \
-       DECLARE_INTERRUPT(45) \
-       DECLARE_INTERRUPT(46) \
-       DECLARE_INTERRUPT(47) \
-       DECLARE_INTERRUPT(48) \
-       DECLARE_INTERRUPT(49) \
-       DECLARE_INTERRUPT(50) \
-       DECLARE_INTERRUPT(51) \
-       DECLARE_INTERRUPT(52) \
-       DECLARE_INTERRUPT(53) \
-       DECLARE_INTERRUPT(54) \
-       DECLARE_INTERRUPT(55) \
-       DECLARE_INTERRUPT(56) \
-       DECLARE_INTERRUPT(57) \
-       DECLARE_INTERRUPT(58) \
-       DECLARE_INTERRUPT(59) \
-       DECLARE_INTERRUPT(60) \
-       DECLARE_INTERRUPT(61) \
-       DECLARE_INTERRUPT(62) \
-       DECLARE_INTERRUPT(63) \
-       DECLARE_INTERRUPT(64) \
-       DECLARE_INTERRUPT(65) \
-       DECLARE_INTERRUPT(66) \
-       DECLARE_INTERRUPT(67) \
-       DECLARE_INTERRUPT(68) \
-       DECLARE_INTERRUPT(69) \
-       DECLARE_INTERRUPT(70) \
-       DECLARE_INTERRUPT(71) \
-       DECLARE_INTERRUPT(72) \
-       DECLARE_INTERRUPT(73) \
-       DECLARE_INTERRUPT(74) \
-       DECLARE_INTERRUPT(75) \
-       DECLARE_INTERRUPT(76) \
-       DECLARE_INTERRUPT(77) \
-       DECLARE_INTERRUPT(78) \
-       DECLARE_INTERRUPT(79) \
-       DECLARE_INTERRUPT(80) \
-       DECLARE_INTERRUPT(81) \
-       DECLARE_INTERRUPT(82) \
-       DECLARE_INTERRUPT(83) \
-       DECLARE_INTERRUPT(84) \
-       DECLARE_INTERRUPT(85) \
-       DECLARE_INTERRUPT(86) \
-       DECLARE_INTERRUPT(87) \
-       DECLARE_INTERRUPT(88) \
-       DECLARE_INTERRUPT(89) \
-       DECLARE_INTERRUPT(90) \
-       DECLARE_INTERRUPT(91) \
-       DECLARE_INTERRUPT(92) \
-       DECLARE_INTERRUPT(93) \
-       DECLARE_INTERRUPT(94) \
-       DECLARE_INTERRUPT(95) \
-       DECLARE_INTERRUPT(97) \
-       DECLARE_INTERRUPT(96) \
-       DECLARE_INTERRUPT(98) \
-       DECLARE_INTERRUPT(99) \
-       DECLARE_INTERRUPT(100) \
-       DECLARE_INTERRUPT(101) \
-       DECLARE_INTERRUPT(102) \
-       DECLARE_INTERRUPT(103) \
-       DECLARE_INTERRUPT(104) \
-       DECLARE_INTERRUPT(105) \
-       DECLARE_INTERRUPT(106) \
-       DECLARE_INTERRUPT(107) \
-       DECLARE_INTERRUPT(108) \
-       DECLARE_INTERRUPT(109) \
-       DECLARE_INTERRUPT(110) \
-       DECLARE_INTERRUPT(111) \
-       DECLARE_INTERRUPT(112) \
-       DECLARE_INTERRUPT(113) \
-       DECLARE_INTERRUPT(114) \
-       DECLARE_INTERRUPT(115) \
-       DECLARE_INTERRUPT(116) \
-       DECLARE_INTERRUPT(117) \
-       DECLARE_INTERRUPT(118) \
-       DECLARE_INTERRUPT(119) \
-       DECLARE_INTERRUPT(120) \
-       DECLARE_INTERRUPT(121) \
-       DECLARE_INTERRUPT(122) \
-       DECLARE_INTERRUPT(123) \
-       DECLARE_INTERRUPT(124) \
-       DECLARE_INTERRUPT(125) \
-       DECLARE_INTERRUPT(126) \
-       DECLARE_INTERRUPT(127) \
-       DECLARE_INTERRUPT(128) \
-       DECLARE_INTERRUPT(129) \
-       DECLARE_INTERRUPT(130) \
-       DECLARE_INTERRUPT(131) \
-       DECLARE_INTERRUPT(132) \
-       DECLARE_INTERRUPT(133) \
-       DECLARE_INTERRUPT(134) \
-       DECLARE_INTERRUPT(135) \
-       DECLARE_INTERRUPT(136) \
-       DECLARE_INTERRUPT(137) \
-       DECLARE_INTERRUPT(138) \
-       DECLARE_INTERRUPT(139) \
-       DECLARE_INTERRUPT(140) \
-       DECLARE_INTERRUPT(141) \
-       DECLARE_INTERRUPT(142) \
-       DECLARE_INTERRUPT(143) \
-       DECLARE_INTERRUPT(144) \
-       DECLARE_INTERRUPT(145) \
-       DECLARE_INTERRUPT(146) \
-       DECLARE_INTERRUPT(147) \
-       DECLARE_INTERRUPT(148) \
-       DECLARE_INTERRUPT(149) \
-       DECLARE_INTERRUPT(150) \
-       DECLARE_INTERRUPT(151) \
-       DECLARE_INTERRUPT(152) \
-       DECLARE_INTERRUPT(153) \
-       DECLARE_INTERRUPT(154) \
-       DECLARE_INTERRUPT(155) \
-       DECLARE_INTERRUPT(156) \
-       DECLARE_INTERRUPT(157) \
-       DECLARE_INTERRUPT(158) \
-       DECLARE_INTERRUPT(159) \
-       DECLARE_INTERRUPT(160) \
-       DECLARE_INTERRUPT(161) \
-       DECLARE_INTERRUPT(162) \
-       DECLARE_INTERRUPT(163) \
-       DECLARE_INTERRUPT(164) \
-       DECLARE_INTERRUPT(165) \
-       DECLARE_INTERRUPT(166) \
-       DECLARE_INTERRUPT(167) \
-       DECLARE_INTERRUPT(168) \
-       DECLARE_INTERRUPT(169) \
-       DECLARE_INTERRUPT(170) \
-       DECLARE_INTERRUPT(171) \
-       DECLARE_INTERRUPT(172) \
-       DECLARE_INTERRUPT(173) \
-       DECLARE_INTERRUPT(174) \
-       DECLARE_INTERRUPT(175) \
-       DECLARE_INTERRUPT(176) \
-       DECLARE_INTERRUPT(177) \
-       DECLARE_INTERRUPT(178) \
-       DECLARE_INTERRUPT(179) \
-       DECLARE_INTERRUPT(180) \
-       DECLARE_INTERRUPT(181) \
-       DECLARE_INTERRUPT(182) \
-       DECLARE_INTERRUPT(183) \
-       DECLARE_INTERRUPT(184) \
-       DECLARE_INTERRUPT(185) \
-       DECLARE_INTERRUPT(186) \
-       DECLARE_INTERRUPT(187) \
-       DECLARE_INTERRUPT(188) \
-       DECLARE_INTERRUPT(189) \
-       DECLARE_INTERRUPT(190) \
-       DECLARE_INTERRUPT(191) \
-       DECLARE_INTERRUPT(192) \
-       DECLARE_INTERRUPT(193) \
-       DECLARE_INTERRUPT(194) \
-       DECLARE_INTERRUPT(195) \
-       DECLARE_INTERRUPT(196) \
-       DECLARE_INTERRUPT(197) \
-       DECLARE_INTERRUPT(198) \
-       DECLARE_INTERRUPT(199) \
-       DECLARE_INTERRUPT(200) \
-       DECLARE_INTERRUPT(201) \
-       DECLARE_INTERRUPT(202) \
-       DECLARE_INTERRUPT(203) \
-       DECLARE_INTERRUPT(204) \
-       DECLARE_INTERRUPT(205) \
-       DECLARE_INTERRUPT(206) \
-       DECLARE_INTERRUPT(207) \
-       DECLARE_INTERRUPT(208) \
-       DECLARE_INTERRUPT(209) \
-       DECLARE_INTERRUPT(210) \
-       DECLARE_INTERRUPT(211) \
-       DECLARE_INTERRUPT(212) \
-       DECLARE_INTERRUPT(213) \
-       DECLARE_INTERRUPT(214) \
-       DECLARE_INTERRUPT(215) \
-       DECLARE_INTERRUPT(216) \
-       DECLARE_INTERRUPT(217) \
-       DECLARE_INTERRUPT(218) \
-       DECLARE_INTERRUPT(219) \
-       DECLARE_INTERRUPT(220) \
-       DECLARE_INTERRUPT(221) \
-       DECLARE_INTERRUPT(222) \
-       DECLARE_INTERRUPT(223) \
-       DECLARE_INTERRUPT(224) \
-       DECLARE_INTERRUPT(225) \
-       DECLARE_INTERRUPT(226) \
-       DECLARE_INTERRUPT(227) \
-       DECLARE_INTERRUPT(228) \
-       DECLARE_INTERRUPT(229) \
-       DECLARE_INTERRUPT(230) \
-       DECLARE_INTERRUPT(231) \
-       DECLARE_INTERRUPT(232) \
-       DECLARE_INTERRUPT(233) \
-       DECLARE_INTERRUPT(234) \
-       DECLARE_INTERRUPT(235) \
-       DECLARE_INTERRUPT(236) \
-       DECLARE_INTERRUPT(237) \
-       DECLARE_INTERRUPT(238) \
-       DECLARE_INTERRUPT(239) \
-       DECLARE_INTERRUPT(240) \
-       DECLARE_INTERRUPT(241) \
-       DECLARE_INTERRUPT(242) \
-       DECLARE_INTERRUPT(243) \
-       DECLARE_INTERRUPT(244) \
-       DECLARE_INTERRUPT(245) \
-       DECLARE_INTERRUPT(246) \
-       DECLARE_INTERRUPT(247) \
-       DECLARE_INTERRUPT(248) \
-       DECLARE_INTERRUPT(249) \
-       DECLARE_INTERRUPT(250) \
-       DECLARE_INTERRUPT(251) \
-       DECLARE_INTERRUPT(252) \
-       DECLARE_INTERRUPT(253) \
-       DECLARE_INTERRUPT(254) \
-       DECLARE_INTERRUPT(255));
index 9364410a0f83728854df8b01c40e2d369334bf4b..f5654eb510d5888b2ae8f077a446fbfbb8817cee 100644 (file)
@@ -17,8 +17,6 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
-static struct irq_routing_table *pirq_routing_table;
-
 bool pirq_check_irq_routed(struct udevice *dev, int link, u8 irq)
 {
        struct irq_router *priv = dev_get_priv(dev);
@@ -28,7 +26,7 @@ bool pirq_check_irq_routed(struct udevice *dev, int link, u8 irq)
        if (priv->config == PIRQ_VIA_PCI)
                dm_pci_read_config8(dev->parent, LINK_N2V(link, base), &pirq);
        else
-               pirq = readb(priv->ibase + LINK_N2V(link, base));
+               pirq = readb((uintptr_t)priv->ibase + LINK_N2V(link, base));
 
        pirq &= 0xf;
 
@@ -58,7 +56,7 @@ void pirq_assign_irq(struct udevice *dev, int link, u8 irq)
        if (priv->config == PIRQ_VIA_PCI)
                dm_pci_write_config8(dev->parent, LINK_N2V(link, base), irq);
        else
-               writeb(irq, priv->ibase + LINK_N2V(link, base));
+               writeb(irq, (uintptr_t)priv->ibase + LINK_N2V(link, base));
 }
 
 static struct irq_info *check_dup_entry(struct irq_info *slot_base,
@@ -98,7 +96,7 @@ static int create_pirq_routing_table(struct udevice *dev)
        int i;
        int ret;
 
-       node = dev->of_offset;
+       node = dev_of_offset(dev);
 
        /* extract the bdf from fdt_pci_addr */
        priv->bdf = dm_pci_get_bdf(dev->parent);
@@ -219,7 +217,7 @@ static int create_pirq_routing_table(struct udevice *dev)
        /* Fix up the table checksum */
        rt->checksum = table_compute_checksum(rt, rt->size);
 
-       pirq_routing_table = rt;
+       gd->arch.pirq_routing_table = rt;
 
        return 0;
 }
@@ -236,7 +234,7 @@ static void irq_enable_sci(struct udevice *dev)
                if (priv->config == PIRQ_VIA_PCI)
                        dm_pci_write_config32(dev->parent, priv->actl_addr, 0);
                else
-                       writel(0, priv->ibase + priv->actl_addr);
+                       writel(0, (uintptr_t)priv->ibase + priv->actl_addr);
        }
 }
 
@@ -250,8 +248,8 @@ int irq_router_common_init(struct udevice *dev)
                return ret;
        }
        /* Route PIRQ */
-       pirq_route_irqs(dev, pirq_routing_table->slots,
-                       get_irq_slot_count(pirq_routing_table));
+       pirq_route_irqs(dev, gd->arch.pirq_routing_table->slots,
+                       get_irq_slot_count(gd->arch.pirq_routing_table));
 
        if (IS_ENABLED(CONFIG_GENERATE_ACPI_TABLE))
                irq_enable_sci(dev);
@@ -264,12 +262,12 @@ int irq_router_probe(struct udevice *dev)
        return irq_router_common_init(dev);
 }
 
-u32 write_pirq_routing_table(u32 addr)
+ulong write_pirq_routing_table(ulong addr)
 {
-       if (!pirq_routing_table)
+       if (!gd->arch.pirq_routing_table)
                return addr;
 
-       return copy_pirq_routing_table(addr, pirq_routing_table);
+       return copy_pirq_routing_table(addr, gd->arch.pirq_routing_table);
 }
 
 static const struct udevice_id irq_router_ids[] = {
index 498e71a1b90e90cd7bcf85a33061cd0c11201580..25fbd599db0925f6b7f300183bf9eeb783117833 100644 (file)
@@ -7,12 +7,17 @@
 ifdef CONFIG_HAVE_FSP
 obj-y += fsp_configs.o ivybridge.o
 else
-obj-y += cpu.o
+obj-$(CONFIG_$(SPL_)X86_32BIT_INIT) += cpu.o
 obj-y += early_me.o
 obj-y += lpc.o
 obj-y += model_206ax.o
 obj-y += northbridge.o
+ifndef CONFIG_SPL_BUILD
 obj-y += sata.o
-obj-y += sdram.o
+endif
+obj-$(CONFIG_$(SPL_)X86_32BIT_INIT) += sdram.o
+ifndef CONFIG_$(SPL_)X86_32BIT_INIT
+obj-y += sdram_nop.o
+endif
 endif
 obj-y += bd82x6x.o
index e63ea6b22e3ee30aea3aadad14607184b1edc3ea..e3eff69cf67da1a57f22862206cc39419359b93c 100644 (file)
@@ -19,6 +19,8 @@
 #include <asm/arch/pch.h>
 #include <asm/arch/sandybridge.h>
 
+DECLARE_GLOBAL_DATA_PTR;
+
 #define GPIO_BASE      0x48
 #define BIOS_CTRL      0xdc
 
index 85e361a58f07a72ba70842aa5f24622f0dce4255..c4aca08f0df3aeb6e00fbf9be0b3f5de08852565 100644 (file)
@@ -169,8 +169,10 @@ int print_cpuinfo(void)
 
        /* Enable SPD ROMs and DDR-III DRAM */
        ret = uclass_first_device_err(UCLASS_I2C, &dev);
-       if (ret)
+       if (ret) {
+               debug("%s: Failed to get I2C (ret=%d)\n", __func__, ret);
                return ret;
+       }
 
        /* Prepare USB controller early in S3 resume */
        if (boot_mode == PEI_BOOT_RESUME) {
index 4af89b3a7cb3287b219406caac7b9642cc2ce1f2..4e254b3c57146d85ad7caf84d0bf759ed0c1d728 100644 (file)
@@ -20,6 +20,8 @@
 #include <asm/pci.h>
 #include <asm/arch/pch.h>
 
+DECLARE_GLOBAL_DATA_PTR;
+
 #define NMI_OFF                                0
 
 #define ENABLE_ACPI_MODE_IN_COREBOOT   0
@@ -84,7 +86,7 @@ static int pch_pirq_init(struct udevice *pch)
 {
        uint8_t route[8], *ptr;
 
-       if (fdtdec_get_byte_array(gd->fdt_blob, pch->of_offset,
+       if (fdtdec_get_byte_array(gd->fdt_blob, dev_of_offset(pch),
                                  "intel,pirq-routing", route, sizeof(route)))
                return -EINVAL;
        ptr = route;
@@ -111,7 +113,7 @@ static int pch_gpi_routing(struct udevice *pch)
        u32 reg;
        int gpi;
 
-       if (fdtdec_get_byte_array(gd->fdt_blob, pch->of_offset,
+       if (fdtdec_get_byte_array(gd->fdt_blob, dev_of_offset(pch),
                                  "intel,gpi-routing", route, sizeof(route)))
                return -EINVAL;
 
@@ -126,7 +128,7 @@ static int pch_gpi_routing(struct udevice *pch)
 static int pch_power_options(struct udevice *pch)
 {
        const void *blob = gd->fdt_blob;
-       int node = pch->of_offset;
+       int node = dev_of_offset(pch);
        u8 reg8;
        u16 reg16, pmbase;
        u32 reg32;
index 09b534255ca0cffb1431a53fe2af3f6a26e5e28a..81dedee2ec097125c86fdc85e0538cc7dbae45b8 100644 (file)
@@ -22,6 +22,8 @@
 #include <asm/turbo.h>
 #include <asm/arch/model_206ax.h>
 
+DECLARE_GLOBAL_DATA_PTR;
+
 static void enable_vmx(void)
 {
        struct cpuid_result regs;
@@ -286,8 +288,8 @@ static int configure_thermal_target(struct udevice *dev)
        int tcc_offset;
        msr_t msr;
 
-       tcc_offset = fdtdec_get_int(gd->fdt_blob, dev->of_offset, "tcc-offset",
-                                   0);
+       tcc_offset = fdtdec_get_int(gd->fdt_blob, dev_of_offset(dev),
+                                   "tcc-offset", 0);
 
        /* Set TCC activaiton offset if supported */
        msr = msr_read(MSR_PLATFORM_INFO);
index 491f2894f9ed5ec99d9fcb190526672f4a0dd301..94f31c40beb614188ad8e6a6e7d1b33e4fa5bcb3 100644 (file)
@@ -19,6 +19,8 @@
 #include <asm/arch/model_206ax.h>
 #include <asm/arch/sandybridge.h>
 
+DECLARE_GLOBAL_DATA_PTR;
+
 int bridge_silicon_revision(struct udevice *dev)
 {
        struct cpuid_result result;
index 87ff872e20ad683d63823a74c55a3559833aa4a6..0f5e19042575fe4117735137ea026be729806c73 100644 (file)
@@ -39,7 +39,7 @@ static void bd82x6x_sata_init(struct udevice *dev, struct udevice *pch)
 {
        unsigned int port_map, speed_support, port_tx;
        const void *blob = gd->fdt_blob;
-       int node = dev->of_offset;
+       int node = dev_of_offset(dev);
        const char *mode;
        u32 reg32;
        u16 reg16;
@@ -53,7 +53,7 @@ static void bd82x6x_sata_init(struct udevice *dev, struct udevice *pch)
 
        mode = fdt_getprop(blob, node, "intel,sata-mode", NULL);
        if (!mode || !strcmp(mode, "ahci")) {
-               u32 abar;
+               ulong abar;
 
                debug("SATA: Controller in AHCI mode\n");
 
@@ -72,7 +72,7 @@ static void bd82x6x_sata_init(struct udevice *dev, struct udevice *pch)
 
                /* Initialize AHCI memory-mapped space */
                abar = dm_pci_read_bar32(dev, 5);
-               debug("ABAR: %08X\n", abar);
+               debug("ABAR: %08lx\n", abar);
                /* CAP (HBA Capabilities) : enable power management */
                reg32 = readl(abar + 0x00);
                reg32 |= 0x0c006000;  /* set PSC+SSC+SALP+SSS */
@@ -190,7 +190,7 @@ static void bd82x6x_sata_init(struct udevice *dev, struct udevice *pch)
 static void bd82x6x_sata_enable(struct udevice *dev)
 {
        const void *blob = gd->fdt_blob;
-       int node = dev->of_offset;
+       int node = dev_of_offset(dev);
        unsigned port_map;
        const char *mode;
        u16 map = 0;
index e0b06b5ada56a7aab20466c6ffdad3d60549fa37..201368c9c7ce36f2349eaf8f9f7ba6bb7bdc3a76 100644 (file)
@@ -207,8 +207,10 @@ static int copy_spd(struct udevice *dev, struct pei_data *peid)
        int ret;
 
        ret = mrc_locate_spd(dev, sizeof(peid->spd_data[0]), &data);
-       if (ret)
+       if (ret) {
+               debug("%s: Could not locate SPD (ret=%d)\n", __func__, ret);
                return ret;
+       }
 
        memcpy(peid->spd_data[0], data, sizeof(peid->spd_data[0]));
 
@@ -460,18 +462,27 @@ int dram_init(void)
 
        /* We need the pinctrl set up early */
        ret = syscon_get_by_driver_data(X86_SYSCON_PINCONF, &dev);
-       if (ret)
+       if (ret) {
+               debug("%s: Could not get pinconf (ret=%d)\n", __func__, ret);
                return ret;
+       }
 
        ret = uclass_first_device_err(UCLASS_NORTHBRIDGE, &dev);
-       if (ret)
+       if (ret) {
+               debug("%s: Could not get northbridge (ret=%d)\n", __func__,
+                     ret);
                return ret;
+       }
        ret = syscon_get_by_driver_data(X86_SYSCON_ME, &me_dev);
-       if (ret)
+       if (ret) {
+               debug("%s: Could not get ME (ret=%d)\n", __func__, ret);
                return ret;
+       }
        ret = copy_spd(dev, pei_data);
-       if (ret)
+       if (ret) {
+               debug("%s: Could not get SPD (ret=%d)\n", __func__, ret);
                return ret;
+       }
        pei_data->boot_mode = gd->arch.pei_boot_mode;
        debug("Boot mode %d\n", gd->arch.pei_boot_mode);
        debug("mrc_input %p\n", pei_data->mrc_input);
@@ -498,19 +509,27 @@ int dram_init(void)
 
        /* Wait for ME to be ready */
        ret = intel_early_me_init(me_dev);
-       if (ret)
+       if (ret) {
+               debug("%s: Could not init ME (ret=%d)\n", __func__, ret);
                return ret;
+       }
        ret = intel_early_me_uma_size(me_dev);
-       if (ret < 0)
+       if (ret < 0) {
+               debug("%s: Could not get UMA size (ret=%d)\n", __func__, ret);
                return ret;
+       }
 
        ret = mrc_common_init(dev, pei_data, false);
-       if (ret)
+       if (ret) {
+               debug("%s: mrc_common_init() failed (ret=%d)\n", __func__, ret);
                return ret;
+       }
 
        ret = sdram_find(dev);
-       if (ret)
+       if (ret) {
+               debug("%s: sdram_find() failed (ret=%d)\n", __func__, ret);
                return ret;
+       }
        gd->ram_size = gd->arch.meminfo.total_32bit_memory;
 
        debug("MRC output data length %#x at %p\n", pei_data->mrc_output_len,
diff --git a/arch/x86/cpu/ivybridge/sdram_nop.c b/arch/x86/cpu/ivybridge/sdram_nop.c
new file mode 100644 (file)
index 0000000..bd1189e
--- /dev/null
@@ -0,0 +1,18 @@
+/*
+ * Copyright (c) 2016 Google, Inc
+ *
+ * SPDX-License-Identifier:    GPL-2.0
+ */
+
+#include <common.h>
+
+DECLARE_GLOBAL_DATA_PTR;
+
+int dram_init(void)
+{
+       gd->ram_size = 1ULL << 31;
+       gd->bd->bi_dram[0].start = 0;
+       gd->bd->bi_dram[0].size = gd->ram_size;
+
+       return 0;
+}
index 2b6b3bd04e6d137b1078d208fa22a42985439332..988073cc7953f188cf1ffc7758263df83934b437 100644 (file)
@@ -568,7 +568,8 @@ int mp_init_cpu(struct udevice *cpu, void *unused)
         * seq num in the uclass_resolve_seq() during device_probe(). To avoid
         * this, set req_seq to the reg number in the device tree in advance.
         */
-       cpu->req_seq = fdtdec_get_int(gd->fdt_blob, cpu->of_offset, "reg", -1);
+       cpu->req_seq = fdtdec_get_int(gd->fdt_blob, dev_of_offset(cpu), "reg",
+                                     -1);
        plat->ucode_version = microcode_read_rev();
        plat->device_id = gd->arch.x86_device;
 
index 63853e4b22d6df58237ddf65449453c3e6e0c6fa..c1c9b89def798840a4c4bc820cbdc256374fd4f6 100644 (file)
@@ -7,6 +7,8 @@
 #include <common.h>
 #include <asm/e820.h>
 
+DECLARE_GLOBAL_DATA_PTR;
+
 unsigned install_e820_map(unsigned max_entries, struct e820entry *entries)
 {
        entries[0].addr = 0;
index c3092f2b9fb872f408750e9ef70e81d09b25dac3..7153eb21f57e5e71785f8b4a80da154d8266dba4 100644 (file)
@@ -47,7 +47,7 @@ static void qemu_x86_fwcfg_read_entry_pio(uint16_t entry,
 static void qemu_x86_fwcfg_read_entry_dma(struct fw_cfg_dma_access *dma)
 {
        /* the DMA address register is big endian */
-       outl(cpu_to_be32((uint32_t)dma), FW_DMA_PORT_HIGH);
+       outl(cpu_to_be32((uintptr_t)dma), FW_DMA_PORT_HIGH);
 
        while (be32_to_cpu(dma->control) & ~FW_CFG_DMA_ERROR)
                __asm__ __volatile__ ("pause");
@@ -137,14 +137,17 @@ static void qemu_chipset_init(void)
 #endif
 }
 
+#if !CONFIG_IS_ENABLED(SPL_X86_32BIT_INIT)
 int arch_cpu_init(void)
 {
        post_code(POST_CPU_INIT);
 
        return x86_cpu_init_f();
 }
+#endif
 
-#ifndef CONFIG_EFI_STUB
+#if !CONFIG_IS_ENABLED(EFI_STUB) && \
+       !CONFIG_IS_ENABLED(SPL_X86_32BIT_INIT)
 int print_cpuinfo(void)
 {
        post_code(POST_CPU_INFO);
diff --git a/arch/x86/cpu/setjmp.S b/arch/x86/cpu/setjmp.S
deleted file mode 100644 (file)
index 2ea1c6c..0000000
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Written by H. Peter Anvin <hpa@zytor.com>
- * Brought in from Linux v4.4 and modified for U-Boot
- * From Linux arch/um/sys-i386/setjmp.S
- *
- * SPDX-License-Identifier:    GPL-2.0
- */
-
-#define _REGPARM
-
-/*
- * The jmp_buf is assumed to contain the following, in order:
- *     %ebx
- *     %esp
- *     %ebp
- *     %esi
- *     %edi
- *     <return address>
- */
-
-       .text
-       .align 4
-       .globl setjmp
-       .type setjmp, @function
-setjmp:
-#ifdef _REGPARM
-       movl %eax, %edx
-#else
-       movl 4(%esp), %edx
-#endif
-       popl %ecx               /* Return address, and adjust the stack */
-       xorl %eax, %eax         /* Return value */
-       movl %ebx, (%edx)
-       movl %esp, 4(%edx)      /* Post-return %esp! */
-       pushl %ecx              /* Make the call/return stack happy */
-       movl %ebp, 8(%edx)
-       movl %esi, 12(%edx)
-       movl %edi, 16(%edx)
-       movl %ecx, 20(%edx)     /* Return address */
-       ret
-
-       /* Provide function size if needed */
-       .size setjmp, .-setjmp
-
-       .align 4
-       .globl longjmp
-       .type longjmp, @function
-longjmp:
-#ifdef _REGPARM
-       xchgl %eax, %edx
-#else
-       movl 4(%esp), %edx      /* jmp_ptr address */
-#endif
-       movl (%edx), %ebx
-       movl 4(%edx), %esp
-       movl 8(%edx), %ebp
-       movl 12(%edx), %esi
-       movl 16(%edx), %edi
-       jmp *20(%edx)
-
-       .size longjmp, .-longjmp
index a5cba1cf2a766680e3e1b8ab6290bee2aa8a0191..8de55a0af1de3681a360ff35fb5acf70ef878a90 100644 (file)
 #include <generated/generic-asm-offsets.h>
 #include <generated/asm-offsets.h>
 
-/*
- * Define this to boot U-Boot from a 32-bit program which sets the GDT
- * differently. This can be used to boot directly from any stage of coreboot,
- * for example, bypassing the normal payload-loading feature.
- * This is only useful for development.
- */
-#undef LOAD_FROM_32_BIT
-
 .section .text
 .code32
 .globl _start
@@ -76,7 +68,7 @@ _start:
        /* Save table pointer */
        movl    %ecx, %esi
 
-#ifdef LOAD_FROM_32_BIT
+#ifdef CONFIG_X86_LOAD_FROM_32_BIT
        lgdt    gdt_ptr2
 #endif
 
@@ -233,7 +225,7 @@ multiboot_header:
        /* entry addr */
        .long   CONFIG_SYS_TEXT_BASE
 
-#ifdef LOAD_FROM_32_BIT
+#ifdef CONFIG_X86_LOAD_FROM_32_BIT
        /*
         * The following Global Descriptor Table is just enough to get us into
         * 'Flat Protected Mode' - It will be discarded as soon as the final
diff --git a/arch/x86/cpu/start64.S b/arch/x86/cpu/start64.S
new file mode 100644 (file)
index 0000000..651f16a
--- /dev/null
@@ -0,0 +1,28 @@
+/*
+ * 64-bit x86 Startup Code
+ *
+ * (C) Copyright 216 Google, Inc
+ * Written by Simon Glass <sjg@chromium.org>
+ *
+ * SPDX-License-Identifier:    GPL-2.0+
+ */
+
+#include <config.h>
+
+.section .text
+.code64
+.globl _start
+.type _start, @function
+_start:
+       /* Set up memory using the existing stack */
+       mov     %rsp, %rdi
+       call    board_init_f_alloc_reserve
+       mov     %rax, %rsp
+
+       call    board_init_f_init_reserve
+
+       call    board_init_f
+       call    board_init_f_r
+
+       /* Should not return here */
+       jmp     .
index 254d0de0e4ba17a54439537d4c625f93bb880fbe..bbd255efc0a54f0b4970aaf46cbf7d13e072dbc1 100644 (file)
@@ -12,6 +12,8 @@
 #include <asm/processor.h>
 #include <asm/turbo.h>
 
+DECLARE_GLOBAL_DATA_PTR;
+
 #if CONFIG_CPU_INTEL_TURBO_NOT_PACKAGE_SCOPED
 static inline int get_global_turbo_state(void)
 {
@@ -22,16 +24,14 @@ static inline void set_global_turbo_state(int state)
 {
 }
 #else
-static int g_turbo_state = TURBO_UNKNOWN;
-
 static inline int get_global_turbo_state(void)
 {
-       return g_turbo_state;
+       return gd->arch.turbo_state;
 }
 
 static inline void set_global_turbo_state(int state)
 {
-       g_turbo_state = state;
+       gd->arch.turbo_state = state;
 }
 #endif
 
diff --git a/arch/x86/cpu/u-boot-64.lds b/arch/x86/cpu/u-boot-64.lds
new file mode 100644 (file)
index 0000000..718790c
--- /dev/null
@@ -0,0 +1,76 @@
+/*
+ * (C) Copyright 2002
+ * Daniel Engström, Omicron Ceti AB, daniel@omicron.se.
+ *
+ * SPDX-License-Identifier:    GPL-2.0+
+ */
+
+#include <config.h>
+OUTPUT_FORMAT("elf64-x86-64", "elf64-x86-64", "elf64-x86-64")
+OUTPUT_ARCH(i386:x86-64)
+ENTRY(_start)
+
+SECTIONS
+{
+#ifndef CONFIG_CMDLINE
+       /DISCARD/ : { *(.u_boot_list_2_cmd_*) }
+#endif
+
+       . = CONFIG_SYS_TEXT_BASE;       /* Location of bootcode in flash */
+       __text_start = .;
+       .text  : { *(.text*); }
+
+       . = ALIGN(4);
+
+       . = ALIGN(4);
+       .u_boot_list : {
+               KEEP(*(SORT(.u_boot_list*)));
+       }
+
+       . = ALIGN(4);
+       .rodata : { *(SORT_BY_ALIGNMENT(SORT_BY_NAME(.rodata*))) }
+
+       . = ALIGN(4);
+       .data : { *(.data*) }
+
+       . = ALIGN(4);
+       .hash : { *(.hash*) }
+
+       . = ALIGN(4);
+       .got : { *(.got*) }
+
+       . = ALIGN(4);
+       __data_end = .;
+       __init_end = .;
+
+       . = ALIGN(4);
+       .dynsym : { *(.dynsym*) }
+
+       . = ALIGN(4);
+       __rel_dyn_start = .;
+       .rela.dyn : {
+               *(.rela*)
+       }
+       __rel_dyn_end = .;
+       . = ALIGN(4);
+
+       .dynamic : { *(.dynamic) }
+
+       . = ALIGN(4);
+       _end = .;
+
+       .bss __rel_dyn_start (OVERLAY) : {
+               __bss_start = .;
+               *(.bss)
+               *(COM*)
+               . = ALIGN(4);
+               __bss_end = .;
+       }
+
+       /DISCARD/ : { *(.dynsym) }
+       /DISCARD/ : { *(.dynstr*) }
+       /DISCARD/ : { *(.dynamic*) }
+       /DISCARD/ : { *(.plt*) }
+       /DISCARD/ : { *(.interp*) }
+       /DISCARD/ : { *(.gnu*) }
+}
diff --git a/arch/x86/cpu/u-boot-spl.lds b/arch/x86/cpu/u-boot-spl.lds
new file mode 100644 (file)
index 0000000..8a38d58
--- /dev/null
@@ -0,0 +1,74 @@
+/*
+ * (C) Copyright 2002
+ * Daniel Engström, Omicron Ceti AB, daniel@omicron.se.
+ *
+ * SPDX-License-Identifier:    GPL-2.0+
+ */
+
+#include <config.h>
+OUTPUT_FORMAT("elf32-i386", "elf32-i386", "elf32-i386")
+OUTPUT_ARCH(i386)
+ENTRY(_start)
+
+SECTIONS
+{
+#ifndef CONFIG_CMDLINE
+       /DISCARD/ : { *(.u_boot_list_2_cmd_*) }
+#endif
+
+       . = CONFIG_SPL_TEXT_BASE;       /* Location of bootcode in flash */
+       __text_start = .;
+       .text  : { *(.text*); }
+
+       . = ALIGN(4);
+
+       . = ALIGN(4);
+       .u_boot_list : {
+               KEEP(*(SORT(.u_boot_list*)));
+       }
+
+       . = ALIGN(4);
+       .rodata : { *(SORT_BY_ALIGNMENT(SORT_BY_NAME(.rodata*))) }
+
+       . = ALIGN(4);
+       .data : { *(.data*) }
+
+       . = ALIGN(4);
+       __data_end = .;
+       __init_end = .;
+
+        _image_binary_end = .;
+
+       . = 0x120000;
+       .bss (OVERLAY) : {
+               __bss_start = .;
+               *(.bss*)
+               *(COM*)
+               . = ALIGN(4);
+               __bss_end = .;
+       }
+       __bss_size = __bss_end - __bss_start;
+
+       /DISCARD/ : { *(.dynstr*) }
+       /DISCARD/ : { *(.dynamic*) }
+       /DISCARD/ : { *(.plt*) }
+       /DISCARD/ : { *(.interp*) }
+       /DISCARD/ : { *(.gnu*) }
+
+#ifdef CONFIG_SPL_X86_16BIT_INIT
+       /*
+        * The following expressions place the 16-bit Real-Mode code and
+        * Reset Vector at the end of the Flash ROM
+        */
+       . = START_16 - RESET_SEG_START;
+       .start16 : AT (START_16) {
+               KEEP(*(.start16));
+       }
+
+       . = RESET_VEC_LOC - RESET_SEG_START;
+       .resetvec : AT (RESET_VEC_LOC) {
+               KEEP(*(.resetvec));
+       }
+#endif
+
+}
index cca536b27239e847a93eb7ad41ec82b5f1e1476f..186718d8f9dff88df7dc43a2b6f3d9464edb47bd 100644 (file)
@@ -103,7 +103,7 @@ SECTIONS
        /DISCARD/ : { *(.interp*) }
        /DISCARD/ : { *(.gnu*) }
 
-#ifdef CONFIG_X86_RESET_VECTOR
+#ifdef CONFIG_X86_16BIT_INIT
        /*
         * The following expressions place the 16-bit Real-Mode code and
         * Reset Vector at the end of the Flash ROM
diff --git a/arch/x86/cpu/x86_64/Makefile b/arch/x86/cpu/x86_64/Makefile
new file mode 100644 (file)
index 0000000..400f0ff
--- /dev/null
@@ -0,0 +1,6 @@
+#
+# (C) Copyright 2016 Google, Inc
+# Written by Simon Glass <sjg@chromium.org>
+#
+
+obj-y += cpu.o interrupts.o setjmp.o
diff --git a/arch/x86/cpu/x86_64/cpu.c b/arch/x86/cpu/x86_64/cpu.c
new file mode 100644 (file)
index 0000000..db171f7
--- /dev/null
@@ -0,0 +1,73 @@
+/*
+ * (C) Copyright 2016 Google, Inc
+ * Written by Simon Glass <sjg@chromium.org>
+ *
+ * SPDX-License-Identifier:    GPL-2.0+
+ */
+
+#include <common.h>
+#include <debug_uart.h>
+
+DECLARE_GLOBAL_DATA_PTR;
+
+/* Global declaration of gd */
+struct global_data *global_data_ptr;
+
+void arch_setup_gd(gd_t *new_gd)
+{
+       global_data_ptr = new_gd;
+
+       /*
+        * TODO(sjg@chromium.org): For some reason U-Boot does not boot
+        * without this line. It fails to start up U-Boot proper and instead
+        * restarts SPL. Need to figure out why:
+        *
+        * U-Boot SPL 2017.01
+        *
+        * U-Boot SPL 2017.01
+        * CPU:   Intel(R) Core(TM) i5-3427U CPU @ 1.80GHz
+        * Trying to boot from SPIJumping to 64-bit U-Boot: Note many
+        * features are missing
+        *
+        * U-Boot SPL 2017.01
+        */
+#ifdef CONFIG_DEBUG_UART
+       printch(' ');
+#endif
+}
+
+int cpu_has_64bit(void)
+{
+       return true;
+}
+
+void enable_caches(void)
+{
+       /* Not implemented */
+}
+
+void disable_caches(void)
+{
+       /* Not implemented */
+}
+
+int dcache_status(void)
+{
+       return true;
+}
+
+int x86_mp_init(void)
+{
+       /* Not implemented */
+       return 0;
+}
+
+int misc_init_r(void)
+{
+       return 0;
+}
+
+int print_cpuinfo(void)
+{
+       return 0;
+}
diff --git a/arch/x86/cpu/x86_64/interrupts.c b/arch/x86/cpu/x86_64/interrupts.c
new file mode 100644 (file)
index 0000000..3e06173
--- /dev/null
@@ -0,0 +1,29 @@
+/*
+ * (C) Copyright 2016 Google, Inc
+ * Written by Simon Glass <sjg@chromium.org>
+ *
+ * SPDX-License-Identifier:    GPL-2.0+
+ */
+
+#include <common.h>
+#include <asm/processor-flags.h>
+
+void enable_interrupts(void)
+{
+       asm("sti\n");
+}
+
+int disable_interrupts(void)
+{
+       long flags;
+
+       asm volatile ("pushfq ; popq %0 ; cli\n" : "=g" (flags) : );
+
+       return flags & X86_EFLAGS_IF;
+}
+
+int interrupt_init(void)
+{
+       /* Nothing to do - this was already done in SPL */
+       return 0;
+}
diff --git a/arch/x86/cpu/x86_64/setjmp.c b/arch/x86/cpu/x86_64/setjmp.c
new file mode 100644 (file)
index 0000000..25f8d28
--- /dev/null
@@ -0,0 +1,20 @@
+/*
+ * Copyright (c) 2016 Google, Inc
+ *
+ * SPDX-License-Identifier:    GPL-2.0+
+ */
+
+#include <common.h>
+#include <asm/setjmp.h>
+
+int setjmp(struct jmp_buf_data *jmp_buf)
+{
+       printf("WARNING: setjmp() is not supported\n");
+
+       return 0;
+}
+
+void longjmp(struct jmp_buf_data *jmp_buf, int val)
+{
+       printf("WARNING: longjmp() is not supported\n");
+}
index b93234046e0c60bc20c76ed8d99eba68d420c530..fab919a3589dda4dfe8fa6b318ef259773aa41a4 100644 (file)
        cpus {
                #address-cells = <1>;
                #size-cells = <0>;
+               u-boot,dm-pre-reloc;
 
                cpu@0 {
                        device_type = "cpu";
                        compatible = "intel,core-gen3";
                        reg = <0>;
                        intel,apic-id = <0>;
+                       u-boot,dm-pre-reloc;
                };
 
                cpu@1 {
@@ -39,6 +41,7 @@
                        compatible = "intel,core-gen3";
                        reg = <1>;
                        intel,apic-id = <1>;
+                       u-boot,dm-pre-reloc;
                };
 
                cpu@2 {
@@ -46,6 +49,7 @@
                        compatible = "intel,core-gen3";
                        reg = <2>;
                        intel,apic-id = <2>;
+                       u-boot,dm-pre-reloc;
                };
 
                cpu@3 {
@@ -53,6 +57,7 @@
                        compatible = "intel,core-gen3";
                        reg = <3>;
                        intel,apic-id = <3>;
+                       u-boot,dm-pre-reloc;
                };
 
        };
 
                northbridge@0,0 {
                        reg = <0x00000000 0 0 0 0>;
+                       u-boot,dm-pre-reloc;
                        compatible = "intel,bd82x6x-northbridge";
                        board-id-gpios = <&gpio_b 9 0>, <&gpio_b 10 0>,
                                        <&gpio_b 11 0>, <&gpio_a 10 0>;
-                       u-boot,dm-pre-reloc;
                        spd {
+                               u-boot,dm-pre-reloc;
                                #address-cells = <1>;
                                #size-cells = <0>;
                                elpida_4Gb_1600_x16 {
+                                       u-boot,dm-pre-reloc;
                                        reg = <0>;
                                        data = [92 10 0b 03 04 19 02 02
                                                03 52 01 08 0a 00 fe 00
                                                00 00 00 00 00 00 00 00];
                                };
                                samsung_4Gb_1600_1.35v_x16 {
+                                       u-boot,dm-pre-reloc;
                                        reg = <1>;
                                        data = [92 11 0b 03 04 19 02 02
                                                03 11 01 08 0a 00 fe 00
                                #address-cells = <1>;
                                #size-cells = <0>;
                                compatible = "intel,ich9-spi";
+                               u-boot,dm-pre-reloc;
                                spi-flash@0 {
                                        #size-cells = <1>;
                                        #address-cells = <1>;
+                                       u-boot,dm-pre-reloc;
                                        reg = <0>;
                                        compatible = "winbond,w25q64",
                                                        "spi-flash";
                                        rw-mrc-cache {
                                                label = "rw-mrc-cache";
                                                reg = <0x003e0000 0x00010000>;
+                                               u-boot,dm-pre-reloc;
                                        };
                                };
                        };
        };
 
        microcode {
+               u-boot,dm-pre-reloc;
                update@0 {
+                       u-boot,dm-pre-reloc;
 #include "microcode/m12306a9_0000001b.dtsi"
                };
        };
index 56d34af9279df64e4f4672c0c7622cd5b930baae..7714ed0b77f3e51b9be9dbe54794f0bea5bba359 100644 (file)
 #ifdef CONFIG_ROM_SIZE
 / {
        binman {
+#ifdef CONFIG_SPL
+               u-boot-spl-with-ucode-ptr {
+                       optional-ucode;
+               };
+#else
                u-boot-with-ucode-ptr {
                        optional-ucode;
                };
+#endif
        };
 };
 #endif
index 9c3f2a08e63721814c30065622f6d53e57eb7838..afea14ed32b160e6c64dbf3aa376d376d60805a5 100644 (file)
        cpus {
                #address-cells = <1>;
                #size-cells = <0>;
+               u-boot,dm-pre-reloc;
 
                cpu@0 {
                        device_type = "cpu";
                        compatible = "cpu-qemu";
+                       u-boot,dm-pre-reloc;
                        reg = <0>;
                        intel,apic-id = <0>;
                };
                pch@1,0 {
                        reg = <0x00000800 0 0 0 0>;
                        compatible = "intel,pch7";
+                       u-boot,dm-pre-reloc;
 
                        irq-router {
                                compatible = "intel,irq-router";
+                               u-boot,dm-pre-reloc;
                                intel,pirq-config = "pci";
                                intel,pirq-link = <0x60 4>;
                                intel,pirq-mask = <0x0e40>;
index 0d462a9c788d60e019a8f4687b9fe56e47791661..bc398dd72c6dc76caf11dbd8a7e53036bbc632e3 100644 (file)
        cpus {
                #address-cells = <1>;
                #size-cells = <0>;
+               u-boot,dm-pre-reloc;
 
                cpu@0 {
                        device_type = "cpu";
                        compatible = "cpu-qemu";
+                       u-boot,dm-pre-reloc;
                        reg = <0>;
                        intel,apic-id = <0>;
                };
                pch@1f,0 {
                        reg = <0x0000f800 0 0 0 0>;
                        compatible = "intel,pch9";
+                       u-boot,dm-pre-reloc;
 
                        irq-router {
                                compatible = "intel,irq-router";
+                               u-boot,dm-pre-reloc;
                                intel,pirq-config = "pci";
                                intel,actl-8bit;
                                intel,actl-addr = <0x44>;
index 54c3faf45147d581e5010850aebffe03a79d30e3..22f7b54fed3f156fa41d16858a9796581b638dbd 100644 (file)
@@ -1,5 +1,6 @@
 / {
        serial: serial {
+               u-boot,dm-pre-reloc;
                compatible = "ns16550";
                reg = <0x3f8 8>;
                reg-shift = <0>;
index 31f0b1aa10d163958c1e838e573e9908a2ec3001..69c1c1d498673c30d9f941e1e5fdeff50c0e499a 100644 (file)
                intel-me {
                };
 #endif
+#ifdef CONFIG_SPL
+               u-boot-spl-with-ucode-ptr {
+                       pos = <CONFIG_SPL_TEXT_BASE>;
+               };
+
+               u-boot-dtb-with-ucode2 {
+                       type = "u-boot-dtb-with-ucode";
+               };
+               u-boot {
+                       pos = <0xfff00000>;
+               };
+#else
                u-boot-with-ucode-ptr {
                        pos = <CONFIG_SYS_TEXT_BASE>;
                };
+#endif
                u-boot-dtb-with-ucode {
                };
                u-boot-ucode {
                        pos = <CONFIG_X86_REFCODE_ADDR>;
                };
 #endif
+#ifdef CONFIG_SPL
+               x86-start16-spl {
+                       pos = <CONFIG_SYS_X86_START16>;
+               };
+#else
                x86-start16 {
                        pos = <CONFIG_SYS_X86_START16>;
                };
+#endif
        };
 };
 #endif
index caff4d8a1e0df982049380eedc1582cf1a44d3f1..bbd80a1dd9aa9707a643a5ffef6017ee0a63db43 100644 (file)
@@ -316,4 +316,4 @@ int acpi_create_madt_lapic_nmi(struct acpi_madt_lapic_nmi *lapic_nmi,
                               u8 cpu, u16 flags, u8 lint);
 u32 acpi_fill_madt(u32 current);
 void acpi_create_gnvs(struct acpi_global_nvs *gnvs);
-u32 write_acpi_tables(u32 start);
+ulong write_acpi_tables(ulong start);
index a373a798861edd6319f12ee2353187bb8c2d0466..48b138c6b0e9ed9d14c1d30ba445c42136ed6073 100644 (file)
@@ -117,7 +117,8 @@ enum {
        X86_SUBARCH_PC = 0,
        X86_SUBARCH_LGUEST,
        X86_SUBARCH_XEN,
-       X86_SUBARCH_MRST,
+       X86_SUBARCH_INTEL_MID,
+       X86_SUBARCH_CE4100,
        X86_NR_SUBARCHS,
 };
 #endif /* _ASM_X86_BOOTPARAM_H */
index 7dfeb8bbed2b4cdc69a0e4c3943b4ad0e9d241ed..a2d1fd8703bd1418f20673f097e3f81ce5781bd6 100644 (file)
@@ -8,24 +8,25 @@
 
 static __inline__ __u32 ___arch__swab32(__u32 x)
 {
-#ifdef CONFIG_X86_BSWAP
        __asm__("bswap %0" : "=r" (x) : "0" (x));
-#else
-       __asm__("xchgb %b0,%h0\n\t"     /* swap lower bytes     */
-               "rorl $16,%0\n\t"       /* swap words           */
-               "xchgb %b0,%h0"         /* swap higher bytes    */
-               :"=q" (x)
-               : "0" (x));
-#endif
+
        return x;
 }
 
+#define _constant_swab16(x) ((__u16)(                          \
+       (((__u16)(x) & (__u16)0x00ffU) << 8) |                  \
+       (((__u16)(x) & (__u16)0xff00U) >> 8)))
+
 static __inline__ __u16 ___arch__swab16(__u16 x)
 {
+#if CONFIG_IS_ENABLED(X86_64)
+       return _constant_swab16(x);
+#else
        __asm__("xchgb %b0,%h0"         /* swap bytes           */ \
                : "=q" (x) \
                :  "0" (x)); \
                return x;
+#endif
 }
 
 #define __arch__swab32(x) ___arch__swab32(x)
index 540024a85920ff5a9a0813cc4ab964e371855caa..c651f2f594535ab47c315d9b9fa4176cfe844748 100644 (file)
@@ -159,6 +159,8 @@ static inline unsigned int cpuid_edx(unsigned int op)
        return edx;
 }
 
+#if !CONFIG_IS_ENABLED(X86_64)
+
 /* Standard macro to see if a specific flag is changeable */
 static inline int flag_is_changeable_p(uint32_t flag)
 {
@@ -179,6 +181,7 @@ static inline int flag_is_changeable_p(uint32_t flag)
                : "ir" (flag));
        return ((f1^f2) & flag) != 0;
 }
+#endif
 
 static inline void mfence(void)
 {
@@ -260,6 +263,15 @@ void cpu_call32(ulong code_seg32, ulong target, ulong table);
  */
 int cpu_jump_to_64bit(ulong setup_base, ulong target);
 
+/**
+ * cpu_jump_to_64bit_uboot() - special function to jump from SPL to U-Boot
+ *
+ * This handles calling from 32-bit SPL to 64-bit U-Boot.
+ *
+ * @target:    Address of U-Boot in RAM
+ */
+int cpu_jump_to_64bit_uboot(ulong target);
+
 /**
  * cpu_get_family_model() - Get the family and model for the CPU
  *
index 3fb3546e27f8f76e1bd72fd1b3db6f8cdeb5f6c8..7c22bcd5cd8e7448d1daffd41a28abf0069a8dfa 100644 (file)
@@ -139,7 +139,7 @@ struct hob_guid {
  */
 static inline const struct hob_header *get_next_hob(const struct hob_header *hdr)
 {
-       return (const struct hob_header *)((u32)hdr + hdr->len);
+       return (const struct hob_header *)((uintptr_t)hdr + hdr->len);
 }
 
 /**
@@ -172,7 +172,7 @@ static inline bool end_of_hob(const struct hob_header *hdr)
  */
 static inline void *get_guid_hob_data(const struct hob_header *hdr)
 {
-       return (void *)((u32)hdr + sizeof(struct hob_guid));
+       return (void *)((uintptr_t)hdr + sizeof(struct hob_guid));
 }
 
 /**
index 7434f779b663d7d6b22782320f9ffa5a136609c8..4570bc7a4ad6a94b8b8b3981bca3fb83c5ec8306 100644 (file)
@@ -93,6 +93,8 @@ struct arch_global_data {
        char *mrc_output;
        unsigned int mrc_output_len;
        ulong table;                    /* Table pointer from previous loader */
+       int turbo_state;                /* Current turbo state */
+       struct irq_routing_table *pirq_routing_table;
 #ifdef CONFIG_SEABIOS
        u32 high_table_ptr;
        u32 high_table_limit;
@@ -104,8 +106,9 @@ struct arch_global_data {
 #include <asm-generic/global_data.h>
 
 #ifndef __ASSEMBLY__
-# ifdef CONFIG_EFI_APP
+# if defined(CONFIG_EFI_APP) || CONFIG_IS_ENABLED(X86_64)
 
+/* TODO(sjg@chromium.org): Consider using a fixed register for gd on x86_64 */
 #define gd global_data_ptr
 
 #define DECLARE_GLOBAL_DATA_PTR   extern struct global_data *global_data_ptr
@@ -114,7 +117,11 @@ static inline __attribute__((no_instrument_function)) gd_t *get_fs_gd_ptr(void)
 {
        gd_t *gd_ptr;
 
+#if CONFIG_IS_ENABLED(X86_64)
+       asm volatile("fs mov 0, %0\n" : "=r" (gd_ptr));
+#else
        asm volatile("fs movl 0, %0\n" : "=r" (gd_ptr));
+#endif
 
        return gd_ptr;
 }
index 2e6c3120c771f5ade5c5e0f1d413c8d32f6e5130..83b99dcd192f14bf5b074d3129916d7baf1865e0 100644 (file)
@@ -90,4 +90,7 @@ int mp_init(struct mp_params *params);
 /* Probes the CPU device */
 int mp_init_cpu(struct udevice *cpu, void *unused);
 
+/* Set up additional CPUs */
+int x86_mp_init(void);
+
 #endif /* _X86_MP_H_ */
index ad8eba947b9a42aca24499cfad3693030d5d2223..30dbdca90db78234ef9d9777551b9eb8bee23b9c 100644 (file)
@@ -224,9 +224,9 @@ struct mp_ext_compat_address_space {
  * @mc:                configuration table header address
  * @return:    configuration table end address
  */
-static inline u32 mp_next_mpc_entry(struct mp_config_table *mc)
+static inline ulong mp_next_mpc_entry(struct mp_config_table *mc)
 {
-       return (u32)mc + mc->mpc_length;
+       return (ulong)mc + mc->mpc_length;
 }
 
 /**
@@ -254,9 +254,9 @@ static inline void mp_add_mpc_entry(struct mp_config_table *mc, uint length)
  * @mc:                configuration table header address
  * @return:    configuration table end address
  */
-static inline u32 mp_next_mpe_entry(struct mp_config_table *mc)
+static inline ulong mp_next_mpe_entry(struct mp_config_table *mc)
 {
-       return (u32)mc + mc->mpc_length + mc->mpe_length;
+       return (ulong)mc + mc->mpc_length + mc->mpe_length;
 }
 
 /**
@@ -456,6 +456,6 @@ int mp_determine_pci_dstirq(int bus, int dev, int func, int pirq);
  * @addr:      start address to write MP table
  * @return:    end address of MP table
  */
-u32 write_mp_table(u32 addr);
+ulong write_mp_table(ulong addr);
 
 #endif /* __ASM_MPSPEC_H */
index 5529f32702cd94017bb0593bf0faeb8cb4594f43..717f6cb8e01055615ccbd41d5d1f929804850ea4 100644 (file)
@@ -16,8 +16,13 @@ typedef int          __kernel_pid_t;
 typedef unsigned short __kernel_ipc_pid_t;
 typedef unsigned short __kernel_uid_t;
 typedef unsigned short __kernel_gid_t;
+#if CONFIG_IS_ENABLED(X86_64)
+typedef unsigned long  __kernel_size_t;
+typedef long           __kernel_ssize_t;
+#else
 typedef unsigned int   __kernel_size_t;
 typedef int            __kernel_ssize_t;
+#endif
 typedef int            __kernel_ptrdiff_t;
 typedef long           __kernel_time_t;
 typedef long           __kernel_suseconds_t;
index d1f0f0cb6b872e69909f10493db034ace439716e..d6c44c978a9184fb788991d90755c3b0ecc4e6b2 100644 (file)
@@ -132,6 +132,6 @@ typedef int (*sfi_table_handler) (struct sfi_table_header *table);
  * @base:      Address to write table to
  * @return address to use for the next table
  */
-u32 write_sfi_table(u32 base);
+ulong write_sfi_table(ulong base);
 
 #endif /*_LINUX_SFI_H */
diff --git a/arch/x86/include/asm/spl.h b/arch/x86/include/asm/spl.h
new file mode 100644 (file)
index 0000000..d48a3fc
--- /dev/null
@@ -0,0 +1,8 @@
+/*
+ * Copyright (C) 2017 Google, Inc
+ * Written by Simon Glass <sjg@chromium.org>
+ *
+ * SPDX-License-Identifier:    GPL-2.0+
+ *
+ * This file is required for SPL to build, but is empty.
+ */
index 81f98f27745381993f009409dc0536e80026b6c3..d1b23880219ebc6f28be102c86834d7e72de3be4 100644 (file)
@@ -65,6 +65,6 @@ void write_tables(void);
  * @start:     start address to write PIRQ routing table
  * @return:    end address of PIRQ routing table
  */
-u32 write_pirq_routing_table(u32 start);
+ulong write_pirq_routing_table(ulong start);
 
 #endif /* _X86_TABLES_H_ */
index 880dcb488a5df933550ed204636b820ccffb2c35..a47e581fe3ab1f0ae9e046aeed97e5876c2ff448 100644 (file)
@@ -44,7 +44,12 @@ typedef __INT64_TYPE__ s64;
 typedef __UINT64_TYPE__ u64;
 #endif
 
+#if CONFIG_IS_ENABLED(X86_64)
+#define BITS_PER_LONG 64
+#else
 #define BITS_PER_LONG 32
+#endif
+
 /* Dma addresses are 32-bits wide.  */
 
 typedef u32 dma_addr_t;
index 723288f7b2bf21fbe4b34eadf516e9b214cc8b37..1c2c0851790e296cb3e80a1eaf5d3c1fd74bee5f 100644 (file)
@@ -5,10 +5,14 @@
 # SPDX-License-Identifier:     GPL-2.0+
 #
 
+ifndef CONFIG_X86_64
 obj-y += bios.o
 obj-y += bios_asm.o
 obj-y += bios_interrupts.o
+endif
+ifndef CONFIG_SPL_BUILD
 obj-$(CONFIG_CMD_BOOTM) += bootm.o
+endif
 obj-y  += cmd_boot.o
 obj-$(CONFIG_SEABIOS) += coreboot_table.o
 obj-$(CONFIG_EFI) += efi/
@@ -35,8 +39,11 @@ ifndef CONFIG_QEMU
 obj-$(CONFIG_GENERATE_ACPI_TABLE) += acpi_table.o
 endif
 obj-y  += tables.o
+ifndef CONFIG_SPL_BUILD
 obj-$(CONFIG_CMD_ZBOOT)        += zimage.o
+endif
 obj-$(CONFIG_HAVE_FSP) += fsp/
+obj-$(CONFIG_SPL_BUILD) += spl.o
 
 extra-$(CONFIG_USE_PRIVATE_LIBGCC) += lib.a
 
@@ -45,7 +52,9 @@ OBJCOPYFLAGS := --prefix-symbols=__normal_
 $(obj)/lib.a: $(NORMAL_LIBGCC) FORCE
        $(call if_changed,objcopy)
 
+ifeq ($(CONFIG_$(SPL_)X86_64),)
 obj-$(CONFIG_EFI_APP) += crt0_ia32_efi.o reloc_ia32_efi.o
+endif
 
 ifneq ($(CONFIG_EFI_STUB),)
 
@@ -65,5 +74,7 @@ extra-$(CONFIG_EFI_STUB_64BIT) += crt0_x86_64_efi.o reloc_x86_64_efi.o
 endif
 
 ifneq ($(CONFIG_EFI_STUB)$(CONFIG_CMD_BOOTEFI_HELLO_COMPILE),)
+ifeq ($(CONFIG_$(SPL_)X86_64),)
 extra-y += $(EFI_CRT0) $(EFI_RELOC)
 endif
+endif
index 7001e8ba348932541ecd0ca1f647f7dda6f62759..355456dc19e50366534137a6e977a883c013436a 100644 (file)
@@ -327,7 +327,7 @@ static void enter_acpi_mode(int pm1_cnt)
  * QEMU's version of write_acpi_tables is defined in
  * arch/x86/cpu/qemu/acpi_table.c
  */
-u32 write_acpi_tables(u32 start)
+ulong write_acpi_tables(ulong start)
 {
        u32 current;
        struct acpi_rsdp *rsdp;
@@ -345,7 +345,7 @@ u32 write_acpi_tables(u32 start)
        /* Align ACPI tables to 16 byte */
        current = ALIGN(current, 16);
 
-       debug("ACPI: Writing ACPI tables at %x\n", start);
+       debug("ACPI: Writing ACPI tables at %lx\n", start);
 
        /* We need at least an RSDP and an RSDT Table */
        rsdp = (struct acpi_rsdp *)current;
index 9324bdb83e864eaa2c1e9c331e2a45a9a7ec473d..66d7629a6dd2641ed2e2cc7bd64021f0fd322ab2 100644 (file)
@@ -157,7 +157,7 @@ static void setup_realmode_idt(void)
         for (i = 0; i < 256; i++) {
                idts[i].cs = 0;
                idts[i].offset = 0x1000 + (i * __idt_handler_size);
-               write_idt_stub((void *)((u32)idts[i].offset), i);
+               write_idt_stub((void *)((ulong)idts[i].offset), i);
        }
 
        /*
@@ -227,7 +227,7 @@ static void vbe_set_graphics(int vesa_mode, struct vbe_mode_info *mode_info)
        mode_info->video_mode = (1 << 14) | vesa_mode;
        vbe_get_mode_info(mode_info);
 
-       framebuffer = (unsigned char *)mode_info->vesa.phys_base_ptr;
+       framebuffer = (unsigned char *)(ulong)mode_info->vesa.phys_base_ptr;
        debug("VBE: resolution:  %dx%d@%d\n",
              le16_to_cpu(mode_info->vesa.x_resolution),
              le16_to_cpu(mode_info->vesa.y_resolution),
index e5e63f6888e3975993a03b78fff3199609bb65f5..3c3d9e1e800261839d45f70b9f0866f0ab67f77f 100644 (file)
@@ -155,7 +155,14 @@ int boot_linux_kernel(ulong setup_base, ulong load_address, bool image_64bit)
                        puts("Cannot boot 64-bit kernel on 32-bit machine\n");
                        return -EFAULT;
                }
+               /* At present 64-bit U-Boot does not support booting a
+                * kernel.
+                * TODO(sjg@chromium.org): Support booting both 32-bit and
+                * 64-bit kernels from 64-bit U-Boot.
+                */
+#if !CONFIG_IS_ENABLED(X86_64)
                return cpu_jump_to_64bit(setup_base, load_address);
+#endif
        } else {
                /*
                * Set %ebx, %ebp, and %edi to 0, %esi to point to the
index 2a186fc22f6e94072aeed2dfb5bc4a3520ebea9f..420393b843e8853fea47048633ae5441ffb7c209 100644 (file)
@@ -19,7 +19,7 @@ __weak ulong board_get_usable_ram_top(ulong total_size)
 
 int init_cache_f_r(void)
 {
-#if defined(CONFIG_X86_RESET_VECTOR) & !defined(CONFIG_HAVE_FSP)
+#if CONFIG_IS_ENABLED(X86_32BIT_INIT) && !defined(CONFIG_HAVE_FSP)
        int ret;
 
        ret = mtrr_commit(false);
index dd08402665596ccf8654f682e69ebae565d6a028..d3ae6d9694aaf0d0e074a1fef74568f6a78a507b 100644 (file)
@@ -33,6 +33,8 @@
 #include <common.h>
 #include <asm/interrupt.h>
 
+#if !CONFIG_IS_ENABLED(X86_64)
+
 struct irq_action {
        interrupt_handler_t *handler;
        void *arg;
@@ -118,10 +120,12 @@ void do_irq(int hw_irq)
                }
        }
 }
+#endif
 
 #if defined(CONFIG_CMD_IRQ)
 int do_irqinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 {
+#if !CONFIG_IS_ENABLED(X86_64)
        int irq;
 
        printf("Spurious IRQ: %u, last unknown IRQ: %d\n",
@@ -139,6 +143,7 @@ int do_irqinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
                                        irq_handlers[irq].count);
                }
        }
+#endif
 
        return 0;
 }
index 6ab43f1055fdc31a2bb7f2b2d08d830392c812b5..a6e493d69af9aa814fa4398fcd5eaa510a5e5794 100644 (file)
@@ -25,10 +25,10 @@ static bool isa_irq_occupied[16];
 
 struct mp_config_table *mp_write_floating_table(struct mp_floating_table *mf)
 {
-       u32 mc;
+       ulong mc;
 
        memcpy(mf->mpf_signature, MPF_SIGNATURE, 4);
-       mf->mpf_physptr = (u32)mf + sizeof(struct mp_floating_table);
+       mf->mpf_physptr = (ulong)mf + sizeof(struct mp_floating_table);
        mf->mpf_length = 1;
        mf->mpf_spec = MPSPEC_V14;
        mf->mpf_checksum = 0;
@@ -41,7 +41,7 @@ struct mp_config_table *mp_write_floating_table(struct mp_floating_table *mf)
        mf->mpf_feature5 = 0;
        mf->mpf_checksum = table_compute_checksum(mf, mf->mpf_length * 16);
 
-       mc = (u32)mf + sizeof(struct mp_floating_table);
+       mc = (ulong)mf + sizeof(struct mp_floating_table);
        return (struct mp_config_table *)mc;
 }
 
@@ -219,14 +219,14 @@ void mp_write_compat_address_space(struct mp_config_table *mc, int busid,
 
 u32 mptable_finalize(struct mp_config_table *mc)
 {
-       u32 end;
+       ulong end;
 
        mc->mpe_checksum = table_compute_checksum((void *)mp_next_mpc_entry(mc),
                                                  mc->mpe_length);
        mc->mpc_checksum = table_compute_checksum(mc, mc->mpc_length);
        end = mp_next_mpe_entry(mc);
 
-       debug("Write the MP table at: %x - %x\n", (u32)mc, end);
+       debug("Write the MP table at: %lx - %lx\n", (ulong)mc, end);
 
        return end;
 }
@@ -304,7 +304,8 @@ static int mptable_add_intsrc(struct mp_config_table *mc,
        }
 
        /* Get I/O interrupt information from device tree */
-       cell = fdt_getprop(blob, dev->of_offset, "intel,pirq-routing", &len);
+       cell = fdt_getprop(blob, dev_of_offset(dev), "intel,pirq-routing",
+                          &len);
        if (!cell)
                return -ENOENT;
 
@@ -365,13 +366,13 @@ static void mptable_add_lintsrc(struct mp_config_table *mc, int bus_isa)
                         bus_isa, 0, MP_APIC_ALL, 1);
 }
 
-u32 write_mp_table(u32 addr)
+ulong write_mp_table(ulong addr)
 {
        struct mp_config_table *mc;
        int ioapic_id, ioapic_ver;
        int bus_isa = 0xff;
        int ret;
-       u32 end;
+       ulong end;
 
        /* 16 byte align the table address */
        addr = ALIGN(addr, 16);
index 3f94cdf2dacad9dfee75081a22df4764c39b9e14..406852d324daf189ccc4133729feda9787bbeb4e 100644 (file)
@@ -104,7 +104,7 @@ static int ich6_pinctrl_cfg_pin(s32 gpiobase, s32 iobase, int pin_node)
 
        /* if iobase is present, let's configure the pad */
        if (iobase != -1) {
-               int iobase_addr;
+               ulong iobase_addr;
 
                /*
                 * The offset for the same pin for the IOBASE and GPIOBASE are
@@ -187,7 +187,7 @@ static int ich6_pinctrl_probe(struct udevice *dev)
                return -EINVAL;
        }
 
-       for (pin_node = fdt_first_subnode(gd->fdt_blob, dev->of_offset);
+       for (pin_node = fdt_first_subnode(gd->fdt_blob, dev_of_offset(dev));
             pin_node > 0;
             pin_node = fdt_next_subnode(gd->fdt_blob, pin_node)) {
                /* Configure the pin */
index a93d355d8a2457e3e049db8b07d1986a6c98a56e..5df3cab6c9cf1ea3014ea64fb4c4e9578cfa8b8e 100644 (file)
@@ -11,9 +11,8 @@
 #include <asm/pci.h>
 #include <asm/pirq_routing.h>
 
-static bool irq_already_routed[16];
-
-static u8 pirq_get_next_free_irq(struct udevice *dev, u8 *pirq, u16 bitmap)
+static u8 pirq_get_next_free_irq(struct udevice *dev, u8 *pirq, u16 bitmap,
+                                bool irq_already_routed[])
 {
        int i, link;
        u8 irq = 0;
@@ -55,9 +54,11 @@ void pirq_route_irqs(struct udevice *dev, struct irq_info *irq, int num)
 {
        unsigned char irq_slot[MAX_INTX_ENTRIES];
        unsigned char pirq[CONFIG_MAX_PIRQ_LINKS];
+       bool irq_already_routed[16];
        int i, intx;
 
        memset(pirq, 0, CONFIG_MAX_PIRQ_LINKS);
+       memset(irq_already_routed, '\0', sizeof(irq_already_routed));
 
        /* Set PCI IRQs */
        for (i = 0; i < num; i++) {
@@ -83,7 +84,8 @@ void pirq_route_irqs(struct udevice *dev, struct irq_info *irq, int num)
 
                        /* yet not routed */
                        if (!pirq[link]) {
-                               irq = pirq_get_next_free_irq(dev, pirq, bitmap);
+                               irq = pirq_get_next_free_irq(dev, pirq, bitmap,
+                                               irq_already_routed);
                                pirq[link] = irq;
                        } else {
                                irq = pirq[link];
@@ -114,14 +116,14 @@ u32 copy_pirq_routing_table(u32 addr, struct irq_routing_table *rt)
        addr = ALIGN(addr, 16);
 
        debug("Copying Interrupt Routing Table to 0x%x\n", addr);
-       memcpy((void *)addr, rt, rt->size);
+       memcpy((void *)(uintptr_t)addr, rt, rt->size);
 
        /*
         * We do the sanity check here against the copied table after memcpy,
         * as something might go wrong after the memcpy, which is normally
         * due to the F segment decode is not turned on to systeam RAM.
         */
-       rom_rt = (struct irq_routing_table *)addr;
+       rom_rt = (struct irq_routing_table *)(uintptr_t)addr;
        if (rom_rt->signature != PIRQ_SIGNATURE ||
            rom_rt->version != PIRQ_VERSION || rom_rt->size % 16) {
                printf("Interrupt Routing Table not valid\n");
index 0d683bfc12282ee5ca1243fde252da6771c0f165..1da5210d27b6edac653c4f20488b84aa6432f60c 100644 (file)
@@ -26,7 +26,7 @@ DECLARE_GLOBAL_DATA_PTR;
 
 int copy_uboot_to_ram(void)
 {
-       size_t len = (size_t)&__data_end - (size_t)&__text_start;
+       size_t len = (uintptr_t)&__data_end - (uintptr_t)&__text_start;
 
        if (gd->flags & GD_FLG_SKIP_RELOC)
                return 0;
@@ -38,7 +38,7 @@ int copy_uboot_to_ram(void)
 int clear_bss(void)
 {
        ulong dst_addr = (ulong)&__bss_start + gd->reloc_off;
-       size_t len = (size_t)&__bss_end - (size_t)&__bss_start;
+       size_t len = (uintptr_t)&__bss_end - (uintptr_t)&__bss_start;
 
        if (gd->flags & GD_FLG_SKIP_RELOC)
                return 0;
@@ -47,38 +47,58 @@ int clear_bss(void)
        return 0;
 }
 
-/*
- * This function has more error checking than you might expect. Please see
- * the commit message for more informaiton.
- */
-int do_elf_reloc_fixups(void)
+#if CONFIG_IS_ENABLED(X86_64)
+static void do_elf_reloc_fixups64(unsigned int text_base, uintptr_t size,
+                                 Elf64_Rela *re_src, Elf64_Rela *re_end)
 {
-       Elf32_Rel *re_src = (Elf32_Rel *)(&__rel_dyn_start);
-       Elf32_Rel *re_end = (Elf32_Rel *)(&__rel_dyn_end);
+       Elf64_Addr *offset_ptr_rom, *last_offset = NULL;
+       Elf64_Addr *offset_ptr_ram;
 
-       Elf32_Addr *offset_ptr_rom, *last_offset = NULL;
-       Elf32_Addr *offset_ptr_ram;
-       unsigned int text_base = 0;
+       do {
+               /* Get the location from the relocation entry */
+               offset_ptr_rom = (Elf64_Addr *)(uintptr_t)re_src->r_offset;
 
-       /* The size of the region of u-boot that runs out of RAM. */
-       uintptr_t size = (uintptr_t)&__bss_end - (uintptr_t)&__text_start;
+               /* Check that the location of the relocation is in .text */
+               if (offset_ptr_rom >= (Elf64_Addr *)(uintptr_t)text_base &&
+                   offset_ptr_rom > last_offset) {
+                       /* Switch to the in-RAM version */
+                       offset_ptr_ram = (Elf64_Addr *)((ulong)offset_ptr_rom +
+                                                       gd->reloc_off);
 
-       if (gd->flags & GD_FLG_SKIP_RELOC)
-               return 0;
-       if (re_src == re_end)
-               panic("No relocation data");
+                       /* Check that the target points into .text */
+                       if (*offset_ptr_ram >= text_base &&
+                           *offset_ptr_ram <= text_base + size) {
+                               *offset_ptr_ram = gd->reloc_off +
+                                                       re_src->r_addend;
+                       } else {
+                               debug("   %p: %lx: rom reloc %lx, ram %p, value %lx, limit %"
+                                     PRIXPTR "\n",
+                                     re_src, (ulong)re_src->r_info,
+                                     (ulong)re_src->r_offset, offset_ptr_ram,
+                                     (ulong)*offset_ptr_ram, text_base + size);
+                       }
+               } else {
+                       debug("   %p: %lx: rom reloc %lx, last %p\n", re_src,
+                             (ulong)re_src->r_info, (ulong)re_src->r_offset,
+                             last_offset);
+               }
+               last_offset = offset_ptr_rom;
 
-#ifdef CONFIG_SYS_TEXT_BASE
-       text_base = CONFIG_SYS_TEXT_BASE;
+       } while (++re_src < re_end);
+}
 #else
-       panic("No CONFIG_SYS_TEXT_BASE");
-#endif
+static void do_elf_reloc_fixups32(unsigned int text_base, uintptr_t size,
+                                 Elf32_Rel *re_src, Elf32_Rel *re_end)
+{
+       Elf32_Addr *offset_ptr_rom, *last_offset = NULL;
+       Elf32_Addr *offset_ptr_ram;
+
        do {
                /* Get the location from the relocation entry */
-               offset_ptr_rom = (Elf32_Addr *)re_src->r_offset;
+               offset_ptr_rom = (Elf32_Addr *)(uintptr_t)re_src->r_offset;
 
                /* Check that the location of the relocation is in .text */
-               if (offset_ptr_rom >= (Elf32_Addr *)text_base &&
+               if (offset_ptr_rom >= (Elf32_Addr *)(uintptr_t)text_base &&
                    offset_ptr_rom > last_offset) {
 
                        /* Switch to the in-RAM version */
@@ -103,6 +123,38 @@ int do_elf_reloc_fixups(void)
                last_offset = offset_ptr_rom;
 
        } while (++re_src < re_end);
+}
+#endif
+
+/*
+ * This function has more error checking than you might expect. Please see
+ * this commit message for more information:
+ *    62f7970a x86: Add error checking to x86 relocation code
+ */
+int do_elf_reloc_fixups(void)
+{
+       void *re_src = (void *)(&__rel_dyn_start);
+       void *re_end = (void *)(&__rel_dyn_end);
+       uint text_base;
+
+       /* The size of the region of u-boot that runs out of RAM. */
+       uintptr_t size = (uintptr_t)&__bss_end - (uintptr_t)&__text_start;
+
+       if (gd->flags & GD_FLG_SKIP_RELOC)
+               return 0;
+       if (re_src == re_end)
+               panic("No relocation data");
+
+#ifdef CONFIG_SYS_TEXT_BASE
+       text_base = CONFIG_SYS_TEXT_BASE;
+#else
+       panic("No CONFIG_SYS_TEXT_BASE");
+#endif
+#if CONFIG_IS_ENABLED(X86_64)
+       do_elf_reloc_fixups64(text_base, size, re_src, re_end);
+#else
+       do_elf_reloc_fixups32(text_base, size, re_src, re_end);
+#endif
 
        return 0;
 }
index 3d3658088ad5b640a225125272e146aeca9c6add..507e037b998b19e78d5c02430cd556b022e23da7 100644 (file)
@@ -38,14 +38,14 @@ static void *get_entry_start(struct table_info *tab)
        tab->table[tab->count] = tab->entry_start;
        tab->entry_start += sizeof(struct sfi_table_header);
 
-       return (void *)tab->entry_start;
+       return (void *)(uintptr_t)tab->entry_start;
 }
 
 static void finish_table(struct table_info *tab, const char *sig, void *entry)
 {
        struct sfi_table_header *hdr;
 
-       hdr = (struct sfi_table_header *)(tab->base + tab->ptr);
+       hdr = (struct sfi_table_header *)(uintptr_t)(tab->base + tab->ptr);
        strcpy(hdr->sig, sig);
        hdr->len = sizeof(*hdr) + ((ulong)entry - tab->entry_start);
        hdr->rev = 1;
@@ -131,7 +131,7 @@ static int sfi_write_xsdt(struct table_info *tab)
        return 0;
 }
 
-u32 write_sfi_table(u32 base)
+ulong write_sfi_table(ulong base)
 {
        struct table_info table;
 
diff --git a/arch/x86/lib/spl.c b/arch/x86/lib/spl.c
new file mode 100644 (file)
index 0000000..ed2d40b
--- /dev/null
@@ -0,0 +1,159 @@
+/*
+ * Copyright (c) 2016 Google, Inc
+ *
+ * SPDX-License-Identifier:     GPL-2.0
+ */
+
+#include <common.h>
+#include <debug_uart.h>
+#include <spl.h>
+#include <asm/cpu.h>
+#include <asm/init_helpers.h>
+#include <asm/mtrr.h>
+#include <asm/processor.h>
+#include <asm-generic/sections.h>
+
+DECLARE_GLOBAL_DATA_PTR;
+
+__weak int arch_cpu_init_dm(void)
+{
+       return 0;
+}
+
+static int x86_spl_init(void)
+{
+       /*
+        * TODO(sjg@chromium.org): We use this area of RAM for the stack
+        * and global_data in SPL. Once U-Boot starts up and releocates it
+        * is not needed. We could make this a CONFIG option or perhaps
+        * place it immediately below CONFIG_SYS_TEXT_BASE.
+        */
+       char *ptr = (char *)0x110000;
+       int ret;
+
+       debug("%s starting\n", __func__);
+       ret = spl_init();
+       if (ret) {
+               debug("%s: spl_init() failed\n", __func__);
+               return ret;
+       }
+       preloader_console_init();
+
+       ret = arch_cpu_init();
+       if (ret) {
+               debug("%s: arch_cpu_init() failed\n", __func__);
+               return ret;
+       }
+       ret = arch_cpu_init_dm();
+       if (ret) {
+               debug("%s: arch_cpu_init_dm() failed\n", __func__);
+               return ret;
+       }
+       ret = print_cpuinfo();
+       if (ret) {
+               debug("%s: print_cpuinfo() failed\n", __func__);
+               return ret;
+       }
+       ret = dram_init();
+       if (ret) {
+               debug("%s: dram_init() failed\n", __func__);
+               return ret;
+       }
+       memset(&__bss_start, 0, (ulong)&__bss_end - (ulong)&__bss_start);
+
+       /* TODO(sjg@chromium.org): Consider calling cpu_init_r() here */
+       ret = interrupt_init();
+       if (ret) {
+               debug("%s: interrupt_init() failed\n", __func__);
+               return ret;
+       }
+
+       /*
+        * The stack grows down from ptr. Put the global data at ptr. This
+        * will only be used for SPL. Once SPL loads U-Boot proper it will
+        * set up its own stack.
+        */
+       gd->new_gd = (struct global_data *)ptr;
+       memcpy(gd->new_gd, gd, sizeof(*gd));
+       arch_setup_gd(gd->new_gd);
+       gd->start_addr_sp = (ulong)ptr;
+
+       /* Cache the SPI flash. Otherwise copying the code to RAM takes ages */
+       ret = mtrr_add_request(MTRR_TYPE_WRBACK,
+                              (1ULL << 32) - CONFIG_XIP_ROM_SIZE,
+                              CONFIG_XIP_ROM_SIZE);
+       if (ret) {
+               debug("%s: SPI cache setup failed\n", __func__);
+               return ret;
+       }
+
+       return 0;
+}
+
+void board_init_f(ulong flags)
+{
+       int ret;
+
+       ret = x86_spl_init();
+       if (ret) {
+               debug("Error %d\n", ret);
+               hang();
+       }
+
+       /* Uninit CAR and jump to board_init_f_r() */
+       board_init_f_r_trampoline(gd->start_addr_sp);
+}
+
+void board_init_f_r(void)
+{
+       init_cache_f_r();
+       gd->flags &= ~GD_FLG_SERIAL_READY;
+       debug("cache status %d\n", dcache_status());
+       board_init_r(gd, 0);
+}
+
+u32 spl_boot_device(void)
+{
+       return BOOT_DEVICE_BOARD;
+}
+
+int spl_start_uboot(void)
+{
+       return 0;
+}
+
+void spl_board_announce_boot_device(void)
+{
+       printf("SPI flash");
+}
+
+static int spl_board_load_image(struct spl_image_info *spl_image,
+                               struct spl_boot_device *bootdev)
+{
+       spl_image->size = CONFIG_SYS_MONITOR_LEN;
+       spl_image->entry_point = CONFIG_SYS_TEXT_BASE;
+       spl_image->load_addr = CONFIG_SYS_TEXT_BASE;
+       spl_image->os = IH_OS_U_BOOT;
+       spl_image->name = "U-Boot";
+
+       debug("Loading to %lx\n", spl_image->load_addr);
+
+       return 0;
+}
+SPL_LOAD_IMAGE_METHOD("SPI", 0, BOOT_DEVICE_BOARD, spl_board_load_image);
+
+int spl_spi_load_image(void)
+{
+       return -EPERM;
+}
+
+void __noreturn jump_to_image_no_args(struct spl_image_info *spl_image)
+{
+       int ret;
+
+       printf("Jumping to 64-bit U-Boot: Note many features are missing\n");
+       ret = cpu_jump_to_64bit_uboot(spl_image->entry_point);
+       debug("ret=%d\n", ret);
+       while (1)
+               ;
+}
index 5966e5862a31eddf5c2d39e582a6ec98e0c871d5..4f5fe74288209594017f456cea2fc2ac94ce170a 100644 (file)
 #include <asm/acpi_table.h>
 #include <asm/coreboot_tables.h>
 
-#ifdef CONFIG_GENERATE_SMBIOS_TABLE
-static u32 write_smbios_table_wrapper(u32 addr)
-{
-       return write_smbios_table(addr);
-}
-#endif
-
 /**
  * Function prototype to write a specific configuration table
  *
  * @addr:      start address to write the table
  * @return:    end address of the table
  */
-typedef u32 (*table_write)(u32 addr);
+typedef ulong (*table_write)(ulong addr);
 
 static table_write table_write_funcs[] = {
 #ifdef CONFIG_GENERATE_PIRQ_TABLE
@@ -41,7 +34,7 @@ static table_write table_write_funcs[] = {
        write_acpi_tables,
 #endif
 #ifdef CONFIG_GENERATE_SMBIOS_TABLE
-       write_smbios_table_wrapper,
+       write_smbios_table,
 #endif
 };
 
index 1b33c771391f49ffe82864ff1582bdfd07e5e97d..b6b0f2beb3a16469449ba7d5664f8d80f20e89d1 100644 (file)
@@ -165,7 +165,7 @@ struct boot_params *load_zimage(char *image, unsigned long kernel_size,
                 * A very old kernel MUST have its real-mode code
                 * loaded at 0x90000
                 */
-               if ((u32)setup_base != 0x90000) {
+               if ((ulong)setup_base != 0x90000) {
                        /* Copy the real-mode kernel */
                        memmove((void *)0x90000, setup_base, setup_size);
 
index 36809fd3761840a918471698d2cb185fedc3894e..6d55dca2db5707589f07cfabdef78c9fbf036d2c 100644 (file)
@@ -18,6 +18,13 @@ config TARGET_QEMU_X86
          supported by U-Boot. They are via QEMU '-M pc', an i440FX/PIIX
          chipset platform and '-M q35', a Q35/ICH9 chipset platform.
 
+config TARGET_QEMU_X86_64
+       bool "QEMU x86 64-bit"
+       help
+         This is the QEMU emulated x86 64-bit board. With this config
+         U-Boot is built as a 64-bit binary. This allows testing while
+         this feature is being completed.
+
 endchoice
 
 source "board/emulation/qemu-x86/Kconfig"
index c9181fc1bf217dde1779fa09aeb4aef0fc9f5b61..a593f8cdc878dfafcf8d71197c9eca643ae13514 100644 (file)
@@ -1,4 +1,4 @@
-if TARGET_QEMU_X86
+if TARGET_QEMU_X86 || TARGET_QEMU_X86_64
 
 config SYS_BOARD
        default "qemu-x86"
@@ -13,8 +13,8 @@ config SYS_CONFIG_NAME
        default "qemu-x86"
 
 config SYS_TEXT_BASE
-       default 0xfff00000 if !EFI_STUB
-       default 0x01110000 if EFI_STUB
+       default 0xfff00000 if !EFI_STUB && !SUPPORT_SPL
+       default 0x01110000 if EFI_STUB || SUPPORT_SPL
 
 config BOARD_SPECIFIC_OPTIONS # dummy
        def_bool y
index 54dc2c58a8367f3d4bd3ca20edfeda32fb6cd082..4cf8ac90e7d250d178a1bb8083ae7b19fa66a816 100644 (file)
@@ -6,3 +6,10 @@ F:     include/configs/qemu-x86.h
 F:     configs/qemu-x86_defconfig
 F:     configs/qemu-x86_efi_payload32_defconfig
 F:     configs/qemu-x86_efi_payload64_defconfig
+
+QEMU X86 64-bit BOARD
+M:     Bin Meng <bmeng.cn@gmail.com>
+S:     Maintained
+F:     board/emulation/qemu-x86/
+F:     include/configs/qemu-x86.h
+F:     configs/qemu-x86_64_defconfig
index 7ba73a2461dc82052d516428fca2444a38ce4687..e56c026ef6d260c48d1f3f165a80f0f0718e68b8 100644 (file)
@@ -22,6 +22,13 @@ config TARGET_CHROMEBOOK_LINK
          and it provides a 2560x1700 high resolution touch-enabled LCD
          display.
 
+config TARGET_CHROMEBOOK_LINK64
+       bool "Chromebook link 64-bit"
+       help
+         This is the Chromebook Pixel released in 2013. With this config
+         U-Boot is built as a 64-bit binary. This allows testing while this
+         feature is being completed.
+
 config TARGET_CHROMEBOX_PANTHER
        bool "Chromebox panther (not available)"
        select n
index fa12f338de584416d28e404a2f2dff5e28fad408..8999b5829439d4bd1f928a56a2e124c4fc264794 100644 (file)
@@ -1,4 +1,4 @@
-if TARGET_CHROMEBOOK_LINK
+if TARGET_CHROMEBOOK_LINK || TARGET_CHROMEBOOK_LINK64
 
 config SYS_BOARD
        default "chromebook_link"
@@ -13,7 +13,8 @@ config SYS_CONFIG_NAME
        default "chromebook_link"
 
 config SYS_TEXT_BASE
-       default 0xfff00000
+       default 0xfff00000 if !SUPPORT_SPL
+       default 0x10000000 if SUPPORT_SPL
 
 config BOARD_SPECIFIC_OPTIONS # dummy
        def_bool y
index bc253a2ba7b5d7662d337e5f440beddfe67e0fcb..e7aef53390cc79670c76eddfdff7f70913a83d82 100644 (file)
@@ -4,3 +4,10 @@ S:     Maintained
 F:     board/google/chromebook_link/
 F:     include/configs/chromebook_link.h
 F:     configs/chromebook_link_defconfig
+
+CHROMEBOOK LINK 64-bit BOARD
+M:     Simon Glass <sjg@chromium.org>
+S:     Maintained
+F:     board/google/chromebook_link/
+F:     include/configs/chromebook_link.h
+F:     configs/chromebook_link64_defconfig
index e75ff4fc3a3ac7fee3b3971f914534386e4c6614..54a4e4f9c3c70fc428b145bf69405a73d218792a 100644 (file)
@@ -258,8 +258,7 @@ int dram_init(void)
                .wldqsen           = 25,
        };
 
-       ddrmc_ctrl_init_ddr3(&pcm052_ddr_timings, pcm052_cr_settings,
-                            pcm052_phy_settings, 1, 2);
+    const int row_diff = 2;
 
 #elif defined(CONFIG_TARGET_BK4R1)
 
@@ -314,8 +313,7 @@ int dram_init(void)
                .wldqsen           = 25,
        };
 
-       ddrmc_ctrl_init_ddr3(&pcm052_ddr_timings, pcm052_cr_settings,
-                            pcm052_phy_settings, 1, 1);
+    const int row_diff = 1;
 
 #else /* Unknown PCM052 variant */
 
@@ -325,6 +323,9 @@ int dram_init(void)
 
        imx_iomux_v3_setup_multiple_pads(pcm052_pads, ARRAY_SIZE(pcm052_pads));
 
+       ddrmc_ctrl_init_ddr3(&pcm052_ddr_timings, pcm052_cr_settings,
+                            pcm052_phy_settings, 1, row_diff);
+
        gd->ram_size = get_ram_size((void *)PHYS_SDRAM, PHYS_SDRAM_SIZE);
 
        return 0;
index 1fa566436b4585744c1b1f1c8dc8a2363d4ae12c..818ae04dfd015c2c0d6c1b9ed0e4c1db9bd4a1b5 100644 (file)
@@ -44,7 +44,8 @@ int board_prepare_usb(enum usb_init_type type)
 
        /* Try to request gpios needed to start usb host on dragonboard */
        if (!dm_gpio_is_valid(&hub_reset)) {
-               node = fdt_subnode_offset(gd->fdt_blob, pmic_gpio->of_offset,
+               node = fdt_subnode_offset(gd->fdt_blob,
+                                         dev_of_offset(pmic_gpio),
                                          "usb_hub_reset_pm");
                if (node < 0) {
                        printf("Failed to find usb_hub_reset_pm dt node.\n");
@@ -59,7 +60,8 @@ int board_prepare_usb(enum usb_init_type type)
        }
 
        if (!dm_gpio_is_valid(&usb_sel)) {
-               node = fdt_subnode_offset(gd->fdt_blob, pmic_gpio->of_offset,
+               node = fdt_subnode_offset(gd->fdt_blob,
+                                         dev_of_offset(pmic_gpio),
                                          "usb_sw_sel_pm");
                if (node < 0) {
                        printf("Failed to find usb_sw_sel_pm dt node.\n");
@@ -110,7 +112,8 @@ int misc_init_r(void)
                return 0;
        }
 
-       node = fdt_subnode_offset(gd->fdt_blob, pon->of_offset, "key_vol_down");
+       node = fdt_subnode_offset(gd->fdt_blob, dev_of_offset(pon),
+                                 "key_vol_down");
        if (node < 0) {
                printf("Failed to find key_vol_down node. Check device tree\n");
                return 0;
diff --git a/cmd/.gitignore b/cmd/.gitignore
new file mode 100644 (file)
index 0000000..bab889f
--- /dev/null
@@ -0,0 +1,6 @@
+config_data.gz
+config_data_gz.h
+config_data_size.h
+license_data.gz
+license_data_gz.h
+license_data_size.h
index 4a0d489696898e20586893e989fe0f7fc62ea00d..ef5315631476f652a8d2ccb322539e1cd4231f45 100644 (file)
@@ -126,6 +126,18 @@ config CMD_BDI
        help
          Print board info
 
+config CMD_CONFIG
+       bool "config"
+       select BUILD_BIN2C
+       default SANDBOX
+       help
+         Print ".config" contents.
+
+         If this option is enabled, the ".config" file contents are embedded
+         in the U-Boot image and can be printed on the console by the "config"
+         command.  This provides information of which options are enabled on
+         the running U-Boot.
+
 config CMD_CONSOLE
        bool "coninfo"
        default y
@@ -142,6 +154,7 @@ config CMD_CPU
 
 config CMD_LICENSE
        bool "license"
+       select BUILD_BIN2C
        help
          Print GPL license text
 
@@ -346,6 +359,16 @@ config CMD_MEMINFO
        help
          Display memory information.
 
+config CMD_UNZIP
+       bool "unzip"
+       help
+         Uncompress a zip-compressed memory region.
+
+config CMD_ZIP
+       bool "zip"
+       help
+         Compress a memory region with zlib deflate method.
+
 endmenu
 
 menu "Device access commands"
index 566fed9f7bc269bb5469d253bccb914a75ccb540..f13bb8c11ecb34fd48083cc1c1b83dc115061e39 100644 (file)
@@ -31,6 +31,7 @@ obj-$(CONFIG_CMD_BOOTI) += booti.o
 obj-$(CONFIG_CMD_CACHE) += cache.o
 obj-$(CONFIG_CMD_CBFS) += cbfs.o
 obj-$(CONFIG_CMD_CLK) += clk.o
+obj-$(CONFIG_CMD_CONFIG) += config.o
 obj-$(CONFIG_CMD_CONSOLE) += console.o
 obj-$(CONFIG_CMD_CPLBINFO) += cplbinfo.o
 obj-$(CONFIG_CMD_CPU) += cpu.o
@@ -165,3 +166,39 @@ obj-$(CONFIG_CMD_BLOB) += blob.o
 obj-y += nvedit.o
 
 obj-$(CONFIG_ARCH_MVEBU) += mvebu/
+
+filechk_data_gz = (echo "static const char data_gz[] ="; cat $< | scripts/bin2c; echo ";")
+
+filechk_data_size = \
+       (echo "static const size_t data_size = "; \
+       cat $< | wc -c; echo ";")
+
+# "config" command
+$(obj)/config.o: $(obj)/config_data_gz.h $(obj)/config_data_size.h
+
+targets += config_data.gz
+$(obj)/config_data.gz: $(KCONFIG_CONFIG) FORCE
+       $(call if_changed,gzip)
+
+targets += config_data_gz.h
+$(obj)/config_data_gz.h: $(obj)/config_data.gz FORCE
+       $(call filechk,data_gz)
+
+targets += config_data_size.h
+$(obj)/config_data_size.h: $(KCONFIG_CONFIG) FORCE
+       $(call filechk,data_size)
+
+# "license" command
+$(obj)/license.o: $(obj)/license_data_gz.h $(obj)/license_data_size.h
+
+targets += license_data.gz
+$(obj)/license_data.gz: $(srctree)/Licenses/gpl-2.0.txt FORCE
+       $(call if_changed,gzip)
+
+targets += license_data_gz.h
+$(obj)/license_data_gz.h: $(obj)/license_data.gz FORCE
+       $(call filechk,data_gz)
+
+targets += license_data_size.h
+$(obj)/license_data_size.h: $(srctree)/Licenses/gpl-2.0.txt FORCE
+       $(call filechk,data_size)
index a7e181d22c4c4072d91b3b34ac5f5fb906bf6fa1..953a57de33996b7b2c3c28cb320fc8420fcc76e2 100644 (file)
@@ -390,7 +390,7 @@ static int nand_imls_legacyimage(struct mtd_info *mtd, int nand_dev,
                return -ENOMEM;
        }
 
-       ret = nand_read_skip_bad(mtd, off, &len, imgdata);
+       ret = nand_read_skip_bad(mtd, off, &len, NULL, mtd->size, imgdata);
        if (ret < 0 && ret != -EUCLEAN) {
                free(imgdata);
                return ret;
@@ -430,7 +430,7 @@ static int nand_imls_fitimage(struct mtd_info *mtd, int nand_dev, loff_t off,
                return -ENOMEM;
        }
 
-       ret = nand_read_skip_bad(mtd, off, &len, imgdata);
+       ret = nand_read_skip_bad(mtd, off, &len, NULL, mtd->size, imgdata);
        if (ret < 0 && ret != -EUCLEAN) {
                free(imgdata);
                return ret;
diff --git a/cmd/config.c b/cmd/config.c
new file mode 100644 (file)
index 0000000..0c7f4e0
--- /dev/null
@@ -0,0 +1,44 @@
+/*
+ * Copyright (C) 2017 Masahiro Yamada <yamada.masahiro@socionext.com>
+ *
+ * SPDX-License-Identifier:    GPL-2.0+
+ */
+
+#include <common.h>
+#include <command.h>
+#include <malloc.h>
+
+#include "config_data_gz.h"
+#include "config_data_size.h"
+
+static int do_config(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+{
+       char *dst;
+       unsigned long len = data_size;
+       int ret = CMD_RET_SUCCESS;
+
+       dst = malloc(data_size + 1);
+       if (!dst)
+               return CMD_RET_FAILURE;
+
+       ret = gunzip(dst, data_size, (unsigned char *)data_gz, &len);
+       if (ret) {
+               printf("failed to uncompress .config data\n");
+               ret = CMD_RET_FAILURE;
+               goto free;
+       }
+
+       dst[data_size] = 0;
+       puts(dst);
+
+free:
+       free(dst);
+
+       return ret;
+}
+
+U_BOOT_CMD(
+       config, 1, 1, do_config,
+       "print .config",
+       ""
+);
index 5ee57f8ca3d922cc96c1ba00fd00ae596c32d1fb..29fc8aa9a41fba47c0851680ec6a2c0fc2470f21 100644 (file)
@@ -6,31 +6,36 @@
  */
 
 #include <common.h>
-
-/* Licenses/gpl-2.0.txt is currently 18092 bytes in size */
-#define LICENSE_MAX    20480
-
 #include <command.h>
 #include <malloc.h>
-#include <license.h>
 
-int do_license(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+#include "license_data_gz.h"
+#include "license_data_size.h"
+
+static int do_license(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 {
-       char *dst = malloc(LICENSE_MAX);
-       unsigned long len = LICENSE_MAX;
+       char *dst;
+       unsigned long len = data_size;
+       int ret = CMD_RET_SUCCESS;
 
+       dst = malloc(data_size + 1);
        if (!dst)
-               return -1;
+               return CMD_RET_FAILURE;
 
-       if (gunzip(dst, LICENSE_MAX, license_gzip, &len) != 0) {
+       ret = gunzip(dst, data_size, (unsigned char *)data_gz, &len);
+       if (ret) {
                printf("Error uncompressing license text\n");
-               free(dst);
-               return -1;
+               ret = CMD_RET_FAILURE;
+               goto free;
        }
+
+       dst[data_size] = 0;
        puts(dst);
+
+free:
        free(dst);
 
-       return 0;
+       return ret;
 }
 
 U_BOOT_CMD(
index 99c0b5ac78107f16ed203fb5a0a4b05217ca26be..ae6cd8528c60a7652421afab2e20a78339e9316e 100644 (file)
@@ -768,7 +768,8 @@ static int setup_reloc(void)
 }
 
 /* ARM calls relocate_code from its crt0.S */
-#if !defined(CONFIG_ARM) && !defined(CONFIG_SANDBOX)
+#if !defined(CONFIG_ARM) && !defined(CONFIG_SANDBOX) && \
+               !CONFIG_IS_ENABLED(X86_64)
 
 static int jump_to_copy(void)
 {
@@ -845,7 +846,7 @@ __weak int arch_cpu_init_dm(void)
        return 0;
 }
 
-static init_fnc_t init_sequence_f[] = {
+static const init_fnc_t init_sequence_f[] = {
 #ifdef CONFIG_SANDBOX
        setup_ram_buf,
 #endif
@@ -1032,13 +1033,14 @@ static init_fnc_t init_sequence_f[] = {
        setup_reloc,
 #if defined(CONFIG_X86) || defined(CONFIG_ARC)
        copy_uboot_to_ram,
-       clear_bss,
        do_elf_reloc_fixups,
+       clear_bss,
 #endif
 #if defined(CONFIG_XTENSA)
        clear_bss,
 #endif
-#if !defined(CONFIG_ARM) && !defined(CONFIG_SANDBOX)
+#if !defined(CONFIG_ARM) && !defined(CONFIG_SANDBOX) && \
+               !CONFIG_IS_ENABLED(X86_64)
        jump_to_copy,
 #endif
        NULL,
@@ -1072,7 +1074,7 @@ void board_init_f(ulong boot_flags)
                hang();
 
 #if !defined(CONFIG_ARM) && !defined(CONFIG_SANDBOX) && \
-               !defined(CONFIG_EFI_APP)
+               !defined(CONFIG_EFI_APP) && !CONFIG_IS_ENABLED(X86_64)
        /* NOTREACHED - jump_to_copy() does not return */
        hang();
 #endif
@@ -1096,8 +1098,10 @@ void board_init_f(ulong boot_flags)
  * NOTE: At present only x86 uses this route, but it is intended that
  * all archs will move to this when generic relocation is implemented.
  */
-static init_fnc_t init_sequence_f_r[] = {
+static const init_fnc_t init_sequence_f_r[] = {
+#if !CONFIG_IS_ENABLED(X86_64)
        init_cache_f_r,
+#endif
 
        NULL,
 };
index 48fa4ee52406df7a5fe874b14366c8d81fb67379..8077280de414f6ba6504d5c992c4e2c575cfe440 100644 (file)
@@ -737,7 +737,7 @@ static int run_main_loop(void)
  *
  * TODO: perhaps reset the watchdog in the initcall function after each call?
  */
-init_fnc_t init_sequence_r[] = {
+static init_fnc_t init_sequence_r[] = {
        initr_trace,
        initr_reloc,
        /* TODO: could x86/PPC have this also perhaps? */
@@ -947,6 +947,16 @@ init_fnc_t init_sequence_r[] = {
 
 void board_init_r(gd_t *new_gd, ulong dest_addr)
 {
+       /*
+        * Set up the new global data pointer. So far only x86 does this
+        * here.
+        * TODO(sjg@chromium.org): Consider doing this for all archs, or
+        * dropping the new_gd parameter.
+        */
+#if CONFIG_IS_ENABLED(X86_64)
+       arch_setup_gd(new_gd);
+#endif
+
 #ifdef CONFIG_NEEDS_MANUAL_RELOC
        int i;
 #endif
index e1d84763bdcce8e6a95df1af22f6644198006123..1232808df52b654ed50c7a866e6bd35f2e2d376d 100644 (file)
@@ -41,14 +41,14 @@ static int on_console(const char *name, const char *value, enum env_op op,
        case env_op_create:
        case env_op_overwrite:
 
-#ifdef CONFIG_CONSOLE_MUX
+#if CONFIG_IS_ENABLED(CONSOLE_MUX)
                if (iomux_doenv(console, value))
                        return 1;
 #else
                /* Try assigning specified device */
                if (console_assign(console, value) < 0)
                        return 1;
-#endif /* CONFIG_CONSOLE_MUX */
+#endif
                return 0;
 
        case env_op_delete:
@@ -85,7 +85,7 @@ static int on_silent(const char *name, const char *value, enum env_op op,
 U_BOOT_ENV_CALLBACK(silent, on_silent);
 #endif
 
-#ifdef CONFIG_SYS_CONSOLE_IS_IN_ENV
+#if CONFIG_IS_ENABLED(SYS_CONSOLE_IS_IN_ENV)
 /*
  * if overwrite_console returns 1, the stdin, stderr and stdout
  * are switched to the serial port, else the settings in the
@@ -98,7 +98,7 @@ extern int overwrite_console(void);
 #define OVERWRITE_CONSOLE 0
 #endif /* CONFIG_SYS_CONSOLE_OVERWRITE_ROUTINE */
 
-#endif /* CONFIG_SYS_CONSOLE_IS_IN_ENV */
+#endif /* CONFIG_IS_ENABLED(SYS_CONSOLE_IS_IN_ENV) */
 
 static int console_setfile(int file, struct stdio_dev * dev)
 {
@@ -145,7 +145,7 @@ static int console_setfile(int file, struct stdio_dev * dev)
        return error;
 }
 
-#if defined(CONFIG_CONSOLE_MUX)
+#if CONFIG_IS_ENABLED(CONSOLE_MUX)
 /** Console I/O multiplexing *******************************************/
 
 static struct stdio_dev *tstcdev;
@@ -265,7 +265,7 @@ static inline void console_doenv(int file, struct stdio_dev *dev)
 {
        console_setfile(file, dev);
 }
-#endif /* defined(CONFIG_CONSOLE_MUX) */
+#endif /* CONIFIG_IS_ENABLED(CONSOLE_MUX) */
 
 /** U-Boot INITIAL CONSOLE-NOT COMPATIBLE FUNCTIONS *************************/
 
@@ -290,7 +290,7 @@ int serial_printf(const char *fmt, ...)
 int fgetc(int file)
 {
        if (file < MAX_FILES) {
-#if defined(CONFIG_CONSOLE_MUX)
+#if CONFIG_IS_ENABLED(CONSOLE_MUX)
                /*
                 * Effectively poll for input wherever it may be available.
                 */
@@ -736,7 +736,7 @@ void stdio_print_current_devices(void)
        }
 }
 
-#ifdef CONFIG_SYS_CONSOLE_IS_IN_ENV
+#if CONFIG_IS_ENABLED(SYS_CONSOLE_IS_IN_ENV)
 /* Called after the relocation - use desired console functions */
 int console_init_r(void)
 {
@@ -745,7 +745,7 @@ int console_init_r(void)
 #ifdef CONFIG_SYS_CONSOLE_ENV_OVERWRITE
        int i;
 #endif /* CONFIG_SYS_CONSOLE_ENV_OVERWRITE */
-#ifdef CONFIG_CONSOLE_MUX
+#if CONFIG_IS_ENABLED(CONSOLE_MUX)
        int iomux_err = 0;
 #endif
 
@@ -766,7 +766,7 @@ int console_init_r(void)
                inputdev  = search_device(DEV_FLAGS_INPUT,  stdinname);
                outputdev = search_device(DEV_FLAGS_OUTPUT, stdoutname);
                errdev    = search_device(DEV_FLAGS_OUTPUT, stderrname);
-#ifdef CONFIG_CONSOLE_MUX
+#if CONFIG_IS_ENABLED(CONSOLE_MUX)
                iomux_err = iomux_doenv(stdin, stdinname);
                iomux_err += iomux_doenv(stdout, stdoutname);
                iomux_err += iomux_doenv(stderr, stderrname);
@@ -799,7 +799,7 @@ int console_init_r(void)
                console_doenv(stdin, inputdev);
        }
 
-#ifdef CONFIG_CONSOLE_MUX
+#if CONFIG_IS_ENABLED(CONSOLE_MUX)
 done:
 #endif
 
@@ -829,7 +829,7 @@ done:
        return 0;
 }
 
-#else /* CONFIG_SYS_CONSOLE_IS_IN_ENV */
+#else /* !CONFIG_IS_ENABLED(SYS_CONSOLE_IS_IN_ENV) */
 
 /* Called after the relocation - use desired console functions */
 int console_init_r(void)
@@ -873,7 +873,7 @@ int console_init_r(void)
        if (outputdev != NULL) {
                console_setfile(stdout, outputdev);
                console_setfile(stderr, outputdev);
-#ifdef CONFIG_CONSOLE_MUX
+#if CONFIG_IS_ENABLED(CONSOLE_MUX)
                console_devices[stdout][0] = outputdev;
                console_devices[stderr][0] = outputdev;
 #endif
@@ -882,7 +882,7 @@ int console_init_r(void)
        /* Initializes input console */
        if (inputdev != NULL) {
                console_setfile(stdin, inputdev);
-#ifdef CONFIG_CONSOLE_MUX
+#if CONFIG_IS_ENABLED(CONSOLE_MUX)
                console_devices[stdin][0] = inputdev;
 #endif
        }
@@ -907,4 +907,4 @@ int console_init_r(void)
        return 0;
 }
 
-#endif /* CONFIG_SYS_CONSOLE_IS_IN_ENV */
+#endif /* CONFIG_IS_ENABLED(SYS_CONSOLE_IS_IN_ENV) */
index c53200f5c6fef36d0f7e8c248161b4dbffda0f8e..27b4d1226a6349c6b95001f4e924aed9db144f61 100644 (file)
 #include <dm/device-internal.h>
 
 #ifndef CONFIG_ENV_SPI_BUS
-# define CONFIG_ENV_SPI_BUS    0
+# define CONFIG_ENV_SPI_BUS    CONFIG_SF_DEFAULT_BUS
 #endif
 #ifndef CONFIG_ENV_SPI_CS
-# define CONFIG_ENV_SPI_CS     0
+# define CONFIG_ENV_SPI_CS     CONFIG_SF_DEFAULT_CS
 #endif
 #ifndef CONFIG_ENV_SPI_MAX_HZ
-# define CONFIG_ENV_SPI_MAX_HZ 1000000
+# define CONFIG_ENV_SPI_MAX_HZ CONFIG_SF_DEFAULT_SPEED
 #endif
 #ifndef CONFIG_ENV_SPI_MODE
-# define CONFIG_ENV_SPI_MODE   SPI_MODE_3
+# define CONFIG_ENV_SPI_MODE   CONFIG_SF_DEFAULT_MODE
 #endif
 
 #ifdef CONFIG_ENV_OFFSET_REDUND
index c9f7019e38e8de1469f506cdd57353fd27d8e134..a57a5759e4a030d9c03a5aad969703de787d41d6 100644 (file)
@@ -903,14 +903,9 @@ void fdt_fixup_mtdparts(void *blob, void *node_info, int node_info_size)
 {
        struct node_info *ni = node_info;
        struct mtd_device *dev;
-       char *parts;
        int i, idx;
        int noff;
 
-       parts = getenv("mtdparts");
-       if (!parts)
-               return;
-
        if (mtdparts_init() != 0)
                return;
 
index 3d8d00b4486e74a0c011e1c2986c7be997fb257a..0e4e6803e7a832fe0ced120beb8d665ab3969762 100644 (file)
@@ -10,7 +10,7 @@
 #include <serial.h>
 #include <malloc.h>
 
-#ifdef CONFIG_CONSOLE_MUX
+#if CONFIG_IS_ENABLED(CONSOLE_MUX)
 void iomux_printdevs(const int console)
 {
        int i;
@@ -145,4 +145,4 @@ int iomux_doenv(const int console, const char *arg)
        free(cons_set);
        return 0;
 }
-#endif /* CONFIG_CONSOLE_MUX */
+#endif /* CONSOLE_MUX */
index b2ba492abd3b075543e4bf4758b1987afc60faf6..cf714c2726114c0a0d037773f48859f44f891208 100644 (file)
@@ -149,6 +149,16 @@ config SPL_SHA256_SUPPORT
          SHA256 variant is supported: SHA512 and others are not currently
          supported in U-Boot.
 
+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
+         name. This can be useful in SPL since setting up the CPUs earlier
+         may improve boot performance. Enable this option to build the
+         drivers in drivers/cpu as part of an SPL build.
+
 config SPL_CRYPTO_SUPPORT
        bool "Support crypto drivers"
        depends on SPL
@@ -425,6 +435,24 @@ config SYS_OS_BASE
 
 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
+         necessary driver support. This enables the drivers in drivers/pci
+         as part of an SPL build.
+
+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
+         boot. This enables the drivers in drivers/pch as part of an SPL
+         build.
+
 config SPL_POST_MEM_SUPPORT
        bool "Support POST drivers"
        depends on SPL
@@ -465,6 +493,16 @@ config SPL_RAM_DEVICE
          be already in memory when SPL takes over, e.g. loaded by the boot
          ROM.
 
+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
+         non-volatile (battery-backed) memory which is accessible if
+         needed. This enables the drivers in drivers/rtc as part of an SPL
+         build.
+
 config SPL_SATA_SUPPORT
        bool "Support loading from SATA"
        depends on SPL
@@ -508,6 +546,15 @@ config SPL_SPI_SUPPORT
          enable SPI drivers that are needed for other purposes also, such
          as a SPI PMIC.
 
+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
+         function. This enables the drivers in drivers/timer as part of an
+         SPL build.
+
 config SPL_USB_HOST_SUPPORT
        bool "Support USB host drivers"
        depends on SPL
index cd1d6b285ef02a6cac36defcc485c899b5b2db8f..925a1b149157bf337b9983c7aeddb19a5d789ce9 100644 (file)
@@ -96,8 +96,11 @@ static int spl_spi_load_image(struct spl_image_info *spl_image,
                /* Load u-boot, mkimage header is 64 bytes. */
                err = spi_flash_read(flash, CONFIG_SYS_SPI_U_BOOT_OFFS, 0x40,
                                     (void *)header);
-               if (err)
+               if (err) {
+                       debug("%s: Failed to read from SPI flash (err=%d)\n",
+                             __func__, err);
                        return err;
+               }
 
                if (IS_ENABLED(CONFIG_SPL_LOAD_FIT) &&
                        image_get_magic(header) == FDT_MAGIC) {
index 5f9a64ad1c5490d4f8414a2a86e82e165a4084d9..d2d29cc98f5ed3e8cf7f91f13daa2d6619756df5 100644 (file)
@@ -516,7 +516,7 @@ static int probe_usb_keyboard(struct usb_device *dev)
                return error;
 
        stdinname = getenv("stdin");
-#ifdef CONFIG_CONSOLE_MUX
+#if CONFIG_IS_ENABLED(CONSOLE_MUX)
        error = iomux_doenv(stdin, stdinname);
        if (error)
                return error;
@@ -581,7 +581,7 @@ int usb_kbd_deregister(int force)
                data = usb_kbd_dev->privptr;
                if (stdio_deregister_dev(dev, force) != 0)
                        return 1;
-#ifdef CONFIG_CONSOLE_MUX
+#if CONFIG_IS_ENABLED(CONSOLE_MUX)
                if (iomux_doenv(stdin, getenv("stdin")) != 0)
                        return 1;
 #endif
@@ -626,7 +626,7 @@ static int usb_kbd_remove(struct udevice *dev)
                ret = -EPERM;
                goto err;
        }
-#ifdef CONFIG_CONSOLE_MUX
+#if CONFIG_IS_ENABLED(CONSOLE_MUX)
        if (iomux_doenv(stdin, getenv("stdin"))) {
                ret = -ENOLINK;
                goto err;
index 0bcc5866af50c82e950d7f67aec1346963211a24..7380ba7b210d7ee3d6bf03a3138187c567c2b02c 100644 (file)
@@ -24,3 +24,4 @@ CONFIG_SYS_NS16550=y
 CONFIG_USB=y
 CONFIG_USB_STORAGE=y
 CONFIG_OF_LIBFDT=y
+CONFIG_API=y
index 0b7b082644581af57874f27b59d6d1a3e90677cd..dfa8712c2cdf45bd61211796a858d2b477e56a5f 100644 (file)
@@ -31,6 +31,7 @@ CONFIG_CMD_BOOTZ=y
 # CONFIG_CMD_XIMG is not set
 # CONFIG_CMD_EDITENV is not set
 # CONFIG_CMD_CRC32 is not set
+CONFIG_CMD_UNZIP=y
 # CONFIG_CMD_LOADB is not set
 # CONFIG_CMD_LOADS is not set
 # CONFIG_CMD_FLASH is not set
diff --git a/configs/chromebook_link64_defconfig b/configs/chromebook_link64_defconfig
new file mode 100644 (file)
index 0000000..c1d8e73
--- /dev/null
@@ -0,0 +1,89 @@
+CONFIG_X86=y
+CONFIG_SPL_GPIO_SUPPORT=y
+CONFIG_SPL_LIBCOMMON_SUPPORT=y
+CONFIG_SPL_LIBGENERIC_SUPPORT=y
+CONFIG_SYS_MALLOC_F_LEN=0x2000
+CONFIG_SPL_I2C_SUPPORT=y
+CONFIG_SPL_SERIAL_SUPPORT=y
+CONFIG_SPL_SPI_FLASH_SUPPORT=y
+CONFIG_SPL_SPI_SUPPORT=y
+CONFIG_X86_RUN_64BIT=y
+CONFIG_VENDOR_GOOGLE=y
+CONFIG_DEFAULT_DEVICE_TREE="chromebook_link"
+CONFIG_TARGET_CHROMEBOOK_LINK64=y
+CONFIG_ENABLE_MRC_CACHE=y
+CONFIG_HAVE_MRC=y
+CONFIG_SMP=y
+CONFIG_HAVE_VGA_BIOS=y
+CONFIG_FIT=y
+CONFIG_SPL_LOAD_FIT=y
+CONFIG_BOOTSTAGE=y
+CONFIG_BOOTSTAGE_REPORT=y
+CONFIG_SYS_CONSOLE_INFO_QUIET=y
+CONFIG_SPL_SYS_MALLOC_SIMPLE=y
+CONFIG_SPL_CPU_SUPPORT=y
+CONFIG_SPL_NET_SUPPORT=y
+CONFIG_SPL_PCI_SUPPORT=y
+CONFIG_SPL_PCH_SUPPORT=y
+CONFIG_SPL_RTC_SUPPORT=y
+CONFIG_SPL_TIMER_SUPPORT=y
+CONFIG_HUSH_PARSER=y
+CONFIG_CMD_CPU=y
+# CONFIG_CMD_IMLS is not set
+# CONFIG_CMD_FLASH is not set
+CONFIG_CMD_SF=y
+CONFIG_CMD_SPI=y
+CONFIG_CMD_USB=y
+CONFIG_CMD_GPIO=y
+# CONFIG_CMD_SETEXPR is not set
+CONFIG_CMD_DHCP=y
+# CONFIG_CMD_NFS is not set
+CONFIG_CMD_PING=y
+CONFIG_CMD_TIME=y
+CONFIG_CMD_BOOTSTAGE=y
+CONFIG_CMD_TPM=y
+CONFIG_CMD_TPM_TEST=y
+CONFIG_CMD_EXT2=y
+CONFIG_CMD_EXT4=y
+CONFIG_CMD_EXT4_WRITE=y
+CONFIG_CMD_FAT=y
+CONFIG_CMD_FS_GENERIC=y
+CONFIG_OF_CONTROL=y
+CONFIG_SPL_OF_CONTROL=y
+CONFIG_SPL_DM=y
+CONFIG_REGMAP=y
+CONFIG_SPL_REGMAP=y
+CONFIG_SYSCON=y
+CONFIG_SPL_SYSCON=y
+CONFIG_CPU=y
+CONFIG_DM_I2C=y
+CONFIG_SYS_I2C_INTEL=y
+CONFIG_CROS_EC=y
+CONFIG_CROS_EC_LPC=y
+CONFIG_SPI_FLASH=y
+CONFIG_SPI_FLASH_GIGADEVICE=y
+CONFIG_SPI_FLASH_MACRONIX=y
+CONFIG_SPI_FLASH_WINBOND=y
+CONFIG_DM_PCI=y
+CONFIG_DM_RTC=y
+CONFIG_DEBUG_UART=y
+CONFIG_DEBUG_UART_BASE=0x3f8
+CONFIG_DEBUG_UART_CLOCK=1843200
+CONFIG_DEBUG_UART_BOARD_INIT=y
+CONFIG_SYS_NS16550=y
+CONFIG_ICH_SPI=y
+CONFIG_TIMER=y
+CONFIG_TPM_TIS_LPC=y
+CONFIG_USB=y
+CONFIG_DM_USB=y
+CONFIG_USB_STORAGE=y
+CONFIG_DM_VIDEO=y
+CONFIG_USB_KEYBOARD=y
+CONFIG_VIDEO_VESA=y
+CONFIG_FRAMEBUFFER_SET_VESA_MODE=y
+CONFIG_FRAMEBUFFER_VESA_MODE_11A=y
+CONFIG_VIDEO_IVYBRIDGE_IGD=y
+CONFIG_CONSOLE_SCROLL_LINES=5
+CONFIG_USE_PRIVATE_LIBGCC=y
+CONFIG_TPM=y
+# CONFIG_CMD_BOOTEFI_HELLO_COMPILE is not set
index 1a79ab8dfe39955dcf45988100ae611f2ffdacfb..86852add89a216a411390fc1ec78cd1ccf041c80 100644 (file)
@@ -1,5 +1,5 @@
 CONFIG_X86=y
-CONFIG_SYS_MALLOC_F_LEN=0x1800
+CONFIG_SYS_MALLOC_F_LEN=0x2000
 CONFIG_VENDOR_GOOGLE=y
 CONFIG_DEFAULT_DEVICE_TREE="chromebook_link"
 CONFIG_TARGET_CHROMEBOOK_LINK=y
@@ -61,8 +61,8 @@ CONFIG_TPM_TIS_LPC=y
 CONFIG_USB=y
 CONFIG_DM_USB=y
 CONFIG_USB_STORAGE=y
-CONFIG_USB_KEYBOARD=y
 CONFIG_DM_VIDEO=y
+CONFIG_USB_KEYBOARD=y
 CONFIG_VIDEO_VESA=y
 CONFIG_FRAMEBUFFER_SET_VESA_MODE=y
 CONFIG_FRAMEBUFFER_VESA_MODE_11A=y
index 8f206e238458118931e94f4b00b4d5e4cbcc9cc5..e94f7b39da459b07023a6ae6d609744a9b981f77 100644 (file)
@@ -9,6 +9,7 @@ CONFIG_SYS_PROMPT="dragonboard410c => "
 # CONFIG_CMD_IMI is not set
 # CONFIG_CMD_IMLS is not set
 CONFIG_CMD_MEMINFO=y
+CONFIG_CMD_UNZIP=y
 CONFIG_CMD_GPT=y
 CONFIG_CMD_MMC=y
 CONFIG_CMD_USB=y
index c831aab2a94136bf351382f2b6c0a7d0a41bf92d..4d1b4b0d1540c9eddc6206af607ad1a065b1fa04 100644 (file)
@@ -8,6 +8,7 @@ CONFIG_HUSH_PARSER=y
 CONFIG_SYS_PROMPT="U-Boot> "
 # CONFIG_CMD_BDI is not set
 CONFIG_CMD_ASKENV=y
+CONFIG_CMD_UNZIP=y
 # CONFIG_CMD_LOADS is not set
 CONFIG_CMD_MMC=y
 CONFIG_CMD_SF=y
index 8dd330ad753fbfcd9446038fa8cdce0f6cd1e2a9..b112be2ef505876731ff3fe2e36a34944dbacfe5 100644 (file)
@@ -7,6 +7,7 @@ CONFIG_DISTRO_DEFAULTS=y
 # CONFIG_DISPLAY_BOARDINFO is not set
 CONFIG_BOARD_EARLY_INIT_F=y
 # CONFIG_CMD_IMLS is not set
+CONFIG_CMD_UNZIP=y
 CONFIG_CMD_MMC=y
 CONFIG_CMD_USB=y
 CONFIG_CMD_GPIO=y
index 567eb9b5928fff07b8d4af6e07115e12cd390ac9..5ef0e47b4eed5e4ceb3abc1494d21c660b5217ed 100644 (file)
@@ -13,9 +13,10 @@ CONFIG_VIDEO_LCD_POWER="PH22"
 CONFIG_VIDEO_LCD_PANEL_LVDS=y
 CONFIG_DEFAULT_DEVICE_TREE="sun7i-a20-icnova-swac"
 # CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set
-CONFIG_SYS_EXTRA_OPTIONS="AXP209_POWER,SUNXI_GMAC,CMD_BMP,CMD_UNZIP"
+CONFIG_SYS_EXTRA_OPTIONS="AXP209_POWER,SUNXI_GMAC,CMD_BMP"
 CONFIG_SPL=y
 # CONFIG_CMD_IMLS is not set
+CONFIG_CMD_UNZIP=y
 # CONFIG_CMD_FLASH is not set
 # CONFIG_CMD_FPGA is not set
 # CONFIG_SPL_DOS_PARTITION is not set
index 8f0d3fa22b428486efce39ab13f27a8622ee1e95..a42a485e2bbb12905d44d828aa640f4f68bcedbd 100644 (file)
@@ -8,7 +8,7 @@ CONFIG_SPL_POWER_SUPPORT=y
 CONFIG_SPL_SERIAL_SUPPORT=y
 CONFIG_SPL_SPI_FLASH_SUPPORT=y
 CONFIG_SPL_SPI_SUPPORT=y
-CONFIG_DEFAULT_DEVICE_TREE="k2e-evm"
+CONFIG_DEFAULT_DEVICE_TREE="keystone-k2e-evm"
 CONFIG_OF_BOARD_SETUP=y
 CONFIG_SYS_CONSOLE_INFO_QUIET=y
 CONFIG_VERSION_VARIABLE=y
index 17a5e670456c7fffe92e06c464d3c755600dcf37..f3ee01afb1d6094d54f8c3453f9d4d72af926df9 100644 (file)
@@ -8,7 +8,7 @@ CONFIG_SPL_POWER_SUPPORT=y
 CONFIG_SPL_SERIAL_SUPPORT=y
 CONFIG_SPL_SPI_FLASH_SUPPORT=y
 CONFIG_SPL_SPI_SUPPORT=y
-CONFIG_DEFAULT_DEVICE_TREE="k2g-evm"
+CONFIG_DEFAULT_DEVICE_TREE="keystone-k2g-evm"
 CONFIG_OF_BOARD_SETUP=y
 CONFIG_SYS_CONSOLE_INFO_QUIET=y
 CONFIG_VERSION_VARIABLE=y
index 6791d56335673e9ffc6abf924f3b6b6262f701ae..d924796627fce03a4f477743fc2748f96ed6ce6b 100644 (file)
@@ -8,7 +8,7 @@ CONFIG_SPL_POWER_SUPPORT=y
 CONFIG_SPL_SERIAL_SUPPORT=y
 CONFIG_SPL_SPI_FLASH_SUPPORT=y
 CONFIG_SPL_SPI_SUPPORT=y
-CONFIG_DEFAULT_DEVICE_TREE="k2hk-evm"
+CONFIG_DEFAULT_DEVICE_TREE="keystone-k2hk-evm"
 CONFIG_OF_BOARD_SETUP=y
 CONFIG_SYS_CONSOLE_INFO_QUIET=y
 CONFIG_VERSION_VARIABLE=y
index 4a70e1ad39cc9fab39b93905bec08d06fe3ff2a0..c81758571caf63ff83aa2e3ae2989ee3a52f739b 100644 (file)
@@ -8,7 +8,7 @@ CONFIG_SPL_POWER_SUPPORT=y
 CONFIG_SPL_SERIAL_SUPPORT=y
 CONFIG_SPL_SPI_FLASH_SUPPORT=y
 CONFIG_SPL_SPI_SUPPORT=y
-CONFIG_DEFAULT_DEVICE_TREE="k2l-evm"
+CONFIG_DEFAULT_DEVICE_TREE="keystone-k2l-evm"
 CONFIG_OF_BOARD_SETUP=y
 CONFIG_SYS_CONSOLE_INFO_QUIET=y
 CONFIG_VERSION_VARIABLE=y
index 75bd46da2fad3f9ad8192272bb8749d116d0d10e..4d974f1e168115c2ff268c3192b9b54c25854d9e 100644 (file)
@@ -23,3 +23,4 @@ CONFIG_SYS_NS16550=y
 CONFIG_USB=y
 CONFIG_USB_STORAGE=y
 CONFIG_OF_LIBFDT=y
+CONFIG_API=y
diff --git a/configs/qemu-x86_64_defconfig b/configs/qemu-x86_64_defconfig
new file mode 100644 (file)
index 0000000..484e2e9
--- /dev/null
@@ -0,0 +1,80 @@
+CONFIG_X86=y
+CONFIG_SPL_LIBCOMMON_SUPPORT=y
+CONFIG_SPL_LIBGENERIC_SUPPORT=y
+CONFIG_SYS_MALLOC_F_LEN=0x1000
+CONFIG_MAX_CPUS=2
+CONFIG_SPL_SERIAL_SUPPORT=y
+CONFIG_SPL_ENV_SUPPORT=y
+CONFIG_SPL_DRIVERS_MISC_SUPPORT=y
+CONFIG_SPL_SPI_FLASH_SUPPORT=y
+CONFIG_SPL_SPI_SUPPORT=y
+CONFIG_X86_RUN_64BIT=y
+CONFIG_DEFAULT_DEVICE_TREE="qemu-x86_i440fx"
+CONFIG_TARGET_QEMU_X86_64=y
+CONFIG_SMP=y
+CONFIG_GENERATE_PIRQ_TABLE=y
+CONFIG_GENERATE_MP_TABLE=y
+CONFIG_GENERATE_ACPI_TABLE=y
+CONFIG_FIT=y
+CONFIG_SPL_LOAD_FIT=y
+CONFIG_BOOTSTAGE=y
+CONFIG_BOOTSTAGE_REPORT=y
+CONFIG_SYS_CONSOLE_INFO_QUIET=y
+CONFIG_SPL_SYS_MALLOC_SIMPLE=y
+CONFIG_SPL_CPU_SUPPORT=y
+CONFIG_SPL_NET_SUPPORT=y
+CONFIG_SPL_PCI_SUPPORT=y
+CONFIG_SPL_PCH_SUPPORT=y
+CONFIG_SPL_RTC_SUPPORT=y
+CONFIG_SPL_TIMER_SUPPORT=y
+CONFIG_HUSH_PARSER=y
+CONFIG_CMD_CPU=y
+# CONFIG_CMD_BOOTEFI_HELLO_COMPILE is not set
+# CONFIG_CMD_IMLS is not set
+# CONFIG_CMD_FLASH is not set
+CONFIG_CMD_SF=y
+CONFIG_CMD_SPI=y
+CONFIG_CMD_USB=y
+# CONFIG_CMD_SETEXPR is not set
+CONFIG_CMD_DHCP=y
+# CONFIG_CMD_NFS is not set
+CONFIG_CMD_PING=y
+CONFIG_CMD_TIME=y
+CONFIG_CMD_QFW=y
+CONFIG_CMD_BOOTSTAGE=y
+CONFIG_CMD_EXT2=y
+CONFIG_CMD_EXT4=y
+CONFIG_CMD_EXT4_WRITE=y
+CONFIG_CMD_FAT=y
+CONFIG_CMD_FS_GENERIC=y
+CONFIG_OF_CONTROL=y
+CONFIG_SPL_OF_CONTROL=y
+CONFIG_SPL_DM=y
+CONFIG_REGMAP=y
+CONFIG_SPL_REGMAP=y
+CONFIG_SYSCON=y
+CONFIG_SPL_SYSCON=y
+CONFIG_CPU=y
+CONFIG_SPI_FLASH=y
+CONFIG_SPI_FLASH_GIGADEVICE=y
+CONFIG_SPI_FLASH_MACRONIX=y
+CONFIG_SPI_FLASH_WINBOND=y
+CONFIG_DM_ETH=y
+CONFIG_E1000=y
+CONFIG_DM_PCI=y
+CONFIG_DM_RTC=y
+CONFIG_DEBUG_UART=y
+CONFIG_DEBUG_UART_BASE=0x3f8
+CONFIG_DEBUG_UART_CLOCK=1843200
+CONFIG_SYS_NS16550=y
+CONFIG_TIMER=y
+CONFIG_USB=y
+CONFIG_DM_USB=y
+CONFIG_USB_STORAGE=y
+CONFIG_USB_KEYBOARD=y
+CONFIG_DM_VIDEO=y
+CONFIG_VIDEO_VESA=y
+CONFIG_FRAMEBUFFER_SET_VESA_MODE=y
+CONFIG_FRAMEBUFFER_VESA_MODE_111=y
+CONFIG_CONSOLE_SCROLL_LINES=5
+CONFIG_USE_PRIVATE_LIBGCC=y
index c899be0635544a1f6285d76c398ca9d520dedac8..db492af140a8de25cb31dbf8a5a7bbad16af995b 100644 (file)
@@ -14,6 +14,7 @@ CONFIG_SYS_PROMPT="VExpress64# "
 # CONFIG_CMD_EDITENV is not set
 # CONFIG_CMD_ENV_EXISTS is not set
 CONFIG_CMD_MEMTEST=y
+CONFIG_CMD_UNZIP=y
 # CONFIG_CMD_LOADS is not set
 CONFIG_CMD_ARMFLASH=y
 # CONFIG_CMD_FPGA is not set
index 22673624cc64852409717b05cf9b0898f62b7d7f..537301c1c4f01ec0bc2c4034a2e208137c5d2cb9 100644 (file)
@@ -14,6 +14,7 @@ CONFIG_SYS_PROMPT="VExpress64# "
 # CONFIG_CMD_EDITENV is not set
 # CONFIG_CMD_ENV_EXISTS is not set
 CONFIG_CMD_MEMTEST=y
+CONFIG_CMD_UNZIP=y
 # CONFIG_CMD_LOADS is not set
 CONFIG_CMD_ARMFLASH=y
 # CONFIG_CMD_FPGA is not set
index 02740a4441b944282f143a648a6f60b7019af3cf..2720a71b70e20e30db9af76498eaa8ee923e6266 100644 (file)
@@ -14,6 +14,7 @@ CONFIG_SYS_PROMPT="VExpress64# "
 # CONFIG_CMD_EDITENV is not set
 # CONFIG_CMD_ENV_EXISTS is not set
 CONFIG_CMD_MEMTEST=y
+CONFIG_CMD_UNZIP=y
 # CONFIG_CMD_LOADS is not set
 CONFIG_CMD_ARMFLASH=y
 # CONFIG_CMD_FPGA is not set
index 49c0786d955734a2155d93c9d17ba1707bf3f4ae..6b568b451f8400ee4b5c4f6406c9b7f2ad0faf67 100644 (file)
@@ -21,6 +21,7 @@ CONFIG_SYS_PROMPT="ZynqMP> "
 # CONFIG_CMD_XIMG is not set
 # CONFIG_CMD_EDITENV is not set
 # CONFIG_CMD_ENV_EXISTS is not set
+CONFIG_CMD_UNZIP=y
 # CONFIG_CMD_LOADB is not set
 # CONFIG_CMD_LOADS is not set
 CONFIG_CMD_GPT=y
index a3585d07117b380b8f7d14c2f8401b7147024c27..4d7bcf3bd57c76aface53993ab38a6cf3f93ddc6 100644 (file)
@@ -19,6 +19,7 @@ CONFIG_SPL_OS_BOOT=y
 CONFIG_SYS_PROMPT="ZynqMP> "
 # CONFIG_CMD_IMLS is not set
 CONFIG_CMD_MEMTEST=y
+CONFIG_CMD_UNZIP=y
 # CONFIG_CMD_FLASH is not set
 CONFIG_CMD_GPT=y
 CONFIG_CMD_MMC=y
index 3693d9b2a40ad92d08ed510703981bfd8ec076b7..822b25d553879605b11e1437432eca4e61989b83 100644 (file)
@@ -21,6 +21,7 @@ CONFIG_SPL_OS_BOOT=y
 CONFIG_SYS_PROMPT="ZynqMP> "
 # CONFIG_CMD_IMLS is not set
 CONFIG_CMD_MEMTEST=y
+CONFIG_CMD_UNZIP=y
 # CONFIG_CMD_FLASH is not set
 CONFIG_CMD_GPT=y
 CONFIG_CMD_NAND=y
index a4c73f8355070e9f4eccecc0c6eb9dd030ab2c17..89813df4a03feb5f345c4ae04806e4ed3308d22c 100644 (file)
@@ -16,6 +16,7 @@ CONFIG_SPL_OS_BOOT=y
 CONFIG_SYS_PROMPT="ZynqMP> "
 # CONFIG_CMD_IMLS is not set
 CONFIG_CMD_MEMTEST=y
+CONFIG_CMD_UNZIP=y
 # CONFIG_CMD_FLASH is not set
 CONFIG_CMD_MMC=y
 CONFIG_CMD_I2C=y
index f981b21678650a5dc3e17467f6f5a23f5c88e7b3..b8fe33e47971d36a2841a285d4c617aebef3e56b 100644 (file)
@@ -17,6 +17,7 @@ CONFIG_SPL_OS_BOOT=y
 CONFIG_SYS_PROMPT="ZynqMP> "
 # CONFIG_CMD_IMLS is not set
 CONFIG_CMD_MEMTEST=y
+CONFIG_CMD_UNZIP=y
 # CONFIG_CMD_FLASH is not set
 CONFIG_CMD_MMC=y
 CONFIG_CMD_I2C=y
index 7b65fe0917316bdd82d4108f3eddbe823475890f..b13bf5b845d7ff25f8a5f75aeab7fdc658db0c67 100644 (file)
@@ -19,6 +19,7 @@ CONFIG_SPL_OS_BOOT=y
 CONFIG_SYS_PROMPT="ZynqMP> "
 # CONFIG_CMD_IMLS is not set
 CONFIG_CMD_MEMTEST=y
+CONFIG_CMD_UNZIP=y
 # CONFIG_CMD_FLASH is not set
 CONFIG_CMD_GPT=y
 CONFIG_CMD_MMC=y
index 4bed5890f100f9a8109f9a535832832dfc4f108f..2489d8966b50667c1e1cfc07c1883d15977b21e2 100644 (file)
@@ -19,6 +19,7 @@ CONFIG_SPL_OS_BOOT=y
 CONFIG_SYS_PROMPT="ZynqMP> "
 # CONFIG_CMD_IMLS is not set
 CONFIG_CMD_MEMTEST=y
+CONFIG_CMD_UNZIP=y
 # CONFIG_CMD_FLASH is not set
 CONFIG_CMD_GPT=y
 CONFIG_CMD_MMC=y
index b5928e5abec2018f92c852a26770084aba82d144..893cbbdbdaeb5cdbac23b1e24ef0bec7819a33bb 100644 (file)
@@ -324,6 +324,13 @@ static int set_protective_mbr(struct blk_desc *dev_desc)
                printf("%s: calloc failed!\n", __func__);
                return -1;
        }
+
+       /* Read MBR to backup boot code if it exists */
+       if (blk_dread(dev_desc, 0, 1, p_mbr) != 1) {
+               error("** Can't read from device %d **\n", dev_desc->devnum);
+               return -1;
+       }
+
        /* Append signature */
        p_mbr->signature = MSDOS_MBR_SIGNATURE;
        p_mbr->partition_record[0].sys_ind = EFI_PMBR_OSTYPE_EFI_GPT;
index 1b5ccec4b2e58ef9c611dc27a022967685ea49a0..fea324e25eee876f931a56807f9dfc360943ed71 100644 (file)
@@ -684,7 +684,7 @@ steps (see device_probe()):
 
    g. If the driver provides an ofdata_to_platdata() method, then this is
    called to convert the device tree data into platform data. This should
-   do various calls like fdtdec_get_int(gd->fdt_blob, dev->of_offset, ...)
+   do various calls like fdtdec_get_int(gd->fdt_blob, dev_of_offset(dev), ...)
    to access the node and store the resulting information into dev->platdata.
    After this point, the device works the same way whether it was bound
    using a device tree node or U_BOOT_DEVICE() structure. In either case,
index 86e5e25300c318ee760b9ccdbc983eb724042ebb..0063bfe510cd7fbffdb01ba5a5994ac4d8369398 100644 (file)
@@ -205,7 +205,7 @@ For example:
             /* Decode the device tree data */
             struct mmc_platdata *plat = dev_get_platdata(dev);
             const void *blob = gd->fdt_blob;
-            int node = dev->of_offset;
+            int node = dev_of_offset(dev);
 
             plat->fifo_depth = fdtdec_get_int(blob, node, "fifo-depth", 0);
     #endif
index ee4abf4a8b49cc8b8ab2de8521fe91522afb3e14..1955ffe284eafd4aec984ad1aedac49ff11e6d29 100644 (file)
@@ -223,7 +223,7 @@ static int exynos_spi_ofdata_to_platdata(struct udevice *bus)
 {
        struct exynos_spi_platdata *plat = bus->platdata;
        const void *blob = gd->fdt_blob;
-       int node = bus->of_offset;
+       int node = dev_of_offset(bus);
 
        plat->regs = (struct exynos_spi *)fdtdec_get_addr(blob, node, "reg");
        plat->periph_id = pinmux_decode_periph_id(blob, node);
index c19fa142f3a8dc57e05b0ff449f1af5e9621e813..34c55bfb2ff94c416647e727b3232283cf1b8974 100644 (file)
@@ -10,6 +10,7 @@ obj-$(CONFIG_$(SPL_)RAM)      += ram/
 
 ifdef CONFIG_SPL_BUILD
 
+obj-$(CONFIG_SPL_CPU_SUPPORT) += cpu/
 obj-$(CONFIG_SPL_CRYPTO_SUPPORT) += crypto/
 obj-$(CONFIG_SPL_I2C_SUPPORT) += i2c/
 obj-$(CONFIG_SPL_GPIO_SUPPORT) += gpio/
@@ -32,6 +33,10 @@ obj-$(CONFIG_SPL_DMA_SUPPORT) += dma/
 obj-$(CONFIG_SPL_ETH_SUPPORT) += net/
 obj-$(CONFIG_SPL_ETH_SUPPORT) += net/phy/
 obj-$(CONFIG_SPL_USBETH_SUPPORT) += net/phy/
+obj-$(CONFIG_SPL_PCI_SUPPORT) += pci/
+obj-$(CONFIG_SPL_PCH_SUPPORT) += pch/
+obj-$(CONFIG_SPL_RTC_SUPPORT) += rtc/
+obj-$(CONFIG_SPL_TIMER_SUPPORT) += timer/
 obj-$(CONFIG_SPL_MUSB_NEW_SUPPORT) += usb/musb-new/
 obj-$(CONFIG_SPL_USB_GADGET_SUPPORT) += usb/gadget/
 obj-$(CONFIG_SPL_USB_GADGET_SUPPORT) += usb/gadget/udc/
index 9233fcdb6c1edb67befd534b681c0db80c26024b..3e28a5600bf7738a1b81fbd822f76a891c339139 100644 (file)
@@ -345,7 +345,7 @@ nodev:
 static int adc_vdd_platdata_set(struct udevice *dev)
 {
        struct adc_uclass_platdata *uc_pdata = dev_get_uclass_platdata(dev);
-       int ret, offset = dev->of_offset;
+       int ret, offset = dev_of_offset(dev);
        const void *fdt = gd->fdt_blob;
        char *prop;
 
@@ -366,7 +366,7 @@ static int adc_vdd_platdata_set(struct udevice *dev)
 static int adc_vss_platdata_set(struct udevice *dev)
 {
        struct adc_uclass_platdata *uc_pdata = dev_get_uclass_platdata(dev);
-       int ret, offset = dev->of_offset;
+       int ret, offset = dev_of_offset(dev);
        const void *fdt = gd->fdt_blob;
        char *prop;
 
index af369cc4c8aa0f5dd9f849fe0d81e17aa09a1fc6..26a5e58221cc155f5c95d09761600cc316c5b9ae 100644 (file)
@@ -35,7 +35,7 @@ static ulong ast2500_get_mpll_rate(ulong clkin, u32 mpll_reg)
        const ulong post_div = (mpll_reg >> SCU_MPLL_POST_SHIFT)
                        & SCU_MPLL_POST_MASK;
 
-       return (clkin * ((num + 1) / (denum + 1))) / post_div;
+       return (clkin * ((num + 1) / (denum + 1))) / (post_div + 1);
 }
 
 /*
@@ -50,7 +50,7 @@ static ulong ast2500_get_hpll_rate(ulong clkin, u32 hpll_reg)
        const ulong post_div = (hpll_reg >> SCU_HPLL_POST_SHIFT)
                        & SCU_HPLL_POST_MASK;
 
-       return (clkin * ((num + 1) / (denum + 1))) / post_div;
+       return (clkin * ((num + 1) / (denum + 1))) / (post_div + 1);
 }
 
 static ulong ast2500_get_clkin(struct ast2500_scu *scu)
index d36f64ffdf81b7df371b67f77c70cb356ef210d9..ac27d3e675039545d565923b472461fe104305fb 100644 (file)
@@ -154,9 +154,8 @@ static int generic_clk_ofdata_to_platdata(struct udevice *dev)
        u32 num_parents;
 
        num_parents = fdtdec_get_int_array_count(gd->fdt_blob,
-                                                dev_get_parent(dev)->of_offset,
-                                                "clocks", cells,
-                                                GENERATED_SOURCE_MAX);
+                       dev_of_offset(dev_get_parent(dev)), "clocks", cells,
+                       GENERATED_SOURCE_MAX);
 
        if (!num_parents)
                return -1;
index 76ba91af81209296585eae984e6143b3719c0db0..c73156a0df1e095f8b625097cd481d63f1b81b3a 100644 (file)
@@ -47,7 +47,7 @@ int at91_pmc_core_probe(struct udevice *dev)
 int at91_clk_sub_device_bind(struct udevice *dev, const char *drv_name)
 {
        const void *fdt = gd->fdt_blob;
-       int offset = dev->of_offset;
+       int offset = dev_of_offset(dev);
        bool pre_reloc_only = !(gd->flags & GD_FLG_RELOC);
        const char *name;
        int ret;
@@ -90,7 +90,8 @@ int at91_clk_of_xlate(struct clk *clk, struct fdtdec_phandle_args *args)
                return -EINVAL;
        }
 
-       periph = fdtdec_get_uint(gd->fdt_blob, clk->dev->of_offset, "reg", -1);
+       periph = fdtdec_get_uint(gd->fdt_blob, dev_of_offset(clk->dev), "reg",
+                                -1);
        if (periph < 0)
                return -EINVAL;
 
index 153ceba702d621158c238322e1345516125fc31f..6fcfd6997c88d32a312b7ec2fb0b919a870b874b 100644 (file)
@@ -65,7 +65,7 @@ int clk_get_by_index(struct udevice *dev, int index, struct clk *clk)
        debug("%s(dev=%p, index=%d, clk=%p)\n", __func__, dev, index, clk);
 
        assert(clk);
-       ret = fdtdec_parse_phandle_with_args(gd->fdt_blob, dev->of_offset,
+       ret = fdtdec_parse_phandle_with_args(gd->fdt_blob, dev_of_offset(dev),
                                             "clocks", "#clock-cells", 0, index,
                                             &args);
        if (ret) {
@@ -104,7 +104,7 @@ int clk_get_by_name(struct udevice *dev, const char *name, struct clk *clk)
 
        debug("%s(dev=%p, name=%s, clk=%p)\n", __func__, dev, name, clk);
 
-       index = fdt_stringlist_search(gd->fdt_blob, dev->of_offset,
+       index = fdt_stringlist_search(gd->fdt_blob, dev_of_offset(dev),
                                      "clock-names", name);
        if (index < 0) {
                debug("fdt_stringlist_search() failed: %d\n", index);
index 9c4d2b322f707e63cf43407792a740074f1b1939..3911bf61a03a2f9395c23204eed96eac19b48753 100644 (file)
@@ -32,7 +32,7 @@ static int clk_fixed_rate_ofdata_to_platdata(struct udevice *dev)
 {
 #if !CONFIG_IS_ENABLED(OF_PLATDATA)
        to_clk_fixed_rate(dev)->fixed_rate =
-                               fdtdec_get_int(gd->fdt_blob, dev->of_offset,
+                               fdtdec_get_int(gd->fdt_blob, dev_of_offset(dev),
                                               "clock-frequency", 0);
 #endif
 
index 70ec3543cf90eadf9b79e8f01631e1a8a454e3d7..f6eef314ec312d0fb726c52426bb381018fe891a 100644 (file)
@@ -330,7 +330,7 @@ static void pic32_clk_init(struct udevice *dev)
        for (i = REF1CLK; i <= REF5CLK; i++) {
                snprintf(propname, sizeof(propname),
                         "microchip,refo%d-frequency", i - REF1CLK + 1);
-               rate = fdtdec_get_int(blob, dev->of_offset, propname, 0);
+               rate = fdtdec_get_int(blob, dev_of_offset(dev), propname, 0);
                if (rate)
                        pic32_set_refclk(priv, i, pll_hz, rate, ROCLK_SRC_SPLL);
        }
@@ -393,7 +393,8 @@ static int pic32_clk_probe(struct udevice *dev)
        fdt_addr_t addr;
        fdt_size_t size;
 
-       addr = fdtdec_get_addr_size(gd->fdt_blob, dev->of_offset, "reg", &size);
+       addr = fdtdec_get_addr_size(gd->fdt_blob, dev_of_offset(dev), "reg",
+                                   &size);
        if (addr == FDT_ADDR_T_NONE)
                return -EINVAL;
 
index ed553d70a6bc0d62e22513f68fb8d2f9419c0075..70fcfc23e0cbceb78e3440e759f225f10932f474 100644 (file)
@@ -355,7 +355,7 @@ int device_probe(struct udevice *dev)
                        goto fail;
        }
 
-       if (drv->ofdata_to_platdata && dev->of_offset >= 0) {
+       if (drv->ofdata_to_platdata && dev_of_offset(dev) >= 0) {
                ret = drv->ofdata_to_platdata(dev);
                if (ret)
                        goto fail;
@@ -524,7 +524,7 @@ int device_find_child_by_of_offset(struct udevice *parent, int of_offset,
        *devp = NULL;
 
        list_for_each_entry(dev, &parent->child_head, sibling_node) {
-               if (dev->of_offset == of_offset) {
+               if (dev_of_offset(dev) == of_offset) {
                        *devp = dev;
                        return 0;
                }
@@ -549,7 +549,7 @@ static struct udevice *_device_find_global_by_of_offset(struct udevice *parent,
 {
        struct udevice *dev, *found;
 
-       if (parent->of_offset == of_offset)
+       if (dev_of_offset(parent) == of_offset)
                return parent;
 
        list_for_each_entry(dev, &parent->child_head, sibling_node) {
@@ -637,19 +637,21 @@ fdt_addr_t dev_get_addr_index(struct udevice *dev, int index)
                int len = 0;
                int na, ns;
 
-               na = fdt_address_cells(gd->fdt_blob, dev->parent->of_offset);
+               na = fdt_address_cells(gd->fdt_blob,
+                                      dev_of_offset(dev->parent));
                if (na < 1) {
                        debug("bad #address-cells\n");
                        return FDT_ADDR_T_NONE;
                }
 
-               ns = fdt_size_cells(gd->fdt_blob, dev->parent->of_offset);
+               ns = fdt_size_cells(gd->fdt_blob, dev_of_offset(dev->parent));
                if (ns < 0) {
                        debug("bad #size-cells\n");
                        return FDT_ADDR_T_NONE;
                }
 
-               reg = fdt_getprop(gd->fdt_blob, dev->of_offset, "reg", &len);
+               reg = fdt_getprop(gd->fdt_blob, dev_of_offset(dev), "reg",
+                                 &len);
                if (!reg || (len <= (index * sizeof(fdt32_t) * (na + ns)))) {
                        debug("Req index out of range\n");
                        return FDT_ADDR_T_NONE;
@@ -662,16 +664,15 @@ fdt_addr_t dev_get_addr_index(struct udevice *dev, int index)
                 * bus setups.
                 */
                addr = fdt_translate_address((void *)gd->fdt_blob,
-                                            dev->of_offset, reg);
+                                            dev_of_offset(dev), reg);
        } else {
                /*
                 * Use the "simple" translate function for less complex
                 * bus setups.
                 */
                addr = fdtdec_get_addr_size_auto_parent(gd->fdt_blob,
-                                                       dev->parent->of_offset,
-                                                       dev->of_offset, "reg",
-                                                       index, NULL, false);
+                               dev_of_offset(dev->parent), dev_of_offset(dev),
+                               "reg", index, NULL, false);
                if (CONFIG_IS_ENABLED(SIMPLE_BUS) && addr != FDT_ADDR_T_NONE) {
                        if (device_get_uclass_id(dev->parent) ==
                            UCLASS_SIMPLE_BUS)
@@ -702,7 +703,7 @@ fdt_addr_t dev_get_addr_size_index(struct udevice *dev, int index,
         * next call to the exisiting dev_get_xxx function which handles
         * all config options.
         */
-       fdtdec_get_addr_size_auto_noparent(gd->fdt_blob, dev->of_offset,
+       fdtdec_get_addr_size_auto_noparent(gd->fdt_blob, dev_of_offset(dev),
                                           "reg", index, size, false);
 
        /*
@@ -720,7 +721,7 @@ fdt_addr_t dev_get_addr_name(struct udevice *dev, const char *name)
 #if CONFIG_IS_ENABLED(OF_CONTROL)
        int index;
 
-       index = fdt_stringlist_search(gd->fdt_blob, dev->of_offset,
+       index = fdt_stringlist_search(gd->fdt_blob, dev_of_offset(dev),
                                      "reg-names", name);
        if (index < 0)
                return index;
@@ -799,7 +800,7 @@ bool of_device_is_compatible(struct udevice *dev, const char *compat)
 {
        const void *fdt = gd->fdt_blob;
 
-       return !fdt_node_check_compatible(fdt, dev->of_offset, compat);
+       return !fdt_node_check_compatible(fdt, dev_of_offset(dev), compat);
 }
 
 bool of_machine_is_compatible(const char *compat)
index c68bcba54f1e5cfd750ec854f5c12b1a6096b214..833cd78e8489038496da2ad7fe31a3f4600e9a07 100644 (file)
@@ -71,12 +71,12 @@ int regmap_init_mem(struct udevice *dev, struct regmap **mapp)
        int parent;
        int len;
 
-       parent = dev->parent->of_offset;
+       parent = dev_of_offset(dev->parent);
        addr_len = fdt_address_cells(blob, parent);
        size_len = fdt_size_cells(blob, parent);
        both_len = addr_len + size_len;
 
-       cell = fdt_getprop(blob, dev->of_offset, "reg", &len);
+       cell = fdt_getprop(blob, dev_of_offset(dev), "reg", &len);
        len /= sizeof(*cell);
        count = len / both_len;
        if (!cell || !count)
index 9edfc1efb661bddb6bff7ba2af604123f4657819..175fd3fb252d494a5096b02d1a3a3b940879ca33 100644 (file)
@@ -227,10 +227,10 @@ int dm_scan_fdt_node(struct udevice *parent, const void *blob, int offset,
 
 int dm_scan_fdt_dev(struct udevice *dev)
 {
-       if (dev->of_offset == -1)
+       if (dev_of_offset(dev) == -1)
                return 0;
 
-       return dm_scan_fdt_node(dev, gd->fdt_blob, dev->of_offset,
+       return dm_scan_fdt_node(dev, gd->fdt_blob, dev_of_offset(dev),
                                gd->flags & GD_FLG_RELOC ? false : true);
 }
 
index 5c955da3346b2c1ff665060100b2f875a87cbe50..a300217d39a898fa3f04fc3a4dc48445fe0a015b 100644 (file)
@@ -27,10 +27,13 @@ fdt_addr_t simple_bus_translate(struct udevice *dev, fdt_addr_t addr)
 
 static int simple_bus_post_bind(struct udevice *dev)
 {
+#if CONFIG_IS_ENABLED(OF_PLATDATA)
+       return 0;
+#else
        u32 cell[3];
        int ret;
 
-       ret = fdtdec_get_int_array(gd->fdt_blob, dev->of_offset, "ranges",
+       ret = fdtdec_get_int_array(gd->fdt_blob, dev_of_offset(dev), "ranges",
                                   cell, ARRAY_SIZE(cell));
        if (!ret) {
                struct simple_bus_plat *plat = dev_get_uclass_platdata(dev);
@@ -41,6 +44,7 @@ static int simple_bus_post_bind(struct udevice *dev)
        }
 
        return dm_scan_fdt_dev(dev);
+#endif
 }
 
 UCLASS_DRIVER(simple_bus) = {
index 60610e5a1f5464eee6c49afa5b4d3da9bf807e2d..7de370644d72c6ff9232b9f1f6337495ae318aae 100644 (file)
@@ -278,7 +278,7 @@ int uclass_find_device_by_of_offset(enum uclass_id id, int node,
                return ret;
 
        list_for_each_entry(dev, &uc->dev_head, uclass_node) {
-               if (dev->of_offset == node) {
+               if (dev_of_offset(dev) == node) {
                        *devp = dev;
                        return 0;
                }
@@ -299,7 +299,7 @@ static int uclass_find_device_by_phandle(enum uclass_id id,
        int ret;
 
        *devp = NULL;
-       find_phandle = fdtdec_get_int(gd->fdt_blob, parent->of_offset, name,
+       find_phandle = fdtdec_get_int(gd->fdt_blob, dev_of_offset(parent), name,
                                      -1);
        if (find_phandle <= 0)
                return -ENOENT;
@@ -308,7 +308,9 @@ static int uclass_find_device_by_phandle(enum uclass_id id,
                return ret;
 
        list_for_each_entry(dev, &uc->dev_head, uclass_node) {
-               uint phandle = fdt_get_phandle(gd->fdt_blob, dev->of_offset);
+               uint phandle;
+
+               phandle = fdt_get_phandle(gd->fdt_blob, dev_of_offset(dev));
 
                if (phandle == find_phandle) {
                        *devp = dev;
index d908736cffe31e2acb1bfa787bc12b05265543b7..7e71f3bf6ae9bd5b677eb11c017cca682cc5cfd8 100644 (file)
@@ -151,7 +151,7 @@ static int shape_ofdata_to_platdata(struct udevice *dev)
                return ret;
 
        /* Parse the data that only we need */
-       pdata->default_char = fdtdec_get_int(gd->fdt_blob, dev->of_offset,
+       pdata->default_char = fdtdec_get_int(gd->fdt_blob, dev_of_offset(dev),
                                             "character", '@');
 
        return 0;
index 725f06898f33deb8d7e827f016d1a63da90b71aa..3341572e8a6450f8bb0ad759e15e8fdd76c7e309 100644 (file)
@@ -66,7 +66,7 @@ int demo_set_light(struct udevice *dev, int light)
 int demo_parse_dt(struct udevice *dev)
 {
        struct dm_demo_pdata *pdata = dev_get_platdata(dev);
-       int dn = dev->of_offset;
+       int dn = dev_of_offset(dev);
 
        pdata->sides = fdtdec_get_int(gd->fdt_blob, dn, "sides", 0);
        pdata->colour = fdt_getprop(gd->fdt_blob, dn, "colour", NULL);
index 9ac10a745d20434981ece71d8090168ba2fade08..750eedfffd0bb1cb1685dda62cd6da0992c37d86 100644 (file)
@@ -130,7 +130,7 @@ static int gen_74x164_probe(struct udevice *dev)
        char *str, name[32];
        int ret;
        const void *fdt = gd->fdt_blob;
-       int node = dev->of_offset;
+       int node = dev_of_offset(dev);
 
        snprintf(name, sizeof(name), "%s_", dev->name);
        str = strdup(name);
index 6f42bf8a2269018f17004943fd4e328efc948f0e..92849c5295e9ea481ba320130bdd2b04a68a05af 100644 (file)
@@ -92,9 +92,9 @@ static int altera_pio_ofdata_to_platdata(struct udevice *dev)
        plat->regs = map_physmem(dev_get_addr(dev),
                                 sizeof(struct altera_pio_regs),
                                 MAP_NOCACHE);
-       plat->gpio_count = fdtdec_get_int(gd->fdt_blob, dev->of_offset,
+       plat->gpio_count = fdtdec_get_int(gd->fdt_blob, dev_of_offset(dev),
                "altr,gpio-bank-width", 32);
-       plat->bank_name = fdt_getprop(gd->fdt_blob, dev->of_offset,
+       plat->bank_name = fdt_getprop(gd->fdt_blob, dev_of_offset(dev),
                "gpio-bank-name", NULL);
 
        return 0;
index cb90b0241a2bdc7b120f73ca817e7bf9aa5522aa..81c30475514a4b25d007ccc94ebc14d40d66d6ed 100644 (file)
@@ -276,7 +276,7 @@ static const struct dm_gpio_ops atmel_pio4_ops = {
 
 static int atmel_pio4_bind(struct udevice *dev)
 {
-       return dm_scan_fdt_node(dev, gd->fdt_blob, dev->of_offset, false);
+       return dm_scan_fdt_node(dev, gd->fdt_blob, dev_of_offset(dev), false);
 }
 
 static int atmel_pio4_probe(struct udevice *dev)
@@ -308,7 +308,8 @@ static int atmel_pio4_probe(struct udevice *dev)
        pioctrl_data = (struct atmel_pioctrl_data *)dev_get_driver_data(dev);
        nbanks = pioctrl_data->nbanks;
 
-       uc_priv->bank_name = fdt_get_name(gd->fdt_blob, dev->of_offset, NULL);
+       uc_priv->bank_name = fdt_get_name(gd->fdt_blob, dev_of_offset(dev),
+                                         NULL);
        uc_priv->gpio_count = nbanks * ATMEL_PIO_NPINS_PER_BANK;
 
        return 0;
index db32db684516bc4758b4a69356db0d57dd61065b..eefb56d83f69537b2d34d780ea32f665d6ece3d9 100644 (file)
@@ -174,7 +174,7 @@ void db8500_gpio_set_output(unsigned gpio, int val)
 
 /**
  * config_pin - configure a pin's mux attributes
- * @cfg: pin confguration
+ * @cfg: pin configuration
  *
  * Configures a pin's mode (alternate function or GPIO), its pull up status,
  * and its sleep mode based on the specified configuration.  The @cfg is
index 85e0a8647f278646464971691e6fc6ab78ae19e3..7d1904c1e1edf80e2686f26dfec3e1c300cbf64b 100644 (file)
@@ -112,13 +112,13 @@ static int gpio_dwapb_bind(struct udevice *dev)
        if (plat)
                return 0;
 
-       base = fdtdec_get_addr(blob, dev->of_offset, "reg");
+       base = fdtdec_get_addr(blob, dev_of_offset(dev), "reg");
        if (base == FDT_ADDR_T_NONE) {
                debug("Can't get the GPIO register base address\n");
                return -ENXIO;
        }
 
-       for (node = fdt_first_subnode(blob, dev->of_offset);
+       for (node = fdt_first_subnode(blob, dev_of_offset(dev));
             node > 0;
             node = fdt_next_subnode(blob, node)) {
                if (!fdtdec_get_bool(blob, node, "gpio-controller"))
@@ -142,7 +142,7 @@ static int gpio_dwapb_bind(struct udevice *dev)
                if (ret)
                        goto err;
 
-               subdev->of_offset = node;
+               dev_set_of_offset(subdev, node);
                bank++;
        }
 
index 4559739d619c637d79495e349290b7ae93646de9..9ab9df4ce7a6cd5afd1a78813c13560a40265a29 100644 (file)
@@ -707,7 +707,7 @@ int gpio_request_by_name(struct udevice *dev,  const char *list_name, int index,
         * calls in gpio_request_by_name(), but we can do this until
         * gpio_request_by_name_nodev() can be dropped.
         */
-       return gpio_request_by_name_nodev(gd->fdt_blob, dev->of_offset,
+       return gpio_request_by_name_nodev(gd->fdt_blob, dev_of_offset(dev),
                                          list_name, index, desc, flags);
 }
 
@@ -746,7 +746,7 @@ int gpio_request_list_by_name(struct udevice *dev, const char *list_name,
         * calls in gpio_request_by_name(), but we can do this until
         * gpio_request_list_by_name_nodev() can be dropped.
         */
-       return gpio_request_list_by_name_nodev(gd->fdt_blob, dev->of_offset,
+       return gpio_request_list_by_name_nodev(gd->fdt_blob, dev_of_offset(dev),
                                               list_name, desc, max_count,
                                               flags);
 }
@@ -755,7 +755,7 @@ int gpio_get_list_count(struct udevice *dev, const char *list_name)
 {
        int ret;
 
-       ret = fdtdec_parse_phandle_with_args(gd->fdt_blob, dev->of_offset,
+       ret = fdtdec_parse_phandle_with_args(gd->fdt_blob, dev_of_offset(dev),
                                             list_name, "#gpio-cells", 0, -1,
                                             NULL);
        if (ret) {
index 81ce446e1a162d1e2c624e657623b1fc96714963..790577ac810e5abf3ab35bcb163724e2fbe07b51 100644 (file)
@@ -149,14 +149,14 @@ static int broadwell_gpio_ofdata_to_platdata(struct udevice *dev)
        if (ret)
                return ret;
 
-       bank = fdtdec_get_int(gd->fdt_blob, dev->of_offset, "reg", -1);
+       bank = fdtdec_get_int(gd->fdt_blob, dev_of_offset(dev), "reg", -1);
        if (bank == -1) {
                debug("%s: Invalid bank number %d\n", __func__, bank);
                return -EINVAL;
        }
        plat->bank = bank;
        plat->base_addr = gpiobase;
-       plat->bank_name = fdt_getprop(gd->fdt_blob, dev->of_offset,
+       plat->bank_name = fdt_getprop(gd->fdt_blob, dev_of_offset(dev),
                                      "bank-name", NULL);
 
        return 0;
index fd6181fa5a733f4bc76856b621bd6d1ce1e897d7..8b782260bc336cd1117531820f0aedc1cc2ed31b 100644 (file)
@@ -94,14 +94,14 @@ static int gpio_ich6_ofdata_to_platdata(struct udevice *dev)
        if (ret)
                return ret;
 
-       offset = fdtdec_get_int(gd->fdt_blob, dev->of_offset, "reg", -1);
+       offset = fdtdec_get_int(gd->fdt_blob, dev_of_offset(dev), "reg", -1);
        if (offset == -1) {
                debug("%s: Invalid register offset %d\n", __func__, offset);
                return -EINVAL;
        }
        plat->offset = offset;
        plat->base_addr = gpiobase + offset;
-       plat->bank_name = fdt_getprop(gd->fdt_blob, dev->of_offset,
+       plat->bank_name = fdt_getprop(gd->fdt_blob, dev_of_offset(dev),
                                      "bank-name", NULL);
 
        return 0;
index 9674ee75f03185eca01bc5d942ba7acd6a011f01..1bf945acfc634de960b3f5746f11c805dfaaf25e 100644 (file)
@@ -297,7 +297,7 @@ static int lpc32xx_gpio_probe(struct udevice *dev)
        struct lpc32xx_gpio_priv *gpio_priv = dev_get_priv(dev);
        struct gpio_dev_priv *uc_priv = dev->uclass_priv;
 
-       if (dev->of_offset == -1) {
+       if (dev_of_offset(dev) == -1) {
                /* Tell the uclass how many GPIOs we have */
                uc_priv->gpio_count = LPC32XX_GPIOS;
        }
index 168c696c4dc00a435669281d419c2cbbb0bd119e..cfeb6e76328d299b44dd9bf21f0a9f8cceff83aa 100644 (file)
@@ -169,13 +169,13 @@ static int mpc85xx_gpio_ofdata_to_platdata(struct udevice *dev) {
        fdt_addr_t addr;
        fdt_size_t size;
 
-       addr = fdtdec_get_addr_size_auto_noparent(gd->fdt_blob, dev->of_offset,
-                                                 "reg", 0, &size, false);
+       addr = fdtdec_get_addr_size_auto_noparent(gd->fdt_blob,
+                       dev_of_offset(dev), "reg", 0, &size, false);
 
        plat->addr = addr;
        plat->size = size;
-       plat->ngpios = fdtdec_get_int(gd->fdt_blob, dev->of_offset,
-                                                 "ngpios", 32);
+       plat->ngpios = fdtdec_get_int(gd->fdt_blob, dev_of_offset(dev),
+                                     "ngpios", 32);
 
        return 0;
 }
index 03029792c2a7dcb72866a1423183cac794d23464..01ce1d6fa0f21035b488bae500dbb4daf9073dbf 100644 (file)
@@ -106,9 +106,9 @@ static int msm_gpio_ofdata_to_platdata(struct udevice *dev)
 {
        struct gpio_dev_priv *uc_priv = dev_get_uclass_priv(dev);
 
-       uc_priv->gpio_count = fdtdec_get_int(gd->fdt_blob, dev->of_offset,
+       uc_priv->gpio_count = fdtdec_get_int(gd->fdt_blob, dev_of_offset(dev),
                                             "gpio-count", 0);
-       uc_priv->bank_name = fdt_getprop(gd->fdt_blob, dev->of_offset,
+       uc_priv->bank_name = fdt_getprop(gd->fdt_blob, dev_of_offset(dev),
                                         "gpio-bank-name", NULL);
        if (uc_priv->bank_name == NULL)
                uc_priv->bank_name = "soc";
index f906b97fb7466dcfe8e1b7b182034d98f4e324bc..5338552179f6eec9b07c492d22f75a8779203a34 100644 (file)
@@ -320,7 +320,7 @@ static int omap_gpio_bind(struct udevice *dev)
                return -ENOMEM;
 
        plat->base = base_addr;
-       plat->port_name = fdt_get_name(gd->fdt_blob, dev->of_offset, NULL);
+       plat->port_name = fdt_get_name(gd->fdt_blob, dev_of_offset(dev), NULL);
        dev->platdata = plat;
 
        return 0;
index 0410add5183cb607ac55b5a41d1d19c9f5573755..b81f0fa90c2f04d98bce36ac2484ba43b5a1ed33 100644 (file)
@@ -265,7 +265,7 @@ static int pca953x_probe(struct udevice *dev)
                return -ENODEV;
        }
 
-       addr = fdtdec_get_int(gd->fdt_blob, dev->of_offset, "reg", 0);
+       addr = fdtdec_get_int(gd->fdt_blob, dev_of_offset(dev), "reg", 0);
        if (addr == 0)
                return -ENODEV;
 
index 2bda0ff9966bba2db77d3510f44bb5f89a41c983..2cbb9e61ea37890e5589b754bddaa0ff2f89242a 100644 (file)
@@ -131,15 +131,15 @@ static int pcf8575_ofdata_platdata(struct udevice *dev)
 
        int n_latch;
 
-       uc_priv->gpio_count = fdtdec_get_int(gd->fdt_blob, dev->of_offset,
+       uc_priv->gpio_count = fdtdec_get_int(gd->fdt_blob, dev_of_offset(dev),
                                             "gpio-count", 16);
-       uc_priv->bank_name = fdt_getprop(gd->fdt_blob, dev->of_offset,
+       uc_priv->bank_name = fdt_getprop(gd->fdt_blob, dev_of_offset(dev),
                                         "gpio-bank-name", NULL);
        if (!uc_priv->bank_name)
                uc_priv->bank_name = fdt_get_name(gd->fdt_blob,
-                                                 dev->of_offset, NULL);
+                                                 dev_of_offset(dev), NULL);
 
-       n_latch = fdtdec_get_uint(gd->fdt_blob, dev->of_offset,
+       n_latch = fdtdec_get_uint(gd->fdt_blob, dev_of_offset(dev),
                                  "lines-initial-states", 0);
        plat->out = ~n_latch;
 
index 7a037f3a77cd1009d2ca495d4cc7d9a8530721e1..e838ad45a8c742c5e622db857036319bbeceed70 100644 (file)
@@ -133,7 +133,8 @@ static int pic32_gpio_probe(struct udevice *dev)
        char *end;
        int bank;
 
-       addr = fdtdec_get_addr_size(gd->fdt_blob, dev->of_offset, "reg", &size);
+       addr = fdtdec_get_addr_size(gd->fdt_blob, dev_of_offset(dev), "reg",
+                                   &size);
        if (addr == FDT_ADDR_T_NONE)
                return -EINVAL;
 
index 0b619758438f856fb664b572a007579139f39784..e38cee88693bf3509994f0361c36ea37917f0d59 100644 (file)
@@ -193,9 +193,9 @@ static int pm8916_gpio_ofdata_to_platdata(struct udevice *dev)
 {
        struct gpio_dev_priv *uc_priv = dev_get_uclass_priv(dev);
 
-       uc_priv->gpio_count = fdtdec_get_int(gd->fdt_blob, dev->of_offset,
+       uc_priv->gpio_count = fdtdec_get_int(gd->fdt_blob, dev_of_offset(dev),
                                             "gpio-count", 0);
-       uc_priv->bank_name = fdt_getprop(gd->fdt_blob, dev->of_offset,
+       uc_priv->bank_name = fdt_getprop(gd->fdt_blob, dev_of_offset(dev),
                                         "gpio-bank-name", NULL);
        if (uc_priv->bank_name == NULL)
                uc_priv->bank_name = "pm8916";
index 377fed467fb323a5d4beb721a1ac7efc33f2eebb..042996e559e85e946826dccd8df47597968e6d04 100644 (file)
@@ -317,7 +317,7 @@ static int gpio_exynos_bind(struct udevice *parent)
                return 0;
 
        base = (struct s5p_gpio_bank *)dev_get_addr(parent);
-       for (node = fdt_first_subnode(blob, parent->of_offset), bank = base;
+       for (node = fdt_first_subnode(blob, dev_of_offset(parent)), bank = base;
             node > 0;
             node = fdt_next_subnode(blob, node), bank++) {
                struct exynos_gpio_platdata *plat;
@@ -337,7 +337,7 @@ static int gpio_exynos_bind(struct udevice *parent)
                if (ret)
                        return ret;
 
-               dev->of_offset = node;
+               dev_set_of_offset(dev, node);
 
                reg = dev_get_addr(dev);
                if (reg != FDT_ADDR_T_NONE)
index f6435a0543ba787981a70830d65f6c923f97aa4e..ae6d93013f7c79a4bc84ab6be9acd5fd052c736e 100644 (file)
@@ -197,9 +197,9 @@ static int sandbox_gpio_ofdata_to_platdata(struct udevice *dev)
 {
        struct gpio_dev_priv *uc_priv = dev_get_uclass_priv(dev);
 
-       uc_priv->gpio_count = fdtdec_get_int(gd->fdt_blob, dev->of_offset,
+       uc_priv->gpio_count = fdtdec_get_int(gd->fdt_blob, dev_of_offset(dev),
                                             "num-gpios", 0);
-       uc_priv->bank_name = fdt_getprop(gd->fdt_blob, dev->of_offset,
+       uc_priv->bank_name = fdt_getprop(gd->fdt_blob, dev_of_offset(dev),
                                         "gpio-bank-name", NULL);
 
        return 0;
@@ -209,7 +209,7 @@ static int gpio_sandbox_probe(struct udevice *dev)
 {
        struct gpio_dev_priv *uc_priv = dev_get_uclass_priv(dev);
 
-       if (dev->of_offset == -1) {
+       if (dev_of_offset(dev) == -1) {
                /* Tell the uclass how many GPIOs we have */
                uc_priv->gpio_count = CONFIG_SANDBOX_GPIO_COUNT;
        }
index e8accaa333026a08da7931e9527d4a3b41243b31..8d2bb18504aeae4e05981df68521dcab33154b5a 100644 (file)
@@ -312,7 +312,7 @@ static int gpio_sunxi_bind(struct udevice *parent)
                                        plat->bank_name, plat, -1, &dev);
                if (ret)
                        return ret;
-               dev->of_offset = parent->of_offset;
+               dev_set_of_offset(dev, dev_of_offset(parent));
        }
 
        return 0;
index 1c681514db9f50e61a9db041ac2067c084db494c..b0c22e5bfe3146993890eea10498b96f2feef5b6 100644 (file)
@@ -197,7 +197,7 @@ static int tegra186_gpio_bind(struct udevice *parent)
                                  -1, &dev);
                if (ret)
                        return ret;
-               dev->of_offset = parent->of_offset;
+               dev_set_of_offset(dev, dev_of_offset(parent));
        }
 
        return 0;
index 5a031159ca370c423455e0fdebcf8965dc8fb962..b01968a304dae744b5f7926b13f6222868f0e95d 100644 (file)
@@ -337,7 +337,8 @@ static int gpio_tegra_bind(struct udevice *parent)
         * This driver does not make use of interrupts, other than to figure
         * out the number of GPIO banks
         */
-       if (!fdt_getprop(gd->fdt_blob, parent->of_offset, "interrupts", &len))
+       if (!fdt_getprop(gd->fdt_blob, dev_of_offset(parent), "interrupts",
+                        &len))
                return -EINVAL;
        bank_count = len / 3 / sizeof(u32);
        ctlr = (struct gpio_ctlr *)dev_get_addr(parent);
@@ -363,7 +364,7 @@ static int gpio_tegra_bind(struct udevice *parent)
                                          plat->port_name, plat, -1, &dev);
                        if (ret)
                                return ret;
-                       dev->of_offset = parent->of_offset;
+                       dev_set_of_offset(dev, dev_of_offset(parent));
                }
        }
 
index a30ba5d2ed6f3966b3bab766355d05c43faf651a..458104e8b07f89a67f53a9d9fae6ab52028bb1be 100644 (file)
@@ -129,7 +129,7 @@ static int vybrid_gpio_bind(struct udevice *dev)
 
        plat->base = base_addr;
        plat->chip = dev->req_seq;
-       plat->port_name = fdt_get_name(gd->fdt_blob, dev->of_offset, NULL);
+       plat->port_name = fdt_get_name(gd->fdt_blob, dev_of_offset(dev), NULL);
        dev->platdata = plat;
 
        return 0;
index 4bc54eea596eb6b2a63bae682de7feb6550f9b25..5a636697a5e5b257eb3d56e9a66e93f540b82c37 100644 (file)
@@ -242,7 +242,7 @@ static int at91_i2c_ofdata_to_platdata(struct udevice *dev)
 {
        const void *blob = gd->fdt_blob;
        struct at91_i2c_bus *bus = dev_get_priv(dev);
-       int node = dev->of_offset;
+       int node = dev_of_offset(dev);
 
        bus->regs = (struct at91_i2c_regs *)dev_get_addr(dev);
        bus->pdata = (struct at91_i2c_pdata *)dev_get_driver_data(dev);
index 9cf8e7dec0f8861b44f5316e7196ce59e6ecf2ba..86fa684ff0553420ba945d2442306316c8c1de8f 100644 (file)
@@ -34,7 +34,7 @@ static int cros_ec_i2c_ofdata_to_platdata(struct udevice *dev)
 {
        struct cros_ec_i2c_bus *i2c_bus = dev_get_priv(dev);
        const void *blob = gd->fdt_blob;
-       int node = dev->of_offset;
+       int node = dev_of_offset(dev);
 
        i2c_bus->remote_bus = fdtdec_get_uint(blob, node, "google,remote-bus",
                                              0);
index 9521aeb3c308c7e6a85efffa7af3c5ddf3099682..2dd75fd154c431d01a8b0b169e3d5c9c2d7d668b 100644 (file)
@@ -522,7 +522,7 @@ static int s3c_i2c_ofdata_to_platdata(struct udevice *dev)
        struct s3c24x0_i2c_bus *i2c_bus = dev_get_priv(dev);
        int node;
 
-       node = dev->of_offset;
+       node = dev_of_offset(dev);
 
        i2c_bus->hsregs = (struct exynos5_hsi2c *)dev_get_addr(dev);
 
index c3f826d68c7591e4318ecb5754a9312f960a6b1f..e9fbf828f34b8138704491ba97dc137e6db2487f 100644 (file)
@@ -585,21 +585,21 @@ static int fsl_i2c_ofdata_to_platdata(struct udevice *bus)
        struct fsl_i2c_dev *dev = dev_get_priv(bus);
        fdt_addr_t addr;
        fdt_size_t size;
+       int node = dev_of_offset(bus);
 
-       addr = fdtdec_get_addr_size_auto_noparent(gd->fdt_blob, bus->of_offset,
-                                                 "reg", 0, &size, false);
+       addr = fdtdec_get_addr_size_auto_noparent(gd->fdt_blob, node, "reg", 0,
+                                                 &size, false);
 
        dev->base = map_sysmem(CONFIG_SYS_IMMR + addr, size);
 
        if (!dev->base)
                return -ENOMEM;
 
-       dev->index = fdtdec_get_int(gd->fdt_blob, bus->of_offset,
-                                   "cell-index", -1);
-       dev->slaveadd = fdtdec_get_int(gd->fdt_blob, bus->of_offset,
+       dev->index = fdtdec_get_int(gd->fdt_blob, node, "cell-index", -1);
+       dev->slaveadd = fdtdec_get_int(gd->fdt_blob, node,
                                       "u-boot,i2c-slave-addr", 0x7f);
-       dev->speed = fdtdec_get_int(gd->fdt_blob, bus->of_offset,
-                                   "clock-frequency", 400000);
+       dev->speed = fdtdec_get_int(gd->fdt_blob, node, "clock-frequency",
+                                   400000);
 
        dev->i2c_clk = dev->index ? gd->arch.i2c2_clk : gd->arch.i2c1_clk;
 
index a8b83c51bc398a61f89377b3305cc9474a14c9e2..aeeb304a876f13a44cbac1d0ccbecc1523b9b9a0 100644 (file)
@@ -309,7 +309,7 @@ static int i2c_gpio_ofdata_to_platdata(struct udevice *dev)
 {
        struct i2c_gpio_bus *bus = dev_get_priv(dev);
        const void *blob = gd->fdt_blob;
-       int node = dev->of_offset;
+       int node = dev_of_offset(dev);
        int ret;
 
        ret = gpio_request_list_by_name(dev, "gpios", bus->gpios,
index dbd3789747dfdacc1ca2fc013203ff8d4f416e05..f3184c71d9e84d1ac35393ddacee5f44f1f782d5 100644 (file)
@@ -489,7 +489,7 @@ static int i2c_post_probe(struct udevice *dev)
 #if CONFIG_IS_ENABLED(OF_CONTROL)
        struct dm_i2c_bus *i2c = dev_get_uclass_priv(dev);
 
-       i2c->speed_hz = fdtdec_get_int(gd->fdt_blob, dev->of_offset,
+       i2c->speed_hz = fdtdec_get_int(gd->fdt_blob, dev_of_offset(dev),
                                     "clock-frequency", 100000);
 
        return dm_i2c_set_bus_speed(dev, i2c->speed_hz);
@@ -503,10 +503,11 @@ static int i2c_child_post_bind(struct udevice *dev)
 #if CONFIG_IS_ENABLED(OF_CONTROL)
        struct dm_i2c_chip *plat = dev_get_parent_platdata(dev);
 
-       if (dev->of_offset == -1)
+       if (dev_of_offset(dev) == -1)
                return 0;
 
-       return i2c_chip_ofdata_to_platdata(gd->fdt_blob, dev->of_offset, plat);
+       return i2c_chip_ofdata_to_platdata(gd->fdt_blob, dev_of_offset(dev),
+                                          plat);
 #else
        return 0;
 #endif
index 3f072c78b81d1720cc52b16c2b354e75d378ac29..66ce7ecc9c2ad65598f5fb4e478e1bca01339704 100644 (file)
@@ -89,7 +89,7 @@ static int i2c_arbitrator_probe(struct udevice *dev)
 {
        struct i2c_arbitrator_priv *priv = dev_get_priv(dev);
        const void *blob = gd->fdt_blob;
-       int node = dev->of_offset;
+       int node = dev_of_offset(dev);
        int ret;
 
        debug("%s: %s\n", __func__, dev->name);
index db086efe61240f3d7f93d67bc4ba72a0ebb1e5f2..d243b8e32d62aee3f34cb73ba57c8fc9eb63b7e5 100644 (file)
@@ -40,7 +40,7 @@ static int i2c_mux_child_post_bind(struct udevice *dev)
        struct i2c_mux_bus *plat = dev_get_parent_platdata(dev);
        int channel;
 
-       channel = fdtdec_get_int(gd->fdt_blob, dev->of_offset, "reg", -1);
+       channel = fdtdec_get_int(gd->fdt_blob, dev_of_offset(dev), "reg", -1);
        if (channel < 0)
                return -EINVAL;
        plat->channel = channel;
@@ -60,7 +60,7 @@ static int i2c_mux_post_bind(struct udevice *mux)
         * There is no compatible string in the sub-nodes, so we must manually
         * bind these
         */
-       for (offset = fdt_first_subnode(blob, mux->of_offset);
+       for (offset = fdt_first_subnode(blob, dev_of_offset(mux));
             offset > 0;
             offset = fdt_next_subnode(blob, offset)) {
                struct udevice *dev;
index 7e0d2da4d60585c84c29590cb070cc1a66c5b088..1a6761858ce95364983bfe34f690bba0ac6973bd 100644 (file)
@@ -51,7 +51,7 @@ static int pca954x_ofdata_to_platdata(struct udevice *dev)
 {
        struct pca954x_priv *priv = dev_get_priv(dev);
 
-       priv->addr = fdtdec_get_int(gd->fdt_blob, dev->of_offset, "reg", 0);
+       priv->addr = fdtdec_get_int(gd->fdt_blob, dev_of_offset(dev), "reg", 0);
        if (!priv->addr) {
                debug("MUX not found\n");
                return -ENODEV;
index cea3da0b27610cd49cc593dff4b0ab44d42b90ab..648a96eeb4e88cd0ab9b753b31c8d85b9b33d4e5 100644 (file)
@@ -775,11 +775,11 @@ static int mvtwsi_i2c_ofdata_to_platdata(struct udevice *bus)
        if (!dev->base)
                return -ENOMEM;
 
-       dev->index = fdtdec_get_int(gd->fdt_blob, bus->of_offset,
+       dev->index = fdtdec_get_int(gd->fdt_blob, dev_of_offset(bus),
                                    "cell-index", -1);
-       dev->slaveadd = fdtdec_get_int(gd->fdt_blob, bus->of_offset,
+       dev->slaveadd = fdtdec_get_int(gd->fdt_blob, dev_of_offset(bus),
                                       "u-boot,i2c-slave-addr", 0x0);
-       dev->speed = fdtdec_get_int(gd->fdt_blob, bus->of_offset,
+       dev->speed = fdtdec_get_int(gd->fdt_blob, dev_of_offset(bus),
                                    "clock-frequency", 100000);
        return 0;
 }
index 94d9027d256d9e0ef78a9fcf59cc892f17e1d11d..eb789f5bff492246bf19ae5698b6b4367607d818 100644 (file)
@@ -750,7 +750,7 @@ static int mxc_i2c_probe(struct udevice *bus)
 {
        struct mxc_i2c_bus *i2c_bus = dev_get_priv(bus);
        const void *fdt = gd->fdt_blob;
-       int node = bus->of_offset;
+       int node = dev_of_offset(bus);
        fdt_addr_t addr;
        int ret, ret2;
 
index 363cd04e4e2692899b63bad0bbe46613861b6371..3c69dbf409b00fd8cff74cdd321fd6278a821e41 100644 (file)
@@ -312,7 +312,7 @@ static int s3c_i2c_ofdata_to_platdata(struct udevice *dev)
        struct s3c24x0_i2c_bus *i2c_bus = dev_get_priv(dev);
        int node;
 
-       node = dev->of_offset;
+       node = dev_of_offset(dev);
 
        i2c_bus->regs = (struct s3c24x0_i2c *)dev_get_addr(dev);
 
index 513c414ae38aed82fb7aaab6ff0e44288d89b496..931c6de508c02b2c0c3475470908a61f7f59b1fe 100644 (file)
@@ -90,7 +90,7 @@ static int tegra186_bpmp_i2c_probe(struct udevice *dev)
 {
        struct tegra186_bpmp_i2c *priv = dev_get_priv(dev);
 
-       priv->bpmp_bus_id = fdtdec_get_uint(gd->fdt_blob, dev->of_offset,
+       priv->bpmp_bus_id = fdtdec_get_uint(gd->fdt_blob, dev_of_offset(dev),
                                            "nvidia,bpmp-bus-id", U32_MAX);
        if (priv->bpmp_bus_id == U32_MAX) {
                debug("%s: could not parse nvidia,bpmp-bus-id\n", __func__);
index 9bc4555c2eb6f8fc6343e3837526d5023a9af010..00381dcd720ac1b92b70d8afd4b52191d2c47d64 100644 (file)
@@ -189,7 +189,7 @@ static int cros_ec_kbd_probe(struct udevice *dev)
        struct stdio_dev *sdev = &uc_priv->sdev;
        struct input_config *input = &uc_priv->input;
        const void *blob = gd->fdt_blob;
-       int node = dev->of_offset;
+       int node = dev_of_offset(dev);
        int ret;
 
        if (cros_ec_keyb_decode_fdt(blob, node, priv))
index 03d48403857a862c2e6224a15a71eb4472119607..0fd25b17ec0878a0ebe06b0ecc4ff7348a3eba1a 100644 (file)
@@ -315,7 +315,7 @@ static int i8042_kbd_probe(struct udevice *dev)
        struct input_config *input = &uc_priv->input;
        int ret;
 
-       if (fdtdec_get_bool(gd->fdt_blob, dev->of_offset,
+       if (fdtdec_get_bool(gd->fdt_blob, dev_of_offset(dev),
                            "intel,duplicate-por"))
                priv->quirks |= QUIRK_DUP_POR;
 
index c77f6107696281f89c85986efcd95d62b4a37f41..d36f1a1dfa174909cfdab68d58e0e2424e131f28 100644 (file)
@@ -290,7 +290,7 @@ static int tegra_kbd_probe(struct udevice *dev)
        struct keyboard_priv *uc_priv = dev_get_uclass_priv(dev);
        struct stdio_dev *sdev = &uc_priv->sdev;
        struct input_config *input = &uc_priv->input;
-       int node = dev->of_offset;
+       int node = dev_of_offset(dev);
        int ret;
 
        priv->kbc = (struct kbc_tegra *)dev_get_addr(dev);
index cb6e996931b3d33c18d7cdac3466dc7ffe532377..5b119903f55e431e1a811ca9032d4b2e2a3770a4 100644 (file)
@@ -62,7 +62,7 @@ static int led_gpio_bind(struct udevice *parent)
        int node;
        int ret;
 
-       for (node = fdt_first_subnode(blob, parent->of_offset);
+       for (node = fdt_first_subnode(blob, dev_of_offset(parent));
             node > 0;
             node = fdt_next_subnode(blob, node)) {
                struct led_uclass_plat *uc_plat;
index a7fcde51d593a105a3f49db713993958b533bea8..38448de9655d6bb5462d5c35713cd7b9011714a1 100644 (file)
@@ -41,7 +41,7 @@ int mbox_get_by_index(struct udevice *dev, int index, struct mbox_chan *chan)
 
        debug("%s(dev=%p, index=%d, chan=%p)\n", __func__, dev, index, chan);
 
-       ret = fdtdec_parse_phandle_with_args(gd->fdt_blob, dev->of_offset,
+       ret = fdtdec_parse_phandle_with_args(gd->fdt_blob, dev_of_offset(dev),
                                             "mboxes", "#mbox-cells", 0,
                                             index, &args);
        if (ret) {
@@ -85,7 +85,7 @@ int mbox_get_by_name(struct udevice *dev, const char *name,
 
        debug("%s(dev=%p, name=%s, chan=%p)\n", __func__, dev, name, chan);
 
-       index = fdt_stringlist_search(gd->fdt_blob, dev->of_offset,
+       index = fdt_stringlist_search(gd->fdt_blob, dev_of_offset(dev),
                                      "mbox-names", name);
        if (index < 0) {
                debug("fdt_stringlist_search() failed: %d\n", index);
index 759bb46c57b2ec7555c152394956505d18716a1d..3d449b2a5526cac31ee28d8bc4edd2d2f7527806 100644 (file)
@@ -998,7 +998,7 @@ int cros_ec_register(struct udevice *dev)
 {
        struct cros_ec_dev *cdev = dev_get_uclass_priv(dev);
        const void *blob = gd->fdt_blob;
-       int node = dev->of_offset;
+       int node = dev_of_offset(dev);
        char id[MSG_BYTES];
 
        cdev->dev = dev;
index 3de18b2d2ade9e1a18e6e650358fa55747c425f3..6e0934017a3eeec20dd71fb8738958666beb02c1 100644 (file)
 #define debug_trace(fmt, b...)
 #endif
 
+/**
+ * Request format for protocol v3
+ * byte 0      0xda (EC_COMMAND_PROTOCOL_3)
+ * byte 1-8    struct ec_host_request
+ * byte 10-    response data
+ */
+struct ec_host_request_i2c {
+       /* Always 0xda to backward compatible with v2 struct */
+       uint8_t  command_protocol;
+       struct ec_host_request ec_request;
+} __packed;
+
+/*
+ * Response format for protocol v3
+ * byte 0      result code
+ * byte 1      packet_length
+ * byte 2-9    struct ec_host_response
+ * byte 10-    response data
+ */
+struct ec_host_response_i2c {
+       uint8_t result;
+       uint8_t packet_length;
+       struct ec_host_response ec_response;
+} __packed;
+
+static int cros_ec_i2c_packet(struct udevice *udev, int out_bytes, int in_bytes)
+{
+       struct cros_ec_dev *dev = dev_get_uclass_priv(udev);
+       struct dm_i2c_chip *chip = dev_get_parent_platdata(udev);
+       struct ec_host_request_i2c *ec_request_i2c =
+               (struct ec_host_request_i2c *)dev->dout;
+       struct ec_host_response_i2c *ec_response_i2c =
+               (struct ec_host_response_i2c *)dev->din;
+       struct i2c_msg i2c_msg[2];
+       int ret;
+
+       i2c_msg[0].addr = chip->chip_addr;
+       i2c_msg[0].flags = 0;
+       i2c_msg[1].addr = chip->chip_addr;
+       i2c_msg[1].flags = I2C_M_RD;
+
+       /* one extra byte, to indicate v3 */
+       i2c_msg[0].len = out_bytes + 1;
+       i2c_msg[0].buf = dev->dout;
+
+       /* stitch on EC_COMMAND_PROTOCOL_3 */
+       memmove(&ec_request_i2c->ec_request, dev->dout, out_bytes);
+       ec_request_i2c->command_protocol = EC_COMMAND_PROTOCOL_3;
+
+       /* two extra bytes for v3 */
+       i2c_msg[1].len = in_bytes + 2;
+       i2c_msg[1].buf = dev->din;
+
+       ret = dm_i2c_xfer(udev, &i2c_msg[0], 2);
+       if (ret) {
+               printf("%s: Could not execute transfer: %d\n", __func__, ret);
+               return ret;
+       }
+
+       /* When we send a v3 request to v2 ec, ec won't recognize the 0xda
+        * (EC_COMMAND_PROTOCOL_3) and will return with status
+        * EC_RES_INVALID_COMMAND with zero data length
+        *
+        * In case of invalid command for v3 protocol the data length
+        * will be at least sizeof(struct ec_host_response)
+        */
+       if (ec_response_i2c->result == EC_RES_INVALID_COMMAND &&
+           ec_response_i2c->packet_length == 0)
+               return -EPROTONOSUPPORT;
+
+       if (ec_response_i2c->packet_length < sizeof(struct ec_host_response)) {
+               printf("%s: response of %u bytes too short; not a full hdr\n",
+                      __func__, ec_response_i2c->packet_length);
+               return -EBADMSG;
+       }
+
+
+       /* drop result and packet_len */
+       memmove(dev->din, &ec_response_i2c->ec_response, in_bytes);
+
+       return in_bytes;
+}
+
 static int cros_ec_i2c_command(struct udevice *udev, uint8_t cmd,
                               int cmd_version, const uint8_t *dout,
                               int dout_len, uint8_t **dinp, int din_len)
 {
        struct cros_ec_dev *dev = dev_get_uclass_priv(udev);
+       struct dm_i2c_chip *chip = dev_get_parent_platdata(udev);
+       struct i2c_msg i2c_msg[2];
        /* version8, cmd8, arglen8, out8[dout_len], csum8 */
        int out_bytes = dout_len + 4;
        /* response8, arglen8, in8[din_len], checksum8 */
@@ -53,6 +138,11 @@ static int cros_ec_i2c_command(struct udevice *udev, uint8_t cmd,
        assert(dout_len >= 0);
        assert(dinp);
 
+       i2c_msg[0].addr = chip->chip_addr;
+       i2c_msg[0].len = out_bytes;
+       i2c_msg[0].buf = dev->dout;
+       i2c_msg[0].flags = 0;
+
        /*
         * Copy command and data into output buffer so we can do a single I2C
         * burst transaction.
@@ -85,24 +175,21 @@ static int cros_ec_i2c_command(struct udevice *udev, uint8_t cmd,
        *ptr++ = (uint8_t)
                cros_ec_calc_checksum(dev->dout, dout_len + 3);
 
+       i2c_msg[1].addr = chip->chip_addr;
+       i2c_msg[1].len = in_bytes;
+       i2c_msg[1].buf = in_ptr;
+       i2c_msg[1].flags = I2C_M_RD;
+
        /* Send output data */
        cros_ec_dump_data("out", -1, dev->dout, out_bytes);
-       ret = dm_i2c_write(udev, 0, dev->dout, out_bytes);
+
+       ret = dm_i2c_xfer(udev, &i2c_msg[0], 2);
        if (ret) {
-               debug("%s: Cannot complete I2C write to %s\n", __func__,
+               debug("%s: Could not execute transfer to %s\n", __func__,
                      udev->name);
                ret = -1;
        }
 
-       if (!ret) {
-               ret = dm_i2c_read(udev, 0, in_ptr, in_bytes);
-               if (ret) {
-                       debug("%s: Cannot complete I2C read from %s\n",
-                             __func__, udev->name);
-                       ret = -1;
-               }
-       }
-
        if (*in_ptr != EC_RES_SUCCESS) {
                debug("%s: Received bad result code %d\n", __func__, *in_ptr);
                return -(int)*in_ptr;
@@ -136,6 +223,7 @@ static int cros_ec_probe(struct udevice *dev)
 
 static struct dm_cros_ec_ops cros_ec_ops = {
        .command = cros_ec_i2c_command,
+       .packet = cros_ec_i2c_packet,
 };
 
 static const struct udevice_id cros_ec_ids[] = {
index c4fbca0d3ae129a260d3073fe7387b4f6688ff6b..848c67bc230c2fe55612f53bdb1060d58a0a2741 100644 (file)
@@ -522,7 +522,7 @@ int cros_ec_probe(struct udevice *dev)
        int err;
 
        memcpy(ec, &s_state, sizeof(*ec));
-       err = cros_ec_decode_ec_flash(blob, dev->of_offset, &ec->ec_config);
+       err = cros_ec_decode_ec_flash(blob, dev_of_offset(dev), &ec->ec_config);
        if (err)
                return err;
 
@@ -531,7 +531,7 @@ int cros_ec_probe(struct udevice *dev)
             keyb_dev;
             device_find_next_child(&keyb_dev)) {
                if (device_get_uclass_id(keyb_dev) == UCLASS_KEYBOARD) {
-                       node = keyb_dev->of_offset;
+                       node = dev_of_offset(keyb_dev);
                        break;
                }
        }
index 4410d0357ff37f63020a8e5820a3ca3d2ced7b13..02de8d7df3d05fc84c64acaf503fadf750343cc9 100644 (file)
@@ -115,9 +115,9 @@ static int sandbox_i2c_eeprom_ofdata_to_platdata(struct udevice *dev)
 {
        struct sandbox_i2c_flash_plat_data *plat = dev_get_platdata(dev);
 
-       plat->size = fdtdec_get_int(gd->fdt_blob, dev->of_offset,
+       plat->size = fdtdec_get_int(gd->fdt_blob, dev_of_offset(dev),
                                    "sandbox,size", 32);
-       plat->filename = fdt_getprop(gd->fdt_blob, dev->of_offset,
+       plat->filename = fdt_getprop(gd->fdt_blob, dev_of_offset(dev),
                                     "sandbox,filename", NULL);
        if (!plat->filename) {
                debug("%s: No filename for device '%s'\n", __func__,
index d43d1d300ac28bf73b763fd9fc8241d49afffe8b..a8af9e0c537f921f57b5b7c4709e7124fc4cd4df 100644 (file)
@@ -32,7 +32,7 @@ static LIST_HEAD(fw_list);
  *          be ignored.
  * @return: 0 on success, or negative value on failure
  */
-static int bios_linker_allocate(struct bios_linker_entry *entry, u32 *addr)
+static int bios_linker_allocate(struct bios_linker_entry *entry, ulong *addr)
 {
        uint32_t size, align;
        struct fw_file *file;
@@ -147,7 +147,7 @@ static int bios_linker_add_checksum(struct bios_linker_entry *entry)
 }
 
 /* This function loads and patches ACPI tables provided by QEMU */
-u32 write_acpi_tables(u32 addr)
+ulong write_acpi_tables(ulong addr)
 {
        int i, ret = 0;
        struct fw_file *file;
index f4ddbea3760e5e05965846e5f874aebed0bd5f95..bd8b9602e0dd1b4229aa1caf3b30aa94079c141e 100644 (file)
@@ -112,19 +112,19 @@ static int tegra186_bpmp_bind(struct udevice *dev)
        debug("%s(dev=%p)\n", __func__, dev);
 
        ret = device_bind_driver_to_node(dev, "tegra186_clk", "tegra186_clk",
-                                        dev->of_offset, &child);
+                                        dev_of_offset(dev), &child);
        if (ret)
                return ret;
 
        ret = device_bind_driver_to_node(dev, "tegra186_reset",
-                                        "tegra186_reset", dev->of_offset,
+                                        "tegra186_reset", dev_of_offset(dev),
                                         &child);
        if (ret)
                return ret;
 
        ret = device_bind_driver_to_node(dev, "tegra186_power_domain",
                                         "tegra186_power_domain",
-                                        dev->of_offset, &child);
+                                        dev_of_offset(dev), &child);
        if (ret)
                return ret;
 
@@ -141,7 +141,7 @@ static ulong tegra186_bpmp_get_shmem(struct udevice *dev, int index)
        struct fdtdec_phandle_args args;
        fdt_addr_t reg;
 
-       ret = fdtdec_parse_phandle_with_args(gd->fdt_blob, dev->of_offset,
+       ret = fdtdec_parse_phandle_with_args(gd->fdt_blob, dev_of_offset(dev),
                                              "shmem", NULL, 0, index, &args);
        if (ret < 0) {
                error("fdtdec_parse_phandle_with_args() failed: %d\n", ret);
index 0eb009657c43ed7b995a688296b908b3b33eb1a2..5db3c374ce0a1021f78af71d043df88e6a12272f 100644 (file)
@@ -22,12 +22,12 @@ static int tegra_car_bpmp_bind(struct udevice *dev)
        debug("%s(dev=%p)\n", __func__, dev);
 
        ret = device_bind_driver_to_node(dev, "tegra_car_clk", "tegra_car_clk",
-                                        dev->of_offset, &child);
+                                        dev_of_offset(dev), &child);
        if (ret)
                return ret;
 
        ret = device_bind_driver_to_node(dev, "tegra_car_reset",
-                                        "tegra_car_reset", dev->of_offset,
+                                        "tegra_car_reset", dev_of_offset(dev),
                                         &child);
        if (ret)
                return ret;
index 62cb242343c7199f402fe3221cb6cbac3999c24a..852255782f138e752194a4ed275ae2b264b41043 100644 (file)
@@ -75,7 +75,7 @@ static int atmel_sdhci_probe(struct udevice *dev)
        host->ioaddr = (void *)dev_get_addr(dev);
 
        host->quirks = 0;
-       host->bus_width = fdtdec_get_int(gd->fdt_blob, dev->of_offset,
+       host->bus_width = fdtdec_get_int(gd->fdt_blob, dev_of_offset(dev),
                                         "bus-width", 4);
 
        caps = sdhci_readl(host, SDHCI_CAPABILITIES);
index c440399a09cfa38e0dd569a68c7a8c347ad3633a..40f7892ac80b757ef95ca723a1495d56110f3a93 100644 (file)
@@ -264,7 +264,7 @@ static int exynos_dwmmc_probe(struct udevice *dev)
        struct dwmci_host *host = &priv->host;
        int err;
 
-       err = exynos_dwmci_get_config(gd->fdt_blob, dev->of_offset, host);
+       err = exynos_dwmci_get_config(gd->fdt_blob, dev_of_offset(dev), host);
        if (err)
                return err;
        err = do_dwmci_init(host);
index 73473c53a375fe679a6bd94a36301f1dbae6f383..adeb5df6da925bb895bda35cc59eca9a7be3fb7c 100644 (file)
@@ -954,7 +954,7 @@ static int fsl_esdhc_probe(struct udevice *dev)
        struct mmc_uclass_priv *upriv = dev_get_uclass_priv(dev);
        struct fsl_esdhc_priv *priv = dev_get_priv(dev);
        const void *fdt = gd->fdt_blob;
-       int node = dev->of_offset;
+       int node = dev_of_offset(dev);
        fdt_addr_t addr;
        unsigned int val;
        int ret;
index 1db683d01e695696e633727233c8d45af39f8465..7a7e67f6f3579ee4164161ee7eacf1b7b3cae6ab 100644 (file)
@@ -50,16 +50,16 @@ DECLARE_GLOBAL_DATA_PTR;
 
 static int msm_sdc_clk_init(struct udevice *dev)
 {
-       uint clk_rate = fdtdec_get_uint(gd->fdt_blob, dev->of_offset,
-                                       "clock-frequency", 400000);
+       int node = dev_of_offset(dev);
+       uint clk_rate = fdtdec_get_uint(gd->fdt_blob, node, "clock-frequency",
+                                       400000);
        uint clkd[2]; /* clk_id and clk_no */
        int clk_offset;
        struct udevice *clk_dev;
        struct clk clk;
        int ret;
 
-       ret = fdtdec_get_int_array(gd->fdt_blob, dev->of_offset, "clock", clkd,
-                                  2);
+       ret = fdtdec_get_int_array(gd->fdt_blob, node, "clock", clkd, 2);
        if (ret)
                return ret;
 
@@ -168,17 +168,14 @@ static int msm_ofdata_to_platdata(struct udevice *dev)
        struct udevice *parent = dev->parent;
        struct msm_sdhc *priv = dev_get_priv(dev);
        struct sdhci_host *host = &priv->host;
+       int node = dev_of_offset(dev);
 
        host->name = strdup(dev->name);
        host->ioaddr = (void *)dev_get_addr(dev);
-       host->bus_width = fdtdec_get_int(gd->fdt_blob, dev->of_offset,
-                                        "bus-width", 4);
-       host->index = fdtdec_get_uint(gd->fdt_blob, dev->of_offset, "index", 0);
+       host->bus_width = fdtdec_get_int(gd->fdt_blob, node, "bus-width", 4);
+       host->index = fdtdec_get_uint(gd->fdt_blob, node, "index", 0);
        priv->base = (void *)fdtdec_get_addr_size_auto_parent(gd->fdt_blob,
-                                                             parent->of_offset,
-                                                             dev->of_offset,
-                                                             "reg", 1, NULL,
-                                                             false);
+                       dev_of_offset(parent), node, "reg", 1, NULL, false);
        if (priv->base == (void *)FDT_ADDR_T_NONE ||
            host->ioaddr == (void *)FDT_ADDR_T_NONE)
                return -EINVAL;
index b3268467dcc904e660bd5b09463704b6cbf247ea..5bb628d1250aed9c627f5a4d8963611387ceae09 100644 (file)
@@ -728,7 +728,7 @@ static int omap_hsmmc_ofdata_to_platdata(struct udevice *dev)
 {
        struct omap_hsmmc_data *priv = dev_get_priv(dev);
        const void *fdt = gd->fdt_blob;
-       int node = dev->of_offset;
+       int node = dev_of_offset(dev);
        struct mmc_config *cfg;
        int val;
 
index 1e14fa14d6a00f9b14f0a3a015b84a0ab0563dab..9d8a392ed9646b346061de53b00876adc26acded 100644 (file)
@@ -38,18 +38,18 @@ static int pic32_sdhci_probe(struct udevice *dev)
        fdt_size_t size;
        int ret;
 
-       addr = fdtdec_get_addr_size(fdt, dev->of_offset, "reg", &size);
+       addr = fdtdec_get_addr_size(fdt, dev_of_offset(dev), "reg", &size);
        if (addr == FDT_ADDR_T_NONE)
                return -EINVAL;
 
        host->ioaddr    = ioremap(addr, size);
        host->name      = dev->name;
        host->quirks    = SDHCI_QUIRK_NO_HISPD_BIT;
-       host->bus_width = fdtdec_get_int(gd->fdt_blob, dev->of_offset,
+       host->bus_width = fdtdec_get_int(gd->fdt_blob, dev_of_offset(dev),
                                        "bus-width", 4);
        host->ops = &pic32_sdhci_ops;
 
-       ret = fdtdec_get_int_array(gd->fdt_blob, dev->of_offset,
+       ret = fdtdec_get_int_array(gd->fdt_blob, dev_of_offset(dev),
                                   "clock-freq-min-max", f_min_max, 2);
        if (ret) {
                printf("sdhci: clock-freq-min-max not found\n");
index 47db6786cfce47334d4d387562c3dd6490318289..c36eda05d20b139b71caaca95430513f91f66212 100644 (file)
@@ -59,24 +59,24 @@ static int rockchip_dwmmc_ofdata_to_platdata(struct udevice *dev)
 
        host->name = dev->name;
        host->ioaddr = (void *)dev_get_addr(dev);
-       host->buswidth = fdtdec_get_int(gd->fdt_blob, dev->of_offset,
+       host->buswidth = fdtdec_get_int(gd->fdt_blob, dev_of_offset(dev),
                                        "bus-width", 4);
        host->get_mmc_clk = rockchip_dwmmc_get_mmc_clk;
        host->priv = dev;
 
        /* use non-removeable as sdcard and emmc as judgement */
-       if (fdtdec_get_bool(gd->fdt_blob, dev->of_offset, "non-removable"))
+       if (fdtdec_get_bool(gd->fdt_blob, dev_of_offset(dev), "non-removable"))
                host->dev_index = 0;
        else
                host->dev_index = 1;
 
-       priv->fifo_depth = fdtdec_get_int(gd->fdt_blob, dev->of_offset,
+       priv->fifo_depth = fdtdec_get_int(gd->fdt_blob, dev_of_offset(dev),
                                    "fifo-depth", 0);
        if (priv->fifo_depth < 0)
                return -EINVAL;
-       priv->fifo_mode = fdtdec_get_bool(gd->fdt_blob, dev->of_offset,
+       priv->fifo_mode = fdtdec_get_bool(gd->fdt_blob, dev_of_offset(dev),
                                          "fifo-mode");
-       if (fdtdec_get_int_array(gd->fdt_blob, dev->of_offset,
+       if (fdtdec_get_int_array(gd->fdt_blob, dev_of_offset(dev),
                                 "clock-freq-min-max", priv->minmax, 2))
                return -EINVAL;
 #endif
index 13588647014c8846cfcacc5f0220e1e7ade8f2d2..bd91f917580ae3a779f5d5f7247cd2c1e53fd612 100644 (file)
@@ -38,7 +38,7 @@ static int arasan_sdhci_probe(struct udevice *dev)
        struct clk clk;
 
 
-       max_frequency = fdtdec_get_int(gd->fdt_blob, dev->of_offset,
+       max_frequency = fdtdec_get_int(gd->fdt_blob, dev_of_offset(dev),
                        "max-frequency", 0);
        ret = clk_get_by_index(dev, 0, &clk);
        if (!ret) {
index 28327d5f0bced321690b1ec52d16c5906f5d42ca..640ea0261eb50e24c586de49d0928dffefec90fd 100644 (file)
@@ -247,7 +247,7 @@ static int s5p_sdhci_probe(struct udevice *dev)
        struct sdhci_host *host = dev_get_priv(dev);
        int ret;
 
-       ret = sdhci_get_config(gd->fdt_blob, dev->of_offset, host);
+       ret = sdhci_get_config(gd->fdt_blob, dev_of_offset(dev), host);
        if (ret)
                return ret;
 
index 0a22e582957fc24e00f05c56e956aa1fabfce479..d0c3c5155a01628bc6c3b363551d88c480bbb246 100644 (file)
@@ -70,7 +70,7 @@ static int socfpga_dwmmc_ofdata_to_platdata(struct udevice *dev)
                return -EINVAL;
        }
 
-       fifo_depth = fdtdec_get_int(gd->fdt_blob, dev->of_offset,
+       fifo_depth = fdtdec_get_int(gd->fdt_blob, dev_of_offset(dev),
                                    "fifo-depth", 0);
        if (fifo_depth < 0) {
                printf("DWMMC: Can't get FIFO depth\n");
@@ -79,7 +79,7 @@ static int socfpga_dwmmc_ofdata_to_platdata(struct udevice *dev)
 
        host->name = dev->name;
        host->ioaddr = (void *)dev_get_addr(dev);
-       host->buswidth = fdtdec_get_int(gd->fdt_blob, dev->of_offset,
+       host->buswidth = fdtdec_get_int(gd->fdt_blob, dev_of_offset(dev),
                                        "bus-width", 4);
        host->clksel = socfpga_dwmci_clksel;
 
@@ -92,9 +92,9 @@ static int socfpga_dwmmc_ofdata_to_platdata(struct udevice *dev)
        host->bus_hz = clk;
        host->fifoth_val = MSIZE(0x2) |
                RX_WMARK(fifo_depth / 2 - 1) | TX_WMARK(fifo_depth / 2);
-       priv->drvsel = fdtdec_get_uint(gd->fdt_blob, dev->of_offset,
+       priv->drvsel = fdtdec_get_uint(gd->fdt_blob, dev_of_offset(dev),
                                       "drvsel", 3);
-       priv->smplsel = fdtdec_get_uint(gd->fdt_blob, dev->of_offset,
+       priv->smplsel = fdtdec_get_uint(gd->fdt_blob, dev_of_offset(dev),
                                        "smplsel", 0);
        host->priv = priv;
 
index 0211dc7b80d7a3f6e53bfb0c407fff04d8e2b233..0df74ef79ae1d14566bdf162b7b9c8c38cff8c54 100644 (file)
@@ -578,8 +578,8 @@ static int tegra_mmc_probe(struct udevice *dev)
        priv->cfg.name = "Tegra SD/MMC";
        priv->cfg.ops = &tegra_mmc_ops;
 
-       bus_width = fdtdec_get_int(gd->fdt_blob, dev->of_offset, "bus-width",
-                                  1);
+       bus_width = fdtdec_get_int(gd->fdt_blob, dev_of_offset(dev),
+                                  "bus-width", 1);
 
        priv->cfg.voltages = MMC_VDD_32_33 | MMC_VDD_33_34 | MMC_VDD_165_195;
        priv->cfg.host_caps = 0;
index 4af7fdb13c91471757fb9d4459c6eba1f48bd5fa..7f20ef124d66a54401dac10362a82581d60ccaea 100644 (file)
@@ -705,7 +705,8 @@ static int uniphier_sd_probe(struct udevice *dev)
        plat->cfg.name = dev->name;
        plat->cfg.host_caps = MMC_MODE_HS_52MHz | MMC_MODE_HS;
 
-       switch (fdtdec_get_int(gd->fdt_blob, dev->of_offset, "bus-width", 1)) {
+       switch (fdtdec_get_int(gd->fdt_blob, dev_of_offset(dev), "bus-width",
+                              1)) {
        case 8:
                plat->cfg.host_caps |= MMC_MODE_8BIT;
                break;
@@ -719,7 +720,7 @@ static int uniphier_sd_probe(struct udevice *dev)
                return -EINVAL;
        }
 
-       if (fdt_get_property(gd->fdt_blob, dev->of_offset, "non-removable",
+       if (fdt_get_property(gd->fdt_blob, dev_of_offset(dev), "non-removable",
                             NULL))
                priv->caps |= UNIPHIER_SD_CAP_NONREMOVABLE;
 
index 828da111c80e279a450ab4ac15e19fa582be4240..f67811023983057b2099576e8e85e5254dbd3d97 100644 (file)
@@ -405,7 +405,8 @@ static int xenon_sdhci_probe(struct udevice *dev)
                armada_3700_soc_pad_voltage_set(host);
 
        host->host_caps = MMC_MODE_HS | MMC_MODE_HS_52MHz | MMC_MODE_DDR_52MHz;
-       switch (fdtdec_get_int(gd->fdt_blob, dev->of_offset, "bus-width", 1)) {
+       switch (fdtdec_get_int(gd->fdt_blob, dev_of_offset(dev), "bus-width",
+               1)) {
        case 8:
                host->host_caps |= MMC_MODE_8BIT;
                break;
@@ -455,7 +456,7 @@ static int xenon_sdhci_ofdata_to_platdata(struct udevice *dev)
        if (of_device_is_compatible(dev, "marvell,armada-3700-sdhci"))
                priv->pad_ctrl_reg = (void *)dev_get_addr_index(dev, 1);
 
-       name = fdt_getprop(gd->fdt_blob, dev->of_offset, "marvell,pad-type",
+       name = fdt_getprop(gd->fdt_blob, dev_of_offset(dev), "marvell,pad-type",
                           NULL);
        if (name) {
                if (0 == strncmp(name, "sd", 2)) {
index a9148a7fe41f0f0e4af4b66a0aa3ca94c3059f6d..e04964b558e54653a6b7915bf4711883e1f7f2aa 100644 (file)
@@ -349,7 +349,7 @@ static int altera_qspi_ofdata_to_platdata(struct udevice *dev)
 {
        struct altera_qspi_platdata *pdata = dev_get_platdata(dev);
        void *blob = (void *)gd->fdt_blob;
-       int node = dev->of_offset;
+       int node = dev_of_offset(dev);
        const char *list, *end;
        const fdt32_t *cell;
        void *base;
index e036b88a6256c5752021af6351da6d0185a383b1..d440f5ccd96d07816ca2be3b16cb401db0a9a638 100644 (file)
@@ -2441,7 +2441,7 @@ unsigned long flash_init (void)
 static int cfi_flash_probe(struct udevice *dev)
 {
        void *blob = (void *)gd->fdt_blob;
-       int node = dev->of_offset;
+       int node = dev_of_offset(dev);
        const fdt32_t *cell;
        phys_addr_t addr;
        int parent, addrc, sizec;
index 9166fcd9803f75a0376896632c4400f833c17b5f..8ed7874cc9f73523f34a1a9a37fedf3f7002d8c8 100644 (file)
@@ -371,7 +371,7 @@ static void pic32_flash_bank_init(flash_info_t *info,
 static int pic32_flash_probe(struct udevice *dev)
 {
        void *blob = (void *)gd->fdt_blob;
-       int node = dev->of_offset;
+       int node = dev_of_offset(dev);
        const char *list, *end;
        const fdt32_t *cell;
        unsigned long addr, size;
index 4944059fa3f16c1d8710089f18e92246854bea3b..36a50fe3a15d9ebd393765cdaa5c7462c68681c7 100644 (file)
@@ -516,7 +516,7 @@ int sandbox_sf_ofdata_to_platdata(struct udevice *dev)
 {
        struct sandbox_spi_flash_plat_data *pdata = dev_get_platdata(dev);
        const void *blob = gd->fdt_blob;
-       int node = dev->of_offset;
+       int node = dev_of_offset(dev);
 
        pdata->filename = fdt_getprop(blob, node, "sandbox,filename", NULL);
        pdata->device_name = fdt_getprop(blob, node, "compatible", NULL);
@@ -641,7 +641,7 @@ int sandbox_spi_get_emul(struct sandbox_state *state,
                debug("%s: busnum=%u, cs=%u: binding SPI flash emulation: ",
                      __func__, busnum, cs);
                ret = sandbox_sf_bind_emul(state, busnum, cs, bus,
-                                          slave->of_offset, slave->name);
+                                          dev_of_offset(slave), slave->name);
                if (ret) {
                        debug("failed (err=%d)\n", ret);
                        return ret;
index 2e378dc822aa00e2b6ad695033693e0a3b60c31b..ab7910bc1450ffe25ef8d541425a98db1296a92d 100644 (file)
@@ -919,7 +919,7 @@ int spi_flash_decode_fdt(const void *blob, struct spi_flash *flash)
 #ifdef CONFIG_DM_SPI_FLASH
        fdt_addr_t addr;
        fdt_size_t size;
-       int node = flash->dev->of_offset;
+       int node = dev_of_offset(flash->dev);
 
        addr = fdtdec_get_addr_size(blob, node, "memory-map", &size);
        if (addr == FDT_ADDR_T_NONE) {
index 346f138caf85c49802ce9296d2176388660e51dc..f8782bcbd03205bb6e92879140e3e78a87cd46f1 100644 (file)
@@ -857,7 +857,7 @@ static int ag7xxx_get_phy_iface_offset(struct udevice *dev)
 {
        int offset;
 
-       offset = fdtdec_lookup_phandle(gd->fdt_blob, dev->of_offset, "phy");
+       offset = fdtdec_lookup_phandle(gd->fdt_blob, dev_of_offset(dev), "phy");
        if (offset <= 0) {
                debug("%s: PHY OF node not found (ret=%i)\n", __func__, offset);
                return -EINVAL;
index 92a1b644958cf7050e96a66ba5afa62f2ba456ad..d4d17dd2226e7b0f2689d4452debddbe19bc206a 100644 (file)
@@ -576,7 +576,7 @@ static int altera_tse_probe(struct udevice *dev)
        struct eth_pdata *pdata = dev_get_platdata(dev);
        struct altera_tse_priv *priv = dev_get_priv(dev);
        void *blob = (void *)gd->fdt_blob;
-       int node = dev->of_offset;
+       int node = dev_of_offset(dev);
        const char *list, *end;
        const fdt32_t *cell;
        void *base, *desc_mem = NULL;
@@ -676,7 +676,8 @@ static int altera_tse_ofdata_to_platdata(struct udevice *dev)
        const char *phy_mode;
 
        pdata->phy_interface = -1;
-       phy_mode = fdt_getprop(gd->fdt_blob, dev->of_offset, "phy-mode", NULL);
+       phy_mode = fdt_getprop(gd->fdt_blob, dev_of_offset(dev), "phy-mode",
+                              NULL);
        if (phy_mode)
                pdata->phy_interface = phy_get_interface_by_name(phy_mode);
        if (pdata->phy_interface == -1) {
index e828e85d8b318fda0b8775e80cdfc5c19fc02f3f..55f56d955529b3d1d9f740e80cd1d8471532e41e 100644 (file)
@@ -20,7 +20,7 @@ static int davinci_emac_3517_get_macid(struct udevice *dev, u16 offset,
                                       int slave, u8 *mac_addr)
 {
        void *fdt = (void *)gd->fdt_blob;
-       int node = dev->of_offset;
+       int node = dev_of_offset(dev);
        u32 macid_lsb;
        u32 macid_msb;
        fdt32_t gmii = 0;
@@ -60,7 +60,7 @@ static int cpsw_am33xx_cm_get_macid(struct udevice *dev, u16 offset, int slave,
                                    u8 *mac_addr)
 {
        void *fdt = (void *)gd->fdt_blob;
-       int node = dev->of_offset;
+       int node = dev_of_offset(dev);
        u32 macid_lo;
        u32 macid_hi;
        fdt32_t gmii = 0;
@@ -110,7 +110,7 @@ int ti_cm_get_macid(struct udevice *dev, int slave, u8 *mac_addr)
        if (of_device_is_compatible(dev, "ti,dm816-emac"))
                return cpsw_am33xx_cm_get_macid(dev, 0x30, slave, mac_addr);
 
-       if (of_machine_is_compatible("ti,am4372"))
+       if (of_machine_is_compatible("ti,am43"))
                return cpsw_am33xx_cm_get_macid(dev, 0x630, slave, mac_addr);
 
        if (of_machine_is_compatible("ti,dra7"))
index cbce683eea9ab13369a0a0d8c944daeb7aca92d2..5fbab9e492f85eb044a2fefc4a3d0369fed676b1 100644 (file)
@@ -981,7 +981,7 @@ static int cpsw_phy_init(struct cpsw_priv *priv, struct cpsw_slave *slave)
 
 #ifdef CONFIG_DM_ETH
        if (slave->data->phy_of_handle)
-               phydev->dev->of_offset = slave->data->phy_of_handle;
+               dev_set_of_offset(phydev->dev, slave->data->phy_of_handle);
 #endif
 
        priv->phydev = phydev;
@@ -1286,7 +1286,7 @@ static int cpsw_eth_ofdata_to_platdata(struct udevice *dev)
        const char *phy_mode;
        const char *phy_sel_compat = NULL;
        const void *fdt = gd->fdt_blob;
-       int node = dev->of_offset;
+       int node = dev_of_offset(dev);
        int subnode;
        int slave_index = 0;
        int active_slave;
index e207bc63b837fbc60db485642f49613bd8f6b1f9..eee4e09d7ed9859339c43bce9d756c3f3713e4e0 100644 (file)
@@ -728,7 +728,8 @@ int designware_eth_ofdata_to_platdata(struct udevice *dev)
 
        pdata->iobase = dev_get_addr(dev);
        pdata->phy_interface = -1;
-       phy_mode = fdt_getprop(gd->fdt_blob, dev->of_offset, "phy-mode", NULL);
+       phy_mode = fdt_getprop(gd->fdt_blob, dev_of_offset(dev), "phy-mode",
+                              NULL);
        if (phy_mode)
                pdata->phy_interface = phy_get_interface_by_name(phy_mode);
        if (pdata->phy_interface == -1) {
@@ -737,19 +738,19 @@ int designware_eth_ofdata_to_platdata(struct udevice *dev)
        }
 
        pdata->max_speed = 0;
-       cell = fdt_getprop(gd->fdt_blob, dev->of_offset, "max-speed", NULL);
+       cell = fdt_getprop(gd->fdt_blob, dev_of_offset(dev), "max-speed", NULL);
        if (cell)
                pdata->max_speed = fdt32_to_cpu(*cell);
 
 #ifdef CONFIG_DM_GPIO
-       if (fdtdec_get_bool(gd->fdt_blob, dev->of_offset,
+       if (fdtdec_get_bool(gd->fdt_blob, dev_of_offset(dev),
                            "snps,reset-active-low"))
                reset_flags |= GPIOD_ACTIVE_LOW;
 
        ret = gpio_request_by_name(dev, "snps,reset-gpio", 0,
                &priv->reset_gpio, reset_flags);
        if (ret == 0) {
-               ret = fdtdec_get_int_array(gd->fdt_blob, dev->of_offset,
+               ret = fdtdec_get_int_array(gd->fdt_blob, dev_of_offset(dev),
                        "snps,reset-delays-us", dw_pdata->reset_delays, 3);
        } else if (ret == -ENOENT) {
                ret = 0;
index 3304fddc696ffca174477bd7f1f4859a8e8af2d0..5f34c8fe3c6e22fde41aa50bd8d2874be51a41c5 100644 (file)
@@ -1277,7 +1277,8 @@ static int fecmxc_ofdata_to_platdata(struct udevice *dev)
        priv->eth = (struct ethernet_regs *)pdata->iobase;
 
        pdata->phy_interface = -1;
-       phy_mode = fdt_getprop(gd->fdt_blob, dev->of_offset, "phy-mode", NULL);
+       phy_mode = fdt_getprop(gd->fdt_blob, dev_of_offset(dev), "phy-mode",
+                              NULL);
        if (phy_mode)
                pdata->phy_interface = phy_get_interface_by_name(phy_mode);
        if (pdata->phy_interface == -1) {
index 5f833fa711f3d4d041ed7f133a12c3ace8ea682b..e9b202ab9ae81c26d48f8f943568fc84bf781ab6 100644 (file)
@@ -36,9 +36,9 @@ static int gmac_rockchip_ofdata_to_platdata(struct udevice *dev)
 {
        struct gmac_rockchip_platdata *pdata = dev_get_platdata(dev);
 
-       pdata->tx_delay = fdtdec_get_int(gd->fdt_blob, dev->of_offset,
+       pdata->tx_delay = fdtdec_get_int(gd->fdt_blob, dev_of_offset(dev),
                                         "tx-delay", 0x30);
-       pdata->rx_delay = fdtdec_get_int(gd->fdt_blob, dev->of_offset,
+       pdata->rx_delay = fdtdec_get_int(gd->fdt_blob, dev_of_offset(dev),
                                         "rx-delay", 0x10);
 
        return designware_eth_ofdata_to_platdata(dev);
index a5120e01ad36e064d1ef77534819e2943c662cff..1b781f4d95a74939de39363f4dc532af21524fe8 100644 (file)
@@ -1099,7 +1099,7 @@ static int ks2_sl_eth_ofdata_to_platdata(struct udevice *dev)
        struct ks2_eth_priv *priv = dev_get_priv(dev);
        struct eth_pdata *pdata = dev_get_platdata(dev);
        const void *fdt = gd->fdt_blob;
-       int slave = dev->of_offset;
+       int slave = dev_of_offset(dev);
        int interfaces;
        int gbe;
        int netcp_devices;
@@ -1126,13 +1126,13 @@ static int ks2_eth_ofdata_to_platdata(struct udevice *dev)
        int netcp_devices;
        int gbe;
 
-       netcp_devices = fdt_subnode_offset(fdt, dev->of_offset,
+       netcp_devices = fdt_subnode_offset(fdt, dev_of_offset(dev),
                                           "netcp-devices");
        gbe = fdt_subnode_offset(fdt, netcp_devices, "gbe");
 
        ks2_eth_bind_slaves(dev, gbe, &gbe_0);
 
-       ks2_eth_parse_slave_interface(dev->of_offset, gbe_0, priv, pdata);
+       ks2_eth_parse_slave_interface(dev_of_offset(dev), gbe_0, priv, pdata);
 
        pdata->iobase = dev_get_addr(dev);
 
index 01527f7fc7cecd0fb6c700b72693e927062f22b5..452fc3e3b97ccde238774011bcec30f42ace90b5 100644 (file)
@@ -999,7 +999,8 @@ static int macb_eth_probe(struct udevice *dev)
 #ifdef CONFIG_DM_ETH
        const char *phy_mode;
 
-       phy_mode = fdt_getprop(gd->fdt_blob, dev->of_offset, "phy-mode", NULL);
+       phy_mode = fdt_getprop(gd->fdt_blob, dev_of_offset(dev), "phy-mode",
+                              NULL);
        if (phy_mode)
                macb->phy_interface = phy_get_interface_by_name(phy_mode);
        if (macb->phy_interface == -1) {
index 00f378f0826aebe1414a0e8139612b3371e92525..674075f037ddaaca04c61e227f59a84a8f1e7442 100644 (file)
@@ -1611,7 +1611,7 @@ static int mvneta_probe(struct udevice *dev)
        struct eth_pdata *pdata = dev_get_platdata(dev);
        struct mvneta_port *pp = dev_get_priv(dev);
        void *blob = (void *)gd->fdt_blob;
-       int node = dev->of_offset;
+       int node = dev_of_offset(dev);
        struct mii_dev *bus;
        unsigned long addr;
        void *bd_space;
@@ -1691,7 +1691,8 @@ static int mvneta_ofdata_to_platdata(struct udevice *dev)
 
        /* Get phy-mode / phy_interface from DT */
        pdata->phy_interface = -1;
-       phy_mode = fdt_getprop(gd->fdt_blob, dev->of_offset, "phy-mode", NULL);
+       phy_mode = fdt_getprop(gd->fdt_blob, dev_of_offset(dev), "phy-mode",
+                              NULL);
        if (phy_mode)
                pdata->phy_interface = phy_get_interface_by_name(phy_mode);
        if (pdata->phy_interface == -1) {
index 405776af95db191fa00c76451b25b766fcfa7943..88e88b903b3fc63757b0ed46312ef96a7c84f6a6 100644 (file)
@@ -4047,7 +4047,7 @@ static int mvpp2_probe(struct udevice *dev)
                return err;
        }
 
-       return mvpp2_port_probe(dev, port, dev->of_offset, priv,
+       return mvpp2_port_probe(dev, port, dev_of_offset(dev), priv,
                                &buffer_loc.first_rxq);
 }
 
@@ -4138,7 +4138,7 @@ static int mvpp2_base_probe(struct udevice *dev)
 static int mvpp2_base_bind(struct udevice *parent)
 {
        const void *blob = gd->fdt_blob;
-       int node = parent->of_offset;
+       int node = dev_of_offset(parent);
        struct uclass_driver *drv;
        struct udevice *dev;
        struct eth_pdata *plat;
@@ -4169,7 +4169,7 @@ static int mvpp2_base_bind(struct udevice *parent)
 
                /* Create child device UCLASS_ETH and bind it */
                device_bind(parent, &mvpp2_driver, name, plat, subnode, &dev);
-               dev->of_offset = subnode;
+               dev_set_of_offset(dev, subnode);
        }
 
        return 0;
index 7163fa257f4c5ad5f9476a862fe5b267f8684d33..0e4a4ebcc603370ce66845e507979e1aa0f7424e 100644 (file)
@@ -244,7 +244,7 @@ static int ksz90x1_of_config_group(struct phy_device *phydev,
                return -EOPNOTSUPP;
 
        for (i = 0; i < ofcfg->grpsz; i++) {
-               val[i] = fdtdec_get_uint(gd->fdt_blob, dev->of_offset,
+               val[i] = fdtdec_get_uint(gd->fdt_blob, dev_of_offset(dev),
                                         ofcfg->grp[i].name, -1);
                offset = ofcfg->grp[i].off;
                if (val[i] == -1) {
index c55dd973f4c3ea6d8d1e2cc2966e4f233d37d920..d1ce4060ff8613f51687eeb9afe433770d9e2bcf 100644 (file)
@@ -167,13 +167,13 @@ static int dp83867_of_init(struct phy_device *phydev)
        struct dp83867_private *dp83867 = phydev->priv;
        struct udevice *dev = phydev->dev;
 
-       dp83867->rx_id_delay = fdtdec_get_uint(gd->fdt_blob, dev->of_offset,
+       dp83867->rx_id_delay = fdtdec_get_uint(gd->fdt_blob, dev_of_offset(dev),
                                 "ti,rx-internal-delay", -1);
 
-       dp83867->tx_id_delay = fdtdec_get_uint(gd->fdt_blob, dev->of_offset,
+       dp83867->tx_id_delay = fdtdec_get_uint(gd->fdt_blob, dev_of_offset(dev),
                                 "ti,tx-internal-delay", -1);
 
-       dp83867->fifo_depth = fdtdec_get_uint(gd->fdt_blob, dev->of_offset,
+       dp83867->fifo_depth = fdtdec_get_uint(gd->fdt_blob, dev_of_offset(dev),
                                 "ti,fifo-depth", -1);
 
        return 0;
index 920bfcb380b30ca8469c7a75aabfa2118df6d2b2..3f80f0495e8d54ff6b74e5e3995e343595eaa9f7 100644 (file)
@@ -104,7 +104,7 @@ static int xilinxphy_of_init(struct phy_device *phydev)
        u32 phytype;
 
        debug("%s\n", __func__);
-       phytype = fdtdec_get_int(gd->fdt_blob, phydev->dev->of_offset,
+       phytype = fdtdec_get_int(gd->fdt_blob, dev_of_offset(phydev->dev),
                                 "phy-type", -1);
        if (phytype == XAE_PHY_TYPE_1000BASE_X)
                phydev->flags |= XAE_PHY_TYPE_1000BASE_X;
index 167af8bde5b2770bd2638ff2ee2361580271bf91..385aad5b7e1d735afdcecdcc5bec4570a6c73efa 100644 (file)
@@ -535,7 +535,8 @@ static int pic32_eth_probe(struct udevice *dev)
        int offset = 0;
        int phy_addr = -1;
 
-       addr = fdtdec_get_addr_size(gd->fdt_blob, dev->of_offset, "reg", &size);
+       addr = fdtdec_get_addr_size(gd->fdt_blob, dev_of_offset(dev), "reg",
+                                   &size);
        if (addr == FDT_ADDR_T_NONE)
                return -EINVAL;
 
@@ -544,7 +545,8 @@ static int pic32_eth_probe(struct udevice *dev)
 
        /* get phy mode */
        pdata->phy_interface = -1;
-       phy_mode = fdt_getprop(gd->fdt_blob, dev->of_offset, "phy-mode", NULL);
+       phy_mode = fdt_getprop(gd->fdt_blob, dev_of_offset(dev), "phy-mode",
+                              NULL);
        if (phy_mode)
                pdata->phy_interface = phy_get_interface_by_name(phy_mode);
        if (pdata->phy_interface == -1) {
@@ -553,13 +555,13 @@ static int pic32_eth_probe(struct udevice *dev)
        }
 
        /* get phy addr */
-       offset = fdtdec_lookup_phandle(gd->fdt_blob, dev->of_offset,
+       offset = fdtdec_lookup_phandle(gd->fdt_blob, dev_of_offset(dev),
                                       "phy-handle");
        if (offset > 0)
                phy_addr = fdtdec_get_int(gd->fdt_blob, offset, "reg", -1);
 
        /* phy reset gpio */
-       gpio_request_by_name_nodev(gd->fdt_blob, dev->of_offset,
+       gpio_request_by_name_nodev(gd->fdt_blob, dev_of_offset(dev),
                                   "reset-gpios", 0,
                                   &priv->rst_gpio, GPIOD_IS_OUT);
 
index 591242797e26dfff301888f1022f62ce8fa5f88d..9742c2c4f6612269b49363120a3334936da1730c 100644 (file)
@@ -26,7 +26,7 @@ static int sb_eth_raw_start(struct udevice *dev)
 
        debug("eth_sandbox_raw: Start\n");
 
-       interface = fdt_getprop(gd->fdt_blob, dev->of_offset,
+       interface = fdt_getprop(gd->fdt_blob, dev_of_offset(dev),
                                            "host-raw-interface", NULL);
        if (interface == NULL)
                return -EINVAL;
index d538d379bbec77cb54c7072b63480218f3d456dd..79d0ae68bfd5281ff2d0c985053de8e9d71925d5 100644 (file)
@@ -60,8 +60,9 @@ static int sb_eth_start(struct udevice *dev)
 
        debug("eth_sandbox: Start\n");
 
-       fdtdec_get_byte_array(gd->fdt_blob, dev->of_offset, "fake-host-hwaddr",
-                             priv->fake_host_hwaddr, ARP_HLEN);
+       fdtdec_get_byte_array(gd->fdt_blob, dev_of_offset(dev),
+                             "fake-host-hwaddr", priv->fake_host_hwaddr,
+                             ARP_HLEN);
        priv->recv_packet_buffer = net_rx_packets[0];
        return 0;
 }
index abd9cc8bc0b3ba51ab826b1cfc8c4bbfd9e675aa..b87210bad7923c1b0ae56f61c928794b5407463f 100644 (file)
@@ -442,7 +442,7 @@ static int parse_phy_pins(struct udevice *dev)
        const char *pin_name;
        int drive, pull, i;
 
-       offset = fdtdec_lookup_phandle(gd->fdt_blob, dev->of_offset,
+       offset = fdtdec_lookup_phandle(gd->fdt_blob, dev_of_offset(dev),
                                       "pinctrl-0");
        if (offset < 0) {
                printf("WARNING: emac: cannot find pinctrl-0 node\n");
@@ -716,6 +716,7 @@ static int sun8i_emac_eth_ofdata_to_platdata(struct udevice *dev)
        struct eth_pdata *pdata = dev_get_platdata(dev);
        struct emac_eth_dev *priv = dev_get_priv(dev);
        const char *phy_mode;
+       int node = dev_of_offset(dev);
        int offset = 0;
 
        pdata->iobase = dev_get_addr_name(dev, "emac");
@@ -725,13 +726,13 @@ static int sun8i_emac_eth_ofdata_to_platdata(struct udevice *dev)
        priv->phyaddr = -1;
        priv->use_internal_phy = false;
 
-       offset = fdtdec_lookup_phandle(gd->fdt_blob, dev->of_offset,
+       offset = fdtdec_lookup_phandle(gd->fdt_blob, node,
                                       "phy");
        if (offset > 0)
                priv->phyaddr = fdtdec_get_int(gd->fdt_blob, offset, "reg",
                                               -1);
 
-       phy_mode = fdt_getprop(gd->fdt_blob, dev->of_offset, "phy-mode", NULL);
+       phy_mode = fdt_getprop(gd->fdt_blob, node, "phy-mode", NULL);
 
        if (phy_mode)
                pdata->phy_interface = phy_get_interface_by_name(phy_mode);
@@ -751,7 +752,7 @@ static int sun8i_emac_eth_ofdata_to_platdata(struct udevice *dev)
        }
 
        if (priv->variant == H3_EMAC) {
-               if (fdt_getprop(gd->fdt_blob, dev->of_offset,
+               if (fdt_getprop(gd->fdt_blob, node,
                                "allwinner,use-internal-phy", NULL))
                        priv->use_internal_phy = true;
        }
index 7df4c63acfd7888b08be6a4cf1fcd46443fd7295..f2ce4e2a8edb743c0616ea23e4655f983069826d 100644 (file)
@@ -783,7 +783,7 @@ int tsec_probe(struct udevice *dev)
        pdata->iobase = (phys_addr_t)dev_get_addr(dev);
        priv->regs = (struct tsec *)pdata->iobase;
 
-       offset = fdtdec_lookup_phandle(gd->fdt_blob, dev->of_offset,
+       offset = fdtdec_lookup_phandle(gd->fdt_blob, dev_of_offset(dev),
                                       "phy-handle");
        if (offset > 0) {
                reg = fdtdec_get_int(gd->fdt_blob, offset, "reg", 0);
@@ -802,7 +802,7 @@ int tsec_probe(struct udevice *dev)
                return -ENOENT;
        }
 
-       offset = fdtdec_lookup_phandle(gd->fdt_blob, dev->of_offset,
+       offset = fdtdec_lookup_phandle(gd->fdt_blob, dev_of_offset(dev),
                                       "tbi-handle");
        if (offset > 0) {
                reg = fdtdec_get_int(gd->fdt_blob, offset, "reg",
@@ -812,7 +812,7 @@ int tsec_probe(struct udevice *dev)
                priv->tbiaddr = CONFIG_SYS_TBIPA_VALUE;
        }
 
-       phy_mode = fdt_getprop(gd->fdt_blob, dev->of_offset,
+       phy_mode = fdt_getprop(gd->fdt_blob, dev_of_offset(dev),
                               "phy-connection-type", NULL);
        if (phy_mode)
                pdata->phy_interface = phy_get_interface_by_name(phy_mode);
index 51c74266637cc9c5747c289f07ab3adf58c1ecb3..a6f24b3cbecb138a3e780586088ed318b744fd1d 100644 (file)
@@ -682,13 +682,14 @@ static int axi_emac_ofdata_to_platdata(struct udevice *dev)
 {
        struct eth_pdata *pdata = dev_get_platdata(dev);
        struct axidma_priv *priv = dev_get_priv(dev);
+       int node = dev_of_offset(dev);
        int offset = 0;
        const char *phy_mode;
 
        pdata->iobase = (phys_addr_t)dev_get_addr(dev);
        priv->iobase = (struct axi_regs *)pdata->iobase;
 
-       offset = fdtdec_lookup_phandle(gd->fdt_blob, dev->of_offset,
+       offset = fdtdec_lookup_phandle(gd->fdt_blob, node,
                                       "axistream-connected");
        if (offset <= 0) {
                printf("%s: axistream is not found\n", __func__);
@@ -705,12 +706,11 @@ static int axi_emac_ofdata_to_platdata(struct udevice *dev)
 
        priv->phyaddr = -1;
 
-       offset = fdtdec_lookup_phandle(gd->fdt_blob, dev->of_offset,
-                                      "phy-handle");
+       offset = fdtdec_lookup_phandle(gd->fdt_blob, node, "phy-handle");
        if (offset > 0)
                priv->phyaddr = fdtdec_get_int(gd->fdt_blob, offset, "reg", -1);
 
-       phy_mode = fdt_getprop(gd->fdt_blob, dev->of_offset, "phy-mode", NULL);
+       phy_mode = fdt_getprop(gd->fdt_blob, node, "phy-mode", NULL);
        if (phy_mode)
                pdata->phy_interface = phy_get_interface_by_name(phy_mode);
        if (pdata->phy_interface == -1) {
index ea93cf906ed76063ab0577dfd314f6fc1c8e2431..7d4e14f8ef33a41b4defd59519d2643aff90c8d8 100644 (file)
@@ -604,15 +604,15 @@ static int emaclite_ofdata_to_platdata(struct udevice *dev)
 
        emaclite->phyaddr = -1;
 
-       offset = fdtdec_lookup_phandle(gd->fdt_blob, dev->of_offset,
+       offset = fdtdec_lookup_phandle(gd->fdt_blob, dev_of_offset(dev),
                                      "phy-handle");
        if (offset > 0)
                emaclite->phyaddr = fdtdec_get_int(gd->fdt_blob, offset,
                                                   "reg", -1);
 
-       emaclite->txpp = fdtdec_get_int(gd->fdt_blob, dev->of_offset,
+       emaclite->txpp = fdtdec_get_int(gd->fdt_blob, dev_of_offset(dev),
                                        "xlnx,tx-ping-pong", 0);
-       emaclite->rxpp = fdtdec_get_int(gd->fdt_blob, dev->of_offset,
+       emaclite->rxpp = fdtdec_get_int(gd->fdt_blob, dev_of_offset(dev),
                                        "xlnx,rx-ping-pong", 0);
 
        printf("EMACLITE: %lx, phyaddr %d, %d/%d\n", (ulong)emaclite->regs,
index 6dd87cf28f95540da795f9b414be4def7e494439..86dd03fedaf6a3e11843975201c1cc3bb899438f 100644 (file)
@@ -345,7 +345,7 @@ static int zynq_phy_init(struct udevice *dev)
        priv->phydev->advertising = priv->phydev->supported;
 
        if (priv->phy_of_handle > 0)
-               priv->phydev->dev->of_offset = priv->phy_of_handle;
+               dev_set_of_offset(priv->phydev->dev, priv->phy_of_handle);
 
        return phy_config(priv->phydev);
 }
@@ -684,6 +684,7 @@ static int zynq_gem_ofdata_to_platdata(struct udevice *dev)
 {
        struct eth_pdata *pdata = dev_get_platdata(dev);
        struct zynq_gem_priv *priv = dev_get_priv(dev);
+       int node = dev_of_offset(dev);
        const char *phy_mode;
 
        pdata->iobase = (phys_addr_t)dev_get_addr(dev);
@@ -692,13 +693,13 @@ static int zynq_gem_ofdata_to_platdata(struct udevice *dev)
        priv->emio = 0;
        priv->phyaddr = -1;
 
-       priv->phy_of_handle = fdtdec_lookup_phandle(gd->fdt_blob,
-                                       dev->of_offset, "phy-handle");
+       priv->phy_of_handle = fdtdec_lookup_phandle(gd->fdt_blob, node,
+                                                   "phy-handle");
        if (priv->phy_of_handle > 0)
                priv->phyaddr = fdtdec_get_int(gd->fdt_blob,
                                        priv->phy_of_handle, "reg", -1);
 
-       phy_mode = fdt_getprop(gd->fdt_blob, dev->of_offset, "phy-mode", NULL);
+       phy_mode = fdt_getprop(gd->fdt_blob, node, "phy-mode", NULL);
        if (phy_mode)
                pdata->phy_interface = phy_get_interface_by_name(phy_mode);
        if (pdata->phy_interface == -1) {
@@ -707,7 +708,7 @@ static int zynq_gem_ofdata_to_platdata(struct udevice *dev)
        }
        priv->interface = pdata->phy_interface;
 
-       priv->emio = fdtdec_get_bool(gd->fdt_blob, dev->of_offset, "xlnx,emio");
+       priv->emio = fdtdec_get_bool(gd->fdt_blob, node, "xlnx,emio");
 
        printf("ZYNQ GEM: %lx, phyaddr %x, interface %s\n", (ulong)priv->iobase,
               priv->phyaddr, phy_string_for_interface(priv->interface));
index 3b00e6a41b36c040e3c1298bf4f5b1248c51872a..a1408f5bf1ca7c157f4210759ae0a73617020ead 100644 (file)
@@ -839,8 +839,9 @@ static int pci_uclass_pre_probe(struct udevice *bus)
        /* For bridges, use the top-level PCI controller */
        if (!device_is_on_pci_bus(bus)) {
                hose->ctlr = bus;
-               ret = decode_regions(hose, gd->fdt_blob, bus->parent->of_offset,
-                               bus->of_offset);
+               ret = decode_regions(hose, gd->fdt_blob,
+                                    dev_of_offset(bus->parent),
+                                    dev_of_offset(bus));
                if (ret) {
                        debug("%s: Cannot decode regions\n", __func__);
                        return ret;
@@ -903,7 +904,7 @@ static int pci_uclass_child_post_bind(struct udevice *dev)
        struct fdt_pci_addr addr;
        int ret;
 
-       if (dev->of_offset == -1)
+       if (dev_of_offset(dev) == -1)
                return 0;
 
        /*
@@ -911,7 +912,7 @@ static int pci_uclass_child_post_bind(struct udevice *dev)
         * just check the address.
         */
        pplat = dev_get_parent_platdata(dev);
-       ret = fdtdec_get_pci_addr(gd->fdt_blob, dev->of_offset,
+       ret = fdtdec_get_pci_addr(gd->fdt_blob, dev_of_offset(dev),
                                  FDT_PCI_SPACE_CONFIG, "reg", &addr);
 
        if (ret) {
index cd083f7dde8c8353585416df3fe86b47f50c5a67..57204c4f3f1ca098b19d60767320aa9542f081a1 100644 (file)
@@ -334,7 +334,7 @@ int dm_pci_run_vga_bios(struct udevice *dev, int (*int15_handler)(void),
                        goto err;
 #endif
        } else {
-#ifdef CONFIG_X86
+#if defined(CONFIG_X86) && CONFIG_IS_ENABLED(X86_32BIT_INIT)
                bios_set_interrupt_handler(0x15, int15_handler);
 
                bios_run_on_x86(dev, (unsigned long)ram, vesa_mode,
index 430270ec2923597412f039d41f76117562f4d9f8..7d9c63b06f20eee9dce8dbc6b2aa5c160d908d81 100644 (file)
@@ -1099,7 +1099,7 @@ static int pci_tegra_ofdata_to_platdata(struct udevice *dev)
 
        INIT_LIST_HEAD(&pcie->ports);
 
-       if (tegra_pcie_parse_dt(gd->fdt_blob, dev->of_offset, id, pcie))
+       if (tegra_pcie_parse_dt(gd->fdt_blob, dev_of_offset(dev), id, pcie))
                return -EINVAL;
 
        return 0;
index 90b9fe2a17a82b34136754adaa9ea5b2cf590da5..b6806cf67b69bae3f5babaf5a94ffe8d88949fbc 100644 (file)
@@ -438,7 +438,7 @@ static int ls_pcie_probe(struct udevice *dev)
 {
        struct ls_pcie *pcie = dev_get_priv(dev);
        const void *fdt = gd->fdt_blob;
-       int node = dev->of_offset;
+       int node = dev_of_offset(dev);
        u8 header_type;
        u16 link_sta;
        bool ep_mode;
index 521600180e6d0068b0b9d30e667ab356027a445c..08e2e9344583072ab4f44fc48f009962647e68b8 100644 (file)
@@ -186,7 +186,7 @@ static int pcie_xilinx_ofdata_to_platdata(struct udevice *dev)
        DECLARE_GLOBAL_DATA_PTR;
        int err;
 
-       err = fdt_get_resource(gd->fdt_blob, dev->of_offset, "reg",
+       err = fdt_get_resource(gd->fdt_blob, dev_of_offset(dev), "reg",
                               0, &reg_res);
        if (err < 0) {
                error("\"reg\" resource not found\n");
index bc2508bb7e0372137ee7b861e00189c08f4ef27a..caa1928f07dccd6a5113486766cf01581f44e873 100644 (file)
@@ -107,7 +107,7 @@ void comphy_print(struct chip_serdes_phy_config *chip_cfg,
 static int comphy_probe(struct udevice *dev)
 {
        const void *blob = gd->fdt_blob;
-       int node = dev->of_offset;
+       int node = dev_of_offset(dev);
        struct chip_serdes_phy_config *chip_cfg = dev_get_priv(dev);
        struct comphy_map comphy_map_data[MAX_LANE_OPTIONS];
        int subnode;
index e3f64b63553cd6aaba741edd062b0f6ff8a668b8..fccc7c4b0668cfc8b15a6440fc0363989a9cf6fb 100644 (file)
@@ -75,7 +75,7 @@ static int ar933x_pinctrl_get_periph_id(struct udevice *dev,
        u32 cell[2];
        int ret;
 
-       ret = fdtdec_get_int_array(gd->fdt_blob, periph->of_offset,
+       ret = fdtdec_get_int_array(gd->fdt_blob, dev_of_offset(periph),
                                   "interrupts", cell, ARRAY_SIZE(cell));
        if (ret < 0)
                return -EINVAL;
index d02597e968aca76fd1edc5b1482e1030cad48ab9..a7f8c7082e80110fe623dc8bfbd08d8a67a1af9e 100644 (file)
@@ -95,7 +95,7 @@ static int qca953x_pinctrl_get_periph_id(struct udevice *dev,
        u32 cell[2];
        int ret;
 
-       ret = fdtdec_get_int_array(gd->fdt_blob, periph->of_offset,
+       ret = fdtdec_get_int_array(gd->fdt_blob, dev_of_offset(periph),
                                   "interrupts", cell, ARRAY_SIZE(cell));
        if (ret < 0)
                return -EINVAL;
index dd0a16ef5fab75295bb43050d4d24f71998d2d65..5b9a592b0da6f9cf3d1851cc06324723bed376f2 100644 (file)
@@ -70,7 +70,7 @@ static unsigned long pin_to_bank_base(struct udevice *dev, const char *pin_name,
 int exynos_pinctrl_set_state(struct udevice *dev, struct udevice *config)
 {
        const void *fdt = gd->fdt_blob;
-       int node = config->of_offset;
+       int node = dev_of_offset(config);
        unsigned int count, idx, pin_num;
        unsigned int pinfunc, pinpud, pindrv;
        unsigned long reg, value;
index 30f7cfc8200acdb68fd46b10fd5ecec0f6b9bfd5..b5486b8fe4bff10f9df263b5b7dec7c9cbb64cd8 100644 (file)
@@ -142,19 +142,19 @@ int meson_pinctrl_probe(struct udevice *dev)
        int node, gpio = -1, len;
        int na, ns;
 
-       na = fdt_address_cells(gd->fdt_blob, dev->parent->of_offset);
+       na = fdt_address_cells(gd->fdt_blob, dev_of_offset(dev->parent));
        if (na < 1) {
                debug("bad #address-cells\n");
                return -EINVAL;
        }
 
-       ns = fdt_size_cells(gd->fdt_blob, dev->parent->of_offset);
+       ns = fdt_size_cells(gd->fdt_blob, dev_of_offset(dev->parent));
        if (ns < 1) {
                debug("bad #size-cells\n");
                return -EINVAL;
        }
 
-       fdt_for_each_subnode(node, gd->fdt_blob, dev->of_offset) {
+       fdt_for_each_subnode(node, gd->fdt_blob, dev_of_offset(dev)) {
                if (fdt_getprop(gd->fdt_blob, node, "gpio-controller", &len)) {
                        gpio = node;
                        break;
index b07763931fe8a2c102b9fdf0f3ba1daddbc46e26..80f0dfaf91b0c3a089cc90165c7a05c3814c013e 100644 (file)
@@ -28,7 +28,7 @@ DECLARE_GLOBAL_DATA_PTR;
 int mvebu_pinctrl_set_state(struct udevice *dev, struct udevice *config)
 {
        const void *blob = gd->fdt_blob;
-       int node = config->of_offset;
+       int node = dev_of_offset(config);
        struct mvebu_pinctrl_priv *priv;
        u32 pin_arr[MVEBU_MAX_PINS_PER_BANK];
        u32 function;
@@ -82,7 +82,7 @@ static int mvebu_pinctrl_set_state_all(struct udevice *dev,
                                       struct udevice *config)
 {
        const void *blob = gd->fdt_blob;
-       int node = config->of_offset;
+       int node = dev_of_offset(config);
        struct mvebu_pinctrl_priv *priv;
        u32 func_arr[MVEBU_MAX_PINS_PER_BANK];
        int pin, err;
@@ -128,7 +128,7 @@ static int mvebu_pinctrl_set_state_all(struct udevice *dev,
 int mvebu_pinctl_probe(struct udevice *dev)
 {
        const void *blob = gd->fdt_blob;
-       int node = dev->of_offset;
+       int node = dev_of_offset(dev);
        struct mvebu_pinctrl_priv *priv;
 
        priv = dev_get_priv(dev);
index 949d0f32d8b9cfeed5b5064780d48aaf1eb509e0..e130faf8764ef44122a961d41f60679f3822f51a 100644 (file)
@@ -19,7 +19,7 @@ static int imx_pinctrl_set_state(struct udevice *dev, struct udevice *config)
 {
        struct imx_pinctrl_priv *priv = dev_get_priv(dev);
        struct imx_pinctrl_soc_info *info = priv->info;
-       int node = config->of_offset;
+       int node = dev_of_offset(config);
        const struct fdt_property *prop;
        u32 *pin_data;
        int npins, size, pin_size;
@@ -176,7 +176,7 @@ int imx_pinctrl_probe(struct udevice *dev,
                      struct imx_pinctrl_soc_info *info)
 {
        struct imx_pinctrl_priv *priv = dev_get_priv(dev);
-       int node = dev->of_offset, ret;
+       int node = dev_of_offset(dev), ret;
        struct fdtdec_phandle_args arg;
        fdt_addr_t addr;
        fdt_size_t size;
@@ -189,7 +189,8 @@ int imx_pinctrl_probe(struct udevice *dev,
        priv->dev = dev;
        priv->info = info;
 
-       addr = fdtdec_get_addr_size(gd->fdt_blob, dev->of_offset, "reg", &size);
+       addr = fdtdec_get_addr_size(gd->fdt_blob, dev_of_offset(dev), "reg",
+                                   &size);
 
        if (addr == FDT_ADDR_T_NONE)
                return -EINVAL;
index 6d4aadc32c0bcfb64b36df96cdc877bb4e073fb1..5c6bff568ad0154a88ab36903bd40a9093e56d98 100644 (file)
@@ -109,7 +109,7 @@ static int atmel_pinctrl_set_state(struct udevice *dev, struct udevice *config)
 {
        struct atmel_pio4_port *bank_base;
        const void *blob = gd->fdt_blob;
-       int node = config->of_offset;
+       int node = dev_of_offset(config);
        u32 offset, func, bank, line;
        u32 cells[MAX_PINMUX_ENTRIES];
        u32 i, conf;
index 3629322dbb380ad9867dfcd855ef22eb55556d24..0272496b51d13ba8613c5e555b27cc0ac240f1e5 100644 (file)
@@ -245,7 +245,7 @@ static int pinctrl_generic_set_state_one(struct udevice *dev,
                                         bool is_group, unsigned selector)
 {
        const void *fdt = gd->fdt_blob;
-       int node_offset = config->of_offset;
+       int node_offset = dev_of_offset(config);
        const char *propname;
        const void *value;
        int prop_offset, len, func_selector, param, ret;
@@ -300,7 +300,7 @@ static int pinctrl_generic_set_state_subnode(struct udevice *dev,
                                             struct udevice *config)
 {
        const void *fdt = gd->fdt_blob;
-       int node = config->of_offset;
+       int node = dev_of_offset(config);
        const char *subnode_target_type = "pins";
        bool is_group = false;
        const char *name;
index 02ab9b4afde6499ad9deee4b68fcd6b4b7947cd7..49afe91c24eff576e81adcb87e02e1ed78023235 100644 (file)
@@ -64,7 +64,7 @@ static int pinctrl_config_one(struct udevice *config)
 static int pinctrl_select_state_full(struct udevice *dev, const char *statename)
 {
        const void *fdt = gd->fdt_blob;
-       int node = dev->of_offset;
+       int node = dev_of_offset(dev);
        char propname[32]; /* long enough */
        const fdt32_t *list;
        uint32_t phandle;
@@ -122,7 +122,7 @@ static int pinctrl_select_state_full(struct udevice *dev, const char *statename)
 static int pinconfig_post_bind(struct udevice *dev)
 {
        const void *fdt = gd->fdt_blob;
-       int offset = dev->of_offset;
+       int offset = dev_of_offset(dev);
        bool pre_reloc_only = !(gd->flags & GD_FLG_RELOC);
        const char *name;
        int ret;
index 9acac29133cb900259eab828c7aa90a771060dbe..59466ee02e637d72ed87776825e5f182a8d88904 100644 (file)
@@ -253,7 +253,7 @@ static int pic32_pinctrl_get_periph_id(struct udevice *dev,
        int ret;
        u32 cell[2];
 
-       ret = fdtdec_get_int_array(gd->fdt_blob, periph->of_offset,
+       ret = fdtdec_get_int_array(gd->fdt_blob, dev_of_offset(periph),
                                   "interrupts", cell, ARRAY_SIZE(cell));
        if (ret < 0)
                return -EINVAL;
@@ -310,7 +310,7 @@ static int pic32_pinctrl_probe(struct udevice *dev)
        struct pic32_pinctrl_priv *priv = dev_get_priv(dev);
        struct fdt_resource res;
        void *fdt = (void *)gd->fdt_blob;
-       int node = dev->of_offset;
+       int node = dev_of_offset(dev);
        int ret;
 
        ret = fdt_get_named_resource(fdt, node, "reg", "reg-names",
index 6aea856aa63f119b816ac62ac0879e7e711411f1..8d42584b31517431670f2669e0fe239d4d9ffc43 100644 (file)
@@ -205,7 +205,7 @@ static int rk3036_pinctrl_get_periph_id(struct udevice *dev,
        u32 cell[3];
        int ret;
 
-       ret = fdtdec_get_int_array(gd->fdt_blob, periph->of_offset,
+       ret = fdtdec_get_int_array(gd->fdt_blob, dev_of_offset(periph),
                                   "interrupts", cell, ARRAY_SIZE(cell));
        if (ret < 0)
                return -EINVAL;
index 03222647cade379d62d2aea4ec73e5b343426bda..cb13d30da8e9e8769a1053a6281f4126ac10af2d 100644 (file)
@@ -479,7 +479,7 @@ static int rk3288_pinctrl_get_periph_id(struct udevice *dev,
        u32 cell[3];
        int ret;
 
-       ret = fdtdec_get_int_array(gd->fdt_blob, periph->of_offset,
+       ret = fdtdec_get_int_array(gd->fdt_blob, dev_of_offset(periph),
                                   "interrupts", cell, ARRAY_SIZE(cell));
        if (ret < 0)
                return -EINVAL;
@@ -644,7 +644,7 @@ static int rk3288_pinctrl_set_state(struct udevice *dev, struct udevice *config)
        u32 cell[60], *ptr;
 
        debug("%s: %s %s\n", __func__, dev->name, config->name);
-       ret = fdtdec_get_int_array_count(blob, config->of_offset,
+       ret = fdtdec_get_int_array_count(blob, dev_of_offset(config),
                                         "rockchip,pins", cell,
                                         ARRAY_SIZE(cell));
        if (ret < 0) {
index 17ea165edaf11eea3bb656a70b7905fd7375fabf..da301544c99174fc9f3b3e6f4a5ea82e03cbef00 100644 (file)
@@ -362,7 +362,7 @@ static int rk3399_pinctrl_get_periph_id(struct udevice *dev,
        u32 cell[3];
        int ret;
 
-       ret = fdtdec_get_int_array(gd->fdt_blob, periph->of_offset,
+       ret = fdtdec_get_int_array(gd->fdt_blob, dev_of_offset(periph),
                                   "interrupts", cell, ARRAY_SIZE(cell));
        if (ret < 0)
                return -EINVAL;
index 1bb6262fa1b9b799f19ff0eec542b8a7fc1eee47..3dabbe4ac0aa274ff5a3ad73b4c447274795757a 100644 (file)
@@ -41,7 +41,7 @@ int power_domain_get(struct udevice *dev, struct power_domain *power_domain)
 
        debug("%s(dev=%p, power_domain=%p)\n", __func__, dev, power_domain);
 
-       ret = fdtdec_parse_phandle_with_args(gd->fdt_blob, dev->of_offset,
+       ret = fdtdec_parse_phandle_with_args(gd->fdt_blob, dev_of_offset(dev),
                                             "power-domains",
                                             "#power-domain-cells", 0, 0,
                                             &args);
index e8164bfd08afab318252a10a6da0f8582ed8815d..15da12edea9e7708bc404db64d4cb0a2cd89776c 100644 (file)
@@ -52,7 +52,7 @@ static int act8846_bind(struct udevice *dev)
        int regulators_node;
        int children;
 
-       regulators_node = fdt_subnode_offset(blob, dev->of_offset,
+       regulators_node = fdt_subnode_offset(blob, dev_of_offset(dev),
                                             "regulators");
        if (regulators_node <= 0) {
                debug("%s: %s regulators subnode not found!", __func__,
index aeab5c949adf864f0efca6cf8fa8b463f1f2c894..4f92e3dad8228565021a5aab4252ed1f048ba314 100644 (file)
@@ -108,9 +108,9 @@ static int sandbox_i2c_pmic_ofdata_to_platdata(struct udevice *emul)
 
        debug("%s:%d Setting PMIC default registers\n", __func__, __LINE__);
 
-       reg_defaults = fdtdec_locate_byte_array(gd->fdt_blob, emul->of_offset,
-                                               "reg-defaults",
-                                               SANDBOX_PMIC_REG_COUNT);
+       reg_defaults = fdtdec_locate_byte_array(gd->fdt_blob,
+                       dev_of_offset(emul), "reg-defaults",
+                       SANDBOX_PMIC_REG_COUNT);
 
        if (!reg_defaults) {
                error("Property \"reg-defaults\" not found for device: %s!",
index 307f96bad1b8fefce8961ceaf1e83a840c2b2aa1..d8f30df371b86eb0d838e3ed4a0a9a357ed9e518 100644 (file)
@@ -49,7 +49,7 @@ static int lp873x_bind(struct udevice *dev)
        int regulators_node;
        const void *blob = gd->fdt_blob;
        int children;
-       int node = dev->of_offset;
+       int node = dev_of_offset(dev);
 
        regulators_node = fdt_subnode_offset(blob, node, "regulators");
 
index dc5a54a6a3aca82b229b03ae1710519f2581a013..8295fab3f02d4c162f3a60d0338614be6d170e62 100644 (file)
@@ -54,7 +54,7 @@ static int max77686_bind(struct udevice *dev)
        const void *blob = gd->fdt_blob;
        int children;
 
-       regulators_node = fdt_subnode_offset(blob, dev->of_offset,
+       regulators_node = fdt_subnode_offset(blob, dev_of_offset(dev),
                                             "voltage-regulators");
        if (regulators_node <= 0) {
                debug("%s: %s regulators subnode not found!", __func__,
index 0ab425e5dc70770549019816226f7886e45e56ec..f5a23073c4a2a38d41fd123c8c44e4347812e21e 100644 (file)
@@ -49,7 +49,7 @@ static int palmas_bind(struct udevice *dev)
        int pmic_node = -1, regulators_node;
        const void *blob = gd->fdt_blob;
        int children;
-       int node = dev->of_offset;
+       int node = dev_of_offset(dev);
        int subnode, len;
 
        fdt_for_each_subnode(subnode, blob, node) {
index 3beb48eeac522901a698d94253aff51b7b3968cd..90a43f2fe52c449317f387fd08b18114d37d4689 100644 (file)
@@ -56,7 +56,7 @@ static int pfuze100_bind(struct udevice *dev)
        int regulators_node;
        const void *blob = gd->fdt_blob;
 
-       regulators_node = fdt_subnode_offset(blob, dev->of_offset,
+       regulators_node = fdt_subnode_offset(blob, dev_of_offset(dev),
                                             "regulators");
        if (regulators_node <= 0) {
                debug("%s: %s regulators subnode not found!", __func__,
index 7211026aecbea883c7ad42a0262d9d9f8cb56306..0f7fa517f9967c7dd48bde23c4dc1844cbc1da52 100644 (file)
@@ -33,7 +33,7 @@ int pmic_bind_children(struct udevice *pmic, int offset,
        int ret;
 
        debug("%s for '%s' at node offset: %d\n", __func__, pmic->name,
-             pmic->of_offset);
+             dev_of_offset(pmic));
 
        for (node = fdt_first_subnode(blob, offset);
             node > 0;
index 770f471672e8f8a8677664631d43400134d17c55..3f5f316b56ffdbeddc1a5c085b0b7a1642cddfa9 100644 (file)
@@ -61,7 +61,7 @@ static int rk808_bind(struct udevice *dev)
        int regulators_node;
        int children;
 
-       regulators_node = fdt_subnode_offset(blob, dev->of_offset,
+       regulators_node = fdt_subnode_offset(blob, dev_of_offset(dev),
                                             "regulators");
        if (regulators_node <= 0) {
                debug("%s: %s regulators subnode not found!", __func__,
index 075fe7e2f15c01acdd7da2597e56c4dc87272650..25d673b9981052cadd12e8c61fddd67315a4c215 100644 (file)
@@ -58,7 +58,7 @@ static int s5m8767_bind(struct udevice *dev)
        const void *blob = gd->fdt_blob;
        int children;
 
-       node = fdt_subnode_offset(blob, dev->of_offset, "regulators");
+       node = fdt_subnode_offset(blob, dev_of_offset(dev), "regulators");
        if (node <= 0) {
                debug("%s: %s regulators subnode not found!", __func__,
                      dev->name);
index 3e56acd5e274243671cf35fbe9c0ab4180d56af0..b4e412eb3efac74298b61de334cc4393babbda43 100644 (file)
@@ -51,7 +51,7 @@ static int sandbox_pmic_read(struct udevice *dev, uint reg,
 
 static int sandbox_pmic_bind(struct udevice *dev)
 {
-       if (!pmic_bind_children(dev, dev->of_offset, pmic_children_info))
+       if (!pmic_bind_children(dev, dev_of_offset(dev), pmic_children_info))
                error("%s:%d PMIC: %s - no child found!", __func__, __LINE__,
                                                          dev->name);
 
index 4797f327facc02fb40fb39eb57649effe7cd42f2..b30a7f08e957454062ea536acaa9ac70d60f651c 100644 (file)
@@ -56,7 +56,7 @@ static int tps65090_bind(struct udevice *dev)
        const void *blob = gd->fdt_blob;
        int children;
 
-       regulators_node = fdt_subnode_offset(blob, dev->of_offset,
+       regulators_node = fdt_subnode_offset(blob, dev_of_offset(dev),
                                             "regulators");
        if (regulators_node <= 0) {
                debug("%s: %s regulators subnode not found!", __func__,
index 3d2d9081c1b1fbb45d4f2b400bd83c06b0a8f269..cd5213766dc8707a6fe4a637a4f965a263d27a05 100644 (file)
@@ -28,7 +28,7 @@ static int fixed_regulator_ofdata_to_platdata(struct udevice *dev)
        struct fixed_regulator_platdata *dev_pdata;
        struct gpio_desc *gpio;
        const void *blob = gd->fdt_blob;
-       int node = dev->of_offset, flags = GPIOD_IS_OUT;
+       int node = dev_of_offset(dev), flags = GPIOD_IS_OUT;
        int ret;
 
        dev_pdata = dev_get_platdata(dev);
@@ -54,7 +54,7 @@ static int fixed_regulator_ofdata_to_platdata(struct udevice *dev)
 
        /* Get optional ramp up delay */
        dev_pdata->startup_delay_us = fdtdec_get_uint(gd->fdt_blob,
-                                                     dev->of_offset,
+                                                     dev_of_offset(dev),
                                                      "startup-delay-us", 0);
 
        return 0;
index 0a60a9cfc6a20d26ad0db54b6abceaead93cc1b6..42391c69b4307bcf9eaf005570d56186db2469a6 100644 (file)
@@ -30,7 +30,7 @@ static int gpio_regulator_ofdata_to_platdata(struct udevice *dev)
        struct gpio_regulator_platdata *dev_pdata;
        struct gpio_desc *gpio;
        const void *blob = gd->fdt_blob;
-       int node = dev->of_offset;
+       int node = dev_of_offset(dev);
        int ret, count, i, j;
        u32 states_array[8];
 
index cce7cd2fc222a06040c3a4e071d45250560dd481..399f7a5f5513e1a0a7cb9a34c477d5fe5e687266 100644 (file)
@@ -356,7 +356,7 @@ static int palmas_smps_probe(struct udevice *dev)
                case 8:
                case 9:
                case 10:
-                       idx = dev->driver_data - 4;
+                       idx = dev->driver_data - 3;
                        uc_pdata->ctrl_reg = palmas_smps_ctrl[type][idx];
                        uc_pdata->volt_reg = palmas_smps_volt[type][idx];
                        break;
index b0a4c5da6d807c7d0668387434bea528dd3dfa7b..4875238e43d7935e9a772f33acc1fc638ce348de 100644 (file)
@@ -88,7 +88,7 @@ static int pwm_regulator_ofdata_to_platdata(struct udevice *dev)
        struct pwm_regulator_info *priv = dev_get_priv(dev);
        struct fdtdec_phandle_args args;
        const void *blob = gd->fdt_blob;
-       int node = dev->of_offset;
+       int node = dev_of_offset(dev);
        int ret;
 
        ret = fdtdec_parse_phandle_with_args(blob, node, "pwms", "#pwm-cells",
index 52a107036325e2fb31d150e7fd3890d3f72432df..2e0b5ed307f9e8447781336484258762a82b0905 100644 (file)
@@ -278,7 +278,7 @@ static bool regulator_name_is_unique(struct udevice *check_dev,
 static int regulator_post_bind(struct udevice *dev)
 {
        struct dm_regulator_uclass_platdata *uc_pdata;
-       int offset = dev->of_offset;
+       int offset = dev_of_offset(dev);
        const void *blob = gd->fdt_blob;
        const char *property = "regulator-name";
 
@@ -308,7 +308,7 @@ static int regulator_post_bind(struct udevice *dev)
 static int regulator_pre_probe(struct udevice *dev)
 {
        struct dm_regulator_uclass_platdata *uc_pdata;
-       int offset = dev->of_offset;
+       int offset = dev_of_offset(dev);
 
        uc_pdata = dev_get_uclass_platdata(dev);
        if (!uc_pdata)
index af39347aacf72842f1b0befca59468825c209379..b037130385155dc30a6c0f5fc7ac913dd55463d4 100644 (file)
 
 #ccflags-y += -DDEBUG
 
-obj-$(CONFIG_DM_PWM) += pwm-uclass.o
-obj-$(CONFIG_PWM_ROCKCHIP) += rk_pwm.o
-obj-$(CONFIG_PWM_IMX) += pwm-imx.o pwm-imx-util.o
-ifdef CONFIG_DM_PWM
-obj-$(CONFIG_PWM_TEGRA) += tegra_pwm.o
-obj-$(CONFIG_PWM_EXYNOS) += exynos_pwm.o
-endif
+obj-$(CONFIG_DM_PWM)           += pwm-uclass.o
+
+obj-$(CONFIG_PWM_EXYNOS)       += exynos_pwm.o
+obj-$(CONFIG_PWM_IMX)          += pwm-imx.o pwm-imx-util.o
+obj-$(CONFIG_PWM_ROCKCHIP)     += rk_pwm.o
+obj-$(CONFIG_PWM_TEGRA)                += tegra_pwm.o
index 200cf61bc948b71c9331fc2b07cf45c12f37046a..b6e67f2bf3e4924de4386a903c08ef6e4dfa1460 100644 (file)
@@ -116,7 +116,7 @@ static int rproc_pre_probe(struct udevice *dev)
 
        if (!dev->platdata) {
 #if CONFIG_IS_ENABLED(OF_CONTROL)
-               int node = dev->of_offset;
+               int node = dev_of_offset(dev);
                const void *blob = gd->fdt_blob;
                bool tmp;
                if (!blob) {
index 76ac3be092e2567642316221326fd1f86b2502c2..bb7a145f45242a9ca6188c44fa1a014dc5fb5705 100644 (file)
@@ -33,7 +33,7 @@ struct ti_powerproc_privdata {
 static int ti_of_to_priv(struct udevice *dev,
                         struct ti_powerproc_privdata *priv)
 {
-       int node = dev->of_offset;
+       int node = dev_of_offset(dev);
        const void *blob = gd->fdt_blob;
        int tmp;
 
index d3744ef703cbb1f7976f3ca6a778a6f094ff62b7..e92b24fa34ac7b767b7077bb7a4034fc2310f283 100644 (file)
@@ -43,7 +43,7 @@ int reset_get_by_index(struct udevice *dev, int index,
        debug("%s(dev=%p, index=%d, reset_ctl=%p)\n", __func__, dev, index,
              reset_ctl);
 
-       ret = fdtdec_parse_phandle_with_args(gd->fdt_blob, dev->of_offset,
+       ret = fdtdec_parse_phandle_with_args(gd->fdt_blob, dev_of_offset(dev),
                                             "resets", "#reset-cells", 0,
                                             index, &args);
        if (ret) {
@@ -88,7 +88,7 @@ int reset_get_by_name(struct udevice *dev, const char *name,
        debug("%s(dev=%p, name=%s, reset_ctl=%p)\n", __func__, dev, name,
              reset_ctl);
 
-       index = fdt_stringlist_search(gd->fdt_blob, dev->of_offset,
+       index = fdt_stringlist_search(gd->fdt_blob, dev_of_offset(dev),
                                      "reset-names", name);
        if (index < 0) {
                debug("fdt_stringlist_search() failed: %d\n", index);
index eff9c592d65159f451800aff05b2c33ca07c0b66..8344940282eb431455f12c042d497970a1dfd0e4 100644 (file)
@@ -92,7 +92,7 @@ static int altera_uart_ofdata_to_platdata(struct udevice *dev)
        plat->regs = map_physmem(dev_get_addr(dev),
                                 sizeof(struct altera_uart_regs),
                                 MAP_NOCACHE);
-       plat->uartclk = fdtdec_get_int(gd->fdt_blob, dev->of_offset,
+       plat->uartclk = fdtdec_get_int(gd->fdt_blob, dev_of_offset(dev),
                "clock-frequency", 0);
 
        return 0;
index 2df4a1f04fe52620776817a09340b5674ed1f499..1f819d487b6e84bada1002c1436bb3752965eca9 100644 (file)
@@ -383,13 +383,13 @@ int ns16550_serial_ofdata_to_platdata(struct udevice *dev)
                int ret;
 
                /* we prefer to use a memory-mapped register */
-               ret = fdtdec_get_pci_addr(gd->fdt_blob, dev->of_offset,
+               ret = fdtdec_get_pci_addr(gd->fdt_blob, dev_of_offset(dev),
                                          FDT_PCI_SPACE_MEM32, "reg",
                                          &pci_addr);
                if (ret) {
                        /* try if there is any i/o-mapped register */
                        ret = fdtdec_get_pci_addr(gd->fdt_blob,
-                                                 dev->of_offset,
+                                                 dev_of_offset(dev),
                                                  FDT_PCI_SPACE_IO,
                                                  "reg", &pci_addr);
                        if (ret)
@@ -413,9 +413,9 @@ int ns16550_serial_ofdata_to_platdata(struct udevice *dev)
        plat->base = (unsigned long)map_physmem(addr, 0, MAP_NOCACHE);
 #endif
 
-       plat->reg_offset = fdtdec_get_int(gd->fdt_blob, dev->of_offset,
+       plat->reg_offset = fdtdec_get_int(gd->fdt_blob, dev_of_offset(dev),
                                     "reg-offset", 0);
-       plat->reg_shift = fdtdec_get_int(gd->fdt_blob, dev->of_offset,
+       plat->reg_shift = fdtdec_get_int(gd->fdt_blob, dev_of_offset(dev),
                                         "reg-shift", 0);
 
        err = clk_get_by_index(dev, 0, &clk);
@@ -429,7 +429,7 @@ int ns16550_serial_ofdata_to_platdata(struct udevice *dev)
        }
 
        if (!plat->clock)
-               plat->clock = fdtdec_get_int(gd->fdt_blob, dev->of_offset,
+               plat->clock = fdtdec_get_int(gd->fdt_blob, dev_of_offset(dev),
                                             "clock-frequency",
                                             CONFIG_SYS_NS16550_CLK);
        if (!plat->clock) {
index bcc3465312e8819c71ff3667b3847b09e6de84bd..858e340f5937d0b7b5031042893063f19a905bd0 100644 (file)
@@ -152,7 +152,7 @@ static int sandbox_serial_ofdata_to_platdata(struct udevice *dev)
        int i;
 
        plat->colour = -1;
-       colour = fdt_getprop(gd->fdt_blob, dev->of_offset,
+       colour = fdt_getprop(gd->fdt_blob, dev_of_offset(dev),
                             "sandbox,text-colour", NULL);
        if (colour) {
                for (i = 0; i < ARRAY_SIZE(ansi_colour); i++) {
index 326a536a26ad47801b40eee9b44a7f04ce084641..fc91977b4c8aa358aa1c5dbe5b426166202ae260 100644 (file)
@@ -115,7 +115,7 @@ static int arc_serial_ofdata_to_platdata(struct udevice *dev)
        DECLARE_GLOBAL_DATA_PTR;
 
        plat->reg = (struct arc_serial_regs *)dev_get_addr(dev);
-       plat->uartclk = fdtdec_get_int(gd->fdt_blob, dev->of_offset,
+       plat->uartclk = fdtdec_get_int(gd->fdt_blob, dev_of_offset(dev),
                                       "clock-frequency", 0);
 
        return 0;
index 3884f744cda0f36515cff86a921cd5f349db426d..e7ed8993b847009795c1cb32788f826ff8e34b23 100644 (file)
@@ -164,8 +164,9 @@ static int bcm283x_mu_serial_ofdata_to_platdata(struct udevice *dev)
                return -EINVAL;
 
        plat->base = addr;
-       plat->clock = fdtdec_get_int(gd->fdt_blob, dev->of_offset, "clock", 1);
-       plat->skip_init = fdtdec_get_bool(gd->fdt_blob, dev->of_offset,
+       plat->clock = fdtdec_get_int(gd->fdt_blob, dev_of_offset(dev), "clock",
+                                    1);
+       plat->skip_init = fdtdec_get_bool(gd->fdt_blob, dev_of_offset(dev),
                                          "skip-init");
        plat->disabled = false;
        return 0;
index a7cab1346f228a5ff10c55c36338876a2ce28929..63b3006c638ade35b66f9c4115d560717ef6042f 100644 (file)
@@ -146,7 +146,7 @@ static const struct dm_serial_ops msm_serial_ops = {
 
 static int msm_uart_clk_init(struct udevice *dev)
 {
-       uint clk_rate = fdtdec_get_uint(gd->fdt_blob, dev->of_offset,
+       uint clk_rate = fdtdec_get_uint(gd->fdt_blob, dev_of_offset(dev),
                                        "clock-frequency", 115200);
        uint clkd[2]; /* clk_id and clk_no */
        int clk_offset;
@@ -154,8 +154,8 @@ static int msm_uart_clk_init(struct udevice *dev)
        struct clk clk;
        int ret;
 
-       ret = fdtdec_get_int_array(gd->fdt_blob, dev->of_offset, "clock", clkd,
-                                  2);
+       ret = fdtdec_get_int_array(gd->fdt_blob, dev_of_offset(dev), "clock",
+                                  clkd, 2);
        if (ret)
                return ret;
 
index 4fd2b1dd054f39cf5e560b10e93708147be27815..1cfcbf25b4f1755a46ed73ffa7402f33abc01437 100644 (file)
@@ -359,7 +359,7 @@ static int mxc_serial_ofdata_to_platdata(struct udevice *dev)
 
        plat->reg = (struct mxc_uart *)addr;
 
-       plat->use_dte = fdtdec_get_bool(gd->fdt_blob, dev->of_offset,
+       plat->use_dte = fdtdec_get_bool(gd->fdt_blob, dev_of_offset(dev),
                                        "fsl,dte-mode");
        return 0;
 }
index c2141f0a083dfc8651d89c126eed36ccad018300..b0e01aa0e5c1064afe97a8d9f88d2e9751f37f11 100644 (file)
@@ -141,7 +141,8 @@ static int pic32_uart_probe(struct udevice *dev)
        int ret;
 
        /* get address */
-       addr = fdtdec_get_addr_size(gd->fdt_blob, dev->of_offset, "reg", &size);
+       addr = fdtdec_get_addr_size(gd->fdt_blob, dev_of_offset(dev), "reg",
+                                   &size);
        if (addr == FDT_ADDR_T_NONE)
                return -EINVAL;
 
index a8d3d675d577c9776fd9d61d2a87906ad5b9809e..a49134a95a8e877be262dd8893d5d87042e19d0c 100644 (file)
@@ -354,9 +354,10 @@ static int pl01x_serial_ofdata_to_platdata(struct udevice *dev)
                return -EINVAL;
 
        plat->base = addr;
-       plat->clock = fdtdec_get_int(gd->fdt_blob, dev->of_offset, "clock", 1);
+       plat->clock = fdtdec_get_int(gd->fdt_blob, dev_of_offset(dev), "clock",
+                                    1);
        plat->type = dev_get_driver_data(dev);
-       plat->skip_init = fdtdec_get_bool(gd->fdt_blob, dev->of_offset,
+       plat->skip_init = fdtdec_get_bool(gd->fdt_blob, dev_of_offset(dev),
                                          "skip-init");
        return 0;
 }
index 622547951e69cf57353dacab151b9b4ecbfb7c5d..96842de8d4765893d955fb270c29cc0d2651f7aa 100644 (file)
@@ -187,7 +187,7 @@ static int s5p_serial_ofdata_to_platdata(struct udevice *dev)
                return -EINVAL;
 
        plat->reg = (struct s5p_uart *)addr;
-       plat->port_id = fdtdec_get_int(gd->fdt_blob, dev->of_offset,
+       plat->port_id = fdtdec_get_int(gd->fdt_blob, dev_of_offset(dev),
                                        "id", dev->seq);
        return 0;
 }
index ef7cf0f26c84673799b79d08f66ceb777e568ffa..51f7fbcfb795ee502e8ca55e5e0c61cd7a9d3d58 100644 (file)
@@ -216,12 +216,13 @@ static int sh_serial_ofdata_to_platdata(struct udevice *dev)
        struct sh_serial_platdata *plat = dev_get_platdata(dev);
        fdt_addr_t addr;
 
-       addr = fdtdec_get_addr(gd->fdt_blob, dev->of_offset, "reg");
+       addr = fdtdec_get_addr(gd->fdt_blob, dev_of_offset(dev), "reg");
        if (addr == FDT_ADDR_T_NONE)
                return -EINVAL;
 
        plat->base = addr;
-       plat->clk = fdtdec_get_int(gd->fdt_blob, dev->of_offset, "clock", 1);
+       plat->clk = fdtdec_get_int(gd->fdt_blob, dev_of_offset(dev), "clock",
+                                  1);
        plat->type = dev_get_driver_data(dev);
        return 0;
 }
index 4ea5304b1d016314160f1d61776e73049995ac57..0e25cba6acc6b47e7126d785389afe105b5fc62d 100644 (file)
@@ -105,7 +105,7 @@ static int uniphier_serial_probe(struct udevice *dev)
 
        priv->membase = port;
 
-       priv->uartclk = fdtdec_get_int(gd->fdt_blob, dev->of_offset,
+       priv->uartclk = fdtdec_get_int(gd->fdt_blob, dev_of_offset(dev),
                                       "clock-frequency", 0);
 
        tmp = readl(&port->lcr_mcr);
index f16f90de2898cd5bd4f699fead2eeaf43643f07d..9a6e41f33076d9584e1f61285979cee5cc3b6997 100644 (file)
@@ -282,7 +282,7 @@ static int cadence_spi_ofdata_to_platdata(struct udevice *bus)
 {
        struct cadence_spi_platdata *plat = bus->platdata;
        const void *blob = gd->fdt_blob;
-       int node = bus->of_offset;
+       int node = dev_of_offset(bus);
        int subnode;
        u32 data[4];
        int ret;
index 20aa99a451dc7cab03e33625d8da6e291e3f8bf8..65d37b0b9fabd3457bba307fc98f9f519841fc78 100644 (file)
@@ -540,7 +540,7 @@ static int davinci_ofdata_to_platadata(struct udevice *bus)
 {
        struct davinci_spi_slave *ds = dev_get_priv(bus);
        const void *blob = gd->fdt_blob;
-       int node = bus->of_offset;
+       int node = dev_of_offset(bus);
 
        ds->regs = dev_map_physmem(bus, sizeof(struct davinci_spi_regs));
        if (!ds->regs) {
index 24a6e982054c5ce67893c81b85a1f74397b8ff56..9d5e29c6c3f690eeff560042a946ac27d4030fd1 100644 (file)
@@ -132,7 +132,7 @@ static int dw_spi_ofdata_to_platdata(struct udevice *bus)
 {
        struct dw_spi_platdata *plat = bus->platdata;
        const void *blob = gd->fdt_blob;
-       int node = bus->of_offset;
+       int node = dev_of_offset(bus);
 
        plat->regs = (struct dw_spi *)dev_get_addr(bus);
 
index 44948c37364d27d42138fd824145e426ad56acdf..aa0784c04a55947709ea6fa051bcd017c96073ae 100644 (file)
@@ -253,7 +253,7 @@ static int exynos_spi_ofdata_to_platdata(struct udevice *bus)
 {
        struct exynos_spi_platdata *plat = bus->platdata;
        const void *blob = gd->fdt_blob;
-       int node = bus->of_offset;
+       int node = dev_of_offset(bus);
 
        plat->regs = (struct exynos_spi *)dev_get_addr(bus);
        plat->periph_id = pinmux_decode_periph_id(blob, node);
index f213587557c6baad1d958caebb0dc55c7ffba3b8..e09985ef2bff3eb51e14cb45bc27b9095923f3f2 100644 (file)
@@ -646,7 +646,7 @@ static int fsl_dspi_ofdata_to_platdata(struct udevice *bus)
        fdt_addr_t addr;
        struct fsl_dspi_platdata *plat = bus->platdata;
        const void *blob = gd->fdt_blob;
-       int node = bus->of_offset;
+       int node = dev_of_offset(bus);
 
        if (fdtdec_get_bool(blob, node, "big-endian"))
                plat->flags |= DSPI_FLAG_REGMAP_ENDIAN_BIG;
index 4d378c227d5bc7e47e1211ed27a7e3cb91716b92..b2a058380f69ea271602af6815d9cf0bba5441da 100644 (file)
@@ -1078,7 +1078,7 @@ static int fsl_qspi_ofdata_to_platdata(struct udevice *bus)
        struct fdt_resource res_regs, res_mem;
        struct fsl_qspi_platdata *plat = bus->platdata;
        const void *blob = gd->fdt_blob;
-       int node = bus->of_offset;
+       int node = dev_of_offset(bus);
        int ret, flash_num = 0, subnode;
 
        if (fdtdec_get_bool(blob, node, "big-endian"))
index caf0103dc386ec732dfa444b4e734da25450f3ca..893fe33b66f77572870397d17d45a077c2075b9a 100644 (file)
@@ -658,14 +658,14 @@ static int ich_spi_child_pre_probe(struct udevice *dev)
 static int ich_spi_ofdata_to_platdata(struct udevice *dev)
 {
        struct ich_spi_platdata *plat = dev_get_platdata(dev);
+       int node = dev_of_offset(dev);
        int ret;
 
-       ret = fdt_node_check_compatible(gd->fdt_blob, dev->of_offset,
-                                       "intel,ich7-spi");
+       ret = fdt_node_check_compatible(gd->fdt_blob, node, "intel,ich7-spi");
        if (ret == 0) {
                plat->ich_version = ICHV_7;
        } else {
-               ret = fdt_node_check_compatible(gd->fdt_blob, dev->of_offset,
+               ret = fdt_node_check_compatible(gd->fdt_blob, node,
                                                "intel,ich9-spi");
                if (ret == 0)
                        plat->ich_version = ICHV_9;
index 7c58c3661fa2c06cf35894df811a2803fde017ed..ee847e461050e6e1230f64085d56b098c52aa864 100644 (file)
@@ -261,9 +261,9 @@ static int mvebu_spi_ofdata_to_platdata(struct udevice *bus)
         * it should be used to read the input clock and the DT property
         * can be removed.
         */
-       plat->clock = fdtdec_get_int(gd->fdt_blob, bus->of_offset,
+       plat->clock = fdtdec_get_int(gd->fdt_blob, dev_of_offset(bus),
                                     "clock-frequency", 160000);
-       plat->frequency = fdtdec_get_int(gd->fdt_blob, bus->of_offset,
+       plat->frequency = fdtdec_get_int(gd->fdt_blob, dev_of_offset(bus),
                                         "spi-max-frequency", 40000);
 
        return 0;
index 60e9d6e82552c8d18711a3667508d794545b880b..8a8945010973c54c09f5eac4532354315ee6f3bc 100644 (file)
@@ -627,7 +627,7 @@ static int omap3_spi_probe(struct udevice *dev)
 {
        struct omap3_spi_priv *priv = dev_get_priv(dev);
        const void *blob = gd->fdt_blob;
-       int node = dev->of_offset;
+       int node = dev_of_offset(dev);
 
        struct omap2_mcspi_platform_config* data =
                (struct omap2_mcspi_platform_config*)dev_get_driver_data(dev);
index 25ca1f3e1ba0392249cee85793c46aa3b9d3f5a2..78d78bc54bad97bf99aa544d12cd7d64bfe793d5 100644 (file)
@@ -377,13 +377,14 @@ static int pic32_spi_probe(struct udevice *bus)
 {
        struct pic32_spi_priv *priv = dev_get_priv(bus);
        struct dm_spi_bus *dm_spi = dev_get_uclass_priv(bus);
+       int node = dev_of_offset(bus);
        struct udevice *clkdev;
        fdt_addr_t addr;
        fdt_size_t size;
        int ret;
 
        debug("%s: %d, bus: %i\n", __func__, __LINE__, bus->seq);
-       addr = fdtdec_get_addr_size(gd->fdt_blob, bus->of_offset, "reg", &size);
+       addr = fdtdec_get_addr_size(gd->fdt_blob, node, "reg", &size);
        if (addr == FDT_ADDR_T_NONE)
                return -EINVAL;
 
@@ -391,8 +392,8 @@ static int pic32_spi_probe(struct udevice *bus)
        if (!priv->regs)
                return -EINVAL;
 
-       dm_spi->max_hz = fdtdec_get_int(gd->fdt_blob, bus->of_offset,
-                                       "spi-max-frequency", 250000000);
+       dm_spi->max_hz = fdtdec_get_int(gd->fdt_blob, node, "spi-max-frequency",
+                                       250000000);
        /* get clock rate */
        ret = clk_get_by_index(bus, 0, &clkdev);
        if (ret < 0) {
@@ -413,8 +414,7 @@ static int pic32_spi_probe(struct udevice *bus)
         * of the ongoing transfer. To avoid this sort of error we will drive
         * /CS manually by toggling cs-gpio pins.
         */
-       ret = gpio_request_by_name_nodev(gd->fdt_blob, bus->of_offset,
-                                        "cs-gpios", 0,
+       ret = gpio_request_by_name_nodev(gd->fdt_blob, node, "cs-gpios", 0,
                                         &priv->cs_gpio, GPIOD_IS_OUT);
        if (ret) {
                printf("pic32-spi: error, cs-gpios not found\n");
index 15cf0bda202a72b7257e27a5eff97bdd8250485f..3e44f1795e3ccbcfedb606ece22b01bebd07fde5 100644 (file)
@@ -164,7 +164,7 @@ static int rockchip_spi_ofdata_to_platdata(struct udevice *bus)
        struct rockchip_spi_platdata *plat = dev_get_platdata(bus);
        struct rockchip_spi_priv *priv = dev_get_priv(bus);
        const void *blob = gd->fdt_blob;
-       int node = bus->of_offset;
+       int node = dev_of_offset(bus);
        int ret;
 
        plat->base = dev_get_addr(bus);
index d23dc81a211edc865b516f07a1e8e3a45f9e4993..1690cd76f90ac451cb8c2d6e05b8bcc38b61487e 100644 (file)
@@ -202,7 +202,7 @@ static int soft_spi_ofdata_to_platdata(struct udevice *dev)
 {
        struct soft_spi_platdata *plat = dev->platdata;
        const void *blob = gd->fdt_blob;
-       int node = dev->of_offset;
+       int node = dev_of_offset(dev);
 
        plat->spi_delay_us = fdtdec_get_int(blob, node, "spi-delay-us", 0);
 
index 1ab5b75fa1fc642a3971a58625ddca0a9c70d381..ac17da0777d53a07769da1100e908960fe77405a 100644 (file)
@@ -113,10 +113,11 @@ static int spi_child_post_bind(struct udevice *dev)
 {
        struct dm_spi_slave_platdata *plat = dev_get_parent_platdata(dev);
 
-       if (dev->of_offset == -1)
+       if (dev_of_offset(dev) == -1)
                return 0;
 
-       return spi_slave_ofdata_to_platdata(gd->fdt_blob, dev->of_offset, plat);
+       return spi_slave_ofdata_to_platdata(gd->fdt_blob, dev_of_offset(dev),
+                                           plat);
 }
 #endif
 
@@ -125,7 +126,7 @@ static int spi_post_probe(struct udevice *bus)
 #if !CONFIG_IS_ENABLED(OF_PLATDATA)
        struct dm_spi_bus *spi = dev_get_uclass_priv(bus);
 
-       spi->max_hz = fdtdec_get_int(gd->fdt_blob, bus->of_offset,
+       spi->max_hz = fdtdec_get_int(gd->fdt_blob, dev_of_offset(bus),
                                     "spi-max-frequency", 0);
 #endif
 #if defined(CONFIG_NEEDS_MANUAL_RELOC)
index 123a1f368d8a2e9b2c8c308961186140639282f5..05358ebf4cd1bbb7512acf7d4049b53e60dd6191 100644 (file)
@@ -411,7 +411,7 @@ static int stm32_qspi_ofdata_to_platdata(struct udevice *bus)
        struct fdt_resource res_regs, res_mem;
        struct stm32_qspi_platdata *plat = bus->platdata;
        const void *blob = gd->fdt_blob;
-       int node = bus->of_offset;
+       int node = dev_of_offset(bus);
        int ret;
 
        ret = fdt_get_named_resource(blob, node, "reg", "reg-names",
index 509afba0a298c54bf9ed7f74f45db27a8ae29612..897409ca02faab242a8ec45c235b8d329c546e72 100644 (file)
@@ -101,7 +101,7 @@ static int tegra114_spi_ofdata_to_platdata(struct udevice *bus)
 {
        struct tegra_spi_platdata *plat = bus->platdata;
        const void *blob = gd->fdt_blob;
-       int node = bus->of_offset;
+       int node = dev_of_offset(bus);
 
        plat->base = dev_get_addr(bus);
        plat->periph_id = clock_decode_periph_id(blob, node);
index ce3a2d398cfba08bbd1bf77b7b3f741552154b10..ecbf4c16f3b5eb9435c9741df5787e62a1169961 100644 (file)
@@ -88,7 +88,7 @@ static int tegra20_sflash_ofdata_to_platdata(struct udevice *bus)
 {
        struct tegra_spi_platdata *plat = bus->platdata;
        const void *blob = gd->fdt_blob;
-       int node = bus->of_offset;
+       int node = dev_of_offset(bus);
 
        plat->base = dev_get_addr(bus);
        plat->periph_id = clock_decode_periph_id(blob, node);
index e1da23b7b44b62cbd24d9cb581f7fa98ad9dac08..1d99a1e910e5cff3151c6fdd32d554373b9eb527 100644 (file)
@@ -94,7 +94,7 @@ static int tegra30_spi_ofdata_to_platdata(struct udevice *bus)
 {
        struct tegra_spi_platdata *plat = bus->platdata;
        const void *blob = gd->fdt_blob;
-       int node = bus->of_offset;
+       int node = dev_of_offset(bus);
 
        plat->base = dev_get_addr(bus);
        plat->periph_id = clock_decode_periph_id(blob, node);
index 026cff0c152e1075565315cf78392fdfaec74a03..1e094cbc8b34a4dafa53cf14517c2b401430cab4 100644 (file)
@@ -97,7 +97,7 @@ static int tegra210_qspi_ofdata_to_platdata(struct udevice *bus)
 {
        struct tegra_spi_platdata *plat = bus->platdata;
        const void *blob = gd->fdt_blob;
-       int node = bus->of_offset;
+       int node = dev_of_offset(bus);
 
        plat->base = dev_get_addr(bus);
        plat->periph_id = clock_decode_periph_id(blob, node);
index 6f9f983524d1f051158f5508b32cbeb75fb109dc..79955d75979544ff2540c324695f68c1352bce67 100644 (file)
@@ -553,7 +553,7 @@ static int ti_qspi_ofdata_to_platdata(struct udevice *bus)
 {
        struct ti_qspi_priv *priv = dev_get_priv(bus);
        const void *blob = gd->fdt_blob;
-       int node = bus->of_offset;
+       int node = dev_of_offset(bus);
        fdt_addr_t addr;
        void *mmap;
 
index b98663c23b21e72e62eb970c42ed1f68b7135d42..255e02f585da4a9a6df77d6d477b3464eafeb097 100644 (file)
@@ -101,7 +101,7 @@ static int zynq_qspi_ofdata_to_platdata(struct udevice *bus)
 {
        struct zynq_qspi_platdata *plat = bus->platdata;
        const void *blob = gd->fdt_blob;
-       int node = bus->of_offset;
+       int node = dev_of_offset(bus);
 
        plat->regs = (struct zynq_qspi_regs *)fdtdec_get_addr(blob,
                                                              node, "reg");
index 15ca271ea4a8c02886030b2022e8b11a2a29f8db..5a9b1f0f2ee4cc369c1da3b1b655ae7e5d7f540d 100644 (file)
@@ -71,7 +71,7 @@ static int zynq_spi_ofdata_to_platdata(struct udevice *bus)
 {
        struct zynq_spi_platdata *plat = bus->platdata;
        const void *blob = gd->fdt_blob;
-       int node = bus->of_offset;
+       int node = dev_of_offset(bus);
 
        plat->regs = (struct zynq_spi_regs *)dev_get_addr(bus);
 
index 48bc15759645835760ee7730e0e458372aae9201..605683fc0e5ecf3879b099abcbf2d9d5e2d2cc94 100644 (file)
@@ -147,18 +147,14 @@ static int msm_spmi_probe(struct udevice *dev)
 {
        struct udevice *parent = dev->parent;
        struct msm_spmi_priv *priv = dev_get_priv(dev);
+       int node = dev_of_offset(dev);
        int i;
 
        priv->arb_chnl = dev_get_addr(dev);
        priv->spmi_core = fdtdec_get_addr_size_auto_parent(gd->fdt_blob,
-                                                          parent->of_offset,
-                                                          dev->of_offset,
-                                                          "reg", 1, NULL,
-                                                          false);
+                       dev_of_offset(parent), node, "reg", 1, NULL, false);
        priv->spmi_obs = fdtdec_get_addr_size_auto_parent(gd->fdt_blob,
-                                                         parent->of_offset,
-                                                         dev->of_offset, "reg",
-                                                         2, NULL, false);
+                       dev_of_offset(parent), node, "reg", 2, NULL, false);
        if (priv->arb_chnl == FDT_ADDR_T_NONE ||
            priv->spmi_core == FDT_ADDR_T_NONE ||
            priv->spmi_obs == FDT_ADDR_T_NONE)
index 7ae7f386ee026aeccfa498250177de78044e2c87..0c4e2e1a93a696903cee0c8fb8f6e7e303854155 100644 (file)
@@ -41,7 +41,7 @@ static int sandbox_sysreset_request(struct udevice *dev, enum sysreset_t type)
         * (see the U_BOOT_DEVICE() declaration below) should not do anything.
         * If we are that device, return an error.
         */
-       if (state->fdt_fname && dev->of_offset == -1)
+       if (state->fdt_fname && dev_of_offset(dev) == -1)
                return -ENODEV;
 
        switch (type) {
index 5c63e6b41014ea92a43535a617d988492796420f..1caf3cd2887a4b8fcb639d90c0288c6ae3e731ce 100644 (file)
@@ -55,7 +55,7 @@ static int timer_pre_probe(struct udevice *dev)
                uc_priv->clock_rate = ret;
        } else
                uc_priv->clock_rate = fdtdec_get_int(gd->fdt_blob,
-                               dev->of_offset, "clock-frequency", 0);
+                               dev_of_offset(dev),     "clock-frequency", 0);
 
        return 0;
 }
index 0965ad01d3d69875e69bd1cf3e1b548b0029b666..9abb323745aa9609f693bb411687fc88d4cfd98c 100644 (file)
@@ -373,8 +373,8 @@ static int sandbox_flash_ofdata_to_platdata(struct udevice *dev)
        struct sandbox_flash_plat *plat = dev_get_platdata(dev);
        const void *blob = gd->fdt_blob;
 
-       plat->pathname = fdt_getprop(blob, dev->of_offset, "sandbox,filepath",
-                                    NULL);
+       plat->pathname = fdt_getprop(blob, dev_of_offset(dev),
+                                    "sandbox,filepath", NULL);
 
        return 0;
 }
index 624fbdecf1f965bcda9cc4244d21905f06f87af7..c3a8e73389d4afc3e38f7a561b5263568f6125de 100644 (file)
@@ -277,7 +277,8 @@ static int sandbox_child_post_bind(struct udevice *dev)
 {
        struct sandbox_hub_platdata *plat = dev_get_parent_platdata(dev);
 
-       plat->port = fdtdec_get_int(gd->fdt_blob, dev->of_offset, "reg", -1);
+       plat->port = fdtdec_get_int(gd->fdt_blob, dev_of_offset(dev), "reg",
+                                   -1);
 
        return 0;
 }
index d08879dc67de2ca6a58d913a5c945402f71d44da..d253b946f334a2fae4cfad5f7a89da60c4433266 100644 (file)
@@ -1199,8 +1199,8 @@ static int dwc2_usb_ofdata_to_platdata(struct udevice *dev)
                return -EINVAL;
        priv->regs = (struct dwc2_core_regs *)addr;
 
-       prop = fdt_getprop(gd->fdt_blob, dev->of_offset, "disable-over-current",
-                          NULL);
+       prop = fdt_getprop(gd->fdt_blob, dev_of_offset(dev),
+                          "disable-over-current", NULL);
        if (prop)
                priv->oc_disable = true;
 
index 53281d78b35f1b39860da8aa2b027cbdcf2a68ed..981543e31501cd6ad7fe10e2704ff39dabb8cd69 100644 (file)
@@ -59,7 +59,7 @@ static int ehci_usb_ofdata_to_platdata(struct udevice *dev)
        }
 
        depth = 0;
-       node = fdtdec_next_compatible_subnode(blob, dev->of_offset,
+       node = fdtdec_next_compatible_subnode(blob, dev_of_offset(dev),
                                COMPAT_SAMSUNG_EXYNOS_USB_PHY, &depth);
        if (node <= 0) {
                debug("XHCI: Can't get device node for usb3-phy controller\n");
index 9c3292182683952d7b488b2bdda5c85f4b41a7d7..7ad50fccee35319e0c5f1aa04b97c6a41ccff22a 100644 (file)
@@ -61,7 +61,7 @@ static int ehci_fsl_ofdata_to_platdata(struct udevice *dev)
        struct ehci_fsl_priv *priv = dev_get_priv(dev);
        const void *prop;
 
-       prop = fdt_getprop(gd->fdt_blob, dev->of_offset, "phy_type",
+       prop = fdt_getprop(gd->fdt_blob, dev_of_offset(dev), "phy_type",
                           NULL);
        if (prop) {
                priv->phy_type = (char *)prop;
index 7b309b7b9617a95fd5f02429053812fb93b158c7..55ac162a3c04c09dbf15a6e54770af459d5b1921 100644 (file)
@@ -437,7 +437,7 @@ static int ehci_usb_phy_mode(struct udevice *dev)
        void *__iomem addr = (void *__iomem)dev_get_addr(dev);
        void *__iomem phy_ctrl, *__iomem phy_status;
        const void *blob = gd->fdt_blob;
-       int offset = dev->of_offset, phy_off;
+       int offset = dev_of_offset(dev), phy_off;
        u32 val;
 
        /*
@@ -484,7 +484,7 @@ static int ehci_usb_ofdata_to_platdata(struct udevice *dev)
        struct usb_platdata *plat = dev_get_platdata(dev);
        const char *mode;
 
-       mode = fdt_getprop(gd->fdt_blob, dev->of_offset, "dr_mode", NULL);
+       mode = fdt_getprop(gd->fdt_blob, dev_of_offset(dev), "dr_mode", NULL);
        if (mode) {
                if (strcmp(mode, "peripheral") == 0)
                        plat->init_type = USB_INIT_DEVICE;
index e3620da15fb13974a089834861d4d47d202b2aca..beb3b027963472933a1962dd9ad7626380f97c06 100644 (file)
@@ -696,7 +696,7 @@ static void config_clock(const u32 timing[])
 static int fdt_decode_usb(struct udevice *dev, struct fdt_usb *config)
 {
        const void *blob = gd->fdt_blob;
-       int node = dev->of_offset;
+       int node = dev_of_offset(dev);
        const char *phy, *mode;
 
        config->reg = (struct usb_ctlr *)dev_get_addr(dev);
index f389bff1718f09b7f5f979907e48cfcc48e307f2..84241cd17328715f78c18fde40b60c884eb863c1 100644 (file)
@@ -218,7 +218,7 @@ static int vf_usb_ofdata_to_platdata(struct udevice *dev)
 {
        struct ehci_vf_priv_data *priv = dev_get_priv(dev);
        const void *dt_blob = gd->fdt_blob;
-       int node = dev->of_offset;
+       int node = dev_of_offset(dev);
        const char *mode;
 
        priv->portnr = dev->seq;
index be114fc07715b3a900551cc1a55ba2da5198ecdb..5cf1e9a36cbc1deffddf40b41658317821744288 100644 (file)
@@ -686,16 +686,17 @@ int usb_child_post_bind(struct udevice *dev)
        const void *blob = gd->fdt_blob;
        int val;
 
-       if (dev->of_offset == -1)
+       if (dev_of_offset(dev) == -1)
                return 0;
 
        /* We only support matching a few things */
-       val = fdtdec_get_int(blob, dev->of_offset, "usb,device-class", -1);
+       val = fdtdec_get_int(blob, dev_of_offset(dev), "usb,device-class", -1);
        if (val != -1) {
                plat->id.match_flags |= USB_DEVICE_ID_MATCH_DEV_CLASS;
                plat->id.bDeviceClass = val;
        }
-       val = fdtdec_get_int(blob, dev->of_offset, "usb,interface-class", -1);
+       val = fdtdec_get_int(blob, dev_of_offset(dev), "usb,interface-class",
+                            -1);
        if (val != -1) {
                plat->id.match_flags |= USB_DEVICE_ID_MATCH_INT_CLASS;
                plat->id.bInterfaceClass = val;
index 82fcd84ef2f20dafddc3308f000434e2343b3ebf..b3f48b34e222d2b19f16254dc530325e50eb7ce9 100644 (file)
@@ -68,7 +68,7 @@ static int xhci_usb_ofdata_to_platdata(struct udevice *dev)
        }
 
        depth = 0;
-       node = fdtdec_next_compatible_subnode(blob, dev->of_offset,
+       node = fdtdec_next_compatible_subnode(blob, dev_of_offset(dev),
                                COMPAT_SAMSUNG_EXYNOS5_USB3_PHY, &depth);
        if (node <= 0) {
                debug("XHCI: Can't get device node for usb3-phy controller\n");
index 8cbcb8f923e0901caada82986289a3341cbda3f4..f559830185de3a49621252552e1dbdaae38b0073 100644 (file)
@@ -90,11 +90,11 @@ static void rockchip_dwc3_phy_setup(struct dwc3 *dwc3_reg,
        /* Set dwc3 usb2 phy config */
        reg = readl(&dwc3_reg->g_usb2phycfg[0]);
 
-       if (fdtdec_get_bool(blob, dev->of_offset,
+       if (fdtdec_get_bool(blob, dev_of_offset(dev),
                            "snps,dis-enblslpm-quirk"))
                reg &= ~DWC3_GUSB2PHYCFG_ENBLSLPM;
 
-       utmi_bits = fdtdec_get_int(blob, dev->of_offset,
+       utmi_bits = fdtdec_get_int(blob, dev_of_offset(dev),
                                   "snps,phyif-utmi-bits", -1);
        if (utmi_bits == 16) {
                reg |= DWC3_GUSB2PHYCFG_PHYIF;
@@ -106,11 +106,11 @@ static void rockchip_dwc3_phy_setup(struct dwc3 *dwc3_reg,
                reg |= DWC3_GUSB2PHYCFG_USBTRDTIM_8BIT;
        }
 
-       if (fdtdec_get_bool(blob, dev->of_offset,
+       if (fdtdec_get_bool(blob, dev_of_offset(dev),
                            "snps,dis-u2-freeclk-exists-quirk"))
                reg &= ~DWC3_GUSB2PHYCFG_U2_FREECLK_EXISTS;
 
-       if (fdtdec_get_bool(blob, dev->of_offset,
+       if (fdtdec_get_bool(blob, dev_of_offset(dev),
                            "snps,dis-u2-susphy-quirk"))
                reg &= ~DWC3_GUSB2PHYCFG_SUSPHY;
 
index c888c645fa015bc19ba3e40f21d0e95f4333a516..ed6da19eecdb52da9f88e4be662ed9d6dee2a71a 100644 (file)
@@ -219,7 +219,7 @@ static int musb_usb_probe(struct udevice *dev)
        struct musb_host_data *mdata = &pdata->mdata;
        struct fdt_resource mc, glue;
        void *fdt = (void *)gd->fdt_blob;
-       int node = dev->of_offset;
+       int node = dev_of_offset(dev);
        void __iomem *mregs;
        int ret;
 
index 1c15aa2a427f6570fbdfc30931524efc76a88e9c..852f07facc38e07a244bad501bb3ef8dd542c22f 100644 (file)
@@ -83,7 +83,7 @@ static int ti_musb_ofdata_to_platdata(struct udevice *dev)
 {
        struct ti_musb_platdata *platdata = dev_get_platdata(dev);
        const void *fdt = gd->fdt_blob;
-       int node = dev->of_offset;
+       int node = dev_of_offset(dev);
        int phys;
        int ctrl_mod;
        int usb_index;
@@ -178,7 +178,7 @@ static int ti_musb_host_ofdata_to_platdata(struct udevice *dev)
 {
        struct ti_musb_platdata *platdata = dev_get_platdata(dev);
        const void *fdt = gd->fdt_blob;
-       int node = dev->of_offset;
+       int node = dev_of_offset(dev);
        int ret;
 
        ret = ti_musb_ofdata_to_platdata(dev);
@@ -209,7 +209,7 @@ static int ti_musb_wrapper_bind(struct udevice *parent)
        int node;
        int ret;
 
-       for (node = fdt_first_subnode(fdt, parent->of_offset); node > 0;
+       for (node = fdt_first_subnode(fdt, dev_of_offset(parent)); node > 0;
             node = fdt_next_subnode(fdt, node)) {
                struct udevice *dev;
                const char *name = fdt_get_name(fdt, node, NULL);
index 39cd7caff16dbf25c3ff9e1f89bb95b032a71bf8..ed2bd306c6bc8471305740a0a782cbb281ad39d0 100644 (file)
@@ -276,7 +276,7 @@ static int atmel_fb_ofdata_to_platdata(struct udevice *dev)
        struct display_timing *timing = &priv->timing;
        const void *blob = gd->fdt_blob;
 
-       if (fdtdec_decode_display_timing(blob, dev->of_offset,
+       if (fdtdec_decode_display_timing(blob, dev_of_offset(dev),
                                         plat->timing_index, timing)) {
                debug("%s: Failed to decode display timing\n", __func__);
                return -EINVAL;
index 80f63e3eb5515f6019561eb242f8c2de4158785f..46aacca2b7dc8e610373874363a83ccbe9cd11e3 100644 (file)
@@ -86,7 +86,8 @@ static int ps8622_attach(struct udevice *dev)
        if (ret)
                return ret;
 
-       params = fdt_getprop(gd->fdt_blob, dev->of_offset, "parade,regs", &len);
+       params = fdt_getprop(gd->fdt_blob, dev_of_offset(dev), "parade,regs",
+                            &len);
        if (!params || len % 3) {
                debug("%s: missing/invalid params=%p, len=%x\n", __func__,
                      params, len);
index beef770f920f4d9c41933b28fa5cd9759a71d9ed..4612d0414efa5ecf2525d97d4b3442fd26bca436 100644 (file)
@@ -705,7 +705,7 @@ static int broadwell_igd_ofdata_to_platdata(struct udevice *dev)
 {
        struct broadwell_igd_plat *plat = dev_get_platdata(dev);
        struct broadwell_igd_priv *priv = dev_get_priv(dev);
-       int node = dev->of_offset;
+       int node = dev_of_offset(dev);
        const void *blob = gd->fdt_blob;
 
        if (fdtdec_get_int_array(blob, node, "intel,dp-hotplug",
index fc39f2c5620bca1cd00265ca837b895733b2e417..c5039e7b430c7e050c9741feba2335442e8562fb 100644 (file)
@@ -880,7 +880,7 @@ static int exynos_dp_ofdata_to_platdata(struct udevice *dev)
 {
        struct exynos_dp_priv *priv = dev_get_priv(dev);
        const void *blob = gd->fdt_blob;
-       unsigned int node = dev->of_offset;
+       unsigned int node = dev_of_offset(dev);
        fdt_addr_t addr;
 
        addr = dev_get_addr(dev);
index 5483d6613f76585fc5d15daad7e88c21a269773b..46320e7f02a71a20c7ed0ce4b9e8083eca619f42 100644 (file)
@@ -383,7 +383,7 @@ void exynos_fimd_lcd_init(struct udevice *dev)
        unsigned int offset;
        unsigned int node;
 
-       node = dev->of_offset;
+       node = dev_of_offset(dev);
        if (fdtdec_get_bool(gd->fdt_blob, node, "samsung,disable-sysmmu"))
                exynos_fimd_disable_sysmmu();
 
@@ -482,7 +482,7 @@ unsigned long exynos_fimd_calc_fbsize(struct exynos_fb_priv *priv)
 int exynos_fb_ofdata_to_platdata(struct udevice *dev)
 {
        struct exynos_fb_priv *priv = dev_get_priv(dev);
-       unsigned int node = dev->of_offset;
+       unsigned int node = dev_of_offset(dev);
        const void *blob = gd->fdt_blob;
        fdt_addr_t addr;
 
index 94db3dda4424e2d5c4e0c717b75174b995afa0ca..d8af2e169635584f5afb53792852d82caf028f63 100644 (file)
@@ -18,6 +18,8 @@
 #include <asm/arch/pch.h>
 #include <asm/arch/sandybridge.h>
 
+DECLARE_GLOBAL_DATA_PTR;
+
 struct gt_powermeter {
        u16 reg;
        u32 value;
@@ -515,7 +517,7 @@ static int gma_pm_init_pre_vbios(void *gtt_bar, int rev)
 static int gma_pm_init_post_vbios(struct udevice *dev, int rev, void *gtt_bar)
 {
        const void *blob = gd->fdt_blob;
-       int node = dev->of_offset;
+       int node = dev_of_offset(dev);
        u32 reg32, cycle_delay;
 
        debug("GT Power Management Init (post VBIOS)\n");
@@ -800,7 +802,7 @@ static int gma_func0_init(struct udevice *dev)
        mtrr_add_request(MTRR_TYPE_WRCOMB, base, 256 << 20);
        mtrr_commit(true);
 
-       gtt_bar = (void *)dm_pci_read_bar32(dev, 0);
+       gtt_bar = (void *)(ulong)dm_pci_read_bar32(dev, 0);
        debug("GT bar %p\n", gtt_bar);
        ret = gma_pm_init_pre_vbios(gtt_bar, rev);
        if (ret)
@@ -822,7 +824,7 @@ static int bd82x6x_video_probe(struct udevice *dev)
                return ret;
 
        /* Post VBIOS init */
-       gtt_bar = (void *)dm_pci_read_bar32(dev, 0);
+       gtt_bar = (void *)(ulong)dm_pci_read_bar32(dev, 0);
        ret = gma_pm_init_post_vbios(dev, rev, gtt_bar);
        if (ret)
                return ret;
index de6277f4ffe8efdae5ff7edfee31e10214f4773f..3697f4905c92604477cd38d7aa45a6b450c582b2 100644 (file)
@@ -61,7 +61,7 @@ static int pwm_backlight_ofdata_to_platdata(struct udevice *dev)
        struct pwm_backlight_priv *priv = dev_get_priv(dev);
        struct fdtdec_phandle_args args;
        const void *blob = gd->fdt_blob;
-       int node = dev->of_offset;
+       int node = dev_of_offset(dev);
        int index, ret, count, len;
        const u32 *cell;
 
index fcbb4d63d25f3114d1929658ec4a088dfd96a060..ee43255753c3e8d3c5dae2f9f357bcc334e2a04d 100644 (file)
@@ -162,7 +162,7 @@ int rk_lvds_enable(struct udevice *dev, int panel_bpp,
 int rk_lvds_read_timing(struct udevice *dev, struct display_timing *timing)
 {
        if (fdtdec_decode_display_timing
-           (gd->fdt_blob, dev->of_offset, 0, timing)) {
+           (gd->fdt_blob, dev_of_offset(dev), 0, timing)) {
                debug("%s: Failed to decode display timing\n", __func__);
                return -EINVAL;
        }
@@ -174,7 +174,7 @@ static int rk_lvds_ofdata_to_platdata(struct udevice *dev)
 {
        struct rk_lvds_priv *priv = dev_get_priv(dev);
        const void *blob = gd->fdt_blob;
-       int node = dev->of_offset;
+       int node = dev_of_offset(dev);
        int ret;
        priv->regs = (void *)dev_get_addr(dev);
        priv->grf = syscon_get_first_range(ROCKCHIP_SYSCON_GRF);
index eab548699f74e1830966ebf08fa799c18a04c82f..aeecb5815be15e0f51d3fde88dea31cdfd01cff2 100644 (file)
@@ -321,7 +321,7 @@ static int rk_vop_probe(struct udevice *dev)
         * clock so it is currently not possible to use more than one display
         * device simultaneously.
         */
-       port = fdt_subnode_offset(blob, dev->of_offset, "port");
+       port = fdt_subnode_offset(blob, dev_of_offset(dev), "port");
        if (port < 0)
                return -EINVAL;
        for (node = fdt_first_subnode(blob, port);
index dc5a220d512448efc009cba06b2092056b216e39..18afe2f3fd356b557175e3266bac8f696b2daec7 100644 (file)
@@ -46,7 +46,7 @@ static int sandbox_sdl_bind(struct udevice *dev)
        struct video_uc_platdata *uc_plat = dev_get_uclass_platdata(dev);
        struct sandbox_sdl_plat *plat = dev_get_platdata(dev);
        const void *blob = gd->fdt_blob;
-       int node = dev->of_offset;
+       int node = dev_of_offset(dev);
        int ret = 0;
 
        plat->xres = fdtdec_get_int(blob, node, "xres", LCD_MAX_WIDTH);
index 92214d61b279210e173c845b058a0fe94ea2a952..0ba3f2c2b4bbaa684289332f9f2d7adf8f14a80c 100644 (file)
@@ -338,7 +338,7 @@ static int tegra_lcd_ofdata_to_platdata(struct udevice *dev)
        struct tegra_lcd_priv *priv = dev_get_priv(dev);
        const void *blob = gd->fdt_blob;
        struct display_timing *timing;
-       int node = dev->of_offset;
+       int node = dev_of_offset(dev);
        int panel_node;
        int rgb;
        int ret;
@@ -392,7 +392,7 @@ static int tegra_lcd_bind(struct udevice *dev)
 {
        struct video_uc_platdata *plat = dev_get_uclass_platdata(dev);
        const void *blob = gd->fdt_blob;
-       int node = dev->of_offset;
+       int node = dev_of_offset(dev);
        int rgb;
 
        rgb = fdt_subnode_offset(blob, node, "rgb");
index 28db96c952963b1a88ac3ad32b8268e3022a7ae9..bbbca13bdc4e1d76925c37f539c99808e19a8fb6 100644 (file)
@@ -363,9 +363,9 @@ static int display_init(struct udevice *dev, void *lcdbase,
                return ret;
        }
 
-       dc_ctlr = (struct dc_ctlr *)fdtdec_get_addr(blob, dev->of_offset,
+       dc_ctlr = (struct dc_ctlr *)fdtdec_get_addr(blob, dev_of_offset(dev),
                                                    "reg");
-       if (fdtdec_decode_display_timing(blob, dev->of_offset, 0, timing)) {
+       if (fdtdec_decode_display_timing(blob, dev_of_offset(dev), 0, timing)) {
                debug("%s: Failed to decode display timing\n", __func__);
                return -EINVAL;
        }
index e5cea51d48c81a01494effaba1d7eb674a9c5342..5e4140ff532044ac9a59c968dd431c249415dcd3 100644 (file)
@@ -757,7 +757,7 @@ int tegra_dc_sor_attach(struct udevice *dc_dev, struct udevice *dev,
 
        /* Use the first display controller */
        debug("%s\n", __func__);
-       node = dc_dev->of_offset;
+       node = dev_of_offset(dc_dev);
        disp_ctrl = (struct dc_ctlr *)fdtdec_get_addr(blob, node, "reg");
 
        tegra_dc_sor_enable_dc(disp_ctrl);
@@ -973,7 +973,7 @@ int tegra_dc_sor_detach(struct udevice *dc_dev, struct udevice *dev)
 
        debug("%s\n", __func__);
        /* Use the first display controller */
-       node = dc_dev->of_offset;
+       node = dev_of_offset(dc_dev);
        disp_ctrl = (struct dc_ctlr *)fdtdec_get_addr(blob, node, "reg");
 
        /* Sleep mode */
@@ -1045,7 +1045,7 @@ static int tegra_sor_ofdata_to_platdata(struct udevice *dev)
        int node;
        int ret;
 
-       priv->base = (void *)fdtdec_get_addr(blob, dev->of_offset, "reg");
+       priv->base = (void *)fdtdec_get_addr(blob, dev_of_offset(dev), "reg");
 
        node = fdtdec_next_compatible(blob, 0, COMPAT_NVIDIA_TEGRA124_PMC);
        if (node < 0) {
index 75be5270b16ddd16ba8e93c7aeeba62173a6243e..8e41a9511d47b77f04463d340037d14390e13974 100644 (file)
@@ -2,4 +2,3 @@
 /bmp_logo.h
 /bmp_logo_data.h
 /config.h
-/license.h
index a0d4e94a048c3f3b9ae0043990dbca6b247a24c3..a8befe38e8eed54c55306309123b5d8ab2b0f4a6 100644 (file)
@@ -49,7 +49,6 @@
 #define CONFIG_CMD_TERMINAL    /* built-in Serial Terminal     */
 #define CONFIG_CMD_UBIFS       /* UBIFS Support                */
 #define CONFIG_CMD_UNIVERSE    /* Tundra Universe Support      */
-#define CONFIG_CMD_UNZIP       /* unzip from memory to memory  */
 #define CONFIG_CMD_ZFS         /* ZFS Support                  */
 
 #endif /* _CONFIG_CMD_ALL_H */
index 5ea82f8e4d9c2d4a908e3044a56a576f695363b3..59ba79e43b4bb9b71eb480badb00d35097f51be5 100644 (file)
 #define CONFIG_KGDB_BAUDRATE   230400  /* speed to run kgdb serial port */
 #endif
 
-#define CONFIG_API             1
-
 #endif /* __CONFIG_H */
index 5d568604a6405adc1ff788d67e9deb1cb9de67a0..f1b82df45693bf403532ab02d1487da8ec373319 100644 (file)
@@ -88,8 +88,6 @@
 
 #ifdef CONFIG_USB_MUSB_HCD
 
-#define CONGIG_CMD_STORAGE
-
 #ifdef CONFIG_USB_KEYBOARD
 #define CONFIG_SYS_USB_EVENT_POLL
 #define CONFIG_PREBOOT "usb start"
index 13de819245755ad9275a4baa4637fa1423a6dad4..1062e20f6d313e24531c478502d278f380e04378 100644 (file)
@@ -88,8 +88,6 @@
 
 #ifdef CONFIG_USB_MUSB_HOST
 
-#define CONGIG_CMD_STORAGE
-
 #ifdef CONFIG_USB_KEYBOARD
 #define CONFIG_SYS_USB_EVENT_POLL
 #define CONFIG_PREBOOT "usb start"
index 02094b58af3b5ca77f8af463ee8a45ba724f0a12..82ee7c62e00297aad196de0db6e4a18b282becd8 100644 (file)
@@ -22,7 +22,6 @@
 
 #define CONFIG_VIDEO_BMP_GZIP
 #define CONFIG_SYS_VIDEO_LOGO_MAX_SIZE (1366*767*4)
-#define CONFIG_CMD_UNZIP
 #define CONFIG_CMD_BMP
 #define CONFIG_BMP_24BMP
 #define CONFIG_BMP_32BPP
index f2d798a52f0b28bc7f2fd157f84b684b9f25f6c6..b116a27869a25bc70c2bdfec835897f659c4920e 100644 (file)
 #define CONFIG_ENV_SECT_SIZE           0x1000
 #define CONFIG_ENV_OFFSET              0x003f8000
 
+#define CONFIG_SPL_FRAMEWORK
+
+#define CONFIG_SPL_TEXT_BASE           0xfffd0000
+
+#define BOOT_DEVICE_SPI                        10
+
+#define CONFIG_SPL_BOARD_LOAD_IMAGE
+#define BOOT_DEVICE_BOARD              11
+
 #endif /* __CONFIG_H */
index da1c58983a568d586b60970ae6973d27cff75639..9b7f43f13491ddbaed822979f0f8613cb97caaad 100644 (file)
@@ -57,7 +57,6 @@
 /*#define CONFIG_SUPPORT_EMMC_BOOT */
 #define CONFIG_CMD_REGINFO     /* Register dump                */
 #define CONFIG_CMD_TFTP
-#define CONFIG_CMD_UNZIP
 
 /* Partition table support */
 #define HAVE_BLOCK_DEVICE /* Needed for partition commands */
index a3c40d68aa5266057fcbd0ba897c2838bdcb831a..55d65ef7e8becc58dea83f9a1032ff22575ec4b6 100644 (file)
@@ -95,7 +95,6 @@
 #define CONFIG_CMD_REISER
 #define CONFIG_CMD_SAVES
 #define CONFIG_CMD_UBIFS
-#define CONFIG_CMD_UNZIP
 #endif
 
 /* NAND flash */
index 9ec81402b4ecbf059f1fa267c80364fc65a193b1..899d62de2689070b593814e58b32103d5be75cf6 100644 (file)
@@ -74,7 +74,6 @@
 #define CONFIG_FS_EXT4
 
 /* Command line configuration */
-#define CONFIG_CMD_UNZIP
 #define CONFIG_CMD_ENV
 
 #define CONFIG_MTD_PARTITIONS
index 7ec82cd4bbda4627e68b17858368b250ecfa7c11..ad1adcec8c6166442f8e683a4062dab377863a6b 100644 (file)
 
 #define CONFIG_SYS_NO_FLASH
 
-/*
- * Enable u-boot API for standalone programs.
- */
-#define CONFIG_API
-
 /*
  * Commands configuration
  */
index 8846aa6607cecfbc2708f8b52218d62f9d852292..8ed5602bc9ca4591bfe5403f9aa421af91ced079 100644 (file)
 
 #ifdef CONFIG_USB_MUSB_HCD
 
-#define CONGIG_CMD_STORAGE
-
 #ifdef CONFIG_USB_KEYBOARD
 #define CONFIG_SYS_USB_EVENT_POLL
 #define CONFIG_PREBOOT                 "usb start"
index affe712e046ce80863ec149d4635ca0e6534289a..687befdad373145b4402fa6af9cfc9abc13c1a10 100644 (file)
 #undef CONFIG_ENV_IS_IN_SPI_FLASH
 #define CONFIG_ENV_IS_NOWHERE
 
+#define CONFIG_SPL_FRAMEWORK
+
+#define CONFIG_SPL_TEXT_BASE           0xfffd0000
+
+#define BOOT_DEVICE_SPI                        10
+
+#define CONFIG_SPL_BOARD_LOAD_IMAGE
+#define BOOT_DEVICE_BOARD              11
+
 #endif /* __CONFIG_H */
index dafb05fa072383079a710bb714d37465f9ef65e9..32a4b27870d48fc90f2bd52973e37bcaeb69798d 100644 (file)
 
 #define CONFIG_USB_ETHER
 #define CONFIG_USB_ETHER_RNDIS
-#define CONGIG_CMD_STORAGE
 
 /* Defines for SPL */
 #define CONFIG_SPL_FRAMEWORK
index d120c691e0e3ef802a21894519eedf7242ae9afa..5d4ef58e5f1a369c8b756605403a6a53dc0fd288 100644 (file)
 #define CONFIG_SYS_SPL_MALLOC_START    (CONFIG_SPL_BSS_START_ADDR + \
                                        CONFIG_SPL_BSS_MAX_SIZE)
 #define CONFIG_SYS_SPL_MALLOC_SIZE     (32 * 1024)
-#define CONFIG_SPL_STACK_SIZE          (8 * 1024)
+#define KEYSTONE_SPL_STACK_SIZE                (8 * 1024)
 #define CONFIG_SPL_STACK               (CONFIG_SYS_SPL_MALLOC_START + \
                                        CONFIG_SYS_SPL_MALLOC_SIZE + \
                                        SPL_MALLOC_F_SIZE + \
-                                       CONFIG_SPL_STACK_SIZE - 4)
+                                       KEYSTONE_SPL_STACK_SIZE - 4)
 #define CONFIG_SPL_SPI_LOAD
 #define CONFIG_SYS_SPI_U_BOOT_OFFS     CONFIG_SPL_PAD_TO
 
index 22962392e22032ce3d91de6a4d107e1a9f50dd4f..b453d8fba8128144cb053d36832275c145ac0649 100644 (file)
 
 #define CONFIG_SYS_EEPROM_PAGE_WRITE_DELAY_MS  10
 
-#ifdef CONFIG_ARM64
-#define CONFIG_CMD_UNZIP
-#endif
-
 /*-----------------------------------------------------------------------
  * MMU and Cache Setting
  *----------------------------------------------------------------------*/
index 3a4bfe81330bc671deed8412638db8553a795d39..35ac60ac2646da5f72ef1aa290393e70d02657f4 100644 (file)
 #endif
 
 /*#define CONFIG_MENU_SHOW*/
-#define CONFIG_CMD_UNZIP
 #define CONFIG_CMD_ENV
 
 /* BOOTP options */
index 4759373e51f5b6e10b4a01d81485d9fa4fdb8cef..73830b212b2b504916e0faffbcecda4688559c85 100644 (file)
 
 #define CONFIG_SYS_BOOTM_LEN   (60 * 1024 * 1024)
 
-#define CONFIG_CMD_UNZIP
-
 #define CONFIG_BOARD_EARLY_INIT_R
 #define CONFIG_CLOCKS
 
index 9948bd49fa53b86b54ea0b2775f27b9cf5577b1f..4e95fb7773d961cc1f9d20e1fe3b157d0209e431 100644 (file)
@@ -121,6 +121,16 @@ struct udevice {
 /* Returns non-zero if the device is active (probed and not removed) */
 #define device_active(dev)     ((dev)->flags & DM_FLAG_ACTIVATED)
 
+static inline int dev_of_offset(const struct udevice *dev)
+{
+       return dev->of_offset;
+}
+
+static inline void dev_set_of_offset(struct udevice *dev, int of_offset)
+{
+       dev->of_offset = of_offset;
+}
+
 /**
  * struct udevice_id - Lists the compatible strings supported by a driver
  * @compatible: Compatible string
index d582d4f7abb2c9258509450cf042da85d9e1f549..c24d00e38dd433da831375a6972cae4d85484fde 100644 (file)
@@ -225,7 +225,7 @@ static inline void fill_smbios_header(void *table, int type,
  * @handle:    the structure's handle, a unique 16-bit number
  * @return:    size of the structure
  */
-typedef int (*smbios_write_type)(uintptr_t *addr, int handle);
+typedef int (*smbios_write_type)(ulong *addr, int handle);
 
 /**
  * write_smbios_table() - Write SMBIOS table
@@ -235,6 +235,6 @@ typedef int (*smbios_write_type)(uintptr_t *addr, int handle);
  * @addr:      start address to write SMBIOS table
  * @return:    end address of SMBIOS table
  */
-uintptr_t write_smbios_table(uintptr_t addr);
+ulong write_smbios_table(ulong addr);
 
 #endif /* _SMBIOS_H_ */
index ce1974d86f76751bbc7966372692daebd47d381a..22ca247fec8881ba3dcc87ffc831769f85cf1a4a 100644 (file)
@@ -73,7 +73,7 @@ static int smbios_string_table_len(char *start)
        return len + 1;
 }
 
-static int smbios_write_type0(uintptr_t *current, int handle)
+static int smbios_write_type0(ulong *current, int handle)
 {
        struct smbios_type0 *t = (struct smbios_type0 *)*current;
        int len = sizeof(struct smbios_type0);
@@ -108,7 +108,7 @@ static int smbios_write_type0(uintptr_t *current, int handle)
        return len;
 }
 
-static int smbios_write_type1(uintptr_t *current, int handle)
+static int smbios_write_type1(ulong *current, int handle)
 {
        struct smbios_type1 *t = (struct smbios_type1 *)*current;
        int len = sizeof(struct smbios_type1);
@@ -129,7 +129,7 @@ static int smbios_write_type1(uintptr_t *current, int handle)
        return len;
 }
 
-static int smbios_write_type2(uintptr_t *current, int handle)
+static int smbios_write_type2(ulong *current, int handle)
 {
        struct smbios_type2 *t = (struct smbios_type2 *)*current;
        int len = sizeof(struct smbios_type2);
@@ -147,7 +147,7 @@ static int smbios_write_type2(uintptr_t *current, int handle)
        return len;
 }
 
-static int smbios_write_type3(uintptr_t *current, int handle)
+static int smbios_write_type3(ulong *current, int handle)
 {
        struct smbios_type3 *t = (struct smbios_type3 *)*current;
        int len = sizeof(struct smbios_type3);
@@ -199,7 +199,7 @@ static void smbios_write_type4_dm(struct smbios_type4 *t)
        t->processor_version = smbios_add_string(t->eos, name);
 }
 
-static int smbios_write_type4(uintptr_t *current, int handle)
+static int smbios_write_type4(ulong *current, int handle)
 {
        struct smbios_type4 *t = (struct smbios_type4 *)*current;
        int len = sizeof(struct smbios_type4);
@@ -221,7 +221,7 @@ static int smbios_write_type4(uintptr_t *current, int handle)
        return len;
 }
 
-static int smbios_write_type32(uintptr_t *current, int handle)
+static int smbios_write_type32(ulong *current, int handle)
 {
        struct smbios_type32 *t = (struct smbios_type32 *)*current;
        int len = sizeof(struct smbios_type32);
@@ -234,7 +234,7 @@ static int smbios_write_type32(uintptr_t *current, int handle)
        return len;
 }
 
-static int smbios_write_type127(uintptr_t *current, int handle)
+static int smbios_write_type127(ulong *current, int handle)
 {
        struct smbios_type127 *t = (struct smbios_type127 *)*current;
        int len = sizeof(struct smbios_type127);
@@ -257,10 +257,10 @@ static smbios_write_type smbios_write_funcs[] = {
        smbios_write_type127
 };
 
-uintptr_t write_smbios_table(uintptr_t addr)
+ulong write_smbios_table(ulong addr)
 {
        struct smbios_entry *se;
-       u32 tables;
+       ulong tables;
        int len = 0;
        int max_struct_size = 0;
        int handle = 0;
@@ -271,7 +271,7 @@ uintptr_t write_smbios_table(uintptr_t addr)
        /* 16 byte align the table address */
        addr = ALIGN(addr, 16);
 
-       se = (struct smbios_entry *)addr;
+       se = (struct smbios_entry *)(uintptr_t)addr;
        memset(se, 0, sizeof(struct smbios_entry));
 
        addr += sizeof(struct smbios_entry);
@@ -280,7 +280,7 @@ uintptr_t write_smbios_table(uintptr_t addr)
 
        /* populate minimum required tables */
        for (i = 0; i < ARRAY_SIZE(smbios_write_funcs); i++) {
-               int tmp = smbios_write_funcs[i](&addr, handle++);
+               int tmp = smbios_write_funcs[i]((ulong *)&addr, handle++);
                max_struct_size = max(max_struct_size, tmp);
                len += tmp;
        }
index 82bc06ef9849525465c0aa70e40d23bfad34c5b8..17b903b0f5bf03d427dc9e95a664db601d88324d 100644 (file)
@@ -1,4 +1,5 @@
 #
 # Generated files
 #
+bin2c
 docproc
diff --git a/scripts/Kconfig b/scripts/Kconfig
new file mode 100644 (file)
index 0000000..2a2c18e
--- /dev/null
@@ -0,0 +1,2 @@
+config BUILD_BIN2C
+       bool
index 2f081f7104dd141e4121d7b97fa333f1b971df98..3e10c16d59fd1a06d2fc2700adb3ac81e3d18bfb 100644 (file)
@@ -7,6 +7,10 @@
 # SPDX-License-Identifier:     GPL-2.0
 #
 
+hostprogs-$(CONFIG_BUILD_BIN2C)                += bin2c
+
+always         := $(hostprogs-y)
+
 # The following hostprogs-y programs are only build on demand
 hostprogs-y += docproc
 
index c962bbca2c1254e01f8235b88fbc892956be7426..b52f9963f7d0a52f062511acaef0f9af536345bd 100644 (file)
@@ -35,6 +35,12 @@ else
 SPL_BIN := u-boot-spl
 endif
 
+ifdef CONFIG_SPL_BUILD
+SPL_ := SPL_
+else
+SPL_ :=
+endif
+
 include $(srctree)/config.mk
 include $(srctree)/arch/$(ARCH)/Makefile
 
@@ -173,6 +179,8 @@ ifeq ($(CONFIG_SYS_SOC),"at91")
 ALL-y  += boot.bin
 endif
 
+ALL-$(CONFIG_SPL_X86_16BIT_INIT) += $(obj)/u-boot-x86-16bit-spl.bin
+
 ALL-$(CONFIG_ARCH_ZYNQ)                += $(obj)/boot.bin
 ALL-$(CONFIG_ARCH_ZYNQMP)      += $(obj)/boot.bin
 
@@ -185,7 +193,8 @@ quiet_cmd_copy = COPY    $@
       cmd_copy = cp $< $@
 
 ifeq ($(CONFIG_SPL_OF_CONTROL)$(CONFIG_OF_SEPARATE)$(CONFIG_SPL_OF_PLATDATA),yy)
-$(obj)/$(SPL_BIN)-dtb.bin: $(obj)/$(SPL_BIN)-nodtb.bin $(obj)/$(SPL_BIN)-pad.bin \
+$(obj)/$(SPL_BIN)-dtb.bin: $(obj)/$(SPL_BIN)-nodtb.bin \
+               $(if $(CONFIG_SPL_SEPARATE_BSS),,$(obj)/$(SPL_BIN)-pad.bin) \
                $(obj)/$(SPL_BIN).dtb FORCE
        $(call if_changed,cat)
 
@@ -256,11 +265,16 @@ endif
 quiet_cmd_objcopy = OBJCOPY $@
 cmd_objcopy = $(OBJCOPY) $(OBJCOPYFLAGS) $(OBJCOPYFLAGS_$(@F)) $< $@
 
-OBJCOPYFLAGS_$(SPL_BIN)-nodtb.bin = $(SPL_OBJCFLAGS) -O binary
+OBJCOPYFLAGS_$(SPL_BIN)-nodtb.bin = $(SPL_OBJCFLAGS) -O binary \
+               $(if $(CONFIG_SPL_X86_16BIT_INIT),-R .start16 -R .resetvec)
 
 $(obj)/$(SPL_BIN)-nodtb.bin: $(obj)/$(SPL_BIN) FORCE
        $(call if_changed,objcopy)
 
+OBJCOPYFLAGS_u-boot-x86-16bit-spl.bin := -O binary -j .start16 -j .resetvec
+$(obj)/u-boot-x86-16bit-spl.bin: $(obj)/u-boot-spl FORCE
+       $(call if_changed,objcopy)
+
 LDFLAGS_$(SPL_BIN) += -T u-boot-spl.lds $(LDFLAGS_FINAL)
 ifneq ($(CONFIG_SPL_TEXT_BASE),)
 LDFLAGS_$(SPL_BIN) += -Ttext $(CONFIG_SPL_TEXT_BASE)
diff --git a/scripts/bin2c.c b/scripts/bin2c.c
new file mode 100644 (file)
index 0000000..c3d7eef
--- /dev/null
@@ -0,0 +1,36 @@
+/*
+ * Unloved program to convert a binary on stdin to a C include on stdout
+ *
+ * Jan 1999 Matt Mackall <mpm@selenic.com>
+ *
+ * This software may be used and distributed according to the terms
+ * of the GNU General Public License, incorporated herein by reference.
+ */
+
+#include <stdio.h>
+
+int main(int argc, char *argv[])
+{
+       int ch, total = 0;
+
+       if (argc > 1)
+               printf("const char %s[] %s=\n",
+                       argv[1], argc > 2 ? argv[2] : "");
+
+       do {
+               printf("\t\"");
+               while ((ch = getchar()) != EOF) {
+                       total++;
+                       printf("\\x%02x", ch);
+                       if (total % 16 == 0)
+                               break;
+               }
+               printf("\"\n");
+       } while (ch != EOF);
+
+       if (argc > 1)
+               printf("\t;\n\n#include <linux/types.h>\n\nconst size_t %s_size = %d;\n",
+                      argv[1], total);
+
+       return 0;
+}
index 6618dfb679c0a705a4df410fab932d87f6e87d89..97e52dce83da570288947e676667a5d0237ce66d 100755 (executable)
@@ -37,12 +37,12 @@ cat `find ${srctree} -name "Kconfig*"` |sed -n \
        -e 's/^menuconfig \([A-Za-z0-9_]*\).*$/CONFIG_\1/p' |sort |uniq > ${ok}
 comm -23 ${suspects} ${ok} >${new_adhoc}
 if [ -s ${new_adhoc} ]; then
-       echo "Error: You must add new CONFIG options using Kconfig"
-       echo "The following new ad-hoc CONFIG options were detected:"
-       cat ${new_adhoc}
-       echo
-       echo "Please add these via Kconfig instead. Find a suitable Kconfig"
-       echo "file and add a 'config' or 'menuconfig' option."
+       echo >&2 "Error: You must add new CONFIG options using Kconfig"
+       echo >&2 "The following new ad-hoc CONFIG options were detected:"
+       cat >&2 ${new_adhoc}
+       echo >&2
+       echo >&2 "Please add these via Kconfig instead. Find a suitable Kconfig"
+       echo >&2 "file and add a 'config' or 'menuconfig' option."
        # Don't delete the temporary files in case they are useful
        exit 1
 else
index 84f57566fda65fe7867456180ca3de4647317416..3afc870f0f2a454c5331cf0076ba2da9170dc747 100755 (executable)
@@ -7,9 +7,12 @@
 
 use strict;
 use POSIX;
+use File::Basename;
+use Cwd 'abs_path';
 
 my $P = $0;
 $P =~ s@.*/@@g;
+my $D = dirname(abs_path($P));
 
 my $V = '0.32';
 
@@ -42,6 +45,9 @@ my $configuration_file = ".checkpatch.conf";
 my $max_line_length = 80;
 my $ignore_perl_version = 0;
 my $minimum_perl_version = 5.10.0;
+my $spelling_file = "$D/spelling.txt";
+my $codespell = 0;
+my $codespellfile = "/usr/share/codespell/dictionary.txt";
 
 sub help {
        my ($exitcode) = @_;
@@ -82,6 +88,9 @@ Options:
                              file.  It's your fault if there's no backup or git
   --ignore-perl-version      override checking of perl version.  expect
                              runtime errors.
+  --codespell                Use the codespell dictionary for spelling/typos
+                             (default:/usr/local/share/codespell/dictionary.txt)
+  --codespellfile            Use this codespell dictionary
   -h, --help, --version      display this help and exit
 
 When FILE is - read standard input.
@@ -139,6 +148,8 @@ GetOptions(
        'ignore-perl-version!' => \$ignore_perl_version,
        'debug=s'       => \%debug,
        'test-only=s'   => \$tst_only,
+       'codespell!'    => \$codespell,
+       'codespellfile=s' => \$codespellfile,
        'h|help'        => \$help,
        'version'       => \$help
 ) or help(1);
@@ -387,6 +398,56 @@ our $allowed_asm_includes = qr{(?x:
 )};
 # memory.h: ARM has a custom one
 
+# Load common spelling mistakes and build regular expression list.
+my $misspellings;
+my %spelling_fix;
+
+if (open(my $spelling, '<', $spelling_file)) {
+       while (<$spelling>) {
+               my $line = $_;
+
+               $line =~ s/\s*\n?$//g;
+               $line =~ s/^\s*//g;
+
+               next if ($line =~ m/^\s*#/);
+               next if ($line =~ m/^\s*$/);
+
+               my ($suspect, $fix) = split(/\|\|/, $line);
+
+               $spelling_fix{$suspect} = $fix;
+       }
+       close($spelling);
+} else {
+       warn "No typos will be found - file '$spelling_file': $!\n";
+}
+
+if ($codespell) {
+       if (open(my $spelling, '<', $codespellfile)) {
+               while (<$spelling>) {
+                       my $line = $_;
+
+                       $line =~ s/\s*\n?$//g;
+                       $line =~ s/^\s*//g;
+
+                       next if ($line =~ m/^\s*#/);
+                       next if ($line =~ m/^\s*$/);
+                       next if ($line =~ m/, disabled/i);
+
+                       $line =~ s/,.*$//;
+
+                       my ($suspect, $fix) = split(/->/, $line);
+
+                       $spelling_fix{$suspect} = $fix;
+               }
+               close($spelling);
+       } else {
+               warn "No codespell typos will be found - file '$codespellfile': $!\n";
+       }
+}
+
+$misspellings = join("|", sort keys %spelling_fix) if keys %spelling_fix;
+
+
 sub build_types {
        my $mods = "(?x:  \n" . join("|\n  ", @modifierList) . "\n)";
        my $all = "(?x:  \n" . join("|\n  ", @typeList) . "\n)";
@@ -528,6 +589,8 @@ my @rawlines = ();
 my @lines = ();
 my @fixed = ();
 my $vname;
+my $fixlinenr = -1;
+
 for my $filename (@ARGV) {
        my $FILE;
        if ($file) {
@@ -1950,6 +2013,24 @@ sub process {
                            "8-bit UTF-8 used in possible commit log\n" . $herecurr);
                }
 
+# Check for various typo / spelling mistakes
+               if (defined($misspellings) &&
+                   ($in_commit_log || $line =~ /^(?:\+|Subject:)/i)) {
+                       while ($rawline =~ /(?:^|[^a-z@])($misspellings)(?:\b|$|[^a-z@])/gi) {
+                               my $typo = $1;
+                               my $typo_fix = $spelling_fix{lc($typo)};
+                               $typo_fix = ucfirst($typo_fix) if ($typo =~ /^[A-Z]/);
+                               $typo_fix = uc($typo_fix) if ($typo =~ /^[A-Z]+$/);
+                               my $msg_type = \&WARN;
+                               $msg_type = \&CHK if ($file);
+                               if (&{$msg_type}("TYPO_SPELLING",
+                                                "'$typo' may be misspelled - perhaps '$typo_fix'?\n" . $herecurr) &&
+                                   $fix) {
+                                       $fixed[$fixlinenr] =~ s/(^|[^A-Za-z@])($typo)($|[^A-Za-z@])/$1$typo_fix$3/;
+                               }
+                       }
+               }
+
 # ignore non-hunk lines and lines being removed
                next if (!$hunk_line || $line =~ /^-/);
 
index d21589bc2b1129ba3b992f417071e3d2f7f86bd1..826d03185289aa1f405fac6ad43db57b9a75b57a 100644 (file)
@@ -102,7 +102,6 @@ CONFIG_APBH_DMA_BURST8
 CONFIG_APER_0_BASE
 CONFIG_APER_1_BASE
 CONFIG_APER_SIZE
-CONFIG_API
 CONFIG_APUS_FAST_EXCEPT
 CONFIG_AP_SH4A_4A
 CONFIG_ARCH_ADPAG101P
index 5733096066c9780a4539270856b03ef4840ffab3..f52cb733c775f7f1f9661b6f245f1e5182c0c8a7 100644 (file)
@@ -35,7 +35,7 @@ static int dm_test_spi_find(struct unit_test_state *uts)
         */
        ut_asserteq(0, uclass_get_device_by_seq(UCLASS_SPI, busnum, &bus));
        ut_assertok(spi_cs_info(bus, cs, &info));
-       of_offset = info.dev->of_offset;
+       of_offset = dev_of_offset(info.dev);
        device_remove(info.dev);
        device_unbind(info.dev);
 
index 49a36cb1932e67794d5f55ec7359e2c54920885a..3048a7b890c9ebc6c25ed4ba7b083fc27727731c 100644 (file)
@@ -37,9 +37,9 @@ static int testfdt_ofdata_to_platdata(struct udevice *dev)
 {
        struct dm_test_pdata *pdata = dev_get_platdata(dev);
 
-       pdata->ping_add = fdtdec_get_int(gd->fdt_blob, dev->of_offset,
+       pdata->ping_add = fdtdec_get_int(gd->fdt_blob, dev_of_offset(dev),
                                        "ping-add", -1);
-       pdata->base = fdtdec_get_addr(gd->fdt_blob, dev->of_offset,
+       pdata->base = fdtdec_get_addr(gd->fdt_blob, dev_of_offset(dev),
                                      "ping-expect");
 
        return 0;
@@ -121,10 +121,10 @@ int dm_check_devices(struct unit_test_state *uts, int num_devices)
                 * want to test the code that sets that up
                 * (testfdt_drv_probe()).
                 */
-               base = fdtdec_get_addr(gd->fdt_blob, dev->of_offset,
+               base = fdtdec_get_addr(gd->fdt_blob, dev_of_offset(dev),
                                       "ping-expect");
                debug("dev=%d, base=%d: %s\n", i, base,
-                     fdt_get_name(gd->fdt_blob, dev->of_offset, NULL));
+                     fdt_get_name(gd->fdt_blob, dev_of_offset(dev), NULL));
 
                ut_assert(!dm_check_operations(uts, dev, base,
                                               dev_get_priv(dev)));
index f5ac6313e1f1b6867a2340b8fdf7bd045588971c..cbccd4ab91ae167b4d5daabf2e251bdc2b6e0234 100644 (file)
@@ -32,7 +32,6 @@ CONFIG_BUILD_ENVCRC ?= $(ENVCRC-y)
 
 hostprogs-$(CONFIG_SPL_GENERATE_ATMEL_PMECC_HEADER) += atmel_pmecc_params
 
-hostprogs-$(CONFIG_CMD_LICENSE) += bin2header
 hostprogs-$(CONFIG_LCD_LOGO) += bmp_logo
 hostprogs-$(CONFIG_VIDEO_LOGO) += bmp_logo
 HOSTCFLAGS_bmp_logo.o := -pedantic
@@ -233,10 +232,6 @@ endif
 
 endif # !LOGO_BMP
 
-# Generated gziped GPL-2.0 license text
-LICENSE_H = $(objtree)/include/license.h
-LICENSE-$(CONFIG_CMD_LICENSE) += $(LICENSE_H)
-
 #
 # Use native tools and options
 # Define __KERNEL_STRICT_NAMES to prevent typedef overlaps
@@ -251,7 +246,7 @@ HOST_EXTRACFLAGS += -include $(srctree)/include/libfdt_env.h \
                -D__KERNEL_STRICT_NAMES \
                -D_GNU_SOURCE
 
-__build:       $(LOGO-y) $(LICENSE-y)
+__build:       $(LOGO-y)
 
 $(LOGO_H):     $(obj)/bmp_logo $(LOGO_BMP)
        $(obj)/bmp_logo --gen-info $(LOGO_BMP) > $@
@@ -259,10 +254,6 @@ $(LOGO_H): $(obj)/bmp_logo $(LOGO_BMP)
 $(LOGO_DATA_H):        $(obj)/bmp_logo $(LOGO_BMP)
        $(obj)/bmp_logo --gen-data $(LOGO_BMP) > $@
 
-$(LICENSE_H): $(obj)/bin2header $(srctree)/Licenses/gpl-2.0.txt
-       cat $(srctree)/Licenses/gpl-2.0.txt | gzip -9 -c | \
-               $(obj)/bin2header license_gzip > $(LICENSE_H)
-
 # Let clean descend into subdirs
 subdir- += env
 
diff --git a/tools/bin2header.c b/tools/bin2header.c
deleted file mode 100644 (file)
index 6c2c23f..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-/* bin2header.c - program to convert binary file into a C structure
- * definition to be included in a header file.
- *
- * (C) Copyright 2008 by Harald Welte <laforge@openmoko.org>
- *
- * SPDX-License-Identifier:    GPL-2.0+
- */
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <unistd.h>
-
-int main(int argc, char **argv)
-{
-       if (argc < 2) {
-               fprintf(stderr, "%s needs one argument: the structure name\n",
-                       argv[0]);
-               exit(1);
-       }
-
-       printf("/* bin2header output - automatically generated */\n");
-       printf("unsigned char %s[] = {\n", argv[1]);
-
-       while (1) {
-               int i, nread;
-               unsigned char buf[10];
-               nread = read(0, buf, sizeof(buf));
-               if (nread <= 0)
-                       break;
-
-               printf("\t");
-               for (i = 0; i < nread - 1; i++)
-                       printf("0x%02x, ", buf[i]);
-
-               printf("0x%02x,\n", buf[nread-1]);
-       }
-
-       printf("};\n");
-
-       exit(0);
-}
index 764c2824ffd3f0bf809a932828cbddcba9d75b7b..1c6706df6db3cff2edae7d55b45ffcbea3418aca 100644 (file)
@@ -21,7 +21,7 @@ class Entry_u_boot_spl_with_ucode_ptr(Entry_u_boot_with_ucode_ptr):
     process.
     """
     def __init__(self, image, etype, node):
-        Entry_blob.__init__(self, image, etype, node)
+        Entry_u_boot_with_ucode_ptr.__init__(self, image, etype, node)
         self.elf_fname = 'spl/u-boot-spl'
 
     def GetDefaultFilename(self):
index 8fe27acb2453a25d15bb1525ff864720c0e480fb..8e51e99a1190700daf7facd9ed595ca081ea5f93 100644 (file)
@@ -62,6 +62,12 @@ class Entry_u_boot_ucode(Entry_blob):
             self.data = ''
             return True
 
+        # Handle microcode in SPL image as well
+        ucode_dest_entry = self.image.FindEntryType('u-boot-spl-with-ucode-ptr')
+        if ucode_dest_entry and not ucode_dest_entry.target_pos:
+            self.data = ''
+            return True
+
         # Get the microcode from the device tree entry
         fdt_entry = self.image.FindEntryType('u-boot-dtb-with-ucode')
         if not fdt_entry or not fdt_entry.ucode_data:
index ccea13fd2dbcd1871d960c2a8cdf0267ecdf7920..f66527665ad87593adb6462d8a726d2712d12b68 100644 (file)
@@ -141,7 +141,7 @@ means to build all arm boards except nvidia, freescale and anything ending
 with 'ball'.
 
 It is convenient to use the -n option to see what will be built based on
-the subset given.
+the subset given. Use -v as well to get an actual list of boards.
 
 Buildman does not store intermediate object files. It optionally copies
 the binary output into a directory when a build is successful. Size
index ae0e0b8e171987169194ab3b9a282cf375ca5fb4..f842d3a1fa1e927cc3cb8a1754f557cee87e90b6 100644 (file)
@@ -249,15 +249,15 @@ class Boards:
             exclude: List of boards to exclude, regardless of 'args'
 
         Returns:
-            Dictionary which holds the number of boards which were selected
+            Dictionary which holds the list of boards which were selected
             due to each argument, arranged by argument.
         """
         result = {}
         terms = self._BuildTerms(args)
 
-        result['all'] = 0
+        result['all'] = []
         for term in terms:
-            result[str(term)] = 0
+            result[str(term)] = []
 
         exclude_list = []
         for expr in exclude:
@@ -285,7 +285,7 @@ class Boards:
             if build_it:
                 board.build_it = True
                 if matching_term:
-                    result[matching_term] += 1
-                result['all'] += 1
+                    result[matching_term].append(board.target)
+                result['all'].append(board.target)
 
         return result
index 545c2cb44a134cbb5ef916498c919b480548b2b9..73b1a14fb6bb8428206ffc4a9a8b8f4e0926b8ec 100644 (file)
@@ -48,9 +48,9 @@ def ShowActions(series, why_selected, boards_selected, builder, options):
     Args:
         series: Series object
         why_selected: Dictionary where each key is a buildman argument
-                provided by the user, and the value is the boards brought
-                in by that argument. For example, 'arm' might bring in
-                400 boards, so in this case the key would be 'arm' and
+                provided by the user, and the value is the list of boards
+                brought in by that argument. For example, 'arm' might bring
+                in 400 boards, so in this case the key would be 'arm' and
                 the value would be a list of board names.
         boards_selected: Dict of selected boards, key is target name,
                 value is Board object
@@ -75,9 +75,11 @@ def ShowActions(series, why_selected, boards_selected, builder, options):
     print
     for arg in why_selected:
         if arg != 'all':
-            print arg, ': %d boards' % why_selected[arg]
+            print arg, ': %d boards' % len(why_selected[arg])
+            if options.verbose:
+                print '   %s' % ' '.join(why_selected[arg])
     print ('Total boards to build for each commit: %d\n' %
-            why_selected['all'])
+            len(why_selected['all']))
 
 def DoBuildman(options, args, toolchains=None, make_func=None, boards=None,
                clean_dir=False):
@@ -221,9 +223,10 @@ def DoBuildman(options, args, toolchains=None, make_func=None, boards=None,
                     options.git_dir, count, series=None, allow_overwrite=True)
     else:
         series = None
-        options.verbose = True
-        if not options.summary:
-            options.show_errors = True
+        if not options.dry_run:
+            options.verbose = True
+            if not options.summary:
+                options.show_errors = True
 
     # By default we have one thread per CPU. But if there are not enough jobs
     # we can have fewer threads and use a high '-j' value for make.
index 11050b66f71057821f0a2076fcbba0a4ad6f734e..6df7b0da13ad845bdf8bbea9902be1fcd1462acf 100755 (executable)
@@ -54,6 +54,7 @@ def Conv_name_to_c(name):
     str = name.replace('@', '_at_')
     str = str.replace('-', '_')
     str = str.replace(',', '_')
+    str = str.replace('.', '_')
     str = str.replace('/', '__')
     return str
 
index be78fc510b8aa0341d26f77ef4c56df881d53a79..2915d97950d32c3920ab6e93523c2f031a4d1065 100644 (file)
@@ -138,7 +138,7 @@ def GetWarningMsg(col, msg_type, fname, line, msg):
         msg_type = col.Color(col.RED, msg_type)
     elif msg_type == 'check':
         msg_type = col.Color(col.MAGENTA, msg_type)
-    return '%s: %s,%d: %s' % (msg_type, fname, line, msg)
+    return '%s:%d: %s: %s\n' % (fname, line, msg_type, msg)
 
 def CheckPatches(verbose, args):
     '''Run the checkpatch.pl script on each patch'''
@@ -157,7 +157,8 @@ def CheckPatches(verbose, args):
                     result.checks):
                 print("Internal error: some problems lost")
             for item in result.problems:
-                print(GetWarningMsg(col, item.get('type', '<unknown>'),
+                sys.stderr.write(
+                    GetWarningMsg(col, item.get('type', '<unknown>'),
                         item.get('file', '<unknown>'),
                         item.get('line', 0), item.get('msg', 'message')))
             print
index 38a452edad4108e54527e8849cbcb27488031821..c1b86521aa4561f7325fb4ce6724dcd0cb67c9dc 100644 (file)
@@ -235,7 +235,8 @@ class Series(dict):
 
         if cover_fname:
             cover_cc = gitutil.BuildEmailList(self.get('cover_cc', ''))
-            print(cover_fname, ', '.join(set(cover_cc + all_ccs)), file=fd)
+            cc_list = ', '.join([x.decode('utf-8') for x in set(cover_cc + all_ccs)])
+            print(cover_fname, cc_list.encode('utf-8'), file=fd)
 
         fd.close()
         return fname