summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitlab-ci.yml40
-rw-r--r--MAINTAINERS22
-rw-r--r--README2
-rw-r--r--api/api.c7
-rw-r--r--arch/arm/Kconfig13
-rw-r--r--arch/arm/cpu/arm926ejs/spear/spr_misc.c2
-rw-r--r--arch/arm/cpu/armv7/vf610/generic.c1
-rw-r--r--arch/arm/cpu/armv8/fsl-layerscape/cpu.c3
-rw-r--r--arch/arm/cpu/armv8/fsl-layerscape/soc.c3
-rw-r--r--arch/arm/cpu/armv8/fsl-layerscape/spl.c1
-rw-r--r--arch/arm/dts/Makefile3
-rw-r--r--arch/arm/dts/am335x-brsmarc1.dts416
-rw-r--r--arch/arm/dts/hi3660-hikey960-u-boot.dtsi10
-rw-r--r--arch/arm/dts/hi3660-hikey960.dts607
-rw-r--r--arch/arm/dts/hi3660.dtsi1157
-rw-r--r--arch/arm/dts/hikey960-pinctrl.dtsi1060
-rw-r--r--arch/arm/dts/k3-am65-main.dtsi108
-rw-r--r--arch/arm/dts/k3-am65.dtsi1
-rw-r--r--arch/arm/dts/meson-g12a-sei510.dts502
-rw-r--r--arch/arm/include/asm/arch-hi3660/hi3660.h52
-rw-r--r--arch/arm/include/asm/arch-meson/sm.h18
-rw-r--r--arch/arm/include/asm/ti-common/omap_wdt.h5
-rw-r--r--arch/arm/lib/bootm.c1
-rw-r--r--arch/arm/mach-davinci/misc.c2
-rw-r--r--arch/arm/mach-imx/cmd_dek.c1
-rw-r--r--arch/arm/mach-imx/mx6/opos6ul.c4
-rw-r--r--arch/arm/mach-imx/mx7/soc.c1
-rw-r--r--arch/arm/mach-imx/video.c1
-rw-r--r--arch/arm/mach-k3/sysfw-loader.c21
-rw-r--r--arch/arm/mach-kirkwood/cpu.c1
-rw-r--r--arch/arm/mach-meson/board-common.c35
-rw-r--r--arch/arm/mach-meson/sm.c133
-rw-r--r--arch/arm/mach-omap2/Kconfig1
-rw-r--r--arch/arm/mach-omap2/am33xx/Kconfig4
-rw-r--r--arch/arm/mach-omap2/boot-common.c3
-rw-r--r--arch/arm/mach-omap2/omap3/clock.c1
-rw-r--r--arch/arm/mach-omap2/utils.c2
-rw-r--r--arch/arm/mach-rmobile/cpu_info.c1
-rw-r--r--arch/arm/mach-rockchip/rk3288/rk3288.c1
-rw-r--r--arch/arm/mach-socfpga/misc_gen5.c1
-rw-r--r--arch/arm/mach-socfpga/misc_s10.c1
-rw-r--r--arch/arm/mach-stm32mp/cpu.c2
-rw-r--r--arch/arm/mach-tegra/board2.c1
-rw-r--r--arch/arm/mach-tegra/cboot.c2
-rw-r--r--arch/arm/mach-uniphier/board_late_init.c1
-rw-r--r--arch/arm/mach-uniphier/mmc-first-dev.c1
-rw-r--r--arch/m68k/lib/bootm.c2
-rw-r--r--arch/microblaze/lib/bootm.c1
-rw-r--r--arch/mips/lib/bootm.c1
-rw-r--r--arch/nds32/include/asm/u-boot.h1
-rw-r--r--arch/nds32/lib/bootm.c1
-rw-r--r--arch/powerpc/cpu/mpc85xx/cpu_init.c1
-rw-r--r--arch/powerpc/cpu/mpc85xx/fdt.c2
-rw-r--r--arch/powerpc/cpu/mpc85xx/fsl_corenet_serdes.c1
-rw-r--r--arch/powerpc/cpu/mpc85xx/mp.c2
-rw-r--r--arch/powerpc/lib/bootm.c2
-rw-r--r--arch/riscv/include/asm/u-boot.h1
-rw-r--r--arch/x86/cpu/qemu/e820.c1
-rw-r--r--arch/x86/lib/zimage.c1
-rw-r--r--arch/xtensa/lib/bootm.c1
-rw-r--r--board/Arcturus/ucp1020/cmd_arc.c2
-rw-r--r--board/Arcturus/ucp1020/spl.c3
-rw-r--r--board/Arcturus/ucp1020/ucp1020.c1
-rw-r--r--board/BuR/brppt1/board.c1
-rw-r--r--board/BuR/brsmarc1/Kconfig15
-rw-r--r--board/BuR/brsmarc1/MAINTAINERS6
-rw-r--r--board/BuR/brsmarc1/Makefile10
-rw-r--r--board/BuR/brsmarc1/board.c168
-rw-r--r--board/BuR/brsmarc1/config.mk33
-rw-r--r--board/BuR/brsmarc1/mux.c266
-rw-r--r--board/BuR/brxre1/board.c1
-rw-r--r--board/BuR/common/br_resetc.c1
-rw-r--r--board/BuR/common/common.c1
-rw-r--r--board/BuS/eb_cpu5282/eb_cpu5282.c1
-rw-r--r--board/CZ.NIC/turris_mox/turris_mox.c2
-rw-r--r--board/CZ.NIC/turris_omnia/turris_omnia.c2
-rw-r--r--board/CarMediaLab/flea3/flea3.c1
-rw-r--r--board/LaCie/net2big_v2/net2big_v2.c2
-rw-r--r--board/LaCie/netspace_v2/netspace_v2.c2
-rw-r--r--board/Synology/ds414/cmd_syno.c1
-rw-r--r--board/alliedtelesis/x530/x530.c1
-rw-r--r--board/amazon/kc1/kc1.c1
-rw-r--r--board/amlogic/p200/p200.c2
-rw-r--r--board/amlogic/p201/p201.c2
-rw-r--r--board/amlogic/p212/p212.c2
-rw-r--r--board/amlogic/q200/q200.c2
-rw-r--r--board/amlogic/s400/s400.c1
-rw-r--r--board/amlogic/sei510/MAINTAINERS7
-rw-r--r--board/amlogic/sei510/Makefile6
-rw-r--r--board/amlogic/sei510/README123
-rw-r--r--board/amlogic/sei510/sei510.c26
-rw-r--r--board/amlogic/u200/u200.c1
-rw-r--r--board/amlogic/w400/w400.c2
-rw-r--r--board/aristainetos/aristainetos-v2.c1
-rw-r--r--board/armadeus/apf27/apf27.c1
-rw-r--r--board/armltd/integrator/integrator.c1
-rw-r--r--board/atmel/common/board.c1
-rw-r--r--board/atmel/common/mac_eeprom.c2
-rw-r--r--board/atmel/sama5d3xek/sama5d3xek.c1
-rw-r--r--board/bachmann/ot1200/ot1200.c1
-rw-r--r--board/birdland/bav335x/board.c4
-rw-r--r--board/bluegiga/apx4devkit/apx4devkit.c1
-rw-r--r--board/bluewater/gurnard/gurnard.c1
-rw-r--r--board/bosch/guardian/board.c3
-rw-r--r--board/bosch/shc/board.c4
-rw-r--r--board/boundary/nitrogen6x/nitrogen6x.c1
-rw-r--r--board/broadcom/bcm23550_w1d/bcm23550_w1d.c1
-rw-r--r--board/broadcom/bcm28155_ap/bcm28155_ap.c1
-rw-r--r--board/broadcom/bcmstb/bcmstb.c1
-rw-r--r--board/buffalo/lsxl/lsxl.c3
-rw-r--r--board/cadence/xtfpga/xtfpga.c1
-rw-r--r--board/ccv/xpress/xpress.c1
-rw-r--r--board/compulab/cl-som-imx7/cl-som-imx7.c2
-rw-r--r--board/compulab/cm_fx6/cm_fx6.c2
-rw-r--r--board/compulab/cm_t335/cm_t335.c2
-rw-r--r--board/compulab/cm_t35/cm_t35.c2
-rw-r--r--board/compulab/cm_t54/cm_t54.c2
-rw-r--r--board/compulab/common/omap3_display.c1
-rw-r--r--board/congatec/cgtqmx6eval/cgtqmx6eval.c1
-rw-r--r--board/cssi/MCR3000/MCR3000.c1
-rw-r--r--board/davinci/da8xxevm/da850evm.c5
-rw-r--r--board/davinci/da8xxevm/omapl138_lcdk.c1
-rw-r--r--board/dhelectronics/dh_imx6/dh_imx6.c2
-rw-r--r--board/eets/pdu001/board.c2
-rw-r--r--board/el/el6x/el6x.c1
-rw-r--r--board/emulation/qemu-riscv/qemu-riscv.c1
-rw-r--r--board/engicam/common/board.c1
-rw-r--r--board/esd/meesc/meesc.c1
-rw-r--r--board/freescale/b4860qds/b4860qds.c1
-rw-r--r--board/freescale/b4860qds/spl.c3
-rw-r--r--board/freescale/bsc9131rdb/bsc9131rdb.c1
-rw-r--r--board/freescale/bsc9132qds/bsc9132qds.c1
-rw-r--r--board/freescale/c29xpcie/c29xpcie.c1
-rw-r--r--board/freescale/c29xpcie/spl.c2
-rw-r--r--board/freescale/common/cmd_esbc_validate.c1
-rw-r--r--board/freescale/common/fsl_chain_of_trust.c1
-rw-r--r--board/freescale/common/sys_eeprom.c1
-rw-r--r--board/freescale/common/vid.c1
-rw-r--r--board/freescale/corenet_ds/corenet_ds.c1
-rw-r--r--board/freescale/imx8mq_evk/imx8mq_evk.c1
-rw-r--r--board/freescale/imx8qm_mek/imx8qm_mek.c2
-rw-r--r--board/freescale/imx8qxp_mek/imx8qxp_mek.c2
-rw-r--r--board/freescale/ls1012afrdm/ls1012afrdm.c2
-rw-r--r--board/freescale/ls1012aqds/ls1012aqds.c2
-rw-r--r--board/freescale/ls1012ardb/ls1012ardb.c2
-rw-r--r--board/freescale/ls1028a/ls1028a.c2
-rw-r--r--board/freescale/ls1088a/eth_ls1088aqds.c1
-rw-r--r--board/freescale/ls1088a/ls1088a.c3
-rw-r--r--board/freescale/ls2080a/ls2080a.c2
-rw-r--r--board/freescale/ls2080aqds/eth.c1
-rw-r--r--board/freescale/ls2080aqds/ls2080aqds.c3
-rw-r--r--board/freescale/ls2080ardb/ls2080ardb.c3
-rw-r--r--board/freescale/lx2160a/eth_lx2160aqds.c1
-rw-r--r--board/freescale/lx2160a/lx2160a.c2
-rw-r--r--board/freescale/mpc8323erdb/mpc8323erdb.c1
-rw-r--r--board/freescale/mpc837xemds/pci.c1
-rw-r--r--board/freescale/mpc837xerdb/mpc837xerdb.c1
-rw-r--r--board/freescale/mpc8572ds/mpc8572ds.c1
-rw-r--r--board/freescale/mx51evk/mx51evk_video.c1
-rw-r--r--board/freescale/mx53loco/mx53loco.c1
-rw-r--r--board/freescale/mx53loco/mx53loco_video.c1
-rw-r--r--board/freescale/mx6sabreauto/mx6sabreauto.c1
-rw-r--r--board/freescale/mx6sabresd/mx6sabresd.c1
-rw-r--r--board/freescale/mx6sxsabresd/mx6sxsabresd.c1
-rw-r--r--board/freescale/mx6ul_14x14_evk/mx6ul_14x14_evk.c1
-rw-r--r--board/freescale/mx6ullevk/mx6ullevk.c1
-rw-r--r--board/freescale/p1010rdb/p1010rdb.c1
-rw-r--r--board/freescale/p1010rdb/spl.c3
-rw-r--r--board/freescale/p1022ds/p1022ds.c1
-rw-r--r--board/freescale/p1022ds/spl.c3
-rw-r--r--board/freescale/p1023rdb/p1023rdb.c1
-rw-r--r--board/freescale/p1_p2_rdb_pc/p1_p2_rdb_pc.c1
-rw-r--r--board/freescale/p1_p2_rdb_pc/spl.c3
-rw-r--r--board/freescale/p1_twr/p1_twr.c1
-rw-r--r--board/freescale/p2041rdb/p2041rdb.c1
-rw-r--r--board/freescale/qemu-ppce500/qemu-ppce500.c1
-rw-r--r--board/freescale/t102xqds/spl.c2
-rw-r--r--board/freescale/t102xqds/t102xqds.c1
-rw-r--r--board/freescale/t102xrdb/spl.c2
-rw-r--r--board/freescale/t102xrdb/t102xrdb.c1
-rw-r--r--board/freescale/t1040qds/t1040qds.c1
-rw-r--r--board/freescale/t104xrdb/spl.c2
-rw-r--r--board/freescale/t104xrdb/t104xrdb.c1
-rw-r--r--board/freescale/t208xqds/spl.c2
-rw-r--r--board/freescale/t208xqds/t208xqds.c1
-rw-r--r--board/freescale/t208xrdb/spl.c2
-rw-r--r--board/freescale/t208xrdb/t208xrdb.c1
-rw-r--r--board/freescale/t4qds/spl.c2
-rw-r--r--board/freescale/t4qds/t4240emu.c1
-rw-r--r--board/freescale/t4qds/t4240qds.c1
-rw-r--r--board/freescale/t4rdb/spl.c2
-rw-r--r--board/freescale/t4rdb/t4240rdb.c1
-rw-r--r--board/gardena/smart-gateway-at91sam/board.c1
-rw-r--r--board/gardena/smart-gateway-mt7688/board.c3
-rw-r--r--board/gateworks/gw_ventana/common.c1
-rw-r--r--board/gateworks/gw_ventana/gw_ventana.c2
-rw-r--r--board/gateworks/gw_ventana/gw_ventana_spl.c3
-rw-r--r--board/gdsys/a38x/keyprogram.c1
-rw-r--r--board/gdsys/mpc8308/gazerbeam.c1
-rw-r--r--board/gdsys/mpc8308/hrcon.c1
-rw-r--r--board/gdsys/mpc8308/strider.c1
-rw-r--r--board/gdsys/p1022/controlcenterd-id.c1
-rw-r--r--board/gdsys/p1022/controlcenterd.c1
-rw-r--r--board/ge/bx50v3/bx50v3.c1
-rw-r--r--board/ge/common/ge_common.c1
-rw-r--r--board/ge/mx53ppd/mx53ppd.c2
-rw-r--r--board/grinn/chiliboard/board.c2
-rw-r--r--board/grinn/liteboard/board.c1
-rw-r--r--board/gumstix/pepper/board.c2
-rw-r--r--board/highbank/highbank.c1
-rw-r--r--board/hisilicon/hikey960/Kconfig15
-rw-r--r--board/hisilicon/hikey960/MAINTAINERS6
-rw-r--r--board/hisilicon/hikey960/Makefile3
-rw-r--r--board/hisilicon/hikey960/README247
-rw-r--r--board/hisilicon/hikey960/hikey960.c186
-rw-r--r--board/hisilicon/poplar/poplar.c1
-rw-r--r--board/imgtec/ci20/ci20.c2
-rw-r--r--board/intel/edison/edison.c2
-rw-r--r--board/isee/igep003x/board.c2
-rw-r--r--board/isee/igep00x0/igep00x0.c1
-rw-r--r--board/k+p/kp_imx53/kp_id_rev.c2
-rw-r--r--board/k+p/kp_imx53/kp_imx53.c1
-rw-r--r--board/k+p/kp_imx6q_tpc/kp_imx6q_tpc.c1
-rw-r--r--board/keymile/common/common.c1
-rw-r--r--board/keymile/common/ivm.c1
-rw-r--r--board/keymile/km83xx/km83xx.c1
-rw-r--r--board/keymile/km_arm/km_arm.c1
-rw-r--r--board/keymile/kmp204x/kmp204x.c1
-rw-r--r--board/kosagi/novena/novena.c2
-rw-r--r--board/laird/wb50n/wb50n.c1
-rw-r--r--board/lg/sniper/sniper.c1
-rw-r--r--board/liebherr/display5/display5.c2
-rw-r--r--board/liebherr/display5/spl.c2
-rw-r--r--board/liebherr/mccmon6/mccmon6.c1
-rw-r--r--board/logicpd/imx6/imx6logic.c1
-rw-r--r--board/logicpd/zoom1/zoom1.c2
-rw-r--r--board/menlo/m53menlo/m53menlo.c2
-rw-r--r--board/micronas/vct/vct.c1
-rw-r--r--board/mscc/ocelot/ocelot.c1
-rw-r--r--board/nokia/rx51/rx51.c1
-rw-r--r--board/nvidia/p2371-2180/p2371-2180.c2
-rw-r--r--board/nvidia/p2771-0000/p2771-0000.c2
-rw-r--r--board/overo/common.c26
-rw-r--r--board/overo/overo.c15
-rw-r--r--board/phytec/pcm051/board.c2
-rw-r--r--board/phytec/pcm052/pcm052.c4
-rw-r--r--board/phytec/pfla02/pfla02.c1
-rw-r--r--board/phytec/phycore_rk3288/phycore-rk3288.c4
-rw-r--r--board/qualcomm/dragonboard410c/dragonboard410c.c2
-rw-r--r--board/qualcomm/dragonboard820c/dragonboard820c.c1
-rw-r--r--board/raspberrypi/rpi/rpi.c2
-rw-r--r--board/renesas/alt/alt.c3
-rw-r--r--board/renesas/blanche/blanche.c2
-rw-r--r--board/renesas/gose/gose.c3
-rw-r--r--board/renesas/koelsch/koelsch.c3
-rw-r--r--board/renesas/lager/lager.c3
-rw-r--r--board/renesas/porter/porter.c3
-rw-r--r--board/renesas/sh7752evb/sh7752evb.c2
-rw-r--r--board/renesas/sh7753evb/sh7753evb.c2
-rw-r--r--board/renesas/sh7757lcr/sh7757lcr.c2
-rw-r--r--board/renesas/silk/silk.c3
-rw-r--r--board/renesas/stout/stout.c3
-rw-r--r--board/rockchip/tinker_rk3288/tinker-rk3288.c2
-rw-r--r--board/samsung/common/exynos5-dt.c1
-rw-r--r--board/samsung/common/misc.c1
-rw-r--r--board/samsung/odroid/odroid.c1
-rw-r--r--board/samsung/trats/trats.c1
-rw-r--r--board/samsung/universal_c210/universal.c1
-rw-r--r--board/samtec/vining_fpga/socfpga.c2
-rw-r--r--board/siemens/common/board.c1
-rw-r--r--board/siemens/common/factoryset.c126
-rw-r--r--board/siemens/common/factoryset.h3
-rw-r--r--board/siemens/draco/board.c1
-rw-r--r--board/siemens/pxm2/board.c2
-rw-r--r--board/siemens/rut/board.c1
-rw-r--r--board/siemens/taurus/taurus.c2
-rw-r--r--board/silica/pengwyn/board.c2
-rw-r--r--board/socrates/socrates.c1
-rw-r--r--board/softing/vining_2000/vining_2000.c2
-rw-r--r--board/solidrun/mx6cuboxi/mx6cuboxi.c1
-rw-r--r--board/st/stm32mp1/stm32mp1.c3
-rw-r--r--board/sunxi/board.c3
-rw-r--r--board/synopsys/hsdk/env-lib.c1
-rw-r--r--board/synopsys/hsdk/hsdk.c1
-rw-r--r--board/tcl/sl50/board.c4
-rw-r--r--board/technologic/ts4800/ts4800.c2
-rw-r--r--board/theobroma-systems/puma_rk3399/puma-rk3399.c2
-rw-r--r--board/ti/am335x/board.c4
-rw-r--r--board/ti/am43xx/board.c2
-rw-r--r--board/ti/am57xx/board.c2
-rw-r--r--board/ti/am65x/evm.c1
-rw-r--r--board/ti/beagle/beagle.c1
-rw-r--r--board/ti/common/board_detect.c1
-rw-r--r--board/ti/dra7xx/evm.c2
-rw-r--r--board/ti/evm/evm.c1
-rw-r--r--board/ti/ks2_evm/board.c1
-rw-r--r--board/ti/ks2_evm/board_k2g.c1
-rw-r--r--board/ti/panda/panda.c1
-rw-r--r--board/ti/ti814x/evm.c2
-rw-r--r--board/ti/ti816x/evm.c2
-rw-r--r--board/timll/devkit8000/devkit8000.c2
-rw-r--r--board/toradex/apalis-imx8/apalis-imx8.c2
-rw-r--r--board/toradex/apalis-tk1/apalis-tk1.c2
-rw-r--r--board/toradex/apalis_imx6/apalis_imx6.c2
-rw-r--r--board/toradex/colibri-imx6ull/colibri-imx6ull.c1
-rw-r--r--board/toradex/colibri-imx8x/colibri-imx8x.c2
-rw-r--r--board/toradex/colibri_imx6/colibri_imx6.c2
-rw-r--r--board/toradex/colibri_vf/colibri_vf.c1
-rw-r--r--board/toradex/common/tdx-cfg-block.c1
-rw-r--r--board/toradex/common/tdx-common.c2
-rw-r--r--board/tqc/tqma6/tqma6.c1
-rw-r--r--board/udoo/neo/neo.c1
-rw-r--r--board/udoo/udoo.c1
-rw-r--r--board/varisys/common/sys_eeprom.c1
-rw-r--r--board/varisys/cyrus/cyrus.c1
-rw-r--r--board/vscom/baltos/board.c2
-rw-r--r--board/wandboard/wandboard.c1
-rw-r--r--board/warp7/warp7.c1
-rw-r--r--board/work-microwave/work_92105/work_92105_display.c1
-rw-r--r--board/xes/common/board.c1
-rw-r--r--board/xilinx/zynq/board.c1
-rw-r--r--board/xilinx/zynqmp/cmds.c1
-rw-r--r--board/xilinx/zynqmp/zynqmp.c1
-rw-r--r--cmd/Kconfig8
-rw-r--r--cmd/Makefile1
-rw-r--r--cmd/aes.c1
-rw-r--r--cmd/avb.c1
-rw-r--r--cmd/bdinfo.c1
-rw-r--r--cmd/binop.c1
-rw-r--r--cmd/blob.c1
-rw-r--r--cmd/bmp.c8
-rw-r--r--cmd/bootefi.c1
-rw-r--r--cmd/bootm.c2
-rw-r--r--cmd/bootmenu.c1
-rw-r--r--cmd/cbfs.c1
-rw-r--r--cmd/config.c1
-rw-r--r--cmd/cramfs.c1
-rw-r--r--cmd/dtimg.c1
-rw-r--r--cmd/efidebug.c1
-rw-r--r--cmd/elf.c2
-rw-r--r--cmd/ethsw.c2
-rw-r--r--cmd/fdt.c1
-rw-r--r--cmd/fpga.c2
-rw-r--r--cmd/gpt.c1
-rw-r--r--cmd/i2c.c1
-rw-r--r--cmd/ide.c4
-rw-r--r--cmd/ini.c2
-rw-r--r--cmd/itest.c1
-rw-r--r--cmd/jffs2.c1
-rw-r--r--cmd/license.c1
-rw-r--r--cmd/load.c1
-rw-r--r--cmd/lzmadec.c1
-rw-r--r--cmd/md5sum.c1
-rw-r--r--cmd/mtdparts.c1
-rw-r--r--cmd/mvebu/bubt.c1
-rw-r--r--cmd/nand.c1
-rw-r--r--cmd/net.c1
-rw-r--r--cmd/nvedit.c57
-rw-r--r--cmd/nvedit_efi.c1
-rw-r--r--cmd/part.c1
-rw-r--r--cmd/pcmcia.c341
-rw-r--r--cmd/pxe.c1
-rw-r--r--cmd/qfw.c1
-rw-r--r--cmd/reiser.c1
-rw-r--r--cmd/setexpr.c1
-rw-r--r--cmd/source.c1
-rw-r--r--cmd/spl.c1
-rw-r--r--cmd/tpm-common.c1
-rw-r--r--cmd/tpm-v1.c1
-rw-r--r--cmd/tpm_test.c1
-rw-r--r--cmd/trace.c1
-rw-r--r--cmd/ubi.c1
-rw-r--r--cmd/unzip.c2
-rw-r--r--cmd/ximg.c2
-rw-r--r--cmd/zfs.c1
-rw-r--r--cmd/zip.c1
-rw-r--r--common/autoboot.c1
-rw-r--r--common/board_f.c11
-rw-r--r--common/board_r.c17
-rw-r--r--common/bootm.c1
-rw-r--r--common/bootm_os.c1
-rw-r--r--common/bootretry.c1
-rw-r--r--common/cli.c1
-rw-r--r--common/cli_hush.c1
-rw-r--r--common/cli_simple.c1
-rw-r--r--common/command.c1
-rw-r--r--common/console.c3
-rw-r--r--common/fdt_support.c1
-rw-r--r--common/hash.c1
-rw-r--r--common/hwconfig.c1
-rw-r--r--common/image-android.c1
-rw-r--r--common/image-fdt.c1
-rw-r--r--common/image.c3
-rw-r--r--common/init/board_init.c20
-rw-r--r--common/main.c1
-rw-r--r--common/spl/Kconfig19
-rw-r--r--common/spl/spl.c25
-rw-r--r--common/spl/spl_dfu.c4
-rw-r--r--common/spl/spl_ext.c1
-rw-r--r--common/spl/spl_fat.c1
-rw-r--r--common/spl/spl_fit.c1
-rw-r--r--common/spl/spl_net.c1
-rw-r--r--common/spl/spl_ymodem.c1
-rw-r--r--common/splash.c1
-rw-r--r--common/splash_source.c1
-rw-r--r--common/update.c1
-rw-r--r--common/usb_hub.c1
-rw-r--r--common/usb_kbd.c1
-rw-r--r--configs/am335x_evm_defconfig3
-rw-r--r--configs/am65x_evm_a53_defconfig8
-rw-r--r--configs/brsmarc1_defconfig109
-rw-r--r--configs/da850evm_direct_nor_defconfig17
-rw-r--r--configs/hikey960_defconfig30
-rw-r--r--configs/sei510_defconfig75
-rw-r--r--disk/part.c1
-rw-r--r--disk/part_amiga.c1
-rw-r--r--doc/README.marubun-pcmcia65
-rw-r--r--doc/README.ne200011
-rw-r--r--drivers/Kconfig2
-rw-r--r--drivers/Makefile1
-rw-r--r--drivers/bootcount/bootcount_env.c2
-rw-r--r--drivers/clk/clk-uclass.c13
-rw-r--r--drivers/core/fdtaddr.c17
-rw-r--r--drivers/core/read.c20
-rw-r--r--drivers/ddr/fsl/fsl_ddr_gen4.c1
-rw-r--r--drivers/ddr/fsl/interactive.c1
-rw-r--r--drivers/ddr/fsl/options.c1
-rw-r--r--drivers/dfu/dfu.c1
-rw-r--r--drivers/fastboot/fb_command.c1
-rw-r--r--drivers/fastboot/fb_common.c1
-rw-r--r--drivers/fastboot/fb_getvar.c1
-rw-r--r--drivers/fastboot/fb_mmc.c1
-rw-r--r--drivers/firmware/ti_sci.c13
-rw-r--r--drivers/input/i8042.c1
-rw-r--r--drivers/input/input.c1
-rw-r--r--drivers/misc/fs_loader.c1
-rw-r--r--drivers/mmc/hi6220_dw_mmc.c29
-rw-r--r--drivers/mtd/cfi_flash.c3
-rw-r--r--drivers/mtd/jedec_flash.c1
-rw-r--r--drivers/mtd/mtd_uboot.c1
-rw-r--r--drivers/net/dc2114x.c1
-rw-r--r--drivers/net/fec_mxc.c2
-rw-r--r--drivers/net/fm/b4860.c1
-rw-r--r--drivers/net/fm/fdt.c1
-rw-r--r--drivers/net/fm/fm.c2
-rw-r--r--drivers/net/fsl-mc/mc.c1
-rw-r--r--drivers/net/fsl_mcdmafec.c2
-rw-r--r--drivers/net/ftmac100.c1
-rw-r--r--drivers/net/lan91c96.c1
-rw-r--r--drivers/net/mcffec.c2
-rw-r--r--drivers/net/ne2000_base.c12
-rw-r--r--drivers/net/netconsole.c5
-rw-r--r--drivers/net/phy/micrel_ksz90x1.c1
-rw-r--r--drivers/net/sandbox-raw.c1
-rw-r--r--drivers/net/sh_eth.c2
-rw-r--r--drivers/net/ti/cpsw-common.c1
-rw-r--r--drivers/pci/Kconfig6
-rw-r--r--drivers/pci/Makefile1
-rw-r--r--drivers/pci/fsl_pci_init.c1
-rw-r--r--drivers/pci/pci.c1
-rw-r--r--drivers/pci/pci_common.c1
-rw-r--r--drivers/pci/pcie_dw_ti.c725
-rw-r--r--drivers/pci/pcie_intel_fpga.c18
-rw-r--r--drivers/pcmcia/Kconfig0
-rw-r--r--drivers/pcmcia/Makefile6
-rw-r--r--drivers/pcmcia/marubun_pcmcia.c99
-rw-r--r--drivers/phy/Kconfig9
-rw-r--r--drivers/phy/Makefile1
-rw-r--r--drivers/phy/phy-ti-am654.c411
-rw-r--r--drivers/power/domain/ti-sci-power-domain.c8
-rw-r--r--drivers/qe/qe.c1
-rw-r--r--drivers/reset/reset-socfpga.c1
-rw-r--r--drivers/rtc/m41t60.c1
-rw-r--r--drivers/scsi/scsi.c1
-rw-r--r--drivers/serial/serial-uclass.c2
-rw-r--r--drivers/serial/serial.c2
-rw-r--r--drivers/serial/serial_lpuart.c8
-rw-r--r--drivers/serial/usbtty.c1
-rw-r--r--drivers/tee/sandbox.c8
-rw-r--r--drivers/usb/gadget/designware_udc.c1
-rw-r--r--drivers/usb/gadget/ether.c2
-rw-r--r--drivers/usb/gadget/f_dfu.c1
-rw-r--r--drivers/usb/gadget/f_fastboot.c1
-rw-r--r--drivers/usb/gadget/f_rockusb.c1
-rw-r--r--drivers/usb/gadget/f_sdp.c1
-rw-r--r--drivers/usb/host/ehci-fsl.c1
-rw-r--r--drivers/video/ati_radeon_fb.c1
-rw-r--r--drivers/video/cfb_console.c2
-rw-r--r--drivers/video/mb862xx.c1
-rw-r--r--drivers/video/mx3fb.c1
-rw-r--r--drivers/video/mxsfb.c1
-rw-r--r--drivers/video/videomodes.c1
-rw-r--r--drivers/watchdog/Kconfig9
-rw-r--r--drivers/watchdog/Makefile1
-rw-r--r--drivers/watchdog/omap_wdt.c121
-rw-r--r--env/callback.c11
-rw-r--r--env/common.c21
-rw-r--r--env/eeprom.c13
-rw-r--r--env/embedded.c2
-rw-r--r--env/env.c3
-rw-r--r--env/ext4.c5
-rw-r--r--env/fat.c5
-rw-r--r--env/flags.c15
-rw-r--r--env/flash.c23
-rw-r--r--env/mmc.c7
-rw-r--r--env/nand.c9
-rw-r--r--env/nowhere.c3
-rw-r--r--env/nvram.c3
-rw-r--r--env/onenand.c2
-rw-r--r--env/remote.c2
-rw-r--r--env/sata.c5
-rw-r--r--env/sf.c19
-rw-r--r--env/ubi.c9
-rw-r--r--examples/api/demo.c1
-rw-r--r--examples/api/glue.c3
-rw-r--r--fs/fs.c1
-rw-r--r--fs/ubifs/ubifs.c2
-rw-r--r--include/bootcount.h1
-rw-r--r--include/clk.h12
-rw-r--r--include/command.h1
-rw-r--r--include/common.h191
-rw-r--r--include/configs/brsmarc1.h83
-rw-r--r--include/configs/da850evm.h4
-rw-r--r--include/configs/hikey960.h60
-rw-r--r--include/configs/meson64.h2
-rw-r--r--include/configs/sei510.h137
-rw-r--r--include/dm/fdtaddr.h18
-rw-r--r--include/dm/read.h41
-rw-r--r--include/dt-bindings/clock/hi3660-clock.h214
-rw-r--r--include/dt-bindings/phy/phy-am654-serdes.h13
-rw-r--r--include/env.h335
-rw-r--r--include/env_callback.h25
-rw-r--r--include/env_default.h2
-rw-r--r--include/env_flags.h7
-rw-r--r--include/env_internal.h (renamed from include/environment.h)110
-rw-r--r--include/exports.h1
-rw-r--r--include/gzip.h103
-rw-r--r--include/lcd.h1
-rw-r--r--include/net.h12
-rw-r--r--include/pcmcia.h137
-rw-r--r--include/pcmcia/yenta.h156
-rw-r--r--include/search.h77
-rw-r--r--include/watchdog.h2
-rw-r--r--lib/efi_loader/efi_boottime.c1
-rw-r--r--lib/efi_loader/efi_console.c1
-rw-r--r--lib/efi_loader/efi_variable.c3
-rw-r--r--lib/fdtdec.c2
-rw-r--r--lib/gunzip.c5
-rw-r--r--lib/gzip.c1
-rw-r--r--lib/hashtable.c66
-rw-r--r--lib/smbios.c1
-rw-r--r--lib/uuid.c1
-rw-r--r--net/bootp.c1
-rw-r--r--net/dns.c1
-rw-r--r--net/eth-uclass.c2
-rw-r--r--net/eth_common.c4
-rw-r--r--net/eth_legacy.c2
-rw-r--r--net/link_local.c1
-rw-r--r--net/net.c15
-rw-r--r--net/tftp.c1
-rw-r--r--net/wol.c2
-rw-r--r--post/post.c1
-rw-r--r--scripts/config_whitelist.txt6
-rw-r--r--test/compression.c1
-rw-r--r--test/dm/clk.c1
-rw-r--r--test/dm/eth.c1
-rw-r--r--test/dm/test-fdt.c16
-rw-r--r--test/env/hashtable.c20
-rw-r--r--tools/env/fw_env.c24
-rw-r--r--tools/env/fw_env.h1
-rw-r--r--tools/env/fw_env_main.c1
-rw-r--r--tools/envcrc.c6
572 files changed, 8914 insertions, 1654 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 0759561ce9..84e79bf032 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -145,34 +145,24 @@ Build tools-only:
script:
- make tools-only_config tools-only -j$(nproc)
-# Run various tool tests
-Run patman testsuite:
+Run binman, buildman, dtoc and patman testsuites:
tags: [ 'all' ]
stage: testsuites
script:
- - git config --global user.name "GitLab CI Runner"
- - git config --global user.email trini@konsulko.com
- - ./tools/patman/patman --test
-
-Run buildman testsuite:
- tags: [ 'all' ]
- stage: testsuites
- script:
- - ./tools/buildman/buildman -t
-
-Run binman and dtoc testsuite:
- tags: [ 'all' ]
- stage: testsuites
- script:
- - virtualenv /tmp/venv
- - . /tmp/venv/bin/activate
- - pip install pyelftools
- - export UBOOT_TRAVIS_BUILD_DIR=`cd .. && pwd`/.bm-work/sandbox_spl;
- ./tools/buildman/buildman -P sandbox_spl &&
- export PYTHONPATH="${UBOOT_TRAVIS_BUILD_DIR}/scripts/dtc/pylibfdt";
- export PATH="${UBOOT_TRAVIS_BUILD_DIR}/scripts/dtc:${PATH}";
- ./tools/binman/binman --toolpath ${UBOOT_TRAVIS_BUILD_DIR}/tools test &&
- ./tools/dtoc/dtoc -t
+ - git config --global user.name "GitLab CI Runner";
+ git config --global user.email trini@konsulko.com;
+ export USER=gitlab;
+ virtualenv /tmp/venv;
+ . /tmp/venv/bin/activate;
+ pip install pyelftools;
+ export UBOOT_TRAVIS_BUILD_DIR=`cd .. && pwd`/.bm-work/sandbox_spl;
+ export PYTHONPATH="${UBOOT_TRAVIS_BUILD_DIR}/scripts/dtc/pylibfdt";
+ export PATH="${UBOOT_TRAVIS_BUILD_DIR}/scripts/dtc:${PATH}";
+ ./tools/buildman/buildman -P sandbox_spl;
+ ./tools/binman/binman --toolpath ${UBOOT_TRAVIS_BUILD_DIR}/tools test;
+ ./tools/buildman/buildman -t;
+ ./tools/dtoc/dtoc -t;
+ ./tools/patman/patman --test
# Test sandbox with test.py
sandbox test.py:
diff --git a/MAINTAINERS b/MAINTAINERS
index b443c5af75..74a1423f50 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -50,6 +50,26 @@ so much easier [Ed]
Maintainers List (try to look for most precise areas first)
-----------------------------------
+ANDROID AB
+M: Igor Opaniuk <igor.opaniuk@gmail.com>
+R: Sam Protsenko <semen.protsenko@linaro.org>
+S: Maintained
+F: cmd/ab_select.c
+F: common/android_ab.c
+F: doc/android/ab.txt
+F: include/android_ab.h
+F: test/py/tests/test_android/test_ab.py
+
+ANDROID AVB
+M: Igor Opaniuk <igor.opaniuk@gmail.com>
+S: Maintained
+F: cmd/avb.c
+F: common/avb_verify.c
+F: doc/android/avb2.txt
+F: include/avb_verify.h
+F: lib/libavb/
+F: test/py/tests/test_android/test_avb.py
+
ARC
M: Alexey Brodkin <alexey.brodkin@synopsys.com>
M: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
@@ -168,9 +188,11 @@ F: board/freescale/*mx*/
ARM HISILICON
M: Peter Griffin <peter.griffin@linaro.org>
+M: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
S: Maintained
F: arch/arm/cpu/armv8/hisilicon
F: arch/arm/include/asm/arch-hi6220/
+F: arch/arm/include/asm/arch-hi3660/
ARM MARVELL KIRKWOOD ARMADA-XP ARMADA-38X ARMADA-37XX ARMADA-7K/8K
M: Stefan Roese <sr@denx.de>
diff --git a/README b/README
index b493ffeb2d..2d91619a94 100644
--- a/README
+++ b/README
@@ -83,7 +83,7 @@ Where we come from:
* Provide extended interface to Linux boot loader
* S-Record download
* network boot
- * PCMCIA / CompactFlash / ATA disk / SCSI ... boot
+ * ATA disk / SCSI ... boot
- create ARMBoot project (http://sourceforge.net/projects/armboot)
- add other CPU families (starting with ARM)
- create U-Boot project (http://sourceforge.net/projects/u-boot)
diff --git a/api/api.c b/api/api.c
index 9f03f1a35b..bc9454eb4b 100644
--- a/api/api.c
+++ b/api/api.c
@@ -8,8 +8,9 @@
#include <config.h>
#include <command.h>
#include <common.h>
+#include <env.h>
#include <malloc.h>
-#include <environment.h>
+#include <env_internal.h>
#include <linux/types.h>
#include <api_public.h>
@@ -496,7 +497,7 @@ static int API_env_enum(va_list ap)
{
int i, buflen;
char *last, **next, *s;
- ENTRY *match, search;
+ struct env_entry *match, search;
static char *var;
last = (char *)va_arg(ap, unsigned long);
@@ -513,7 +514,7 @@ static int API_env_enum(va_list ap)
if (s != NULL)
*s = 0;
search.key = var;
- i = hsearch_r(search, FIND, &match, &env_htab, 0);
+ i = hsearch_r(search, ENV_FIND, &match, &env_htab, 0);
if (i == 0) {
i = API_EINVAL;
goto done;
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 3f0e301d41..be2c96a93d 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -1209,6 +1209,18 @@ config TARGET_HIKEY
Support for HiKey 96boards platform. It features a HI6220
SoC, with 8xA53 CPU, mali450 gpu, and 1GB RAM.
+config TARGET_HIKEY960
+ bool "Support HiKey960 96boards Consumer Edition Platform"
+ select ARM64
+ select DM
+ select DM_SERIAL
+ select OF_CONTROL
+ select PL01X_SERIAL
+ imply CMD_DM
+ help
+ Support for HiKey960 96boards platform. It features a HI3660
+ SoC, with 4xA73 CPU, 4xA53 CPU, MALI-G71 GPU, and 3GB RAM.
+
config TARGET_POPLAR
bool "Support Poplar 96boards Enterprise Edition Platform"
select ARM64
@@ -1778,6 +1790,7 @@ source "board/grinn/chiliboard/Kconfig"
source "board/gumstix/pepper/Kconfig"
source "board/h2200/Kconfig"
source "board/hisilicon/hikey/Kconfig"
+source "board/hisilicon/hikey960/Kconfig"
source "board/hisilicon/poplar/Kconfig"
source "board/isee/igep003x/Kconfig"
source "board/phytec/pcm051/Kconfig"
diff --git a/arch/arm/cpu/arm926ejs/spear/spr_misc.c b/arch/arm/cpu/arm926ejs/spear/spr_misc.c
index 371dea5657..d36484c9d6 100644
--- a/arch/arm/cpu/arm926ejs/spear/spr_misc.c
+++ b/arch/arm/cpu/arm926ejs/spear/spr_misc.c
@@ -6,7 +6,7 @@
#include <common.h>
#include <command.h>
-#include <environment.h>
+#include <env.h>
#include <i2c.h>
#include <net.h>
#include <linux/mtd/st_smi.h>
diff --git a/arch/arm/cpu/armv7/vf610/generic.c b/arch/arm/cpu/armv7/vf610/generic.c
index 337f4af7a8..7e4641fd32 100644
--- a/arch/arm/cpu/armv7/vf610/generic.c
+++ b/arch/arm/cpu/armv7/vf610/generic.c
@@ -9,6 +9,7 @@
#include <asm/arch/clock.h>
#include <asm/arch/crm_regs.h>
#include <asm/mach-imx/sys_proto.h>
+#include <env.h>
#include <netdev.h>
#ifdef CONFIG_FSL_ESDHC_IMX
#include <fsl_esdhc_imx.h>
diff --git a/arch/arm/cpu/armv8/fsl-layerscape/cpu.c b/arch/arm/cpu/armv8/fsl-layerscape/cpu.c
index edb9c96658..26f4fdacdb 100644
--- a/arch/arm/cpu/armv8/fsl-layerscape/cpu.c
+++ b/arch/arm/cpu/armv8/fsl-layerscape/cpu.c
@@ -5,6 +5,7 @@
*/
#include <common.h>
+#include <env.h>
#include <fsl_ddr_sdram.h>
#include <asm/io.h>
#include <linux/errno.h>
@@ -32,7 +33,7 @@
#include <fsl_qbman.h>
#ifdef CONFIG_TFABOOT
-#include <environment.h>
+#include <env_internal.h>
#ifdef CONFIG_CHAIN_OF_TRUST
#include <fsl_validate.h>
#endif
diff --git a/arch/arm/cpu/armv8/fsl-layerscape/soc.c b/arch/arm/cpu/armv8/fsl-layerscape/soc.c
index 7414215208..ca8005992a 100644
--- a/arch/arm/cpu/armv8/fsl-layerscape/soc.c
+++ b/arch/arm/cpu/armv8/fsl-layerscape/soc.c
@@ -5,6 +5,7 @@
*/
#include <common.h>
+#include <env.h>
#include <fsl_immap.h>
#include <fsl_ifc.h>
#include <asm/arch/fsl_serdes.h>
@@ -26,7 +27,7 @@
#endif
#include <fsl_immap.h>
#ifdef CONFIG_TFABOOT
-#include <environment.h>
+#include <env_internal.h>
DECLARE_GLOBAL_DATA_PTR;
#endif
diff --git a/arch/arm/cpu/armv8/fsl-layerscape/spl.c b/arch/arm/cpu/armv8/fsl-layerscape/spl.c
index 3e53084b21..8eeeef199b 100644
--- a/arch/arm/cpu/armv8/fsl-layerscape/spl.c
+++ b/arch/arm/cpu/armv8/fsl-layerscape/spl.c
@@ -4,6 +4,7 @@
*/
#include <common.h>
+#include <env.h>
#include <spl.h>
#include <asm/io.h>
#include <fsl_ifc.h>
diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
index 9e7d6d6490..e021888ce4 100644
--- a/arch/arm/dts/Makefile
+++ b/arch/arm/dts/Makefile
@@ -15,6 +15,7 @@ dtb-$(CONFIG_EXYNOS4) += exynos4210-origen.dtb \
exynos4412-odroid.dtb
dtb-$(CONFIG_TARGET_HIKEY) += hi6220-hikey.dtb
+dtb-$(CONFIG_TARGET_HIKEY960) += hi3660-hikey960.dtb
dtb-$(CONFIG_TARGET_POPLAR) += hi3798cv200-poplar.dtb
@@ -139,6 +140,7 @@ dtb-$(CONFIG_ARCH_MESON) += \
meson-gxm-khadas-vim2.dtb \
meson-axg-s400.dtb \
meson-g12a-u200.dtb \
+ meson-g12a-sei510.dtb \
meson-g12b-odroid-n2.dtb
dtb-$(CONFIG_TEGRA) += tegra20-harmony.dtb \
tegra20-medcom-wide.dtb \
@@ -281,6 +283,7 @@ dtb-$(CONFIG_AM33XX) += \
am335x-brppt1-nand.dtb \
am335x-brppt1-spi.dtb \
am335x-brxre1.dtb \
+ am335x-brsmarc1.dtb \
am335x-draco.dtb \
am335x-evm.dtb \
am335x-evmsk.dtb \
diff --git a/arch/arm/dts/am335x-brsmarc1.dts b/arch/arm/dts/am335x-brsmarc1.dts
new file mode 100644
index 0000000000..1a7f9a5365
--- /dev/null
+++ b/arch/arm/dts/am335x-brsmarc1.dts
@@ -0,0 +1,416 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (C) 2017 B&R Industrial Automation GmbH
+ * http://www.br-automation.com
+ *
+ */
+/dts-v1/;
+
+#include "am33xx.dtsi"
+#include "dt-bindings/thermal/thermal.h"
+
+/ {
+ model = "BRSMARC1 SoM";
+ compatible = "ti,am33xx";
+
+ fset: factory-settings {
+ bl-version = " ";
+ order-no = " ";
+ cpu-order-no = " ";
+ hw-revision = " ";
+ serial-no = <0>;
+ device-id = <0x0>;
+ parent-id = <0x0>;
+ hw-variant = <0x0>;
+ hw-platform = <0x7>;
+ fram-offset = <0x100>;
+ fram-size = <0x1F00>;
+ cache-disable = <0x0>;
+ cpu-clock = <0x0>;
+ };
+
+ chosen {
+ bootargs = "console=ttyO0,115200 earlyprintk";
+ stdout-path = &uart0;
+ };
+
+ aliases {
+ fset = &fset;
+ mmc = &mmc2;
+ spi0 = &spi0;
+ spi1 = &spi1;
+ touch0 = &burtouch0;
+ screen0 = &lcdscreen0;
+ };
+
+ memory {
+ device_type = "memory";
+ reg = <0x80000000 0x10000000>; /* 256 MB */
+ };
+
+ vmmcsd_fixed: fixedregulator@0 {
+ compatible = "regulator-fixed";
+ regulator-name = "vmmcsd_fixed";
+ regulator-min-microvolt = <3300000>;
+ regulator-max-microvolt = <3300000>;
+ };
+
+ lcdscreen0: lcdscreen@0 {
+ /*backlight = <&tps_bl>; */
+ compatible = "ti,tilcdc,panel";
+ status = "okay";
+
+ panel-info {
+ ac-bias = <255>;
+ ac-bias-intrpt = <0>;
+ dma-burst-sz = <16>;
+ bpp = <32>;
+ fdd = <0x80>;
+ sync-edge = <0>;
+ sync-ctrl = <1>;
+ raster-order = <0>;
+ fifo-th = <0>;
+ rotation = <0>;
+ pupdelay = <0>;
+ pondelay = <0>;
+ pwrpin = <0x000000B1>;
+ brightdrv = <0>;
+ brightfdim = <100>;
+ brightdef = <50>;
+ };
+
+ display-timings {
+ default {
+ clock-frequency = <0>;
+ hactive = <0>;
+ vactive = <0>;
+ hfront-porch = <0>;
+ hback-porch = <0>;
+ hsync-len = <0>;
+ vfront-porch = <0>;
+ vback-porch = <0>;
+ vsync-len = <0>;
+ hsync-active = <0>;
+ vsync-active = <0>;
+ pupdelay = <10>;
+ pondelay = <10>;
+ };
+ };
+ };
+
+ board_thermal: board-thermal {
+ polling-delay-passive = <1000>; /* milliseconds */
+ polling-delay = <2500>; /* milliseconds */
+
+ thermal-sensors = <&cputemp>;
+
+ trips {
+ crit_trip: crit-trip {
+ temperature = <95000>; /* millicelsius */
+ hysteresis = <5000>; /* millicelsius */
+ type = "critical";
+ };
+ };
+ cooling-maps {
+ map0 {
+ trip = <&crit_trip>;
+ cooling-device =
+ <&resetc THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
+ };
+ };
+ };
+};
+
+&uart0 { /* console uart */
+ u-boot,dm-spl;
+ status = "okay";
+};
+
+&uart2 { /* X2X - P2P */
+ status = "okay";
+};
+
+&uart3 { /* RS485 */
+ status = "okay";
+};
+
+&uart4 { /* RS232 */
+ status = "okay";
+};
+
+&i2c0 {
+ u-boot,dm-spl;
+ status = "okay";
+ clock-frequency = <100000>;
+
+ tps: tps@24 { /* PMIC controller */
+ u-boot,dm-spl;
+ reg = <0x24>;
+ compatible = "ti,tps65217";
+ };
+
+ cputemp: temperature-sensor@48 { /* cpu temperature */
+ #thermal-sensor-cells = <0>;
+ compatible = "nxp,pct2075";
+ reg = <0x48>;
+ };
+
+ basetemp: temperature-sensor@49 { /* baseboard temperature */
+ #thermal-sensor-cells = <0>;
+ compatible = "nxp,pct2075";
+ reg = <0x49>;
+ };
+ extrtc: rtc@51 { /* realtime clock */
+ compatible = "epson,rx8571";
+ reg = <0x51>;
+ };
+
+ resetc: reset-controller@60 {
+ compatible = "bur,rststm";
+ reg = <0x60>;
+
+ cooling-min-state = <0>;
+ cooling-max-state = <1>; /* reset gets fired */
+ #cooling-cells = <2>; /* min followed by max */
+ };
+};
+
+&i2c1 {
+ u-boot,dm-spl;
+ status = "okay";
+};
+
+&spi0 {
+ u-boot,dm-spl;
+ status = "okay";
+
+ cs-gpios = <&gpio0 5 GPIO_ACTIVE_HIGH>,
+ <&gpio0 6 GPIO_ACTIVE_HIGH>,
+ <0>,
+ <0>;
+
+ spi-max-frequency = <24000000>;
+
+ spi_flash: spiflash@0 {
+ u-boot,dm-spl;
+ u-boot,dm-pre-reloc;
+ compatible = "spidev", "spi-flash";
+ spi-max-frequency = <24000000>;
+ reg = <0>;
+ };
+};
+
+&spi1 {
+ u-boot,dm-spl;
+ status = "okay";
+ cs-gpios = <&gpio3 17 GPIO_ACTIVE_HIGH>,
+ <&gpio0 19 GPIO_ACTIVE_HIGH>,
+ <0>,
+ <0>;
+
+ spi-max-frequency = <24000000>;
+};
+
+&edma {
+ status = "okay";
+};
+
+&cppi41dma {
+ status = "okay";
+};
+
+&usb {
+ status = "okay";
+};
+
+&usb_ctrl_mod {
+ status = "okay";
+};
+
+&usb0_phy {
+ status = "okay";
+};
+
+&usb1_phy {
+ status = "okay";
+};
+
+&usb0 {
+ status = "okay";
+ dr_mode = "host";
+};
+
+&usb1 {
+ status = "okay";
+ dr_mode = "host";
+};
+
+&davinci_mdio {
+ status = "okay";
+};
+
+&mac {
+ status = "okay";
+};
+
+&phy_sel {
+ rmii-clock-ext;
+};
+
+&cpsw_emac0 {
+ phy_id = <&davinci_mdio>, <1>;
+ phy-mode = "rmii";
+ ti,ledcr = <0x0480>;
+};
+
+&cpsw_emac1 {
+ phy_id = <&davinci_mdio>, <3>;
+ phy-mode = "rmii";
+ ti,ledcr = <0x0480>;
+};
+
+&mmc1 {
+ vmmc-supply = <&vmmcsd_fixed>;
+ bus-width = <0x4>;
+ ti,non-removable;
+ ti,needs-special-hs-handling;
+ ti,vcc-aux-disable-is-sleep;
+ status = "okay";
+};
+
+&mmc2 {
+ vmmc-supply = <&vmmcsd_fixed>;
+ bus-width = <0x8>;
+ ti,non-removable;
+ ti,needs-special-hs-handling;
+ ti,vcc-aux-disable-is-sleep;
+ status = "okay";
+};
+
+&lcdc {
+ status = "okay";
+ ti,no-reset-on-init;
+ ti,no-idle-on-init;
+};
+
+&elm {
+ status = "okay";
+};
+
+&sham {
+ status = "okay";
+};
+
+&aes {
+ status = "okay";
+};
+
+&gpio0 {
+ u-boot,dm-spl;
+ ti,no-reset-on-init;
+};
+
+&gpio1 {
+ u-boot,dm-spl;
+ ti,no-reset-on-init;
+};
+
+&gpio2 {
+ u-boot,dm-spl;
+ ti,no-reset-on-init;
+};
+
+&gpio3 {
+ u-boot,dm-spl;
+ ti,no-reset-on-init;
+};
+
+&timer1 { /* today unused */
+ status = "okay";
+ ti,no-reset-on-init;
+ ti,no-idle-on-init;
+};
+
+&timer2 { /* used for vxworks primary timer device */
+ status = "okay";
+ ti,no-reset-on-init;
+ ti,no-idle-on-init;
+};
+
+&timer3 { /* used sysdelay and hal tsc counter*/
+ status = "okay";
+ ti,no-reset-on-init;
+ ti,no-idle-on-init;
+};
+
+&timer4 { /* used for PWM beeper */
+ status = "okay";
+ ti,no-reset-on-init;
+ ti,no-idle-on-init;
+};
+
+&timer5 { /* used for PWM backlight */
+ status = "okay";
+ ti,no-reset-on-init;
+ ti,no-idle-on-init;
+};
+
+&timer6 { /* used for cpsw end device */
+ status = "okay";
+ ti,no-reset-on-init;
+ ti,no-idle-on-init;
+};
+
+&timer7 { /* used for cpsw end device */
+ status = "okay";
+ ti,no-reset-on-init;
+ ti,no-idle-on-init;
+};
+
+&wdt2 {
+ status = "okay";
+ ti,no-reset-on-init;
+ ti,no-idle-on-init;
+};
+
+&epwmss0 {
+ status = "okay";
+};
+
+&tscadc {
+ status = "okay";
+
+ tsc {
+ burtouch0: burtouch@0 {
+ status = "okay";
+ compatible = "bur,DdVxSfTouchXXX";
+ bur,hwtree = "IF7";
+ bur,KX0 = <0x0>;
+ bur,KX1 = <0x0>;
+ bur,KX2 = <0x0>;
+ bur,KY0 = <0x0>;
+ bur,KY1 = <0x0>;
+ bur,KY2 = <0x0>;
+ };
+ };
+};
+
+&dcan0 {
+ status = "okay";
+};
+
+&dcan1 {
+ status = "okay";
+};
+
+&sham {
+ status = "disabled";
+};
+
+&aes {
+ status = "disabled";
+};
+
+&rng {
+ status = "disabled";
+};
diff --git a/arch/arm/dts/hi3660-hikey960-u-boot.dtsi b/arch/arm/dts/hi3660-hikey960-u-boot.dtsi
new file mode 100644
index 0000000000..648c77f8c5
--- /dev/null
+++ b/arch/arm/dts/hi3660-hikey960-u-boot.dtsi
@@ -0,0 +1,10 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * U-Boot additions
+ *
+ * Copyright (c) 2019 Linaro Ltd.
+ */
+
+&dwmmc1 {
+ u-boot,dm-pre-reloc;
+};
diff --git a/arch/arm/dts/hi3660-hikey960.dts b/arch/arm/dts/hi3660-hikey960.dts
new file mode 100644
index 0000000000..9fbfb422c8
--- /dev/null
+++ b/arch/arm/dts/hi3660-hikey960.dts
@@ -0,0 +1,607 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * dts file for Hisilicon HiKey960 Development Board
+ *
+ * Copyright (C) 2016, Hisilicon Ltd.
+ *
+ */
+
+/dts-v1/;
+
+#include "hi3660.dtsi"
+#include "hikey960-pinctrl.dtsi"
+#include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/input/input.h>
+#include <dt-bindings/interrupt-controller/irq.h>
+
+/ {
+ model = "HiKey960";
+ compatible = "hisilicon,hi3660-hikey960", "hisilicon,hi3660";
+
+ aliases {
+ mshc1 = &dwmmc1;
+ mshc2 = &dwmmc2;
+ serial0 = &uart0;
+ serial1 = &uart1;
+ serial2 = &uart2;
+ serial3 = &uart3;
+ serial4 = &uart4;
+ serial5 = &uart5;
+ serial6 = &uart6;
+ };
+
+ chosen {
+ stdout-path = "serial6:115200n8";
+ };
+
+ memory@0 {
+ device_type = "memory";
+ /* rewrite this at bootloader */
+ reg = <0x0 0x0 0x0 0x0>;
+ };
+
+ reserved-memory {
+ #address-cells = <2>;
+ #size-cells = <2>;
+ ranges;
+
+ ramoops@32000000 {
+ compatible = "ramoops";
+ reg = <0x0 0x32000000 0x0 0x00100000>;
+ record-size = <0x00020000>;
+ console-size = <0x00020000>;
+ ftrace-size = <0x00020000>;
+ };
+ };
+
+ reboot-mode-syscon@32100000 {
+ compatible = "syscon", "simple-mfd";
+ reg = <0x0 0x32100000 0x0 0x00001000>;
+
+ reboot-mode {
+ compatible = "syscon-reboot-mode";
+ offset = <0x0>;
+
+ mode-normal = <0x77665501>;
+ mode-bootloader = <0x77665500>;
+ mode-recovery = <0x77665502>;
+ };
+ };
+
+ keys {
+ compatible = "gpio-keys";
+ pinctrl-names = "default";
+ pinctrl-0 = <&pwr_key_pmx_func &pwr_key_cfg_func>;
+
+ power {
+ wakeup-source;
+ gpios = <&gpio4 2 GPIO_ACTIVE_LOW>;
+ label = "GPIO Power";
+ linux,code = <KEY_POWER>;
+ };
+ };
+
+ leds {
+ compatible = "gpio-leds";
+
+ user_led1 {
+ label = "green:user1";
+ /* gpio_150_user_led1 */
+ gpios = <&gpio18 6 0>;
+ linux,default-trigger = "heartbeat";
+ };
+
+ user_led2 {
+ label = "green:user2";
+ /* gpio_151_user_led2 */
+ gpios = <&gpio18 7 0>;
+ linux,default-trigger = "none";
+ };
+
+ user_led3 {
+ label = "green:user3";
+ /* gpio_189_user_led3 */
+ gpios = <&gpio23 5 0>;
+ linux,default-trigger = "mmc0";
+ };
+
+ user_led4 {
+ label = "green:user4";
+ /* gpio_190_user_led4 */
+ gpios = <&gpio23 6 0>;
+ panic-indicator;
+ linux,default-trigger = "none";
+ };
+
+ wlan_active_led {
+ label = "yellow:wlan";
+ /* gpio_205_wifi_active */
+ gpios = <&gpio25 5 0>;
+ linux,default-trigger = "phy0tx";
+ default-state = "off";
+ };
+
+ bt_active_led {
+ label = "blue:bt";
+ gpios = <&gpio25 7 0>;
+ /* gpio_207_user_led1 */
+ linux,default-trigger = "hci0-power";
+ default-state = "off";
+ };
+ };
+
+ pmic: pmic@fff34000 {
+ compatible = "hisilicon,hi6421v530-pmic";
+ reg = <0x0 0xfff34000 0x0 0x1000>;
+ interrupt-controller;
+ #interrupt-cells = <2>;
+
+ regulators {
+ ldo3: LDO3 { /* HDMI */
+ regulator-name = "VOUT3_1V85";
+ regulator-min-microvolt = <1800000>;
+ regulator-max-microvolt = <2200000>;
+ regulator-enable-ramp-delay = <120>;
+ };
+
+ ldo9: LDO9 { /* SDCARD I/O */
+ regulator-name = "VOUT9_1V8_2V95";
+ regulator-min-microvolt = <1750000>;
+ regulator-max-microvolt = <3300000>;
+ regulator-enable-ramp-delay = <240>;
+ };
+
+ ldo11: LDO11 { /* Low Speed Connector */
+ regulator-name = "VOUT11_1V8_2V95";
+ regulator-min-microvolt = <1750000>;
+ regulator-max-microvolt = <3300000>;
+ regulator-enable-ramp-delay = <240>;
+ };
+
+ ldo15: LDO15 { /* UFS VCC */
+ regulator-name = "VOUT15_3V0";
+ regulator-min-microvolt = <1750000>;
+ regulator-max-microvolt = <3000000>;
+ regulator-boot-on;
+ regulator-always-on;
+ regulator-enable-ramp-delay = <120>;
+ };
+
+ ldo16: LDO16 { /* SD VDD */
+ regulator-name = "VOUT16_2V95";
+ regulator-min-microvolt = <1750000>;
+ regulator-max-microvolt = <3000000>;
+ regulator-enable-ramp-delay = <360>;
+ };
+ };
+ };
+
+ wlan_en: wlan-en-1-8v {
+ compatible = "regulator-fixed";
+ regulator-name = "wlan-en-regulator";
+ regulator-min-microvolt = <1800000>;
+ regulator-max-microvolt = <1800000>;
+
+ /* GPIO_051_WIFI_EN */
+ gpio = <&gpio6 3 0>;
+
+ /* WLAN card specific delay */
+ startup-delay-us = <70000>;
+ enable-active-high;
+ };
+
+ firmware {
+ optee {
+ compatible = "linaro,optee-tz";
+ method = "smc";
+ };
+ };
+};
+
+/*
+ * Legend: proper name = the GPIO line is used as GPIO
+ * NC = not connected (pin out but not routed from the chip to
+ * anything the board)
+ * "[PER]" = pin is muxed for [peripheral] (not GPIO)
+ * "" = no idea, schematic doesn't say, could be
+ * unrouted (not connected to any external pin)
+ * LSEC = Low Speed External Connector
+ * HSEC = High Speed External Connector
+ *
+ * Line names are taken from "HiKey 960 Board ver A" schematics
+ * from Huawei. The 40 pin low speed expansion connector is named
+ * J2002 63453-140LF.
+ *
+ * For the lines routed to the external connectors the
+ * lines are named after the 96Boards CE Specification 1.0,
+ * Appendix "Expansion Connector Signal Description".
+ *
+ * When the 96Board naming of a line and the schematic name of
+ * the same line are in conflict, the 96Board specification
+ * takes precedence, which means that the external UART on the
+ * LSEC is named UART0 while the schematic and SoC names this
+ * UART3. This is only for the informational lines i.e. "[FOO]",
+ * the GPIO named lines "GPIO-A" thru "GPIO-L" are the only
+ * ones actually used for GPIO.
+ */
+&gpio0 {
+ /* GPIO_000-GPIO_007 */
+ gpio-line-names =
+ "",
+ "TP901", /* TEST_MODE connected to TP901 */
+ "[PMU0_SSI]",
+ "[PMU1_SSI]",
+ "[PMU2_SSI]",
+ "[PMU0_CLKOUT]",
+ "[JTAG_TCK]",
+ "[JTAG_TMS]";
+};
+
+&gpio1 {
+ /* GPIO_008-GPIO_015 */
+ gpio-line-names =
+ "[JTAG_TRST_N]",
+ "[JTAG_TDI]",
+ "[JTAG_TDO]",
+ "NC", "NC",
+ "[I2C3_SCL]",
+ "[I2C3_SDA]",
+ "NC";
+};
+
+&gpio2 {
+ /* GPIO_016-GPIO_023 */
+ gpio-line-names =
+ "NC", "NC", "NC",
+ "GPIO-J", /* LSEC pin 32: GPIO_019 */
+ "GPIO_020_HDMI_SEL",
+ "GPIO-L", /* LSEC pin 34: GPIO_021 */
+ "GPIO_022_UFSBUCK_INT_N",
+ "GPIO-G"; /* LSEC pin 29: LCD_TE0 */
+};
+
+&gpio3 {
+ /* GPIO_024-GPIO_031 */
+ /* The rail from pin BK36 is named LCD_TE0, we assume to be muxed as GPIO for GPIO-G */
+ gpio-line-names =
+ "[CSI0_MCLK]", /* HSEC pin 15: ISP_CCLK0_MCAM */
+ "[CSI1_MCLK]", /* HSEC pin 17: ISP_CCLK1_SCAM */
+ "NC",
+ "[I2C2_SCL]", /* HSEC pin 32: ISP_SCL0 */
+ "[I2C2_SDA]", /* HSEC pin 34: ISP_SDA0 */
+ "[I2C3_SCL]", /* HSEC pin 36: ISP_SCL1 */
+ "[I2C3_SDA]", /* HSEC pin 38: ISP_SDA1 */
+ "NC";
+};
+
+&gpio4 {
+ /* GPIO_032-GPIO_039 */
+ gpio-line-names =
+ "NC", "NC",
+ "PWR_BTN_N", /* LSEC pin 4: GPIO_034_PWRON_DET */
+ "GPIO_035_PMU2_EN",
+ "GPIO_036_USB_HUB_RESET",
+ "NC", "NC", "NC";
+};
+
+&gpio5 {
+ /* GPIO_040-GPIO_047 */
+ gpio-line-names =
+ "GPIO-H", /* LSEC pin 30: GPIO_040_LCD_RST_N */
+ "GPIO_041_HDMI_PD",
+ "TP904", /* Test point */
+ "TP905", /* Test point */
+ "NC", "NC",
+ "GPIO_046_HUB_VDD33_EN",
+ "GPIO_047_PMU1_EN";
+};
+
+&gpio6 {
+ /* GPIO_048-GPIO_055 */
+ gpio-line-names =
+ "NC", "NC", "NC",
+ "GPIO_051_WIFI_EN",
+ "GPIO-I", /* LSEC pin 31: GPIO_052_CAM0_RST_N */
+ /*
+ * These two pins should be used for SD(IO) data according to the
+ * 96boards specification but seems to be repurposed for a IRDA UART.
+ * They are however named according to the spec.
+ */
+ "[SD_DAT1]", /* HSEC pin 3: UART0_IRDA_RXD */
+ "[SD_DAT2]", /* HSEC pin 5: UART0_IRDA_TXD */
+ "[UART1_RXD]"; /* LSEC pin 13: DEBUG_UART6_RXD */
+};
+
+&gpio7 {
+ /* GPIO_056-GPIO_063 */
+ gpio-line-names =
+ "[UART1_TXD]", /* LSEC pin 11: DEBUG_UART6_TXD */
+ "[UART0_CTS]", /* LSEC pin 3: UART3_CTS_N */
+ "[UART0_RTS]", /* LSEC pin 9: UART3_RTS_N */
+ "[UART0_RXD]", /* LSEC pin 7: UART3_RXD */
+ "[UART0_TXD]", /* LSEC pin 5: UART3_TXD */
+ "[SOC_BT_UART4_CTS_N]",
+ "[SOC_BT_UART4_RTS_N]",
+ "[SOC_BT_UART4_RXD]";
+};
+
+&gpio8 {
+ /* GPIO_064-GPIO_071 */
+ gpio-line-names =
+ "[SOC_BT_UART4_TXD]",
+ "NC",
+ "[PMU_HKADC_SSI]",
+ "NC",
+ "GPIO_068_SEL",
+ "NC", "NC", "NC";
+
+};
+
+&gpio9 {
+ /* GPIO_072-GPIO_079 */
+ gpio-line-names =
+ "NC", "NC", "NC",
+ "GPIO-K", /* LSEC pin 33: GPIO_075_CAM1_RST_N */
+ "NC", "NC", "NC", "NC";
+};
+
+&gpio10 {
+ /* GPIO_080-GPIO_087 */
+ gpio-line-names = "NC", "NC", "NC", "NC", "NC", "NC", "NC", "NC";
+};
+
+&gpio11 {
+ /* GPIO_088-GPIO_095 */
+ gpio-line-names =
+ "NC",
+ "[PCIE_PERST_N]",
+ "NC", "NC", "NC", "NC", "NC", "NC";
+};
+
+&gpio12 {
+ /* GPIO_096-GPIO_103 */
+ gpio-line-names = "NC", "NC", "NC", "", "", "", "", "NC";
+};
+
+&gpio13 {
+ /* GPIO_104-GPIO_111 */
+ gpio-line-names = "NC", "NC", "NC", "NC", "NC", "NC", "NC", "NC";
+};
+
+&gpio14 {
+ /* GPIO_112-GPIO_119 */
+ gpio-line-names = "NC", "NC", "NC", "NC", "NC", "NC", "NC", "NC";
+};
+
+&gpio15 {
+ /* GPIO_120-GPIO_127 */
+ gpio-line-names =
+ "NC", "NC", "NC", "NC", "NC", "NC",
+ "GPIO_126_BT_EN",
+ "TP902"; /* GPIO_127_JTAG_SEL0 */
+};
+
+&gpio16 {
+ /* GPIO_128-GPIO_135 */
+ gpio-line-names = "", "", "", "", "", "", "", "";
+};
+
+&gpio17 {
+ /* GPIO_136-GPIO_143 */
+ gpio-line-names = "", "", "", "", "", "", "", "";
+};
+
+&gpio18 {
+ /* GPIO_144-GPIO_151 */
+ gpio-line-names =
+ "[UFS_REF_CLK]",
+ "[UFS_RST_N]",
+ "[SPI1_SCLK]", /* HSEC pin 9: GPIO_146_SPI3_CLK */
+ "[SPI1_DIN]", /* HSEC pin 11: GPIO_147_SPI3_DI */
+ "[SPI1_DOUT]", /* HSEC pin 1: GPIO_148_SPI3_DO */
+ "[SPI1_CS]", /* HSEC pin 7: GPIO_149_SPI3_CS0_N */
+ "GPIO_150_USER_LED1",
+ "GPIO_151_USER_LED2";
+};
+
+&gpio19 {
+ /* GPIO_152-GPIO_159 */
+ gpio-line-names = "NC", "NC", "NC", "NC", "", "", "", "";
+};
+
+&gpio20 {
+ /* GPIO_160-GPIO_167 */
+ gpio-line-names =
+ "[SD_CLK]",
+ "[SD_CMD]",
+ "[SD_DATA0]",
+ "[SD_DATA1]",
+ "[SD_DATA2]",
+ "[SD_DATA3]",
+ "", "";
+};
+
+&gpio21 {
+ /* GPIO_168-GPIO_175 */
+ gpio-line-names =
+ "[WL_SDIO_CLK]",
+ "[WL_SDIO_CMD]",
+ "[WL_SDIO_DATA0]",
+ "[WL_SDIO_DATA1]",
+ "[WL_SDIO_DATA2]",
+ "[WL_SDIO_DATA3]",
+ "", "";
+};
+
+&gpio22 {
+ /* GPIO_176-GPIO_183 */
+ gpio-line-names =
+ "[GPIO_176_PMU_PWR_HOLD]",
+ "NA",
+ "[SYSCLK_EN]",
+ "GPIO_179_WL_WAKEUP_AP",
+ "GPIO_180_HDMI_INT",
+ "NA",
+ "GPIO-F", /* LSEC pin 28: LCD_BL_PWM */
+ "[I2C0_SCL]"; /* LSEC pin 15 */
+};
+
+&gpio23 {
+ /* GPIO_184-GPIO_191 */
+ gpio-line-names =
+ "[I2C0_SDA]", /* LSEC pin 17 */
+ "[I2C1_SCL]", /* Actual SoC I2C1 */
+ "[I2C1_SDA]", /* Actual SoC I2C1 */
+ "[I2C1_SCL]", /* LSEC pin 19: I2C7_SCL */
+ "[I2C1_SDA]", /* LSEC pin 21: I2C7_SDA */
+ "GPIO_189_USER_LED3",
+ "GPIO_190_USER_LED4",
+ "";
+};
+
+&gpio24 {
+ /* GPIO_192-GPIO_199 */
+ gpio-line-names =
+ "[PCM_DI]", /* LSEC pin 22: GPIO_192_I2S0_DI */
+ "[PCM_DO]", /* LSEC pin 20: GPIO_193_I2S0_DO */
+ "[PCM_CLK]", /* LSEC pin 18: GPIO_194_I2S0_XCLK */
+ "[PCM_FS]", /* LSEC pin 16: GPIO_195_I2S0_XFS */
+ "[GPIO_196_I2S2_DI]",
+ "[GPIO_197_I2S2_DO]",
+ "[GPIO_198_I2S2_XCLK]",
+ "[GPIO_199_I2S2_XFS]";
+};
+
+&gpio25 {
+ /* GPIO_200-GPIO_207 */
+ gpio-line-names =
+ "NC",
+ "NC",
+ "GPIO_202_VBUS_TYPEC",
+ "GPIO_203_SD_DET",
+ "GPIO_204_PMU12_IRQ_N",
+ "GPIO_205_WIFI_ACTIVE",
+ "GPIO_206_USBSW_SEL",
+ "GPIO_207_BT_ACTIVE";
+};
+
+&gpio26 {
+ /* GPIO_208-GPIO_215 */
+ gpio-line-names =
+ "GPIO-A", /* LSEC pin 23: GPIO_208 */
+ "GPIO-B", /* LSEC pin 24: GPIO_209 */
+ "GPIO-C", /* LSEC pin 25: GPIO_210 */
+ "GPIO-D", /* LSEC pin 26: GPIO_211 */
+ "GPIO-E", /* LSEC pin 27: GPIO_212 */
+ "[PCIE_CLKREQ_N]",
+ "[PCIE_WAKE_N]",
+ "[SPI0_CLK]"; /* LSEC pin 8: SPI2_CLK */
+};
+
+&gpio27 {
+ /* GPIO_216-GPIO_223 */
+ gpio-line-names =
+ "[SPI0_DIN]", /* LSEC pin 10: SPI2_DI */
+ "[SPI0_DOUT]", /* LSEC pin 14: SPI2_DO */
+ "[SPI0_CS]", /* LSEC pin 12: SPI2_CS0_N */
+ "GPIO_219_CC_INT",
+ "NC",
+ "NC",
+ "[PMU_INT]",
+ "";
+};
+
+&gpio28 {
+ /* GPIO_224-GPIO_231 */
+ gpio-line-names =
+ "", "", "", "", "", "", "", "";
+};
+
+&i2c0 {
+ /* On Low speed expansion */
+ label = "LS-I2C0";
+ status = "okay";
+};
+
+&i2c1 {
+ status = "okay";
+
+ adv7533: adv7533@39 {
+ status = "ok";
+ compatible = "adi,adv7533";
+ reg = <0x39>;
+ };
+};
+
+&uart3 {
+ /* On Low speed expansion */
+ label = "LS-UART0";
+ status = "okay";
+};
+
+&uart4 {
+ status = "okay";
+
+ bluetooth {
+ compatible = "ti,wl1837-st";
+ enable-gpios = <&gpio15 6 GPIO_ACTIVE_HIGH>;
+ max-speed = <3000000>;
+ };
+};
+
+&i2c7 {
+ /* On Low speed expansion */
+ label = "LS-I2C1";
+ status = "okay";
+};
+
+&uart6 {
+ /* On Low speed expansion */
+ label = "LS-UART1";
+ status = "okay";
+};
+
+&spi2 {
+ /* On Low speed expansion */
+ label = "LS-SPI0";
+ status = "okay";
+};
+
+&spi3 {
+ /* On High speed expansion */
+ label = "HS-SPI1";
+ status = "okay";
+};
+
+&dwmmc1 {
+ cd-gpios = <&gpio25 3 GPIO_ACTIVE_LOW>;
+ pinctrl-names = "default";
+ pinctrl-0 = <&sd_pmx_func
+ &sd_clk_cfg_func
+ &sd_cfg_func>;
+ vmmc-supply = <&ldo16>;
+ vqmmc-supply = <&ldo9>;
+ status = "okay";
+};
+
+&dwmmc2 { /* WIFI */
+ bus-width = <0x4>;
+ non-removable;
+ broken-cd;
+ cap-power-off-card;
+ pinctrl-names = "default";
+ pinctrl-0 = <&sdio_pmx_func
+ &sdio_clk_cfg_func
+ &sdio_cfg_func>;
+ /* WL_EN */
+ vmmc-supply = <&wlan_en>;
+ status = "ok";
+
+ wlcore: wlcore@2 {
+ compatible = "ti,wl1837";
+ reg = <2>; /* sdio func num */
+ /* WL_IRQ, GPIO_179_WL_WAKEUP_AP */
+ interrupt-parent = <&gpio22>;
+ interrupts = <3 IRQ_TYPE_EDGE_RISING>;
+ };
+};
diff --git a/arch/arm/dts/hi3660.dtsi b/arch/arm/dts/hi3660.dtsi
new file mode 100644
index 0000000000..65a45b0e80
--- /dev/null
+++ b/arch/arm/dts/hi3660.dtsi
@@ -0,0 +1,1157 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * dts file for Hisilicon Hi3660 SoC
+ *
+ * Copyright (C) 2016, Hisilicon Ltd.
+ */
+
+#include <dt-bindings/interrupt-controller/arm-gic.h>
+#include <dt-bindings/clock/hi3660-clock.h>
+#include <dt-bindings/thermal/thermal.h>
+
+/ {
+ compatible = "hisilicon,hi3660";
+ interrupt-parent = <&gic>;
+ #address-cells = <2>;
+ #size-cells = <2>;
+
+ psci {
+ compatible = "arm,psci-0.2";
+ method = "smc";
+ };
+
+ cpus {
+ #address-cells = <2>;
+ #size-cells = <0>;
+
+ cpu-map {
+ cluster0 {
+ core0 {
+ cpu = <&cpu0>;
+ };
+ core1 {
+ cpu = <&cpu1>;
+ };
+ core2 {
+ cpu = <&cpu2>;
+ };
+ core3 {
+ cpu = <&cpu3>;
+ };
+ };
+ cluster1 {
+ core0 {
+ cpu = <&cpu4>;
+ };
+ core1 {
+ cpu = <&cpu5>;
+ };
+ core2 {
+ cpu = <&cpu6>;
+ };
+ core3 {
+ cpu = <&cpu7>;
+ };
+ };
+ };
+
+ cpu0: cpu@0 {
+ compatible = "arm,cortex-a53";
+ device_type = "cpu";
+ reg = <0x0 0x0>;
+ enable-method = "psci";
+ next-level-cache = <&A53_L2>;
+ cpu-idle-states = <&CPU_SLEEP_0 &CLUSTER_SLEEP_0>;
+ capacity-dmips-mhz = <592>;
+ clocks = <&stub_clock HI3660_CLK_STUB_CLUSTER0>;
+ operating-points-v2 = <&cluster0_opp>;
+ #cooling-cells = <2>;
+ dynamic-power-coefficient = <110>;
+ };
+
+ cpu1: cpu@1 {
+ compatible = "arm,cortex-a53";
+ device_type = "cpu";
+ reg = <0x0 0x1>;
+ enable-method = "psci";
+ next-level-cache = <&A53_L2>;
+ cpu-idle-states = <&CPU_SLEEP_0 &CLUSTER_SLEEP_0>;
+ capacity-dmips-mhz = <592>;
+ clocks = <&stub_clock HI3660_CLK_STUB_CLUSTER0>;
+ operating-points-v2 = <&cluster0_opp>;
+ #cooling-cells = <2>;
+ };
+
+ cpu2: cpu@2 {
+ compatible = "arm,cortex-a53";
+ device_type = "cpu";
+ reg = <0x0 0x2>;
+ enable-method = "psci";
+ next-level-cache = <&A53_L2>;
+ cpu-idle-states = <&CPU_SLEEP_0 &CLUSTER_SLEEP_0>;
+ capacity-dmips-mhz = <592>;
+ clocks = <&stub_clock HI3660_CLK_STUB_CLUSTER0>;
+ operating-points-v2 = <&cluster0_opp>;
+ #cooling-cells = <2>;
+ };
+
+ cpu3: cpu@3 {
+ compatible = "arm,cortex-a53";
+ device_type = "cpu";
+ reg = <0x0 0x3>;
+ enable-method = "psci";
+ next-level-cache = <&A53_L2>;
+ cpu-idle-states = <&CPU_SLEEP_0 &CLUSTER_SLEEP_0>;
+ capacity-dmips-mhz = <592>;
+ clocks = <&stub_clock HI3660_CLK_STUB_CLUSTER0>;
+ operating-points-v2 = <&cluster0_opp>;
+ #cooling-cells = <2>;
+ };
+
+ cpu4: cpu@100 {
+ compatible = "arm,cortex-a73";
+ device_type = "cpu";
+ reg = <0x0 0x100>;
+ enable-method = "psci";
+ next-level-cache = <&A73_L2>;
+ cpu-idle-states = <&CPU_SLEEP_1 &CLUSTER_SLEEP_1>;
+ capacity-dmips-mhz = <1024>;
+ clocks = <&stub_clock HI3660_CLK_STUB_CLUSTER1>;
+ operating-points-v2 = <&cluster1_opp>;
+ #cooling-cells = <2>;
+ dynamic-power-coefficient = <550>;
+ };
+
+ cpu5: cpu@101 {
+ compatible = "arm,cortex-a73";
+ device_type = "cpu";
+ reg = <0x0 0x101>;
+ enable-method = "psci";
+ next-level-cache = <&A73_L2>;
+ cpu-idle-states = <&CPU_SLEEP_1 &CLUSTER_SLEEP_1>;
+ capacity-dmips-mhz = <1024>;
+ clocks = <&stub_clock HI3660_CLK_STUB_CLUSTER1>;
+ operating-points-v2 = <&cluster1_opp>;
+ #cooling-cells = <2>;
+ };
+
+ cpu6: cpu@102 {
+ compatible = "arm,cortex-a73";
+ device_type = "cpu";
+ reg = <0x0 0x102>;
+ enable-method = "psci";
+ next-level-cache = <&A73_L2>;
+ cpu-idle-states = <&CPU_SLEEP_1 &CLUSTER_SLEEP_1>;
+ capacity-dmips-mhz = <1024>;
+ clocks = <&stub_clock HI3660_CLK_STUB_CLUSTER1>;
+ operating-points-v2 = <&cluster1_opp>;
+ #cooling-cells = <2>;
+ };
+
+ cpu7: cpu@103 {
+ compatible = "arm,cortex-a73";
+ device_type = "cpu";
+ reg = <0x0 0x103>;
+ enable-method = "psci";
+ next-level-cache = <&A73_L2>;
+ cpu-idle-states = <&CPU_SLEEP_1 &CLUSTER_SLEEP_1>;
+ capacity-dmips-mhz = <1024>;
+ clocks = <&stub_clock HI3660_CLK_STUB_CLUSTER1>;
+ operating-points-v2 = <&cluster1_opp>;
+ #cooling-cells = <2>;
+ };
+
+ idle-states {
+ entry-method = "psci";
+
+ CPU_SLEEP_0: cpu-sleep-0 {
+ compatible = "arm,idle-state";
+ local-timer-stop;
+ arm,psci-suspend-param = <0x0010000>;
+ entry-latency-us = <400>;
+ exit-latency-us = <650>;
+ min-residency-us = <1500>;
+ };
+ CLUSTER_SLEEP_0: cluster-sleep-0 {
+ compatible = "arm,idle-state";
+ local-timer-stop;
+ arm,psci-suspend-param = <0x1010000>;
+ entry-latency-us = <500>;
+ exit-latency-us = <1600>;
+ min-residency-us = <3500>;
+ };
+
+
+ CPU_SLEEP_1: cpu-sleep-1 {
+ compatible = "arm,idle-state";
+ local-timer-stop;
+ arm,psci-suspend-param = <0x0010000>;
+ entry-latency-us = <400>;
+ exit-latency-us = <550>;
+ min-residency-us = <1500>;
+ };
+
+ CLUSTER_SLEEP_1: cluster-sleep-1 {
+ compatible = "arm,idle-state";
+ local-timer-stop;
+ arm,psci-suspend-param = <0x1010000>;
+ entry-latency-us = <800>;
+ exit-latency-us = <2900>;
+ min-residency-us = <3500>;
+ };
+ };
+
+ A53_L2: l2-cache0 {
+ compatible = "cache";
+ };
+
+ A73_L2: l2-cache1 {
+ compatible = "cache";
+ };
+ };
+
+ cluster0_opp: opp_table0 {
+ compatible = "operating-points-v2";
+ opp-shared;
+
+ opp00 {
+ opp-hz = /bits/ 64 <533000000>;
+ opp-microvolt = <700000>;
+ clock-latency-ns = <300000>;
+ };
+
+ opp01 {
+ opp-hz = /bits/ 64 <999000000>;
+ opp-microvolt = <800000>;
+ clock-latency-ns = <300000>;
+ };
+
+ opp02 {
+ opp-hz = /bits/ 64 <1402000000>;
+ opp-microvolt = <900000>;
+ clock-latency-ns = <300000>;
+ };
+
+ opp03 {
+ opp-hz = /bits/ 64 <1709000000>;
+ opp-microvolt = <1000000>;
+ clock-latency-ns = <300000>;
+ };
+
+ opp04 {
+ opp-hz = /bits/ 64 <1844000000>;
+ opp-microvolt = <1100000>;
+ clock-latency-ns = <300000>;
+ };
+ };
+
+ cluster1_opp: opp_table1 {
+ compatible = "operating-points-v2";
+ opp-shared;
+
+ opp10 {
+ opp-hz = /bits/ 64 <903000000>;
+ opp-microvolt = <700000>;
+ clock-latency-ns = <300000>;
+ };
+
+ opp11 {
+ opp-hz = /bits/ 64 <1421000000>;
+ opp-microvolt = <800000>;
+ clock-latency-ns = <300000>;
+ };
+
+ opp12 {
+ opp-hz = /bits/ 64 <1805000000>;
+ opp-microvolt = <900000>;
+ clock-latency-ns = <300000>;
+ };
+
+ opp13 {
+ opp-hz = /bits/ 64 <2112000000>;
+ opp-microvolt = <1000000>;
+ clock-latency-ns = <300000>;
+ };
+
+ opp14 {
+ opp-hz = /bits/ 64 <2362000000>;
+ opp-microvolt = <1100000>;
+ clock-latency-ns = <300000>;
+ };
+ };
+
+ gic: interrupt-controller@e82b0000 {
+ compatible = "arm,gic-400";
+ reg = <0x0 0xe82b1000 0 0x1000>, /* GICD */
+ <0x0 0xe82b2000 0 0x2000>, /* GICC */
+ <0x0 0xe82b4000 0 0x2000>, /* GICH */
+ <0x0 0xe82b6000 0 0x2000>; /* GICV */
+ #address-cells = <0>;
+ #interrupt-cells = <3>;
+ interrupt-controller;
+ interrupts = <GIC_PPI 9 (GIC_CPU_MASK_SIMPLE(8) |
+ IRQ_TYPE_LEVEL_HIGH)>;
+ };
+
+ a53-pmu {
+ compatible = "arm,cortex-a53-pmu";
+ interrupts = <GIC_SPI 24 IRQ_TYPE_LEVEL_HIGH>,
+ <GIC_SPI 25 IRQ_TYPE_LEVEL_HIGH>,
+ <GIC_SPI 26 IRQ_TYPE_LEVEL_HIGH>,
+ <GIC_SPI 27 IRQ_TYPE_LEVEL_HIGH>;
+ interrupt-affinity = <&cpu0>,
+ <&cpu1>,
+ <&cpu2>,
+ <&cpu3>;
+ };
+
+ a73-pmu {
+ compatible = "arm,cortex-a73-pmu";
+ interrupts = <GIC_SPI 2 IRQ_TYPE_LEVEL_HIGH>,
+ <GIC_SPI 3 IRQ_TYPE_LEVEL_HIGH>,
+ <GIC_SPI 4 IRQ_TYPE_LEVEL_HIGH>,
+ <GIC_SPI 5 IRQ_TYPE_LEVEL_HIGH>;
+ interrupt-affinity = <&cpu4>,
+ <&cpu5>,
+ <&cpu6>,
+ <&cpu7>;
+ };
+
+ timer {
+ compatible = "arm,armv8-timer";
+ interrupt-parent = <&gic>;
+ interrupts = <GIC_PPI 13 (GIC_CPU_MASK_SIMPLE(8) |
+ IRQ_TYPE_LEVEL_LOW)>,
+ <GIC_PPI 14 (GIC_CPU_MASK_SIMPLE(8) |
+ IRQ_TYPE_LEVEL_LOW)>,
+ <GIC_PPI 11 (GIC_CPU_MASK_SIMPLE(8) |
+ IRQ_TYPE_LEVEL_LOW)>,
+ <GIC_PPI 10 (GIC_CPU_MASK_SIMPLE(8) |
+ IRQ_TYPE_LEVEL_LOW)>;
+ };
+
+ soc {
+ compatible = "simple-bus";
+ #address-cells = <2>;
+ #size-cells = <2>;
+ ranges;
+
+ crg_ctrl: crg_ctrl@fff35000 {
+ compatible = "hisilicon,hi3660-crgctrl", "syscon";
+ reg = <0x0 0xfff35000 0x0 0x1000>;
+ #clock-cells = <1>;
+ };
+
+ crg_rst: crg_rst_controller {
+ compatible = "hisilicon,hi3660-reset";
+ #reset-cells = <2>;
+ hisi,rst-syscon = <&crg_ctrl>;
+ };
+
+
+ pctrl: pctrl@e8a09000 {
+ compatible = "hisilicon,hi3660-pctrl", "syscon";
+ reg = <0x0 0xe8a09000 0x0 0x2000>;
+ #clock-cells = <1>;
+ };
+
+ pmuctrl: crg_ctrl@fff34000 {
+ compatible = "hisilicon,hi3660-pmuctrl", "syscon";
+ reg = <0x0 0xfff34000 0x0 0x1000>;
+ #clock-cells = <1>;
+ };
+
+ sctrl: sctrl@fff0a000 {
+ compatible = "hisilicon,hi3660-sctrl", "syscon";
+ reg = <0x0 0xfff0a000 0x0 0x1000>;
+ #clock-cells = <1>;
+ };
+
+ iomcu: iomcu@ffd7e000 {
+ compatible = "hisilicon,hi3660-iomcu", "syscon";
+ reg = <0x0 0xffd7e000 0x0 0x1000>;
+ #clock-cells = <1>;
+
+ };
+
+ iomcu_rst: reset {
+ compatible = "hisilicon,hi3660-reset";
+ hisi,rst-syscon = <&iomcu>;
+ #reset-cells = <2>;
+ };
+
+ mailbox: mailbox@e896b000 {
+ compatible = "hisilicon,hi3660-mbox";
+ reg = <0x0 0xe896b000 0x0 0x1000>;
+ interrupts = <GIC_SPI 192 IRQ_TYPE_LEVEL_HIGH>,
+ <GIC_SPI 193 IRQ_TYPE_LEVEL_HIGH>;
+ #mbox-cells = <3>;
+ };
+
+ stub_clock: stub_clock@e896b500 {
+ compatible = "hisilicon,hi3660-stub-clk";
+ reg = <0x0 0xe896b500 0x0 0x0100>;
+ #clock-cells = <1>;
+ mboxes = <&mailbox 13 3 0>;
+ };
+
+ dual_timer0: timer@fff14000 {
+ compatible = "arm,sp804", "arm,primecell";
+ reg = <0x0 0xfff14000 0x0 0x1000>;
+ interrupts = <GIC_SPI 48 IRQ_TYPE_LEVEL_HIGH>,
+ <GIC_SPI 49 IRQ_TYPE_LEVEL_HIGH>;
+ clocks = <&crg_ctrl HI3660_OSC32K>,
+ <&crg_ctrl HI3660_OSC32K>,
+ <&crg_ctrl HI3660_OSC32K>;
+ clock-names = "timer1", "timer2", "apb_pclk";
+ };
+
+ i2c0: i2c@ffd71000 {
+ compatible = "snps,designware-i2c";
+ reg = <0x0 0xffd71000 0x0 0x1000>;
+ interrupts = <GIC_SPI 118 IRQ_TYPE_LEVEL_HIGH>;
+ #address-cells = <1>;
+ #size-cells = <0>;
+ clock-frequency = <400000>;
+ clocks = <&crg_ctrl HI3660_CLK_GATE_I2C0>;
+ resets = <&iomcu_rst 0x20 3>;
+ pinctrl-names = "default";
+ pinctrl-0 = <&i2c0_pmx_func &i2c0_cfg_func>;
+ status = "disabled";
+ };
+
+ i2c1: i2c@ffd72000 {
+ compatible = "snps,designware-i2c";
+ reg = <0x0 0xffd72000 0x0 0x1000>;
+ interrupts = <GIC_SPI 119 IRQ_TYPE_LEVEL_HIGH>;
+ #address-cells = <1>;
+ #size-cells = <0>;
+ clock-frequency = <400000>;
+ clocks = <&crg_ctrl HI3660_CLK_GATE_I2C1>;
+ resets = <&iomcu_rst 0x20 4>;
+ pinctrl-names = "default";
+ pinctrl-0 = <&i2c1_pmx_func &i2c1_cfg_func>;
+ status = "disabled";
+ };
+
+ i2c3: i2c@fdf0c000 {
+ compatible = "snps,designware-i2c";
+ reg = <0x0 0xfdf0c000 0x0 0x1000>;
+ interrupts = <GIC_SPI 81 IRQ_TYPE_LEVEL_HIGH>;
+ #address-cells = <1>;
+ #size-cells = <0>;
+ clock-frequency = <400000>;
+ clocks = <&crg_ctrl HI3660_CLK_GATE_I2C3>;
+ resets = <&crg_rst 0x78 7>;
+ pinctrl-names = "default";
+ pinctrl-0 = <&i2c3_pmx_func &i2c3_cfg_func>;
+ status = "disabled";
+ };
+
+ i2c7: i2c@fdf0b000 {
+ compatible = "snps,designware-i2c";
+ reg = <0x0 0xfdf0b000 0x0 0x1000>;
+ interrupts = <GIC_SPI 314 IRQ_TYPE_LEVEL_HIGH>;
+ #address-cells = <1>;
+ #size-cells = <0>;
+ clock-frequency = <400000>;
+ clocks = <&crg_ctrl HI3660_CLK_GATE_I2C7>;
+ resets = <&crg_rst 0x60 14>;
+ pinctrl-names = "default";
+ pinctrl-0 = <&i2c7_pmx_func &i2c7_cfg_func>;
+ status = "disabled";
+ };
+
+ uart0: serial@fdf02000 {
+ compatible = "arm,pl011", "arm,primecell";
+ reg = <0x0 0xfdf02000 0x0 0x1000>;
+ interrupts = <GIC_SPI 74 IRQ_TYPE_LEVEL_HIGH>;
+ clocks = <&crg_ctrl HI3660_CLK_MUX_UART0>,
+ <&crg_ctrl HI3660_PCLK>;
+ clock-names = "uartclk", "apb_pclk";
+ pinctrl-names = "default";
+ pinctrl-0 = <&uart0_pmx_func &uart0_cfg_func>;
+ status = "disabled";
+ };
+
+ uart1: serial@fdf00000 {
+ compatible = "arm,pl011", "arm,primecell";
+ reg = <0x0 0xfdf00000 0x0 0x1000>;
+ interrupts = <GIC_SPI 75 IRQ_TYPE_LEVEL_HIGH>;
+ dma-names = "rx", "tx";
+ dmas = <&dma0 2 &dma0 3>;
+ clocks = <&crg_ctrl HI3660_CLK_GATE_UART1>,
+ <&crg_ctrl HI3660_CLK_GATE_UART1>;
+ clock-names = "uartclk", "apb_pclk";
+ pinctrl-names = "default";
+ pinctrl-0 = <&uart1_pmx_func &uart1_cfg_func>;
+ status = "disabled";
+ };
+
+ uart2: serial@fdf03000 {
+ compatible = "arm,pl011", "arm,primecell";
+ reg = <0x0 0xfdf03000 0x0 0x1000>;
+ interrupts = <GIC_SPI 76 IRQ_TYPE_LEVEL_HIGH>;
+ dma-names = "rx", "tx";
+ dmas = <&dma0 4 &dma0 5>;
+ clocks = <&crg_ctrl HI3660_CLK_GATE_UART2>,
+ <&crg_ctrl HI3660_PCLK>;
+ clock-names = "uartclk", "apb_pclk";
+ pinctrl-names = "default";
+ pinctrl-0 = <&uart2_pmx_func &uart2_cfg_func>;
+ status = "disabled";
+ };
+
+ uart3: serial@ffd74000 {
+ compatible = "arm,pl011", "arm,primecell";
+ reg = <0x0 0xffd74000 0x0 0x1000>;
+ interrupts = <GIC_SPI 114 IRQ_TYPE_LEVEL_HIGH>;
+ clocks = <&crg_ctrl HI3660_FACTOR_UART3>,
+ <&crg_ctrl HI3660_PCLK>;
+ clock-names = "uartclk", "apb_pclk";
+ pinctrl-names = "default";
+ pinctrl-0 = <&uart3_pmx_func &uart3_cfg_func>;
+ status = "disabled";
+ };
+
+ uart4: serial@fdf01000 {
+ compatible = "arm,pl011", "arm,primecell";
+ reg = <0x0 0xfdf01000 0x0 0x1000>;
+ interrupts = <GIC_SPI 77 IRQ_TYPE_LEVEL_HIGH>;
+ dma-names = "rx", "tx";
+ dmas = <&dma0 6 &dma0 7>;
+ clocks = <&crg_ctrl HI3660_CLK_GATE_UART4>,
+ <&crg_ctrl HI3660_CLK_GATE_UART4>;
+ clock-names = "uartclk", "apb_pclk";
+ pinctrl-names = "default";
+ pinctrl-0 = <&uart4_pmx_func &uart4_cfg_func>;
+ status = "disabled";
+ };
+
+ uart5: serial@fdf05000 {
+ compatible = "arm,pl011", "arm,primecell";
+ reg = <0x0 0xfdf05000 0x0 0x1000>;
+ interrupts = <GIC_SPI 78 IRQ_TYPE_LEVEL_HIGH>;
+ dma-names = "rx", "tx";
+ dmas = <&dma0 8 &dma0 9>;
+ clocks = <&crg_ctrl HI3660_CLK_GATE_UART5>,
+ <&crg_ctrl HI3660_CLK_GATE_UART5>;
+ clock-names = "uartclk", "apb_pclk";
+ pinctrl-names = "default";
+ pinctrl-0 = <&uart5_pmx_func &uart5_cfg_func>;
+ status = "disabled";
+ };
+
+ uart6: serial@fff32000 {
+ compatible = "arm,pl011", "arm,primecell";
+ reg = <0x0 0xfff32000 0x0 0x1000>;
+ interrupts = <GIC_SPI 79 IRQ_TYPE_LEVEL_HIGH>;
+ clock = <19200000>;
+ clocks = <&crg_ctrl HI3660_CLK_UART6>,
+ <&crg_ctrl HI3660_PCLK>;
+ clock-names = "uartclk", "apb_pclk";
+ pinctrl-names = "default";
+ pinctrl-0 = <&uart6_pmx_func &uart6_cfg_func>;
+ status = "disabled";
+ };
+
+ dma0: dma@fdf30000 {
+ compatible = "hisilicon,k3-dma-1.0";
+ reg = <0x0 0xfdf30000 0x0 0x1000>;
+ #dma-cells = <1>;
+ dma-channels = <16>;
+ dma-requests = <32>;
+ dma-channel-mask = <0xfffe>;
+ interrupts = <GIC_SPI 143 IRQ_TYPE_LEVEL_HIGH>;
+ clocks = <&crg_ctrl HI3660_CLK_GATE_DMAC>;
+ dma-no-cci;
+ dma-type = "hi3660_dma";
+ };
+
+ asp_dmac: dma-controller@e804b000 {
+ compatible = "hisilicon,hisi-pcm-asp-dma-1.0";
+ reg = <0x0 0xe804b000 0x0 0x1000>;
+ #dma-cells = <1>;
+ dma-channels = <16>;
+ dma-requests = <32>;
+ interrupts = <GIC_SPI 216 IRQ_TYPE_LEVEL_HIGH>;
+ interrupt-names = "asp_dma_irq";
+ };
+
+ rtc0: rtc@fff04000 {
+ compatible = "arm,pl031", "arm,primecell";
+ reg = <0x0 0Xfff04000 0x0 0x1000>;
+ interrupts = <GIC_SPI 46 IRQ_TYPE_LEVEL_HIGH>;
+ clocks = <&crg_ctrl HI3660_PCLK>;
+ clock-names = "apb_pclk";
+ };
+
+ gpio0: gpio@e8a0b000 {
+ compatible = "arm,pl061", "arm,primecell";
+ reg = <0 0xe8a0b000 0 0x1000>;
+ interrupts = <GIC_SPI 84 IRQ_TYPE_LEVEL_HIGH>;
+ gpio-controller;
+ #gpio-cells = <2>;
+ gpio-ranges = <&pmx0 1 0 7>;
+ interrupt-controller;
+ #interrupt-cells = <2>;
+ clocks = <&crg_ctrl HI3660_PCLK_GPIO0>;
+ clock-names = "apb_pclk";
+ };
+
+ gpio1: gpio@e8a0c000 {
+ compatible = "arm,pl061", "arm,primecell";
+ reg = <0 0xe8a0c000 0 0x1000>;
+ interrupts = <GIC_SPI 85 IRQ_TYPE_LEVEL_HIGH>;
+ gpio-controller;
+ #gpio-cells = <2>;
+ gpio-ranges = <&pmx0 1 7 7>;
+ interrupt-controller;
+ #interrupt-cells = <2>;
+ clocks = <&crg_ctrl HI3660_PCLK_GPIO1>;
+ clock-names = "apb_pclk";
+ };
+
+ gpio2: gpio@e8a0d000 {
+ compatible = "arm,pl061", "arm,primecell";
+ reg = <0 0xe8a0d000 0 0x1000>;
+ interrupts = <GIC_SPI 86 IRQ_TYPE_LEVEL_HIGH>;
+ gpio-controller;
+ #gpio-cells = <2>;
+ gpio-ranges = <&pmx0 0 14 8>;
+ interrupt-controller;
+ #interrupt-cells = <2>;
+ clocks = <&crg_ctrl HI3660_PCLK_GPIO2>;
+ clock-names = "apb_pclk";
+ };
+
+ gpio3: gpio@e8a0e000 {
+ compatible = "arm,pl061", "arm,primecell";
+ reg = <0 0xe8a0e000 0 0x1000>;
+ interrupts = <GIC_SPI 87 IRQ_TYPE_LEVEL_HIGH>;
+ gpio-controller;
+ #gpio-cells = <2>;
+ gpio-ranges = <&pmx0 0 22 8>;
+ interrupt-controller;
+ #interrupt-cells = <2>;
+ clocks = <&crg_ctrl HI3660_PCLK_GPIO3>;
+ clock-names = "apb_pclk";
+ };
+
+ gpio4: gpio@e8a0f000 {
+ compatible = "arm,pl061", "arm,primecell";
+ reg = <0 0xe8a0f000 0 0x1000>;
+ interrupts = <GIC_SPI 88 IRQ_TYPE_LEVEL_HIGH>;
+ gpio-controller;
+ #gpio-cells = <2>;
+ gpio-ranges = <&pmx0 0 30 8>;
+ interrupt-controller;
+ #interrupt-cells = <2>;
+ clocks = <&crg_ctrl HI3660_PCLK_GPIO4>;
+ clock-names = "apb_pclk";
+ };
+
+ gpio5: gpio@e8a10000 {
+ compatible = "arm,pl061", "arm,primecell";
+ reg = <0 0xe8a10000 0 0x1000>;
+ interrupts = <GIC_SPI 89 IRQ_TYPE_LEVEL_HIGH>;
+ gpio-controller;
+ #gpio-cells = <2>;
+ gpio-ranges = <&pmx0 0 38 8>;
+ interrupt-controller;
+ #interrupt-cells = <2>;
+ clocks = <&crg_ctrl HI3660_PCLK_GPIO5>;
+ clock-names = "apb_pclk";
+ };
+
+ gpio6: gpio@e8a11000 {
+ compatible = "arm,pl061", "arm,primecell";
+ reg = <0 0xe8a11000 0 0x1000>;
+ interrupts = <GIC_SPI 90 IRQ_TYPE_LEVEL_HIGH>;
+ gpio-controller;
+ #gpio-cells = <2>;
+ gpio-ranges = <&pmx0 0 46 8>;
+ interrupt-controller;
+ #interrupt-cells = <2>;
+ clocks = <&crg_ctrl HI3660_PCLK_GPIO6>;
+ clock-names = "apb_pclk";
+ };
+
+ gpio7: gpio@e8a12000 {
+ compatible = "arm,pl061", "arm,primecell";
+ reg = <0 0xe8a12000 0 0x1000>;
+ interrupts = <GIC_SPI 91 IRQ_TYPE_LEVEL_HIGH>;
+ gpio-controller;
+ #gpio-cells = <2>;
+ gpio-ranges = <&pmx0 0 54 8>;
+ interrupt-controller;
+ #interrupt-cells = <2>;
+ clocks = <&crg_ctrl HI3660_PCLK_GPIO7>;
+ clock-names = "apb_pclk";
+ };
+
+ gpio8: gpio@e8a13000 {
+ compatible = "arm,pl061", "arm,primecell";
+ reg = <0 0xe8a13000 0 0x1000>;
+ interrupts = <GIC_SPI 92 IRQ_TYPE_LEVEL_HIGH>;
+ gpio-controller;
+ #gpio-cells = <2>;
+ gpio-ranges = <&pmx0 0 62 8>;
+ interrupt-controller;
+ #interrupt-cells = <2>;
+ clocks = <&crg_ctrl HI3660_PCLK_GPIO8>;
+ clock-names = "apb_pclk";
+ };
+
+ gpio9: gpio@e8a14000 {
+ compatible = "arm,pl061", "arm,primecell";
+ reg = <0 0xe8a14000 0 0x1000>;
+ interrupts = <GIC_SPI 93 IRQ_TYPE_LEVEL_HIGH>;
+ gpio-controller;
+ #gpio-cells = <2>;
+ gpio-ranges = <&pmx0 0 70 8>;
+ interrupt-controller;
+ #interrupt-cells = <2>;
+ clocks = <&crg_ctrl HI3660_PCLK_GPIO9>;
+ clock-names = "apb_pclk";
+ };
+
+ gpio10: gpio@e8a15000 {
+ compatible = "arm,pl061", "arm,primecell";
+ reg = <0 0xe8a15000 0 0x1000>;
+ interrupts = <GIC_SPI 94 IRQ_TYPE_LEVEL_HIGH>;
+ gpio-controller;
+ #gpio-cells = <2>;
+ gpio-ranges = <&pmx0 0 78 8>;
+ interrupt-controller;
+ #interrupt-cells = <2>;
+ clocks = <&crg_ctrl HI3660_PCLK_GPIO10>;
+ clock-names = "apb_pclk";
+ };
+
+ gpio11: gpio@e8a16000 {
+ compatible = "arm,pl061", "arm,primecell";
+ reg = <0 0xe8a16000 0 0x1000>;
+ interrupts = <GIC_SPI 95 IRQ_TYPE_LEVEL_HIGH>;
+ gpio-controller;
+ #gpio-cells = <2>;
+ gpio-ranges = <&pmx0 0 86 8>;
+ interrupt-controller;
+ #interrupt-cells = <2>;
+ clocks = <&crg_ctrl HI3660_PCLK_GPIO11>;
+ clock-names = "apb_pclk";
+ };
+
+ gpio12: gpio@e8a17000 {
+ compatible = "arm,pl061", "arm,primecell";
+ reg = <0 0xe8a17000 0 0x1000>;
+ interrupts = <GIC_SPI 96 IRQ_TYPE_LEVEL_HIGH>;
+ gpio-controller;
+ #gpio-cells = <2>;
+ gpio-ranges = <&pmx0 0 94 3 &pmx0 7 101 1>;
+ interrupt-controller;
+ #interrupt-cells = <2>;
+ clocks = <&crg_ctrl HI3660_PCLK_GPIO12>;
+ clock-names = "apb_pclk";
+ };
+
+ gpio13: gpio@e8a18000 {
+ compatible = "arm,pl061", "arm,primecell";
+ reg = <0 0xe8a18000 0 0x1000>;
+ interrupts = <GIC_SPI 97 IRQ_TYPE_LEVEL_HIGH>;
+ gpio-controller;
+ #gpio-cells = <2>;
+ gpio-ranges = <&pmx0 0 102 8>;
+ interrupt-controller;
+ #interrupt-cells = <2>;
+ clocks = <&crg_ctrl HI3660_PCLK_GPIO13>;
+ clock-names = "apb_pclk";
+ };
+
+ gpio14: gpio@e8a19000 {
+ compatible = "arm,pl061", "arm,primecell";
+ reg = <0 0xe8a19000 0 0x1000>;
+ interrupts = <GIC_SPI 98 IRQ_TYPE_LEVEL_HIGH>;
+ gpio-controller;
+ #gpio-cells = <2>;
+ gpio-ranges = <&pmx0 0 110 8>;
+ interrupt-controller;
+ #interrupt-cells = <2>;
+ clocks = <&crg_ctrl HI3660_PCLK_GPIO14>;
+ clock-names = "apb_pclk";
+ };
+
+ gpio15: gpio@e8a1a000 {
+ compatible = "arm,pl061", "arm,primecell";
+ reg = <0 0xe8a1a000 0 0x1000>;
+ interrupts = <GIC_SPI 99 IRQ_TYPE_LEVEL_HIGH>;
+ gpio-controller;
+ #gpio-cells = <2>;
+ gpio-ranges = <&pmx0 0 118 6>;
+ interrupt-controller;
+ #interrupt-cells = <2>;
+ clocks = <&crg_ctrl HI3660_PCLK_GPIO15>;
+ clock-names = "apb_pclk";
+ };
+
+ gpio16: gpio@e8a1b000 {
+ compatible = "arm,pl061", "arm,primecell";
+ reg = <0 0xe8a1b000 0 0x1000>;
+ interrupts = <GIC_SPI 100 IRQ_TYPE_LEVEL_HIGH>;
+ gpio-controller;
+ #gpio-cells = <2>;
+ interrupt-controller;
+ #interrupt-cells = <2>;
+ clocks = <&crg_ctrl HI3660_PCLK_GPIO16>;
+ clock-names = "apb_pclk";
+ };
+
+ gpio17: gpio@e8a1c000 {
+ compatible = "arm,pl061", "arm,primecell";
+ reg = <0 0xe8a1c000 0 0x1000>;
+ interrupts = <GIC_SPI 101 IRQ_TYPE_LEVEL_HIGH>;
+ gpio-controller;
+ #gpio-cells = <2>;
+ interrupt-controller;
+ #interrupt-cells = <2>;
+ clocks = <&crg_ctrl HI3660_PCLK_GPIO17>;
+ clock-names = "apb_pclk";
+ };
+
+ gpio18: gpio@ff3b4000 {
+ compatible = "arm,pl061", "arm,primecell";
+ reg = <0 0xff3b4000 0 0x1000>;
+ interrupts = <GIC_SPI 102 IRQ_TYPE_LEVEL_HIGH>;
+ gpio-controller;
+ #gpio-cells = <2>;
+ gpio-ranges = <&pmx2 0 0 8>;
+ interrupt-controller;
+ #interrupt-cells = <2>;
+ clocks = <&crg_ctrl HI3660_PCLK_GPIO18>;
+ clock-names = "apb_pclk";
+ };
+
+ gpio19: gpio@ff3b5000 {
+ compatible = "arm,pl061", "arm,primecell";
+ reg = <0 0xff3b5000 0 0x1000>;
+ interrupts = <GIC_SPI 103 IRQ_TYPE_LEVEL_HIGH>;
+ gpio-controller;
+ #gpio-cells = <2>;
+ gpio-ranges = <&pmx2 0 8 4>;
+ interrupt-controller;
+ #interrupt-cells = <2>;
+ clocks = <&crg_ctrl HI3660_PCLK_GPIO19>;
+ clock-names = "apb_pclk";
+ };
+
+ gpio20: gpio@e8a1f000 {
+ compatible = "arm,pl061", "arm,primecell";
+ reg = <0 0xe8a1f000 0 0x1000>;
+ interrupts = <GIC_SPI 104 IRQ_TYPE_LEVEL_HIGH>;
+ gpio-controller;
+ #gpio-cells = <2>;
+ gpio-ranges = <&pmx1 0 0 6>;
+ interrupt-controller;
+ #interrupt-cells = <2>;
+ clocks = <&crg_ctrl HI3660_PCLK_GPIO20>;
+ clock-names = "apb_pclk";
+ };
+
+ gpio21: gpio@e8a20000 {
+ compatible = "arm,pl061", "arm,primecell";
+ reg = <0 0xe8a20000 0 0x1000>;
+ interrupts = <GIC_SPI 105 IRQ_TYPE_LEVEL_HIGH>;
+ gpio-controller;
+ #gpio-cells = <2>;
+ interrupt-controller;
+ #interrupt-cells = <2>;
+ gpio-ranges = <&pmx3 0 0 6>;
+ clocks = <&crg_ctrl HI3660_PCLK_GPIO21>;
+ clock-names = "apb_pclk";
+ };
+
+ gpio22: gpio@fff0b000 {
+ compatible = "arm,pl061", "arm,primecell";
+ reg = <0 0xfff0b000 0 0x1000>;
+ interrupts = <GIC_SPI 106 IRQ_TYPE_LEVEL_HIGH>;
+ gpio-controller;
+ #gpio-cells = <2>;
+ /* GPIO176 */
+ gpio-ranges = <&pmx4 2 0 6>;
+ interrupt-controller;
+ #interrupt-cells = <2>;
+ clocks = <&sctrl HI3660_PCLK_AO_GPIO0>;
+ clock-names = "apb_pclk";
+ };
+
+ gpio23: gpio@fff0c000 {
+ compatible = "arm,pl061", "arm,primecell";
+ reg = <0 0xfff0c000 0 0x1000>;
+ interrupts = <GIC_SPI 107 IRQ_TYPE_LEVEL_HIGH>;
+ gpio-controller;
+ #gpio-cells = <2>;
+ /* GPIO184 */
+ gpio-ranges = <&pmx4 0 6 7>;
+ interrupt-controller;
+ #interrupt-cells = <2>;
+ clocks = <&sctrl HI3660_PCLK_AO_GPIO1>;
+ clock-names = "apb_pclk";
+ };
+
+ gpio24: gpio@fff0d000 {
+ compatible = "arm,pl061", "arm,primecell";
+ reg = <0 0xfff0d000 0 0x1000>;
+ interrupts = <GIC_SPI 108 IRQ_TYPE_LEVEL_HIGH>;
+ gpio-controller;
+ #gpio-cells = <2>;
+ /* GPIO192 */
+ gpio-ranges = <&pmx4 0 13 8>;
+ interrupt-controller;
+ #interrupt-cells = <2>;
+ clocks = <&sctrl HI3660_PCLK_AO_GPIO2>;
+ clock-names = "apb_pclk";
+ };
+
+ gpio25: gpio@fff0e000 {
+ compatible = "arm,pl061", "arm,primecell";
+ reg = <0 0xfff0e000 0 0x1000>;
+ interrupts = <GIC_SPI 109 IRQ_TYPE_LEVEL_HIGH>;
+ gpio-controller;
+ #gpio-cells = <2>;
+ /* GPIO200 */
+ gpio-ranges = <&pmx4 0 21 4 &pmx4 5 25 3>;
+ interrupt-controller;
+ #interrupt-cells = <2>;
+ clocks = <&sctrl HI3660_PCLK_AO_GPIO3>;
+ clock-names = "apb_pclk";
+ };
+
+ gpio26: gpio@fff0f000 {
+ compatible = "arm,pl061", "arm,primecell";
+ reg = <0 0xfff0f000 0 0x1000>;
+ interrupts = <GIC_SPI 110 IRQ_TYPE_LEVEL_HIGH>;
+ gpio-controller;
+ #gpio-cells = <2>;
+ /* GPIO208 */
+ gpio-ranges = <&pmx4 0 28 8>;
+ interrupt-controller;
+ #interrupt-cells = <2>;
+ clocks = <&sctrl HI3660_PCLK_AO_GPIO4>;
+ clock-names = "apb_pclk";
+ };
+
+ gpio27: gpio@fff10000 {
+ compatible = "arm,pl061", "arm,primecell";
+ reg = <0 0xfff10000 0 0x1000>;
+ interrupts = <GIC_SPI 111 IRQ_TYPE_LEVEL_HIGH>;
+ gpio-controller;
+ #gpio-cells = <2>;
+ /* GPIO216 */
+ gpio-ranges = <&pmx4 0 36 6>;
+ interrupt-controller;
+ #interrupt-cells = <2>;
+ clocks = <&sctrl HI3660_PCLK_AO_GPIO5>;
+ clock-names = "apb_pclk";
+ };
+
+ gpio28: gpio@fff1d000 {
+ compatible = "arm,pl061", "arm,primecell";
+ reg = <0 0xfff1d000 0 0x1000>;
+ interrupts = <GIC_SPI 141 IRQ_TYPE_LEVEL_HIGH>;
+ gpio-controller;
+ #gpio-cells = <2>;
+ interrupt-controller;
+ #interrupt-cells = <2>;
+ clocks = <&sctrl HI3660_PCLK_AO_GPIO6>;
+ clock-names = "apb_pclk";
+ };
+
+ spi2: spi@ffd68000 {
+ compatible = "arm,pl022", "arm,primecell";
+ reg = <0x0 0xffd68000 0x0 0x1000>;
+ #address-cells = <1>;
+ #size-cells = <0>;
+ interrupts = <GIC_SPI 116 IRQ_TYPE_LEVEL_HIGH>;
+ clocks = <&crg_ctrl HI3660_CLK_GATE_SPI2>;
+ clock-names = "apb_pclk";
+ pinctrl-names = "default";
+ pinctrl-0 = <&spi2_pmx_func>;
+ num-cs = <1>;
+ cs-gpios = <&gpio27 2 0>;
+ status = "disabled";
+ };
+
+ spi3: spi@ff3b3000 {
+ compatible = "arm,pl022", "arm,primecell";
+ reg = <0x0 0xff3b3000 0x0 0x1000>;
+ #address-cells = <1>;
+ #size-cells = <0>;
+ interrupts = <GIC_SPI 312 IRQ_TYPE_LEVEL_HIGH>;
+ clocks = <&crg_ctrl HI3660_CLK_GATE_SPI3>;
+ clock-names = "apb_pclk";
+ pinctrl-names = "default";
+ pinctrl-0 = <&spi3_pmx_func>;
+ num-cs = <1>;
+ cs-gpios = <&gpio18 5 0>;
+ status = "disabled";
+ };
+
+ pcie@f4000000 {
+ compatible = "hisilicon,kirin960-pcie";
+ reg = <0x0 0xf4000000 0x0 0x1000>,
+ <0x0 0xff3fe000 0x0 0x1000>,
+ <0x0 0xf3f20000 0x0 0x40000>,
+ <0x0 0xf5000000 0x0 0x2000>;
+ reg-names = "dbi", "apb", "phy", "config";
+ bus-range = <0x0 0x1>;
+ #address-cells = <3>;
+ #size-cells = <2>;
+ device_type = "pci";
+ ranges = <0x02000000 0x0 0x00000000
+ 0x0 0xf6000000
+ 0x0 0x02000000>;
+ num-lanes = <1>;
+ #interrupt-cells = <1>;
+ interrupts = <0 283 4>;
+ interrupt-names = "msi";
+ interrupt-map-mask = <0xf800 0 0 7>;
+ interrupt-map = <0x0 0 0 1
+ &gic GIC_SPI 282 IRQ_TYPE_LEVEL_HIGH>,
+ <0x0 0 0 2
+ &gic GIC_SPI 283 IRQ_TYPE_LEVEL_HIGH>,
+ <0x0 0 0 3
+ &gic GIC_SPI 284 IRQ_TYPE_LEVEL_HIGH>,
+ <0x0 0 0 4
+ &gic GIC_SPI 285 IRQ_TYPE_LEVEL_HIGH>;
+ clocks = <&crg_ctrl HI3660_PCIEPHY_REF>,
+ <&crg_ctrl HI3660_CLK_GATE_PCIEAUX>,
+ <&crg_ctrl HI3660_PCLK_GATE_PCIE_PHY>,
+ <&crg_ctrl HI3660_PCLK_GATE_PCIE_SYS>,
+ <&crg_ctrl HI3660_ACLK_GATE_PCIE>;
+ clock-names = "pcie_phy_ref", "pcie_aux",
+ "pcie_apb_phy", "pcie_apb_sys",
+ "pcie_aclk";
+ reset-gpios = <&gpio11 1 0 >;
+ };
+
+ /* UFS */
+ ufs: ufs@ff3b0000 {
+ compatible = "hisilicon,hi3660-ufs", "jedec,ufs-1.1";
+ /* 0: HCI standard */
+ /* 1: UFS SYS CTRL */
+ reg = <0x0 0xff3b0000 0x0 0x1000>,
+ <0x0 0xff3b1000 0x0 0x1000>;
+ interrupt-parent = <&gic>;
+ interrupts = <GIC_SPI 278 IRQ_TYPE_LEVEL_HIGH>;
+ clocks = <&crg_ctrl HI3660_CLK_GATE_UFSIO_REF>,
+ <&crg_ctrl HI3660_CLK_GATE_UFSPHY_CFG>;
+ clock-names = "ref_clk", "phy_clk";
+ freq-table-hz = <0 0>, <0 0>;
+ /* offset: 0x84; bit: 12 */
+ resets = <&crg_rst 0x84 12>;
+ reset-names = "rst";
+ };
+
+ /* SD */
+ dwmmc1: dwmmc1@ff37f000 {
+ compatible = "hisilicon,hi3660-dw-mshc";
+ reg = <0x0 0xff37f000 0x0 0x1000>;
+ #address-cells = <1>;
+ #size-cells = <0>;
+ interrupts = <GIC_SPI 139 IRQ_TYPE_LEVEL_HIGH>;
+ clocks = <&crg_ctrl HI3660_CLK_GATE_SD>,
+ <&crg_ctrl HI3660_HCLK_GATE_SD>;
+ clock-names = "ciu", "biu";
+ clock-frequency = <3200000>;
+ resets = <&crg_rst 0x94 18>;
+ reset-names = "reset";
+ hisilicon,peripheral-syscon = <&sctrl>;
+ card-detect-delay = <200>;
+ status = "disabled";
+ };
+
+ /* SDIO */
+ dwmmc2: dwmmc2@ff3ff000 {
+ compatible = "hisilicon,hi3660-dw-mshc";
+ reg = <0x0 0xff3ff000 0x0 0x1000>;
+ #address-cells = <0x1>;
+ #size-cells = <0x0>;
+ interrupts = <GIC_SPI 140 IRQ_TYPE_LEVEL_HIGH>;
+ clocks = <&crg_ctrl HI3660_CLK_GATE_SDIO0>,
+ <&crg_ctrl HI3660_HCLK_GATE_SDIO0>;
+ clock-names = "ciu", "biu";
+ resets = <&crg_rst 0x94 20>;
+ reset-names = "reset";
+ card-detect-delay = <200>;
+ status = "disabled";
+ };
+
+ watchdog0: watchdog@e8a06000 {
+ compatible = "arm,sp805-wdt", "arm,primecell";
+ reg = <0x0 0xe8a06000 0x0 0x1000>;
+ interrupts = <GIC_SPI 44 IRQ_TYPE_LEVEL_HIGH>;
+ clocks = <&crg_ctrl HI3660_OSC32K>;
+ clock-names = "apb_pclk";
+ };
+
+ watchdog1: watchdog@e8a07000 {
+ compatible = "arm,sp805-wdt", "arm,primecell";
+ reg = <0x0 0xe8a07000 0x0 0x1000>;
+ interrupts = <GIC_SPI 45 IRQ_TYPE_LEVEL_HIGH>;
+ clocks = <&crg_ctrl HI3660_OSC32K>;
+ clock-names = "apb_pclk";
+ };
+
+ tsensor: tsensor@fff30000 {
+ compatible = "hisilicon,hi3660-tsensor";
+ reg = <0x0 0xfff30000 0x0 0x1000>;
+ interrupts = <GIC_SPI 145 IRQ_TYPE_LEVEL_HIGH>;
+ #thermal-sensor-cells = <1>;
+ };
+
+ thermal-zones {
+
+ cls0: cls0 {
+ polling-delay = <1000>;
+ polling-delay-passive = <100>;
+ sustainable-power = <4500>;
+
+ /* sensor ID */
+ thermal-sensors = <&tsensor 1>;
+
+ trips {
+ threshold: trip-point@0 {
+ temperature = <65000>;
+ hysteresis = <1000>;
+ type = "passive";
+ };
+
+ target: trip-point@1 {
+ temperature = <75000>;
+ hysteresis = <1000>;
+ type = "passive";
+ };
+ };
+
+ cooling-maps {
+ map0 {
+ trip = <&target>;
+ contribution = <1024>;
+ cooling-device = <&cpu0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
+ <&cpu1 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
+ <&cpu2 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
+ <&cpu3 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
+ };
+ map1 {
+ trip = <&target>;
+ contribution = <512>;
+ cooling-device = <&cpu4 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
+ <&cpu5 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
+ <&cpu6 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
+ <&cpu7 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
+ };
+ };
+ };
+ };
+ };
+};
diff --git a/arch/arm/dts/hikey960-pinctrl.dtsi b/arch/arm/dts/hikey960-pinctrl.dtsi
new file mode 100644
index 0000000000..d11efc8195
--- /dev/null
+++ b/arch/arm/dts/hikey960-pinctrl.dtsi
@@ -0,0 +1,1060 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * pinctrl dts fils for Hislicon HiKey960 development board
+ *
+ */
+
+#include <dt-bindings/pinctrl/hisi.h>
+
+/ {
+ soc {
+ /* [IOMG_000, IOMG_123] */
+ range: gpio-range {
+ #pinctrl-single,gpio-range-cells = <3>;
+ };
+
+ pmx0: pinmux@e896c000 {
+ compatible = "pinctrl-single";
+ reg = <0x0 0xe896c000 0x0 0x1f0>;
+ #pinctrl-cells = <1>;
+ #gpio-range-cells = <0x3>;
+ pinctrl-single,register-width = <0x20>;
+ pinctrl-single,function-mask = <0x7>;
+ /* pin base, nr pins & gpio function */
+ pinctrl-single,gpio-range = <
+ &range 0 7 0
+ &range 8 116 0>;
+
+ pmu_pmx_func: pmu_pmx_func {
+ pinctrl-single,pins = <
+ 0x008 MUX_M1 /* PMU1_SSI */
+ 0x00c MUX_M1 /* PMU2_SSI */
+ 0x010 MUX_M1 /* PMU_CLKOUT */
+ 0x100 MUX_M1 /* PMU_HKADC_SSI */
+ >;
+ };
+
+ csi0_pwd_n_pmx_func: csi0_pwd_n_pmx_func {
+ pinctrl-single,pins = <
+ 0x044 MUX_M0 /* CSI0_PWD_N */
+ >;
+ };
+
+ csi1_pwd_n_pmx_func: csi1_pwd_n_pmx_func {
+ pinctrl-single,pins = <
+ 0x04c MUX_M0 /* CSI1_PWD_N */
+ >;
+ };
+
+ isp0_pmx_func: isp0_pmx_func {
+ pinctrl-single,pins = <
+ 0x058 MUX_M1 /* ISP_CLK0 */
+ 0x064 MUX_M1 /* ISP_SCL0 */
+ 0x068 MUX_M1 /* ISP_SDA0 */
+ >;
+ };
+
+ isp1_pmx_func: isp1_pmx_func {
+ pinctrl-single,pins = <
+ 0x05c MUX_M1 /* ISP_CLK1 */
+ 0x06c MUX_M1 /* ISP_SCL1 */
+ 0x070 MUX_M1 /* ISP_SDA1 */
+ >;
+ };
+
+ pwr_key_pmx_func: pwr_key_pmx_func {
+ pinctrl-single,pins = <
+ 0x080 MUX_M0 /* GPIO_034 */
+ >;
+ };
+
+ i2c3_pmx_func: i2c3_pmx_func {
+ pinctrl-single,pins = <
+ 0x02c MUX_M1 /* I2C3_SCL */
+ 0x030 MUX_M1 /* I2C3_SDA */
+ >;
+ };
+
+ i2c4_pmx_func: i2c4_pmx_func {
+ pinctrl-single,pins = <
+ 0x090 MUX_M1 /* I2C4_SCL */
+ 0x094 MUX_M1 /* I2C4_SDA */
+ >;
+ };
+
+ pcie_perstn_pmx_func: pcie_perstn_pmx_func {
+ pinctrl-single,pins = <
+ 0x15c MUX_M1 /* PCIE_PERST_N */
+ >;
+ };
+
+ usbhub5734_pmx_func: usbhub5734_pmx_func {
+ pinctrl-single,pins = <
+ 0x11c MUX_M0 /* GPIO_073 */
+ 0x120 MUX_M0 /* GPIO_074 */
+ >;
+ };
+
+ uart0_pmx_func: uart0_pmx_func {
+ pinctrl-single,pins = <
+ 0x0cc MUX_M2 /* UART0_RXD */
+ 0x0d0 MUX_M2 /* UART0_TXD */
+ >;
+ };
+
+ uart1_pmx_func: uart1_pmx_func {
+ pinctrl-single,pins = <
+ 0x0b0 MUX_M2 /* UART1_CTS_N */
+ 0x0b4 MUX_M2 /* UART1_RTS_N */
+ 0x0a8 MUX_M2 /* UART1_RXD */
+ 0x0ac MUX_M2 /* UART1_TXD */
+ >;
+ };
+
+ uart2_pmx_func: uart2_pmx_func {
+ pinctrl-single,pins = <
+ 0x0bc MUX_M2 /* UART2_CTS_N */
+ 0x0c0 MUX_M2 /* UART2_RTS_N */
+ 0x0c8 MUX_M2 /* UART2_RXD */
+ 0x0c4 MUX_M2 /* UART2_TXD */
+ >;
+ };
+
+ uart3_pmx_func: uart3_pmx_func {
+ pinctrl-single,pins = <
+ 0x0dc MUX_M1 /* UART3_CTS_N */
+ 0x0e0 MUX_M1 /* UART3_RTS_N */
+ 0x0e4 MUX_M1 /* UART3_RXD */
+ 0x0e8 MUX_M1 /* UART3_TXD */
+ >;
+ };
+
+ uart4_pmx_func: uart4_pmx_func {
+ pinctrl-single,pins = <
+ 0x0ec MUX_M1 /* UART4_CTS_N */
+ 0x0f0 MUX_M1 /* UART4_RTS_N */
+ 0x0f4 MUX_M1 /* UART4_RXD */
+ 0x0f8 MUX_M1 /* UART4_TXD */
+ >;
+ };
+
+ uart5_pmx_func: uart5_pmx_func {
+ pinctrl-single,pins = <
+ 0x0c4 MUX_M3 /* UART5_CTS_N */
+ 0x0c8 MUX_M3 /* UART5_RTS_N */
+ 0x0bc MUX_M3 /* UART5_RXD */
+ 0x0c0 MUX_M3 /* UART5_TXD */
+ >;
+ };
+
+ uart6_pmx_func: uart6_pmx_func {
+ pinctrl-single,pins = <
+ 0x0cc MUX_M1 /* UART6_CTS_N */
+ 0x0d0 MUX_M1 /* UART6_RTS_N */
+ 0x0d4 MUX_M1 /* UART6_RXD */
+ 0x0d8 MUX_M1 /* UART6_TXD */
+ >;
+ };
+
+ cam0_rst_pmx_func: cam0_rst_pmx_func {
+ pinctrl-single,pins = <
+ 0x0c8 MUX_M0 /* CAM0_RST */
+ >;
+ };
+
+ cam1_rst_pmx_func: cam1_rst_pmx_func {
+ pinctrl-single,pins = <
+ 0x124 MUX_M0 /* CAM1_RST */
+ >;
+ };
+ };
+
+ /* [IOMG_MMC0_000, IOMG_MMC0_005] */
+ pmx1: pinmux@ff37e000 {
+ compatible = "pinctrl-single";
+ reg = <0x0 0xff37e000 0x0 0x18>;
+ #gpio-range-cells = <0x3>;
+ #pinctrl-cells = <1>;
+ pinctrl-single,register-width = <0x20>;
+ pinctrl-single,function-mask = <0x7>;
+ /* pin base, nr pins & gpio function */
+ pinctrl-single,gpio-range = <&range 0 6 0>;
+
+ sd_pmx_func: sd_pmx_func {
+ pinctrl-single,pins = <
+ 0x000 MUX_M1 /* SD_CLK */
+ 0x004 MUX_M1 /* SD_CMD */
+ 0x008 MUX_M1 /* SD_DATA0 */
+ 0x00c MUX_M1 /* SD_DATA1 */
+ 0x010 MUX_M1 /* SD_DATA2 */
+ 0x014 MUX_M1 /* SD_DATA3 */
+ >;
+ };
+ };
+
+ /* [IOMG_FIX_000, IOMG_FIX_011] */
+ pmx2: pinmux@ff3b6000 {
+ compatible = "pinctrl-single";
+ reg = <0x0 0xff3b6000 0x0 0x30>;
+ #pinctrl-cells = <1>;
+ #gpio-range-cells = <0x3>;
+ pinctrl-single,register-width = <0x20>;
+ pinctrl-single,function-mask = <0x7>;
+ /* pin base, nr pins & gpio function */
+ pinctrl-single,gpio-range = <&range 0 12 0>;
+
+ ufs_pmx_func: ufs_pmx_func {
+ pinctrl-single,pins = <
+ 0x000 MUX_M1 /* UFS_REF_CLK */
+ 0x004 MUX_M1 /* UFS_RST_N */
+ >;
+ };
+
+ spi3_pmx_func: spi3_pmx_func {
+ pinctrl-single,pins = <
+ 0x008 MUX_M1 /* SPI3_CLK */
+ 0x00c MUX_M1 /* SPI3_DI */
+ 0x010 MUX_M1 /* SPI3_DO */
+ 0x014 MUX_M1 /* SPI3_CS0_N */
+ >;
+ };
+ };
+
+ /* [IOMG_MMC1_000, IOMG_MMC1_005] */
+ pmx3: pinmux@ff3fd000 {
+ compatible = "pinctrl-single";
+ reg = <0x0 0xff3fd000 0x0 0x18>;
+ #pinctrl-cells = <1>;
+ #gpio-range-cells = <0x3>;
+ pinctrl-single,register-width = <0x20>;
+ pinctrl-single,function-mask = <0x7>;
+ /* pin base, nr pins & gpio function */
+ pinctrl-single,gpio-range = <&range 0 6 0>;
+
+ sdio_pmx_func: sdio_pmx_func {
+ pinctrl-single,pins = <
+ 0x000 MUX_M1 /* SDIO_CLK */
+ 0x004 MUX_M1 /* SDIO_CMD */
+ 0x008 MUX_M1 /* SDIO_DATA0 */
+ 0x00c MUX_M1 /* SDIO_DATA1 */
+ 0x010 MUX_M1 /* SDIO_DATA2 */
+ 0x014 MUX_M1 /* SDIO_DATA3 */
+ >;
+ };
+ };
+
+ /* [IOMG_AO_000, IOMG_AO_041] */
+ pmx4: pinmux@fff11000 {
+ compatible = "pinctrl-single";
+ reg = <0x0 0xfff11000 0x0 0xa8>;
+ #pinctrl-cells = <1>;
+ #gpio-range-cells = <0x3>;
+ pinctrl-single,register-width = <0x20>;
+ pinctrl-single,function-mask = <0x7>;
+ /* pin base in node, nr pins & gpio function */
+ pinctrl-single,gpio-range = <&range 0 42 0>;
+
+ i2s2_pmx_func: i2s2_pmx_func {
+ pinctrl-single,pins = <
+ 0x044 MUX_M1 /* I2S2_DI */
+ 0x048 MUX_M1 /* I2S2_DO */
+ 0x04c MUX_M1 /* I2S2_XCLK */
+ 0x050 MUX_M1 /* I2S2_XFS */
+ >;
+ };
+
+ slimbus_pmx_func: slimbus_pmx_func {
+ pinctrl-single,pins = <
+ 0x02c MUX_M1 /* SLIMBUS_CLK */
+ 0x030 MUX_M1 /* SLIMBUS_DATA */
+ >;
+ };
+
+ i2c0_pmx_func: i2c0_pmx_func {
+ pinctrl-single,pins = <
+ 0x014 MUX_M1 /* I2C0_SCL */
+ 0x018 MUX_M1 /* I2C0_SDA */
+ >;
+ };
+
+ i2c1_pmx_func: i2c1_pmx_func {
+ pinctrl-single,pins = <
+ 0x01c MUX_M1 /* I2C1_SCL */
+ 0x020 MUX_M1 /* I2C1_SDA */
+ >;
+ };
+
+ i2c7_pmx_func: i2c7_pmx_func {
+ pinctrl-single,pins = <
+ 0x024 MUX_M3 /* I2C7_SCL */
+ 0x028 MUX_M3 /* I2C7_SDA */
+ >;
+ };
+
+ pcie_pmx_func: pcie_pmx_func {
+ pinctrl-single,pins = <
+ 0x084 MUX_M1 /* PCIE_CLKREQ_N */
+ 0x088 MUX_M1 /* PCIE_WAKE_N */
+ >;
+ };
+
+ spi2_pmx_func: spi2_pmx_func {
+ pinctrl-single,pins = <
+ 0x08c MUX_M1 /* SPI2_CLK */
+ 0x090 MUX_M1 /* SPI2_DI */
+ 0x094 MUX_M1 /* SPI2_DO */
+ 0x098 MUX_M1 /* SPI2_CS0_N */
+ >;
+ };
+
+ i2s0_pmx_func: i2s0_pmx_func {
+ pinctrl-single,pins = <
+ 0x034 MUX_M1 /* I2S0_DI */
+ 0x038 MUX_M1 /* I2S0_DO */
+ 0x03c MUX_M1 /* I2S0_XCLK */
+ 0x040 MUX_M1 /* I2S0_XFS */
+ >;
+ };
+ };
+
+ pmx5: pinmux@e896c800 {
+ compatible = "pinconf-single";
+ reg = <0x0 0xe896c800 0x0 0x200>;
+ #pinctrl-cells = <1>;
+ pinctrl-single,register-width = <0x20>;
+
+ pmu_cfg_func: pmu_cfg_func {
+ pinctrl-single,pins = <
+ 0x010 0x0 /* PMU1_SSI */
+ 0x014 0x0 /* PMU2_SSI */
+ 0x018 0x0 /* PMU_CLKOUT */
+ 0x10c 0x0 /* PMU_HKADC_SSI */
+ >;
+ pinctrl-single,bias-pulldown = <
+ PULL_DIS
+ PULL_DOWN
+ PULL_DIS
+ PULL_DOWN
+ >;
+ pinctrl-single,bias-pullup = <
+ PULL_DIS
+ PULL_UP
+ PULL_DIS
+ PULL_UP
+ >;
+ pinctrl-single,drive-strength = <
+ DRIVE7_06MA DRIVE6_MASK
+ >;
+ };
+
+ i2c3_cfg_func: i2c3_cfg_func {
+ pinctrl-single,pins = <
+ 0x038 0x0 /* I2C3_SCL */
+ 0x03c 0x0 /* I2C3_SDA */
+ >;
+ pinctrl-single,bias-pulldown = <
+ PULL_DIS
+ PULL_DOWN
+ PULL_DIS
+ PULL_DOWN
+ >;
+ pinctrl-single,bias-pullup = <
+ PULL_DIS
+ PULL_UP
+ PULL_DIS
+ PULL_UP
+ >;
+ pinctrl-single,drive-strength = <
+ DRIVE7_02MA DRIVE6_MASK
+ >;
+ };
+
+ csi0_pwd_n_cfg_func: csi0_pwd_n_cfg_func {
+ pinctrl-single,pins = <
+ 0x050 0x0 /* CSI0_PWD_N */
+ >;
+ pinctrl-single,bias-pulldown = <
+ PULL_DIS
+ PULL_DOWN
+ PULL_DIS
+ PULL_DOWN
+ >;
+ pinctrl-single,bias-pullup = <
+ PULL_DIS
+ PULL_UP
+ PULL_DIS
+ PULL_UP
+ >;
+ pinctrl-single,drive-strength = <
+ DRIVE7_04MA DRIVE6_MASK
+ >;
+ };
+
+ csi1_pwd_n_cfg_func: csi1_pwd_n_cfg_func {
+ pinctrl-single,pins = <
+ 0x058 0x0 /* CSI1_PWD_N */
+ >;
+ pinctrl-single,bias-pulldown = <
+ PULL_DIS
+ PULL_DOWN
+ PULL_DIS
+ PULL_DOWN
+ >;
+ pinctrl-single,bias-pullup = <
+ PULL_DIS
+ PULL_UP
+ PULL_DIS
+ PULL_UP
+ >;
+ pinctrl-single,drive-strength = <
+ DRIVE7_04MA DRIVE6_MASK
+ >;
+ };
+
+ isp0_cfg_func: isp0_cfg_func {
+ pinctrl-single,pins = <
+ 0x064 0x0 /* ISP_CLK0 */
+ 0x070 0x0 /* ISP_SCL0 */
+ 0x074 0x0 /* ISP_SDA0 */
+ >;
+ pinctrl-single,bias-pulldown = <
+ PULL_DIS
+ PULL_DOWN
+ PULL_DIS
+ PULL_DOWN
+ >;
+ pinctrl-single,bias-pullup = <
+ PULL_DIS
+ PULL_UP
+ PULL_DIS
+ PULL_UP
+ >;
+ pinctrl-single,drive-strength = <
+ DRIVE7_04MA DRIVE6_MASK>;
+ };
+
+ isp1_cfg_func: isp1_cfg_func {
+ pinctrl-single,pins = <
+ 0x068 0x0 /* ISP_CLK1 */
+ 0x078 0x0 /* ISP_SCL1 */
+ 0x07c 0x0 /* ISP_SDA1 */
+ >;
+ pinctrl-single,bias-pulldown = <
+ PULL_DIS
+ PULL_DOWN
+ PULL_DIS
+ PULL_DOWN
+ >;
+ pinctrl-single,bias-pullup = <
+ PULL_DIS
+ PULL_UP
+ PULL_DIS
+ PULL_UP
+ >;
+ pinctrl-single,drive-strength = <
+ DRIVE7_04MA DRIVE6_MASK
+ >;
+ };
+
+ pwr_key_cfg_func: pwr_key_cfg_func {
+ pinctrl-single,pins = <
+ 0x08c 0x0 /* GPIO_034 */
+ >;
+ pinctrl-single,bias-pulldown = <
+ PULL_DIS
+ PULL_DOWN
+ PULL_DIS
+ PULL_DOWN
+ >;
+ pinctrl-single,bias-pullup = <
+ PULL_DIS
+ PULL_UP
+ PULL_DIS
+ PULL_UP
+ >;
+ pinctrl-single,drive-strength = <
+ DRIVE7_02MA DRIVE6_MASK
+ >;
+ };
+
+ uart1_cfg_func: uart1_cfg_func {
+ pinctrl-single,pins = <
+ 0x0b4 0x0 /* UART1_RXD */
+ 0x0b8 0x0 /* UART1_TXD */
+ 0x0bc 0x0 /* UART1_CTS_N */
+ 0x0c0 0x0 /* UART1_RTS_N */
+ >;
+ pinctrl-single,bias-pulldown = <
+ PULL_DIS
+ PULL_DOWN
+ PULL_DIS
+ PULL_DOWN
+ >;
+ pinctrl-single,bias-pullup = <
+ PULL_DIS
+ PULL_UP
+ PULL_DIS
+ PULL_UP
+ >;
+ pinctrl-single,drive-strength = <
+ DRIVE7_02MA DRIVE6_MASK
+ >;
+ };
+
+ uart2_cfg_func: uart2_cfg_func {
+ pinctrl-single,pins = <
+ 0x0c8 0x0 /* UART2_CTS_N */
+ 0x0cc 0x0 /* UART2_RTS_N */
+ 0x0d0 0x0 /* UART2_TXD */
+ 0x0d4 0x0 /* UART2_RXD */
+ >;
+ pinctrl-single,bias-pulldown = <
+ PULL_DIS
+ PULL_DOWN
+ PULL_DIS
+ PULL_DOWN
+ >;
+ pinctrl-single,bias-pullup = <
+ PULL_DIS
+ PULL_UP
+ PULL_DIS
+ PULL_UP
+ >;
+ pinctrl-single,drive-strength = <
+ DRIVE7_02MA DRIVE6_MASK
+ >;
+ };
+
+ uart5_cfg_func: uart5_cfg_func {
+ pinctrl-single,pins = <
+ 0x0c8 0x0 /* UART5_RXD */
+ 0x0cc 0x0 /* UART5_TXD */
+ 0x0d0 0x0 /* UART5_CTS_N */
+ 0x0d4 0x0 /* UART5_RTS_N */
+ >;
+ pinctrl-single,bias-pulldown = <
+ PULL_DIS
+ PULL_DOWN
+ PULL_DIS
+ PULL_DOWN
+ >;
+ pinctrl-single,bias-pullup = <
+ PULL_DIS
+ PULL_UP
+ PULL_DIS
+ PULL_UP
+ >;
+ pinctrl-single,drive-strength = <
+ DRIVE7_02MA DRIVE6_MASK
+ >;
+ };
+
+ cam0_rst_cfg_func: cam0_rst_cfg_func {
+ pinctrl-single,pins = <
+ 0x0d4 0x0 /* CAM0_RST */
+ >;
+ pinctrl-single,bias-pulldown = <
+ PULL_DIS
+ PULL_DOWN
+ PULL_DIS
+ PULL_DOWN
+ >;
+ pinctrl-single,bias-pullup = <
+ PULL_DIS
+ PULL_UP
+ PULL_DIS
+ PULL_UP
+ >;
+ pinctrl-single,drive-strength = <
+ DRIVE7_04MA DRIVE6_MASK
+ >;
+ };
+
+ uart0_cfg_func: uart0_cfg_func {
+ pinctrl-single,pins = <
+ 0x0d8 0x0 /* UART0_RXD */
+ 0x0dc 0x0 /* UART0_TXD */
+ >;
+ pinctrl-single,bias-pulldown = <
+ PULL_DIS
+ PULL_DOWN
+ PULL_DIS
+ PULL_DOWN
+ >;
+ pinctrl-single,bias-pullup = <
+ PULL_DIS
+ PULL_UP
+ PULL_DIS
+ PULL_UP
+ >;
+ pinctrl-single,drive-strength = <
+ DRIVE7_02MA DRIVE6_MASK
+ >;
+ };
+
+ uart6_cfg_func: uart6_cfg_func {
+ pinctrl-single,pins = <
+ 0x0d8 0x0 /* UART6_CTS_N */
+ 0x0dc 0x0 /* UART6_RTS_N */
+ 0x0e0 0x0 /* UART6_RXD */
+ 0x0e4 0x0 /* UART6_TXD */
+ >;
+ pinctrl-single,bias-pulldown = <
+ PULL_DIS
+ PULL_DOWN
+ PULL_DIS
+ PULL_DOWN
+ >;
+ pinctrl-single,bias-pullup = <
+ PULL_DIS
+ PULL_UP
+ PULL_DIS
+ PULL_UP
+ >;
+ pinctrl-single,drive-strength = <
+ DRIVE7_02MA DRIVE6_MASK
+ >;
+ };
+
+ uart3_cfg_func: uart3_cfg_func {
+ pinctrl-single,pins = <
+ 0x0e8 0x0 /* UART3_CTS_N */
+ 0x0ec 0x0 /* UART3_RTS_N */
+ 0x0f0 0x0 /* UART3_RXD */
+ 0x0f4 0x0 /* UART3_TXD */
+ >;
+ pinctrl-single,bias-pulldown = <
+ PULL_DIS
+ PULL_DOWN
+ PULL_DIS
+ PULL_DOWN
+ >;
+ pinctrl-single,bias-pullup = <
+ PULL_DIS
+ PULL_UP
+ PULL_DIS
+ PULL_UP
+ >;
+ pinctrl-single,drive-strength = <
+ DRIVE7_02MA DRIVE6_MASK
+ >;
+ };
+
+ uart4_cfg_func: uart4_cfg_func {
+ pinctrl-single,pins = <
+ 0x0f8 0x0 /* UART4_CTS_N */
+ 0x0fc 0x0 /* UART4_RTS_N */
+ 0x100 0x0 /* UART4_RXD */
+ 0x104 0x0 /* UART4_TXD */
+ >;
+ pinctrl-single,bias-pulldown = <
+ PULL_DIS
+ PULL_DOWN
+ PULL_DIS
+ PULL_DOWN
+ >;
+ pinctrl-single,bias-pullup = <
+ PULL_DIS
+ PULL_UP
+ PULL_DIS
+ PULL_UP
+ >;
+ pinctrl-single,drive-strength = <
+ DRIVE7_02MA DRIVE6_MASK
+ >;
+ };
+
+ cam1_rst_cfg_func: cam1_rst_cfg_func {
+ pinctrl-single,pins = <
+ 0x130 0x0 /* CAM1_RST */
+ >;
+ pinctrl-single,bias-pulldown = <
+ PULL_DIS
+ PULL_DOWN
+ PULL_DIS
+ PULL_DOWN
+ >;
+ pinctrl-single,bias-pullup = <
+ PULL_DIS
+ PULL_UP
+ PULL_DIS
+ PULL_UP
+ >;
+ pinctrl-single,drive-strength = <
+ DRIVE7_04MA DRIVE6_MASK
+ >;
+ };
+ };
+
+ pmx6: pinmux@ff3b6800 {
+ compatible = "pinconf-single";
+ reg = <0x0 0xff3b6800 0x0 0x18>;
+ #pinctrl-cells = <1>;
+ pinctrl-single,register-width = <0x20>;
+
+ ufs_cfg_func: ufs_cfg_func {
+ pinctrl-single,pins = <
+ 0x000 0x0 /* UFS_REF_CLK */
+ 0x004 0x0 /* UFS_RST_N */
+ >;
+ pinctrl-single,bias-pulldown = <
+ PULL_DIS
+ PULL_DOWN
+ PULL_DIS
+ PULL_DOWN
+ >;
+ pinctrl-single,bias-pullup = <
+ PULL_DIS
+ PULL_UP
+ PULL_DIS
+ PULL_UP
+ >;
+ pinctrl-single,drive-strength = <
+ DRIVE7_08MA DRIVE6_MASK
+ >;
+ };
+
+ spi3_cfg_func: spi3_cfg_func {
+ pinctrl-single,pins = <
+ 0x008 0x0 /* SPI3_CLK */
+ 0x0 /* SPI3_DI */
+ 0x010 0x0 /* SPI3_DO */
+ 0x014 0x0 /* SPI3_CS0_N */
+ >;
+ pinctrl-single,bias-pulldown = <
+ PULL_DIS
+ PULL_DOWN
+ PULL_DIS
+ PULL_DOWN
+ >;
+ pinctrl-single,bias-pullup = <
+ PULL_DIS
+ PULL_UP
+ PULL_DIS
+ PULL_UP
+ >;
+ pinctrl-single,drive-strength = <
+ DRIVE7_02MA DRIVE6_MASK
+ >;
+ };
+ };
+
+ pmx7: pinmux@ff3fd800 {
+ compatible = "pinconf-single";
+ reg = <0x0 0xff3fd800 0x0 0x18>;
+ #pinctrl-cells = <1>;
+ pinctrl-single,register-width = <0x20>;
+
+ sdio_clk_cfg_func: sdio_clk_cfg_func {
+ pinctrl-single,pins = <
+ 0x000 0x0 /* SDIO_CLK */
+ >;
+ pinctrl-single,bias-pulldown = <
+ PULL_DIS
+ PULL_DOWN
+ PULL_DIS
+ PULL_DOWN
+ >;
+ pinctrl-single,bias-pullup = <
+ PULL_DIS
+ PULL_UP
+ PULL_DIS
+ PULL_UP
+ >;
+ pinctrl-single,drive-strength = <
+ DRIVE6_32MA DRIVE6_MASK
+ >;
+ };
+
+ sdio_cfg_func: sdio_cfg_func {
+ pinctrl-single,pins = <
+ 0x004 0x0 /* SDIO_CMD */
+ 0x008 0x0 /* SDIO_DATA0 */
+ 0x00c 0x0 /* SDIO_DATA1 */
+ 0x010 0x0 /* SDIO_DATA2 */
+ 0x014 0x0 /* SDIO_DATA3 */
+ >;
+ pinctrl-single,bias-pulldown = <
+ PULL_DIS
+ PULL_DOWN
+ PULL_DIS
+ PULL_DOWN
+ >;
+ pinctrl-single,bias-pullup = <
+ PULL_UP
+ PULL_UP
+ PULL_DIS
+ PULL_UP
+ >;
+ pinctrl-single,drive-strength = <
+ DRIVE6_19MA DRIVE6_MASK
+ >;
+ };
+ };
+
+ pmx8: pinmux@ff37e800 {
+ compatible = "pinconf-single";
+ reg = <0x0 0xff37e800 0x0 0x18>;
+ #pinctrl-cells = <1>;
+ pinctrl-single,register-width = <0x20>;
+
+ sd_clk_cfg_func: sd_clk_cfg_func {
+ pinctrl-single,pins = <
+ 0x000 0x0 /* SD_CLK */
+ >;
+ pinctrl-single,bias-pulldown = <
+ PULL_DIS
+ PULL_DOWN
+ PULL_DIS
+ PULL_DOWN
+ >;
+ pinctrl-single,bias-pullup = <
+ PULL_DIS
+ PULL_UP
+ PULL_DIS
+ PULL_UP
+ >;
+ pinctrl-single,drive-strength = <
+ DRIVE6_32MA
+ DRIVE6_MASK
+ >;
+ };
+
+ sd_cfg_func: sd_cfg_func {
+ pinctrl-single,pins = <
+ 0x004 0x0 /* SD_CMD */
+ 0x008 0x0 /* SD_DATA0 */
+ 0x00c 0x0 /* SD_DATA1 */
+ 0x010 0x0 /* SD_DATA2 */
+ 0x014 0x0 /* SD_DATA3 */
+ >;
+ pinctrl-single,bias-pulldown = <
+ PULL_DIS
+ PULL_DOWN
+ PULL_DIS
+ PULL_DOWN
+ >;
+ pinctrl-single,bias-pullup = <
+ PULL_UP
+ PULL_UP
+ PULL_DIS
+ PULL_UP
+ >;
+ pinctrl-single,drive-strength = <
+ DRIVE6_19MA
+ DRIVE6_MASK
+ >;
+ };
+ };
+
+ pmx9: pinmux@fff11800 {
+ compatible = "pinconf-single";
+ reg = <0x0 0xfff11800 0x0 0xbc>;
+ #pinctrl-cells = <1>;
+ pinctrl-single,register-width = <0x20>;
+
+ i2c0_cfg_func: i2c0_cfg_func {
+ pinctrl-single,pins = <
+ 0x01c 0x0 /* I2C0_SCL */
+ 0x020 0x0 /* I2C0_SDA */
+ >;
+ pinctrl-single,bias-pulldown = <
+ PULL_DIS
+ PULL_DOWN
+ PULL_DIS
+ PULL_DOWN
+ >;
+ pinctrl-single,bias-pullup = <
+ PULL_UP
+ PULL_UP
+ PULL_DIS
+ PULL_UP
+ >;
+ pinctrl-single,drive-strength = <
+ DRIVE7_02MA DRIVE6_MASK
+ >;
+ };
+
+ i2c1_cfg_func: i2c1_cfg_func {
+ pinctrl-single,pins = <
+ 0x024 0x0 /* I2C1_SCL */
+ 0x028 0x0 /* I2C1_SDA */
+ >;
+ pinctrl-single,bias-pulldown = <
+ PULL_DIS
+ PULL_DOWN
+ PULL_DIS
+ PULL_DOWN
+ >;
+ pinctrl-single,bias-pullup = <
+ PULL_UP
+ PULL_UP
+ PULL_DIS
+ PULL_UP
+ >;
+ pinctrl-single,drive-strength = <
+ DRIVE7_02MA DRIVE6_MASK
+ >;
+ };
+
+ i2c7_cfg_func: i2c7_cfg_func {
+ pinctrl-single,pins = <
+ 0x02c 0x0 /* I2C7_SCL */
+ 0x030 0x0 /* I2C7_SDA */
+ >;
+ pinctrl-single,bias-pulldown = <
+ PULL_DIS
+ PULL_DOWN
+ PULL_DIS
+ PULL_DOWN
+ >;
+ pinctrl-single,bias-pullup = <
+ PULL_UP
+ PULL_UP
+ PULL_DIS
+ PULL_UP
+ >;
+ pinctrl-single,drive-strength = <
+ DRIVE7_02MA DRIVE6_MASK
+ >;
+ };
+
+ slimbus_cfg_func: slimbus_cfg_func {
+ pinctrl-single,pins = <
+ 0x034 0x0 /* SLIMBUS_CLK */
+ 0x038 0x0 /* SLIMBUS_DATA */
+ >;
+ pinctrl-single,bias-pulldown = <
+ PULL_DIS
+ PULL_DOWN
+ PULL_DIS
+ PULL_DOWN
+ >;
+ pinctrl-single,bias-pullup = <
+ PULL_UP
+ PULL_UP
+ PULL_DIS
+ PULL_UP
+ >;
+ pinctrl-single,drive-strength = <
+ DRIVE7_02MA DRIVE6_MASK
+ >;
+ };
+
+ i2s0_cfg_func: i2s0_cfg_func {
+ pinctrl-single,pins = <
+ 0x040 0x0 /* I2S0_DI */
+ 0x044 0x0 /* I2S0_DO */
+ 0x048 0x0 /* I2S0_XCLK */
+ 0x04c 0x0 /* I2S0_XFS */
+ >;
+ pinctrl-single,bias-pulldown = <
+ PULL_DIS
+ PULL_DOWN
+ PULL_DIS
+ PULL_DOWN
+ >;
+ pinctrl-single,bias-pullup = <
+ PULL_UP
+ PULL_UP
+ PULL_DIS
+ PULL_UP
+ >;
+ pinctrl-single,drive-strength = <
+ DRIVE7_02MA DRIVE6_MASK
+ >;
+ };
+
+ i2s2_cfg_func: i2s2_cfg_func {
+ pinctrl-single,pins = <
+ 0x050 0x0 /* I2S2_DI */
+ 0x054 0x0 /* I2S2_DO */
+ 0x058 0x0 /* I2S2_XCLK */
+ 0x05c 0x0 /* I2S2_XFS */
+ >;
+ pinctrl-single,bias-pulldown = <
+ PULL_DIS
+ PULL_DOWN
+ PULL_DIS
+ PULL_DOWN
+ >;
+ pinctrl-single,bias-pullup = <
+ PULL_UP
+ PULL_UP
+ PULL_DIS
+ PULL_UP
+ >;
+ pinctrl-single,drive-strength = <
+ DRIVE7_02MA DRIVE6_MASK
+ >;
+ };
+
+ pcie_cfg_func: pcie_cfg_func {
+ pinctrl-single,pins = <
+ 0x094 0x0 /* PCIE_CLKREQ_N */
+ 0x098 0x0 /* PCIE_WAKE_N */
+ >;
+ pinctrl-single,bias-pulldown = <
+ PULL_DIS
+ PULL_DOWN
+ PULL_DIS
+ PULL_DOWN
+ >;
+ pinctrl-single,bias-pullup = <
+ PULL_UP
+ PULL_UP
+ PULL_DIS
+ PULL_UP
+ >;
+ pinctrl-single,drive-strength = <
+ DRIVE7_02MA DRIVE6_MASK
+ >;
+ };
+
+ spi2_cfg_func: spi2_cfg_func {
+ pinctrl-single,pins = <
+ 0x09c 0x0 /* SPI2_CLK */
+ 0x0a0 0x0 /* SPI2_DI */
+ 0x0a4 0x0 /* SPI2_DO */
+ 0x0a8 0x0 /* SPI2_CS0_N */
+ >;
+ pinctrl-single,bias-pulldown = <
+ PULL_DIS
+ PULL_DOWN
+ PULL_DIS
+ PULL_DOWN
+ >;
+ pinctrl-single,bias-pullup = <
+ PULL_UP
+ PULL_UP
+ PULL_DIS
+ PULL_UP
+ >;
+ pinctrl-single,drive-strength = <
+ DRIVE7_02MA DRIVE6_MASK
+ >;
+ };
+
+ usb_cfg_func: usb_cfg_func {
+ pinctrl-single,pins = <
+ 0x0ac 0x0 /* GPIO_219 */
+ >;
+ pinctrl-single,bias-pulldown = <
+ PULL_DIS
+ PULL_DOWN
+ PULL_DIS
+ PULL_DOWN
+ >;
+ pinctrl-single,bias-pullup = <
+ PULL_UP
+ PULL_UP
+ PULL_DIS
+ PULL_UP
+ >;
+ pinctrl-single,drive-strength = <
+ DRIVE7_02MA DRIVE6_MASK
+ >;
+ };
+ };
+ };
+};
diff --git a/arch/arm/dts/k3-am65-main.dtsi b/arch/arm/dts/k3-am65-main.dtsi
index 7d03706057..0f5da9a563 100644
--- a/arch/arm/dts/k3-am65-main.dtsi
+++ b/arch/arm/dts/k3-am65-main.dtsi
@@ -5,6 +5,9 @@
* Copyright (C) 2016-2018 Texas Instruments Incorporated - http://www.ti.com/
*/
+#include <dt-bindings/phy/phy-am654-serdes.h>
+#include <dt-bindings/phy/phy.h>
+
&cbass_main {
gic500: interrupt-controller@1800000 {
compatible = "arm,gic-v3";
@@ -143,4 +146,109 @@
clocks = <&k3_clks 113 1>;
power-domains = <&k3_pds 113 TI_SCI_PD_EXCLUSIVE>;
};
+
+ scm_conf: scm_conf@100000 {
+ compatible = "syscon", "simple-mfd";
+ reg = <0 0x00100000 0 0x1c000>;
+ #address-cells = <1>;
+ #size-cells = <1>;
+ ranges = <0x0 0x0 0x00100000 0x1c000>;
+
+ serdes_mux: mux-controller {
+ compatible = "mmio-mux";
+ #mux-control-cells = <1>;
+ mux-reg-masks = <0x4080 0x3>, /* SERDES0 lane select */
+ <0x4090 0x3>; /* SERDES1 lane select */
+ };
+
+ pcie0_mode: pcie-mode@4060 {
+ compatible = "syscon";
+ reg = <0x00004060 0x4>;
+ };
+
+ pcie1_mode: pcie-mode@4070 {
+ compatible = "syscon";
+ reg = <0x00004070 0x4>;
+ };
+
+ serdes0_clk: serdes_clk@4080 {
+ compatible = "syscon";
+ reg = <0x00004080 0x4>;
+ };
+
+ serdes1_clk: serdes_clk@4090 {
+ compatible = "syscon";
+ reg = <0x00004090 0x4>;
+ };
+
+ pcie_devid: pcie-devid@210 {
+ compatible = "syscon";
+ reg = <0x00000210 0x4>;
+ };
+ };
+
+ serdes0: serdes@900000 {
+ compatible = "ti,phy-am654-serdes";
+ reg = <0x0 0x900000 0x0 0x2000>;
+ reg-names = "serdes";
+ #phy-cells = <2>;
+ power-domains = <&k3_pds 153 TI_SCI_PD_EXCLUSIVE>;
+ clocks = <&k3_clks 153 4>, <&k3_clks 153 1>, <&serdes1 AM654_SERDES_LO_REFCLK>;
+ clock-output-names = "serdes0_cmu_refclk", "serdes0_lo_refclk", "serdes0_ro_refclk";
+ assigned-clocks = <&k3_clks 153 4>, <&serdes0 AM654_SERDES_CMU_REFCLK>;
+ assigned-clock-parents = <&k3_clks 153 8>, <&k3_clks 153 4>;
+ ti,serdes-clk = <&serdes0_clk>;
+ mux-controls = <&serdes_mux 0>;
+ #clock-cells = <1>;
+ };
+
+ serdes1: serdes@910000 {
+ compatible = "ti,phy-am654-serdes";
+ reg = <0x0 0x910000 0x0 0x2000>;
+ reg-names = "serdes";
+ #phy-cells = <2>;
+ power-domains = <&k3_pds 154 TI_SCI_PD_EXCLUSIVE>;
+ clocks = <&serdes0 AM654_SERDES_RO_REFCLK>, <&k3_clks 154 1>, <&k3_clks 154 5>;
+ clock-output-names = "serdes1_cmu_refclk", "serdes1_lo_refclk", "serdes1_ro_refclk";
+ assigned-clocks = <&k3_clks 154 5>, <&serdes1 AM654_SERDES_CMU_REFCLK>;
+ assigned-clock-parents = <&k3_clks 154 9>, <&k3_clks 154 5>;
+ ti,serdes-clk = <&serdes1_clk>;
+ mux-controls = <&serdes_mux 1>;
+ #clock-cells = <1>;
+ };
+
+ pcie0_rc: pcie@5500000 {
+ compatible = "ti,am654-pcie-rc";
+ reg = <0x0 0x5500000 0x0 0x1000>, <0x0 0x5501000 0x0 0x1000>, <0x0 0x10000000 0x0 0x2000>, <0x0 0x5506000 0x0 0x1000>;
+ reg-names = "app", "dbics", "config", "atu";
+ power-domains = <&k3_pds 120 TI_SCI_PD_EXCLUSIVE>;
+ #address-cells = <3>;
+ #size-cells = <2>;
+ ranges = <0x81000000 0 0 0x0 0x10020000 0 0x00010000
+ 0x82000000 0 0x10030000 0x0 0x10030000 0 0x07FD0000>;
+ ti,syscon-pcie-id = <&pcie_devid>;
+ ti,syscon-pcie-mode = <&pcie0_mode>;
+ bus-range = <0x0 0xff>;
+ status = "disabled";
+ device_type = "pci";
+ num-lanes = <1>;
+ num-ob-windows = <16>;
+ num-viewport = <16>;
+ max-link-speed = <3>;
+ interrupts = <GIC_SPI 340 IRQ_TYPE_EDGE_RISING>;
+ #interrupt-cells = <1>;
+ interrupt-map-mask = <0 0 0 7>;
+ interrupt-map = <0 0 0 1 &pcie0_intc 0>, /* INT A */
+ <0 0 0 2 &pcie0_intc 0>, /* INT B */
+ <0 0 0 3 &pcie0_intc 0>, /* INT C */
+ <0 0 0 4 &pcie0_intc 0>; /* INT D */
+ msi-map = <0x0 &gic_its 0x0 0x10000>;
+
+ pcie0_intc: legacy-interrupt-controller@1 {
+ interrupt-controller;
+ #interrupt-cells = <1>;
+ interrupt-parent = <&gic500>;
+ interrupts = <GIC_SPI 328 IRQ_TYPE_EDGE_RISING>;
+ };
+ };
};
diff --git a/arch/arm/dts/k3-am65.dtsi b/arch/arm/dts/k3-am65.dtsi
index a3abd146d1..a1467a4dd4 100644
--- a/arch/arm/dts/k3-am65.dtsi
+++ b/arch/arm/dts/k3-am65.dtsi
@@ -69,6 +69,7 @@
<0x00 0x00900000 0x00 0x00900000 0x00 0x00012000>, /* serdes */
<0x00 0x01000000 0x00 0x01000000 0x00 0x0af02400>, /* Most peripherals */
<0x00 0x30800000 0x00 0x30800000 0x00 0x0bc00000>, /* MAIN NAVSS */
+ <0x00 0x10000000 0x00 0x10000000 0x00 0x10000000>, /* PCIe DAT */
/* MCUSS Range */
<0x00 0x28380000 0x00 0x28380000 0x00 0x03880000>,
<0x00 0x40200000 0x00 0x40200000 0x00 0x00900100>,
diff --git a/arch/arm/dts/meson-g12a-sei510.dts b/arch/arm/dts/meson-g12a-sei510.dts
new file mode 100644
index 0000000000..c7a8736885
--- /dev/null
+++ b/arch/arm/dts/meson-g12a-sei510.dts
@@ -0,0 +1,502 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+/*
+ * Copyright (c) 2019 BayLibre SAS. All rights reserved.
+ */
+
+/dts-v1/;
+
+#include "meson-g12a.dtsi"
+#include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/input/input.h>
+#include <dt-bindings/gpio/meson-g12a-gpio.h>
+#include <dt-bindings/sound/meson-g12a-tohdmitx.h>
+
+/ {
+ compatible = "seirobotics,sei510", "amlogic,g12a";
+ model = "SEI Robotics SEI510";
+
+ adc_keys {
+ compatible = "adc-keys";
+ io-channels = <&saradc 0>;
+ io-channel-names = "buttons";
+ keyup-threshold-microvolt = <1800000>;
+
+ button-onoff {
+ label = "On/Off";
+ linux,code = <KEY_POWER>;
+ press-threshold-microvolt = <1700000>;
+ };
+ };
+
+ aliases {
+ serial0 = &uart_AO;
+ ethernet0 = &ethmac;
+ };
+
+ mono_dac: audio-codec-0 {
+ compatible = "maxim,max98357a";
+ #sound-dai-cells = <0>;
+ sound-name-prefix = "U16";
+ sdmode-gpios = <&gpio GPIOX_8 GPIO_ACTIVE_HIGH>;
+ };
+
+ dmics: audio-codec-1 {
+ #sound-dai-cells = <0>;
+ compatible = "dmic-codec";
+ num-channels = <2>;
+ wakeup-delay-ms = <50>;
+ status = "okay";
+ sound-name-prefix = "MIC";
+ };
+
+ chosen {
+ stdout-path = "serial0:115200n8";
+ };
+
+ cvbs-connector {
+ compatible = "composite-video-connector";
+
+ port {
+ cvbs_connector_in: endpoint {
+ remote-endpoint = <&cvbs_vdac_out>;
+ };
+ };
+ };
+
+ emmc_pwrseq: emmc-pwrseq {
+ compatible = "mmc-pwrseq-emmc";
+ reset-gpios = <&gpio BOOT_12 GPIO_ACTIVE_LOW>;
+ };
+
+ hdmi-connector {
+ compatible = "hdmi-connector";
+ type = "a";
+
+ port {
+ hdmi_connector_in: endpoint {
+ remote-endpoint = <&hdmi_tx_tmds_out>;
+ };
+ };
+ };
+
+ memory@0 {
+ device_type = "memory";
+ reg = <0x0 0x0 0x0 0x40000000>;
+ };
+
+ ao_5v: regulator-ao_5v {
+ compatible = "regulator-fixed";
+ regulator-name = "AO_5V";
+ regulator-min-microvolt = <5000000>;
+ regulator-max-microvolt = <5000000>;
+ vin-supply = <&dc_in>;
+ regulator-always-on;
+ };
+
+ dc_in: regulator-dc_in {
+ compatible = "regulator-fixed";
+ regulator-name = "DC_IN";
+ regulator-min-microvolt = <5000000>;
+ regulator-max-microvolt = <5000000>;
+ regulator-always-on;
+ };
+
+ emmc_1v8: regulator-emmc_1v8 {
+ compatible = "regulator-fixed";
+ regulator-name = "EMMC_1V8";
+ regulator-min-microvolt = <1800000>;
+ regulator-max-microvolt = <1800000>;
+ vin-supply = <&vddao_3v3>;
+ regulator-always-on;
+ };
+
+ vddao_3v3: regulator-vddao_3v3 {
+ compatible = "regulator-fixed";
+ regulator-name = "VDDAO_3V3";
+ regulator-min-microvolt = <3300000>;
+ regulator-max-microvolt = <3300000>;
+ vin-supply = <&dc_in>;
+ regulator-always-on;
+ };
+
+ vddao_3v3_t: regultor-vddao_3v3_t {
+ compatible = "regulator-fixed";
+ regulator-name = "VDDAO_3V3_T";
+ regulator-min-microvolt = <3300000>;
+ regulator-max-microvolt = <3300000>;
+ vin-supply = <&vddao_3v3>;
+ gpio = <&gpio GPIOH_8 GPIO_OPEN_DRAIN>;
+ enable-active-high;
+ };
+
+ vddio_ao1v8: regulator-vddio_ao1v8 {
+ compatible = "regulator-fixed";
+ regulator-name = "VDDIO_AO1V8";
+ regulator-min-microvolt = <1800000>;
+ regulator-max-microvolt = <1800000>;
+ vin-supply = <&vddao_3v3>;
+ regulator-always-on;
+ };
+
+ reserved-memory {
+ /* TEE Reserved Memory */
+ bl32_reserved: bl32@5000000 {
+ reg = <0x0 0x05300000 0x0 0x2000000>;
+ no-map;
+ };
+ };
+
+ sdio_pwrseq: sdio-pwrseq {
+ compatible = "mmc-pwrseq-simple";
+ reset-gpios = <&gpio GPIOX_6 GPIO_ACTIVE_LOW>;
+ clocks = <&wifi32k>;
+ clock-names = "ext_clock";
+ };
+
+ wifi32k: wifi32k {
+ compatible = "pwm-clock";
+ #clock-cells = <0>;
+ clock-frequency = <32768>;
+ pwms = <&pwm_ef 0 30518 0>; /* PWM_E at 32.768KHz */
+ };
+
+ sound {
+ compatible = "amlogic,axg-sound-card";
+ model = "G12A-SEI510";
+ audio-aux-devs = <&tdmout_a>, <&tdmout_b>,
+ <&tdmin_a>, <&tdmin_b>;
+ audio-routing = "TDMOUT_A IN 0", "FRDDR_A OUT 0",
+ "TDMOUT_A IN 1", "FRDDR_B OUT 0",
+ "TDMOUT_A IN 2", "FRDDR_C OUT 0",
+ "TDM_A Playback", "TDMOUT_A OUT",
+ "TDMOUT_B IN 0", "FRDDR_A OUT 1",
+ "TDMOUT_B IN 1", "FRDDR_B OUT 1",
+ "TDMOUT_B IN 2", "FRDDR_C OUT 1",
+ "TDM_B Playback", "TDMOUT_B OUT",
+ "TODDR_A IN 4", "PDM Capture",
+ "TODDR_B IN 4", "PDM Capture",
+ "TODDR_C IN 4", "PDM Capture",
+ "TDMIN_A IN 0", "TDM_A Capture",
+ "TDMIN_A IN 3", "TDM_A Loopback",
+ "TDMIN_B IN 0", "TDM_A Capture",
+ "TDMIN_B IN 3", "TDM_A Loopback",
+ "TDMIN_A IN 1", "TDM_B Capture",
+ "TDMIN_A IN 4", "TDM_B Loopback",
+ "TDMIN_B IN 1", "TDM_B Capture",
+ "TDMIN_B IN 4", "TDM_B Loopback",
+ "TODDR_A IN 0", "TDMIN_A OUT",
+ "TODDR_B IN 0", "TDMIN_A OUT",
+ "TODDR_C IN 0", "TDMIN_A OUT",
+ "TODDR_A IN 1", "TDMIN_B OUT",
+ "TODDR_B IN 1", "TDMIN_B OUT",
+ "TODDR_C IN 1", "TDMIN_B OUT";
+
+ assigned-clocks = <&clkc CLKID_MPLL2>,
+ <&clkc CLKID_MPLL0>,
+ <&clkc CLKID_MPLL1>;
+ assigned-clock-parents = <0>, <0>, <0>;
+ assigned-clock-rates = <294912000>,
+ <270950400>,
+ <393216000>;
+ status = "okay";
+
+ dai-link-0 {
+ sound-dai = <&frddr_a>;
+ };
+
+ dai-link-1 {
+ sound-dai = <&frddr_b>;
+ };
+
+ dai-link-2 {
+ sound-dai = <&frddr_c>;
+ };
+
+ dai-link-3 {
+ sound-dai = <&toddr_a>;
+ };
+
+ dai-link-4 {
+ sound-dai = <&toddr_b>;
+ };
+
+ dai-link-5 {
+ sound-dai = <&toddr_c>;
+ };
+
+ /* internal speaker interface */
+ dai-link-6 {
+ sound-dai = <&tdmif_a>;
+ dai-format = "i2s";
+ dai-tdm-slot-tx-mask-0 = <1 1>;
+ mclk-fs = <256>;
+
+ codec-0 {
+ sound-dai = <&mono_dac>;
+ };
+
+ codec-1 {
+ sound-dai = <&tohdmitx TOHDMITX_I2S_IN_A>;
+ };
+ };
+
+ /* 8ch hdmi interface */
+ dai-link-7 {
+ sound-dai = <&tdmif_b>;
+ dai-format = "i2s";
+ dai-tdm-slot-tx-mask-0 = <1 1>;
+ dai-tdm-slot-tx-mask-1 = <1 1>;
+ dai-tdm-slot-tx-mask-2 = <1 1>;
+ dai-tdm-slot-tx-mask-3 = <1 1>;
+ mclk-fs = <256>;
+
+ codec@0 {
+ sound-dai = <&tohdmitx TOHDMITX_I2S_IN_B>;
+ };
+ };
+
+ /* internal digital mics */
+ dai-link-8 {
+ sound-dai = <&pdm>;
+
+ codec {
+ sound-dai = <&dmics>;
+ };
+ };
+
+ /* hdmi glue */
+ dai-link-9 {
+ sound-dai = <&tohdmitx TOHDMITX_I2S_OUT>;
+
+ codec {
+ sound-dai = <&hdmi_tx>;
+ };
+ };
+ };
+};
+
+&arb {
+ status = "okay";
+};
+
+&cec_AO {
+ pinctrl-0 = <&cec_ao_a_h_pins>;
+ pinctrl-names = "default";
+ status = "disabled";
+ hdmi-phandle = <&hdmi_tx>;
+};
+
+&cecb_AO {
+ pinctrl-0 = <&cec_ao_b_h_pins>;
+ pinctrl-names = "default";
+ status = "okay";
+ hdmi-phandle = <&hdmi_tx>;
+};
+
+&clkc_audio {
+ status = "okay";
+};
+
+&cvbs_vdac_port {
+ cvbs_vdac_out: endpoint {
+ remote-endpoint = <&cvbs_connector_in>;
+ };
+};
+
+&ethmac {
+ status = "okay";
+ phy-handle = <&internal_ephy>;
+ phy-mode = "rmii";
+};
+
+&frddr_a {
+ status = "okay";
+};
+
+&frddr_b {
+ status = "okay";
+};
+
+&frddr_c {
+ status = "okay";
+};
+
+&hdmi_tx {
+ status = "okay";
+ pinctrl-0 = <&hdmitx_hpd_pins>, <&hdmitx_ddc_pins>;
+ pinctrl-names = "default";
+};
+
+&hdmi_tx_tmds_port {
+ hdmi_tx_tmds_out: endpoint {
+ remote-endpoint = <&hdmi_connector_in>;
+ };
+};
+
+&i2c3 {
+ status = "okay";
+ pinctrl-0 = <&i2c3_sda_a_pins>, <&i2c3_sck_a_pins>;
+ pinctrl-names = "default";
+};
+
+&pwm_ef {
+ status = "okay";
+ pinctrl-0 = <&pwm_e_pins>;
+ pinctrl-names = "default";
+ clocks = <&xtal>;
+ clock-names = "clkin0";
+};
+
+&pdm {
+ pinctrl-0 = <&pdm_din0_z_pins>, <&pdm_din1_z_pins>,
+ <&pdm_din2_z_pins>, <&pdm_din3_z_pins>,
+ <&pdm_dclk_z_pins>;
+ pinctrl-names = "default";
+ status = "okay";
+};
+
+&saradc {
+ status = "okay";
+ vref-supply = <&vddio_ao1v8>;
+};
+
+/* SDIO */
+&sd_emmc_a {
+ status = "okay";
+ pinctrl-0 = <&sdio_pins>;
+ pinctrl-1 = <&sdio_clk_gate_pins>;
+ pinctrl-names = "default", "clk-gate";
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ bus-width = <4>;
+ cap-sd-highspeed;
+ sd-uhs-sdr50;
+ max-frequency = <100000000>;
+
+ non-removable;
+ disable-wp;
+
+ mmc-pwrseq = <&sdio_pwrseq>;
+
+ vmmc-supply = <&vddao_3v3>;
+ vqmmc-supply = <&vddio_ao1v8>;
+
+ brcmf: wifi@1 {
+ reg = <1>;
+ compatible = "brcm,bcm4329-fmac";
+ };
+};
+
+/* SD card */
+&sd_emmc_b {
+ status = "okay";
+ pinctrl-0 = <&sdcard_c_pins>;
+ pinctrl-1 = <&sdcard_clk_gate_c_pins>;
+ pinctrl-names = "default", "clk-gate";
+
+ bus-width = <4>;
+ cap-sd-highspeed;
+ max-frequency = <50000000>;
+ disable-wp;
+
+ cd-gpios = <&gpio GPIOC_6 GPIO_ACTIVE_LOW>;
+ vmmc-supply = <&vddao_3v3>;
+ vqmmc-supply = <&vddao_3v3>;
+};
+
+/* eMMC */
+&sd_emmc_c {
+ status = "okay";
+ pinctrl-0 = <&emmc_pins>, <&emmc_ds_pins>;
+ pinctrl-1 = <&emmc_clk_gate_pins>;
+ pinctrl-names = "default", "clk-gate";
+
+ bus-width = <8>;
+ cap-mmc-highspeed;
+ mmc-ddr-1_8v;
+ mmc-hs200-1_8v;
+ max-frequency = <200000000>;
+ non-removable;
+ disable-wp;
+
+ mmc-pwrseq = <&emmc_pwrseq>;
+ vmmc-supply = <&vddao_3v3>;
+ vqmmc-supply = <&emmc_1v8>;
+};
+
+&tdmif_a {
+ pinctrl-0 = <&tdm_a_dout0_pins>, <&tdm_a_fs_pins>, <&tdm_a_sclk_pins>;
+ pinctrl-names = "default";
+ status = "okay";
+
+ assigned-clocks = <&clkc_audio AUD_CLKID_TDM_SCLK_PAD0>,
+ <&clkc_audio AUD_CLKID_TDM_LRCLK_PAD0>;
+ assigned-clock-parents = <&clkc_audio AUD_CLKID_MST_A_SCLK>,
+ <&clkc_audio AUD_CLKID_MST_A_LRCLK>;
+ assigned-clock-rates = <0>, <0>;
+};
+
+&tdmif_b {
+ status = "okay";
+};
+
+&tdmin_a {
+ status = "okay";
+};
+
+&tdmin_b {
+ status = "okay";
+};
+
+&tdmout_a {
+ status = "okay";
+};
+
+&tdmout_b {
+ status = "okay";
+};
+
+&toddr_a {
+ status = "okay";
+};
+
+&toddr_b {
+ status = "okay";
+};
+
+&toddr_c {
+ status = "okay";
+};
+
+&tohdmitx {
+ status = "okay";
+};
+
+&uart_A {
+ status = "okay";
+ pinctrl-0 = <&uart_a_pins>, <&uart_a_cts_rts_pins>;
+ pinctrl-names = "default";
+ uart-has-rtscts;
+
+ bluetooth {
+ compatible = "brcm,bcm43438-bt";
+ shutdown-gpios = <&gpio GPIOX_17 GPIO_ACTIVE_HIGH>;
+ max-speed = <2000000>;
+ clocks = <&wifi32k>;
+ clock-names = "lpo";
+ vbat-supply = <&vddao_3v3>;
+ vddio-supply = <&vddio_ao1v8>;
+ };
+};
+
+&uart_AO {
+ status = "okay";
+ pinctrl-0 = <&uart_ao_a_pins>;
+ pinctrl-names = "default";
+};
+
+&usb {
+ status = "okay";
+ dr_mode = "host";
+};
diff --git a/arch/arm/include/asm/arch-hi3660/hi3660.h b/arch/arm/include/asm/arch-hi3660/hi3660.h
new file mode 100644
index 0000000000..3ca0951543
--- /dev/null
+++ b/arch/arm/include/asm/arch-hi3660/hi3660.h
@@ -0,0 +1,52 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * (C) Copyright 2019 Linaro
+ * Author: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
+ */
+
+#ifndef __HI3660_H__
+#define __HI3660_H__
+
+#define HI3660_UART6_BASE 0xfff32000
+
+#define PMU_REG_BASE 0xfff34000
+#define PMIC_HARDWARE_CTRL0 (PMU_REG_BASE + (0x0C5 << 2))
+
+#define SCTRL_REG_BASE 0xfff0a000
+#define SCTRL_SCFPLLCTRL0 (SCTRL_REG_BASE + 0x120)
+#define SCTRL_SCFPLLCTRL0_FPLL0_EN BIT(0)
+
+#define CRG_REG_BASE 0xfff35000
+#define CRG_PEREN2 (CRG_REG_BASE + 0x020)
+#define CRG_PERDIS2 (CRG_REG_BASE + 0x024)
+#define CRG_PERCLKEN2 (CRG_REG_BASE + 0x028)
+#define CRG_PERSTAT2 (CRG_REG_BASE + 0x02C)
+#define CRG_PEREN4 (CRG_REG_BASE + 0x040)
+#define CRG_PERDIS4 (CRG_REG_BASE + 0x044)
+#define CRG_PERCLKEN4 (CRG_REG_BASE + 0x048)
+#define CRG_PERSTAT4 (CRG_REG_BASE + 0x04C)
+#define CRG_PERRSTEN2 (CRG_REG_BASE + 0x078)
+#define CRG_PERRSTDIS2 (CRG_REG_BASE + 0x07C)
+#define CRG_PERRSTSTAT2 (CRG_REG_BASE + 0x080)
+#define CRG_PERRSTEN3 (CRG_REG_BASE + 0x084)
+#define CRG_PERRSTDIS3 (CRG_REG_BASE + 0x088)
+#define CRG_PERRSTSTAT3 (CRG_REG_BASE + 0x08C)
+#define CRG_PERRSTEN4 (CRG_REG_BASE + 0x090)
+#define CRG_PERRSTDIS4 (CRG_REG_BASE + 0x094)
+#define CRG_PERRSTSTAT4 (CRG_REG_BASE + 0x098)
+#define CRG_ISOEN (CRG_REG_BASE + 0x144)
+#define CRG_ISODIS (CRG_REG_BASE + 0x148)
+#define CRG_ISOSTAT (CRG_REG_BASE + 0x14C)
+
+#define PINMUX4_BASE 0xfff11000
+#define PINMUX4_SDDET (PINMUX4_BASE + 0x60)
+
+#define PINCONF3_BASE 0xff37e800
+#define PINCONF3_SDCLK (PINCONF3_BASE + 0x00)
+#define PINCONF3_SDCMD (PINCONF3_BASE + 0x04)
+#define PINCONF3_SDDATA0 (PINCONF3_BASE + 0x08)
+#define PINCONF3_SDDATA1 (PINCONF3_BASE + 0x0c)
+#define PINCONF3_SDDATA2 (PINCONF3_BASE + 0x10)
+#define PINCONF3_SDDATA3 (PINCONF3_BASE + 0x14)
+
+#endif /*__HI3660_H__*/
diff --git a/arch/arm/include/asm/arch-meson/sm.h b/arch/arm/include/asm/arch-meson/sm.h
index 60d04ae228..f3ae46a6d6 100644
--- a/arch/arm/include/asm/arch-meson/sm.h
+++ b/arch/arm/include/asm/arch-meson/sm.h
@@ -12,4 +12,22 @@ ssize_t meson_sm_read_efuse(uintptr_t offset, void *buffer, size_t size);
int meson_sm_get_serial(void *buffer, size_t size);
+enum {
+ REBOOT_REASON_COLD = 0,
+ REBOOT_REASON_NORMAL = 1,
+ REBOOT_REASON_RECOVERY = 2,
+ REBOOT_REASON_UPDATE = 3,
+ REBOOT_REASON_FASTBOOT = 4,
+ REBOOT_REASON_SUSPEND_OFF = 5,
+ REBOOT_REASON_HIBERNATE = 6,
+ REBOOT_REASON_BOOTLOADER = 7,
+ REBOOT_REASON_SHUTDOWN_REBOOT = 8,
+ REBOOT_REASON_RPMBP = 9,
+ REBOOT_REASON_CRASH_DUMP = 11,
+ REBOOT_REASON_KERNEL_PANIC = 12,
+ REBOOT_REASON_WATCHDOG_REBOOT = 13,
+};
+
+int meson_sm_get_reboot_reason(void);
+
#endif /* __MESON_SM_H__ */
diff --git a/arch/arm/include/asm/ti-common/omap_wdt.h b/arch/arm/include/asm/ti-common/omap_wdt.h
index 7d72e3af02..fbc421b630 100644
--- a/arch/arm/include/asm/ti-common/omap_wdt.h
+++ b/arch/arm/include/asm/ti-common/omap_wdt.h
@@ -56,4 +56,9 @@ struct wd_timer {
unsigned int wdt_unfr; /* offset 0x100 */
};
+struct omap3_wdt_priv {
+ struct wd_timer *regs;
+ unsigned int wdt_trgr_pattern;
+};
+
#endif /* __OMAP_WDT_H__ */
diff --git a/arch/arm/lib/bootm.c b/arch/arm/lib/bootm.c
index bf68a5ba62..1638f1e81d 100644
--- a/arch/arm/lib/bootm.c
+++ b/arch/arm/lib/bootm.c
@@ -15,6 +15,7 @@
#include <command.h>
#include <dm.h>
#include <dm/root.h>
+#include <env.h>
#include <image.h>
#include <u-boot/zlib.h>
#include <asm/byteorder.h>
diff --git a/arch/arm/mach-davinci/misc.c b/arch/arm/mach-davinci/misc.c
index df500c8f35..80e964274e 100644
--- a/arch/arm/mach-davinci/misc.c
+++ b/arch/arm/mach-davinci/misc.c
@@ -9,7 +9,7 @@
*/
#include <common.h>
-#include <environment.h>
+#include <env.h>
#include <i2c.h>
#include <net.h>
#include <asm/arch/hardware.h>
diff --git a/arch/arm/mach-imx/cmd_dek.c b/arch/arm/mach-imx/cmd_dek.c
index 463b869420..1b111ba26b 100644
--- a/arch/arm/mach-imx/cmd_dek.c
+++ b/arch/arm/mach-imx/cmd_dek.c
@@ -7,7 +7,6 @@
#include <common.h>
#include <command.h>
-#include <environment.h>
#include <malloc.h>
#include <asm/byteorder.h>
#include <linux/compiler.h>
diff --git a/arch/arm/mach-imx/mx6/opos6ul.c b/arch/arm/mach-imx/mx6/opos6ul.c
index 264fa8a48e..3ab9a3f022 100644
--- a/arch/arm/mach-imx/mx6/opos6ul.c
+++ b/arch/arm/mach-imx/mx6/opos6ul.c
@@ -13,7 +13,7 @@
#include <asm/mach-imx/iomux-v3.h>
#include <asm/io.h>
#include <common.h>
-#include <environment.h>
+#include <env.h>
DECLARE_GLOBAL_DATA_PTR;
@@ -127,7 +127,7 @@ int board_late_init(void)
/* In bootstrap don't use the env vars */
if (((reg & 0x3000000) >> 24) == 0x1) {
- set_default_env(NULL, 0);
+ env_set_default(NULL, 0);
env_set("preboot", "");
}
diff --git a/arch/arm/mach-imx/mx7/soc.c b/arch/arm/mach-imx/mx7/soc.c
index 1b4bbc5037..3b8e1ba9c3 100644
--- a/arch/arm/mach-imx/mx7/soc.c
+++ b/arch/arm/mach-imx/mx7/soc.c
@@ -14,6 +14,7 @@
#include <asm/arch/imx-rdc.h>
#include <asm/arch/crm_regs.h>
#include <dm.h>
+#include <env.h>
#include <imx_thermal.h>
#include <fsl_sec.h>
#include <asm/setup.h>
diff --git a/arch/arm/mach-imx/video.c b/arch/arm/mach-imx/video.c
index 22a371a212..1bc9b7cc7e 100644
--- a/arch/arm/mach-imx/video.c
+++ b/arch/arm/mach-imx/video.c
@@ -1,6 +1,7 @@
// SPDX-License-Identifier: GPL-2.0+
#include <common.h>
+#include <env.h>
#include <linux/errno.h>
#include <asm/mach-imx/video.h>
diff --git a/arch/arm/mach-k3/sysfw-loader.c b/arch/arm/mach-k3/sysfw-loader.c
index 2ede82004a..7a482bdc8a 100644
--- a/arch/arm/mach-k3/sysfw-loader.c
+++ b/arch/arm/mach-k3/sysfw-loader.c
@@ -251,10 +251,21 @@ void k3_sysfw_loader(void (*config_pm_done_callback)(void))
if (config_pm_done_callback)
config_pm_done_callback();
- /* Output System Firmware version info */
- printf("SYSFW ABI: %d.%d (firmware rev 0x%04x '%.*s')\n",
+ /*
+ * Output System Firmware version info. Note that since the
+ * 'firmware_description' field is not guaranteed to be zero-
+ * terminated we manually add a \0 terminator if needed. Further
+ * note that we intentionally no longer rely on the extended
+ * printf() formatter '%.*s' to not having to require a more
+ * full-featured printf() implementation.
+ */
+ char fw_desc[sizeof(ti_sci->version.firmware_description) + 1];
+
+ strncpy(fw_desc, ti_sci->version.firmware_description,
+ sizeof(ti_sci->version.firmware_description));
+ fw_desc[sizeof(fw_desc) - 1] = '\0';
+
+ printf("SYSFW ABI: %d.%d (firmware rev 0x%04x '%s')\n",
ti_sci->version.abi_major, ti_sci->version.abi_minor,
- ti_sci->version.firmware_revision,
- sizeof(ti_sci->version.firmware_description),
- ti_sci->version.firmware_description);
+ ti_sci->version.firmware_revision, fw_desc);
}
diff --git a/arch/arm/mach-kirkwood/cpu.c b/arch/arm/mach-kirkwood/cpu.c
index 8f8e300385..6ad2543438 100644
--- a/arch/arm/mach-kirkwood/cpu.c
+++ b/arch/arm/mach-kirkwood/cpu.c
@@ -6,6 +6,7 @@
*/
#include <common.h>
+#include <env.h>
#include <netdev.h>
#include <asm/cache.h>
#include <asm/io.h>
diff --git a/arch/arm/mach-meson/board-common.c b/arch/arm/mach-meson/board-common.c
index 18383f774e..d261b4ea33 100644
--- a/arch/arm/mach-meson/board-common.c
+++ b/arch/arm/mach-meson/board-common.c
@@ -5,15 +5,20 @@
#include <common.h>
#include <asm/arch/boot.h>
+#include <env.h>
#include <linux/libfdt.h>
#include <linux/err.h>
-#include <environment.h>
#include <asm/arch/mem.h>
#include <asm/arch/sm.h>
#include <asm/armv8/mmu.h>
#include <asm/unaligned.h>
#include <efi_loader.h>
+#if CONFIG_IS_ENABLED(FASTBOOT)
+#include <asm/psci.h>
+#include <fastboot.h>
+#endif
+
DECLARE_GLOBAL_DATA_PTR;
__weak int board_init(void)
@@ -142,7 +147,35 @@ int board_late_init(void)
return meson_board_late_init();
}
+#if CONFIG_IS_ENABLED(FASTBOOT)
+static unsigned int reboot_reason = REBOOT_REASON_NORMAL;
+
+int fastboot_set_reboot_flag()
+{
+ reboot_reason = REBOOT_REASON_BOOTLOADER;
+
+ printf("Using reboot reason: 0x%x\n", reboot_reason);
+
+ return 0;
+}
+
+void reset_cpu(ulong addr)
+{
+ struct pt_regs regs;
+
+ regs.regs[0] = ARM_PSCI_0_2_FN_SYSTEM_RESET;
+ regs.regs[1] = reboot_reason;
+
+ printf("Rebooting with reason: 0x%lx\n", regs.regs[1]);
+
+ smc_call(&regs);
+
+ while (1)
+ ;
+}
+#else
void reset_cpu(ulong addr)
{
psci_system_reset();
}
+#endif
diff --git a/arch/arm/mach-meson/sm.c b/arch/arm/mach-meson/sm.c
index 05b7f0bdf2..fabcb3bfd7 100644
--- a/arch/arm/mach-meson/sm.c
+++ b/arch/arm/mach-meson/sm.c
@@ -8,6 +8,10 @@
#include <common.h>
#include <asm/arch/sm.h>
#include <linux/kernel.h>
+#include <dm.h>
+#include <linux/bitfield.h>
+#include <regmap.h>
+#include <syscon.h>
#define FN_GET_SHARE_MEM_INPUT_BASE 0x82000020
#define FN_GET_SHARE_MEM_OUTPUT_BASE 0x82000021
@@ -77,3 +81,132 @@ int meson_sm_get_serial(void *buffer, size_t size)
return 0;
}
+
+#define AO_SEC_SD_CFG15 0xfc
+#define REBOOT_REASON_MASK GENMASK(15, 12)
+
+int meson_sm_get_reboot_reason(void)
+{
+ struct regmap *regmap;
+ int nodeoffset;
+ ofnode node;
+ unsigned int reason;
+
+ /* find the offset of compatible node */
+ nodeoffset = fdt_node_offset_by_compatible(gd->fdt_blob, -1,
+ "amlogic,meson-gx-ao-secure");
+ if (nodeoffset < 0) {
+ printf("%s: failed to get amlogic,meson-gx-ao-secure\n",
+ __func__);
+ return -ENODEV;
+ }
+
+ /* get regmap from the syscon node */
+ node = offset_to_ofnode(nodeoffset);
+ regmap = syscon_node_to_regmap(node);
+ if (IS_ERR(regmap)) {
+ printf("%s: failed to get regmap\n", __func__);
+ return -EINVAL;
+ }
+
+ regmap_read(regmap, AO_SEC_SD_CFG15, &reason);
+
+ /* The SMC call is not used, we directly use AO_SEC_SD_CFG15 */
+ return FIELD_GET(REBOOT_REASON_MASK, reason);
+}
+
+static int do_sm_serial(cmd_tbl_t *cmdtp, int flag, int argc,
+ char *const argv[])
+{
+ ulong address;
+ int ret;
+
+ if (argc < 2)
+ return CMD_RET_USAGE;
+
+ address = simple_strtoul(argv[1], NULL, 0);
+
+ ret = meson_sm_get_serial((void *)address, SM_CHIP_ID_SIZE);
+ if (ret)
+ return CMD_RET_FAILURE;
+
+ return CMD_RET_SUCCESS;
+}
+
+#define MAX_REBOOT_REASONS 14
+
+static const char *reboot_reasons[MAX_REBOOT_REASONS] = {
+ [REBOOT_REASON_COLD] = "cold_boot",
+ [REBOOT_REASON_NORMAL] = "normal",
+ [REBOOT_REASON_RECOVERY] = "recovery",
+ [REBOOT_REASON_UPDATE] = "update",
+ [REBOOT_REASON_FASTBOOT] = "fastboot",
+ [REBOOT_REASON_SUSPEND_OFF] = "suspend_off",
+ [REBOOT_REASON_HIBERNATE] = "hibernate",
+ [REBOOT_REASON_BOOTLOADER] = "bootloader",
+ [REBOOT_REASON_SHUTDOWN_REBOOT] = "shutdown_reboot",
+ [REBOOT_REASON_RPMBP] = "rpmbp",
+ [REBOOT_REASON_CRASH_DUMP] = "crash_dump",
+ [REBOOT_REASON_KERNEL_PANIC] = "kernel_panic",
+ [REBOOT_REASON_WATCHDOG_REBOOT] = "watchdog_reboot",
+};
+
+static int do_sm_reboot_reason(cmd_tbl_t *cmdtp, int flag, int argc,
+ char *const argv[])
+{
+ const char *reason_str;
+ char *destarg = NULL;
+ int reason;
+
+ if (argc > 1)
+ destarg = argv[1];
+
+ reason = meson_sm_get_reboot_reason();
+ if (reason < 0)
+ return CMD_RET_FAILURE;
+
+ if (reason >= MAX_REBOOT_REASONS ||
+ !reboot_reasons[reason])
+ reason_str = "unknown";
+ else
+ reason_str = reboot_reasons[reason];
+
+ if (destarg)
+ env_set(destarg, reason_str);
+ else
+ printf("reboot reason: %s (%x)\n", reason_str, reason);
+
+ return CMD_RET_SUCCESS;
+}
+
+static cmd_tbl_t cmd_sm_sub[] = {
+ U_BOOT_CMD_MKENT(serial, 2, 1, do_sm_serial, "", ""),
+ U_BOOT_CMD_MKENT(reboot_reason, 1, 1, do_sm_reboot_reason, "", ""),
+};
+
+static int do_sm(cmd_tbl_t *cmdtp, int flag, int argc,
+ char *const argv[])
+{
+ cmd_tbl_t *c;
+
+ if (argc < 2)
+ return CMD_RET_USAGE;
+
+ /* Strip off leading 'sm' command argument */
+ argc--;
+ argv++;
+
+ c = find_cmd_tbl(argv[0], &cmd_sm_sub[0], ARRAY_SIZE(cmd_sm_sub));
+
+ if (c)
+ return c->cmd(cmdtp, flag, argc, argv);
+ else
+ return CMD_RET_USAGE;
+}
+
+U_BOOT_CMD(
+ sm, 5, 0, do_sm,
+ "Secure Monitor Control",
+ "serial <address> - read chip unique id to memory address\n"
+ "sm reboot_reason [name] - get reboot reason and store to to environment"
+);
diff --git a/arch/arm/mach-omap2/Kconfig b/arch/arm/mach-omap2/Kconfig
index efe89eed0b..ed8056e871 100644
--- a/arch/arm/mach-omap2/Kconfig
+++ b/arch/arm/mach-omap2/Kconfig
@@ -176,6 +176,7 @@ source "arch/arm/mach-omap2/omap5/Kconfig"
source "arch/arm/mach-omap2/am33xx/Kconfig"
source "board/BuR/brxre1/Kconfig"
+source "board/BuR/brsmarc1/Kconfig"
source "board/BuR/brppt1/Kconfig"
source "board/siemens/draco/Kconfig"
source "board/siemens/pxm2/Kconfig"
diff --git a/arch/arm/mach-omap2/am33xx/Kconfig b/arch/arm/mach-omap2/am33xx/Kconfig
index 9da2a16a99..7f6b344c82 100644
--- a/arch/arm/mach-omap2/am33xx/Kconfig
+++ b/arch/arm/mach-omap2/am33xx/Kconfig
@@ -121,6 +121,10 @@ config TARGET_BRXRE1
bool "Support BRXRE1"
select BOARD_LATE_INIT
+config TARGET_BRSMARC1
+ bool "Support BRSMARC1"
+ select BOARD_LATE_INIT
+
config TARGET_BRPPT1
bool "Support BRPPT1"
select BOARD_LATE_INIT
diff --git a/arch/arm/mach-omap2/boot-common.c b/arch/arm/mach-omap2/boot-common.c
index c8b8ac657f..734fa9d9e6 100644
--- a/arch/arm/mach-omap2/boot-common.c
+++ b/arch/arm/mach-omap2/boot-common.c
@@ -9,7 +9,6 @@
#include <common.h>
#include <ahci.h>
-#include <environment.h>
#include <spl.h>
#include <asm/omap_common.h>
#include <asm/arch/omap.h>
@@ -208,7 +207,7 @@ void spl_board_init(void)
#if defined(CONFIG_AM33XX) && defined(CONFIG_SPL_MUSB_NEW_SUPPORT)
arch_misc_init();
#endif
-#if defined(CONFIG_HW_WATCHDOG)
+#if defined(CONFIG_HW_WATCHDOG) || defined(CONFIG_WATCHDOG)
hw_watchdog_init();
#endif
#ifdef CONFIG_AM33XX
diff --git a/arch/arm/mach-omap2/omap3/clock.c b/arch/arm/mach-omap2/omap3/clock.c
index cb9e91ebc3..71f73492c6 100644
--- a/arch/arm/mach-omap2/omap3/clock.c
+++ b/arch/arm/mach-omap2/omap3/clock.c
@@ -17,7 +17,6 @@
#include <asm/arch/clocks_omap3.h>
#include <asm/arch/mem.h>
#include <asm/arch/sys_proto.h>
-#include <environment.h>
#include <command.h>
/******************************************************************************
diff --git a/arch/arm/mach-omap2/utils.c b/arch/arm/mach-omap2/utils.c
index 7d01446940..0d5ca20e8e 100644
--- a/arch/arm/mach-omap2/utils.c
+++ b/arch/arm/mach-omap2/utils.c
@@ -4,7 +4,7 @@
* Aneesh V <aneesh@ti.com>
*/
#include <common.h>
-#include <environment.h>
+#include <env.h>
#include <asm/setup.h>
#include <asm/arch/sys_proto.h>
#include <asm/omap_common.h>
diff --git a/arch/arm/mach-rmobile/cpu_info.c b/arch/arm/mach-rmobile/cpu_info.c
index dc407d2a61..9ef94a4899 100644
--- a/arch/arm/mach-rmobile/cpu_info.c
+++ b/arch/arm/mach-rmobile/cpu_info.c
@@ -5,6 +5,7 @@
*/
#include <common.h>
#include <asm/io.h>
+#include <env.h>
#include <linux/ctype.h>
#ifdef CONFIG_ARCH_CPU_INIT
diff --git a/arch/arm/mach-rockchip/rk3288/rk3288.c b/arch/arm/mach-rockchip/rk3288/rk3288.c
index b462c09069..057ce92080 100644
--- a/arch/arm/mach-rockchip/rk3288/rk3288.c
+++ b/arch/arm/mach-rockchip/rk3288/rk3288.c
@@ -4,6 +4,7 @@
*/
#include <common.h>
#include <dm.h>
+#include <env.h>
#include <clk.h>
#include <asm/armv7.h>
#include <asm/io.h>
diff --git a/arch/arm/mach-socfpga/misc_gen5.c b/arch/arm/mach-socfpga/misc_gen5.c
index 71547d81ab..31681b799d 100644
--- a/arch/arm/mach-socfpga/misc_gen5.c
+++ b/arch/arm/mach-socfpga/misc_gen5.c
@@ -5,6 +5,7 @@
#include <common.h>
#include <asm/io.h>
+#include <env.h>
#include <errno.h>
#include <fdtdec.h>
#include <linux/libfdt.h>
diff --git a/arch/arm/mach-socfpga/misc_s10.c b/arch/arm/mach-socfpga/misc_s10.c
index 29abc4a54c..0a5fab11c0 100644
--- a/arch/arm/mach-socfpga/misc_s10.c
+++ b/arch/arm/mach-socfpga/misc_s10.c
@@ -6,6 +6,7 @@
#include <altera.h>
#include <common.h>
+#include <env.h>
#include <errno.h>
#include <fdtdec.h>
#include <miiphy.h>
diff --git a/arch/arm/mach-stm32mp/cpu.c b/arch/arm/mach-stm32mp/cpu.c
index 10190f40d4..a46e8438f7 100644
--- a/arch/arm/mach-stm32mp/cpu.c
+++ b/arch/arm/mach-stm32mp/cpu.c
@@ -5,7 +5,7 @@
#include <common.h>
#include <clk.h>
#include <debug_uart.h>
-#include <environment.h>
+#include <env.h>
#include <misc.h>
#include <asm/io.h>
#include <asm/arch/stm32.h>
diff --git a/arch/arm/mach-tegra/board2.c b/arch/arm/mach-tegra/board2.c
index bbc487aa3b..f13bd256cc 100644
--- a/arch/arm/mach-tegra/board2.c
+++ b/arch/arm/mach-tegra/board2.c
@@ -7,6 +7,7 @@
#include <common.h>
#include <dm.h>
#include <efi_loader.h>
+#include <env.h>
#include <errno.h>
#include <ns16550.h>
#include <usb.h>
diff --git a/arch/arm/mach-tegra/cboot.c b/arch/arm/mach-tegra/cboot.c
index a829ef794f..0433081c6c 100644
--- a/arch/arm/mach-tegra/cboot.c
+++ b/arch/arm/mach-tegra/cboot.c
@@ -4,7 +4,7 @@
*/
#include <common.h>
-#include <environment.h>
+#include <env.h>
#include <fdt_support.h>
#include <fdtdec.h>
#include <stdlib.h>
diff --git a/arch/arm/mach-uniphier/board_late_init.c b/arch/arm/mach-uniphier/board_late_init.c
index 3180b24330..14b61fc7df 100644
--- a/arch/arm/mach-uniphier/board_late_init.c
+++ b/arch/arm/mach-uniphier/board_late_init.c
@@ -6,6 +6,7 @@
*/
#include <common.h>
+#include <env.h>
#include <spl.h>
#include <linux/libfdt.h>
#include <nand.h>
diff --git a/arch/arm/mach-uniphier/mmc-first-dev.c b/arch/arm/mach-uniphier/mmc-first-dev.c
index 2f1c109b9e..149e662070 100644
--- a/arch/arm/mach-uniphier/mmc-first-dev.c
+++ b/arch/arm/mach-uniphier/mmc-first-dev.c
@@ -5,6 +5,7 @@
*/
#include <common.h>
+#include <env.h>
#include <mmc.h>
#include <linux/errno.h>
diff --git a/arch/m68k/lib/bootm.c b/arch/m68k/lib/bootm.c
index 1b15430297..19445b3fc7 100644
--- a/arch/m68k/lib/bootm.c
+++ b/arch/m68k/lib/bootm.c
@@ -6,11 +6,11 @@
#include <common.h>
#include <command.h>
+#include <env.h>
#include <image.h>
#include <u-boot/zlib.h>
#include <bzlib.h>
#include <watchdog.h>
-#include <environment.h>
#include <asm/byteorder.h>
#ifdef CONFIG_SHOW_BOOT_PROGRESS
# include <status_led.h>
diff --git a/arch/microblaze/lib/bootm.c b/arch/microblaze/lib/bootm.c
index 083a43c3a5..ec332944d8 100644
--- a/arch/microblaze/lib/bootm.c
+++ b/arch/microblaze/lib/bootm.c
@@ -9,6 +9,7 @@
#include <common.h>
#include <command.h>
+#include <env.h>
#include <fdt_support.h>
#include <image.h>
#include <u-boot/zlib.h>
diff --git a/arch/mips/lib/bootm.c b/arch/mips/lib/bootm.c
index 6a462f3e5a..8c0d7672f2 100644
--- a/arch/mips/lib/bootm.c
+++ b/arch/mips/lib/bootm.c
@@ -5,6 +5,7 @@
*/
#include <common.h>
+#include <env.h>
#include <image.h>
#include <fdt_support.h>
#include <asm/addrspace.h>
diff --git a/arch/nds32/include/asm/u-boot.h b/arch/nds32/include/asm/u-boot.h
index 68701d6da9..8c949e7fb7 100644
--- a/arch/nds32/include/asm/u-boot.h
+++ b/arch/nds32/include/asm/u-boot.h
@@ -21,7 +21,6 @@
#include <asm/u-boot-nds32.h>
-#include <environment.h>
typedef struct bd_info {
unsigned long bi_arch_number; /* unique id for this board */
diff --git a/arch/nds32/lib/bootm.c b/arch/nds32/lib/bootm.c
index 0cfdc52b46..a472f6a187 100644
--- a/arch/nds32/lib/bootm.c
+++ b/arch/nds32/lib/bootm.c
@@ -7,6 +7,7 @@
#include <common.h>
#include <command.h>
+#include <env.h>
#include <image.h>
#include <u-boot/zlib.h>
#include <asm/byteorder.h>
diff --git a/arch/powerpc/cpu/mpc85xx/cpu_init.c b/arch/powerpc/cpu/mpc85xx/cpu_init.c
index cbcd62e19a..cac9280790 100644
--- a/arch/powerpc/cpu/mpc85xx/cpu_init.c
+++ b/arch/powerpc/cpu/mpc85xx/cpu_init.c
@@ -10,6 +10,7 @@
*/
#include <common.h>
+#include <env.h>
#include <watchdog.h>
#include <asm/processor.h>
#include <ioports.h>
diff --git a/arch/powerpc/cpu/mpc85xx/fdt.c b/arch/powerpc/cpu/mpc85xx/fdt.c
index 20ecca605f..db12aefb29 100644
--- a/arch/powerpc/cpu/mpc85xx/fdt.c
+++ b/arch/powerpc/cpu/mpc85xx/fdt.c
@@ -7,7 +7,7 @@
*/
#include <common.h>
-#include <environment.h>
+#include <env.h>
#include <linux/libfdt.h>
#include <fdt_support.h>
#include <asm/processor.h>
diff --git a/arch/powerpc/cpu/mpc85xx/fsl_corenet_serdes.c b/arch/powerpc/cpu/mpc85xx/fsl_corenet_serdes.c
index 2fab9aaff4..fcfa730233 100644
--- a/arch/powerpc/cpu/mpc85xx/fsl_corenet_serdes.c
+++ b/arch/powerpc/cpu/mpc85xx/fsl_corenet_serdes.c
@@ -4,6 +4,7 @@
*/
#include <common.h>
+#include <env.h>
#ifdef CONFIG_SYS_P4080_ERRATUM_SERDES8
#include <hwconfig.h>
#endif
diff --git a/arch/powerpc/cpu/mpc85xx/mp.c b/arch/powerpc/cpu/mpc85xx/mp.c
index b0aa72ed6e..3882c95f92 100644
--- a/arch/powerpc/cpu/mpc85xx/mp.c
+++ b/arch/powerpc/cpu/mpc85xx/mp.c
@@ -4,7 +4,9 @@
*/
#include <common.h>
+#include <env.h>
#include <asm/processor.h>
+#include <env.h>
#include <ioports.h>
#include <lmb.h>
#include <asm/io.h>
diff --git a/arch/powerpc/lib/bootm.c b/arch/powerpc/lib/bootm.c
index 15e9c2a83e..84691b7554 100644
--- a/arch/powerpc/lib/bootm.c
+++ b/arch/powerpc/lib/bootm.c
@@ -8,13 +8,13 @@
#include <common.h>
+#include <env.h>
#include <watchdog.h>
#include <command.h>
#include <image.h>
#include <malloc.h>
#include <u-boot/zlib.h>
#include <bzlib.h>
-#include <environment.h>
#include <asm/byteorder.h>
#include <asm/mp.h>
#include <bootm.h>
diff --git a/arch/riscv/include/asm/u-boot.h b/arch/riscv/include/asm/u-boot.h
index 3186835e0a..5ba8e77812 100644
--- a/arch/riscv/include/asm/u-boot.h
+++ b/arch/riscv/include/asm/u-boot.h
@@ -20,7 +20,6 @@
#include <asm/u-boot-riscv.h>
-#include <environment.h>
typedef struct bd_info {
unsigned long bi_boot_params; /* where this board expects params */
diff --git a/arch/x86/cpu/qemu/e820.c b/arch/x86/cpu/qemu/e820.c
index 0a690fde68..e682486547 100644
--- a/arch/x86/cpu/qemu/e820.c
+++ b/arch/x86/cpu/qemu/e820.c
@@ -4,6 +4,7 @@
*/
#include <common.h>
+#include <env_internal.h>
#include <asm/e820.h>
DECLARE_GLOBAL_DATA_PTR;
diff --git a/arch/x86/lib/zimage.c b/arch/x86/lib/zimage.c
index 230b38e938..6a6258a505 100644
--- a/arch/x86/lib/zimage.c
+++ b/arch/x86/lib/zimage.c
@@ -13,6 +13,7 @@
*/
#include <common.h>
+#include <env.h>
#include <malloc.h>
#include <asm/acpi_table.h>
#include <asm/io.h>
diff --git a/arch/xtensa/lib/bootm.c b/arch/xtensa/lib/bootm.c
index aceed153d7..93eea53c5f 100644
--- a/arch/xtensa/lib/bootm.c
+++ b/arch/xtensa/lib/bootm.c
@@ -6,6 +6,7 @@
#include <common.h>
#include <command.h>
+#include <env.h>
#include <u-boot/zlib.h>
#include <asm/byteorder.h>
#include <asm/addrspace.h>
diff --git a/board/Arcturus/ucp1020/cmd_arc.c b/board/Arcturus/ucp1020/cmd_arc.c
index 7a510c61fb..2e8477ed3b 100644
--- a/board/Arcturus/ucp1020/cmd_arc.c
+++ b/board/Arcturus/ucp1020/cmd_arc.c
@@ -10,11 +10,11 @@
#include <common.h>
#include <div64.h>
+#include <env.h>
#include <malloc.h>
#include <spi_flash.h>
#include <mmc.h>
#include <version.h>
-#include <environment.h>
#include <asm/io.h>
static ulong fwenv_addr[MAX_FWENV_ADDR];
diff --git a/board/Arcturus/ucp1020/spl.c b/board/Arcturus/ucp1020/spl.c
index 451a9d78bb..9314fabdf2 100644
--- a/board/Arcturus/ucp1020/spl.c
+++ b/board/Arcturus/ucp1020/spl.c
@@ -9,7 +9,8 @@
#include <common.h>
#include <console.h>
-#include <environment.h>
+#include <env.h>
+#include <env_internal.h>
#include <ns16550.h>
#include <malloc.h>
#include <mmc.h>
diff --git a/board/Arcturus/ucp1020/ucp1020.c b/board/Arcturus/ucp1020/ucp1020.c
index 54fd1782cb..6a880c97bc 100644
--- a/board/Arcturus/ucp1020/ucp1020.c
+++ b/board/Arcturus/ucp1020/ucp1020.c
@@ -10,6 +10,7 @@
#include <common.h>
#include <command.h>
+#include <env.h>
#include <hwconfig.h>
#include <pci.h>
#include <i2c.h>
diff --git a/board/BuR/brppt1/board.c b/board/BuR/brppt1/board.c
index b8ab19c0e7..ef4f5c9501 100644
--- a/board/BuR/brppt1/board.c
+++ b/board/BuR/brppt1/board.c
@@ -10,6 +10,7 @@
*/
#include <common.h>
+#include <env.h>
#include <errno.h>
#include <spl.h>
#include <asm/arch/cpu.h>
diff --git a/board/BuR/brsmarc1/Kconfig b/board/BuR/brsmarc1/Kconfig
new file mode 100644
index 0000000000..6d3d7a2a26
--- /dev/null
+++ b/board/BuR/brsmarc1/Kconfig
@@ -0,0 +1,15 @@
+if TARGET_BRSMARC1
+
+config SYS_BOARD
+ default "brsmarc1"
+
+config SYS_VENDOR
+ default "BuR"
+
+config SYS_SOC
+ default "am33xx"
+
+config SYS_CONFIG_NAME
+ default "brsmarc1"
+
+endif
diff --git a/board/BuR/brsmarc1/MAINTAINERS b/board/BuR/brsmarc1/MAINTAINERS
new file mode 100644
index 0000000000..c6dfc20f4d
--- /dev/null
+++ b/board/BuR/brsmarc1/MAINTAINERS
@@ -0,0 +1,6 @@
+BRSMARC1 BOARD
+M: Hannes Schmelzer <hannes.schmelzer@br-automation.com>
+S: Maintained
+F: board/BuR/brsmarc1/
+F: include/configs/brsmarc1.h
+F: configs/brsmarc1_defconfig
diff --git a/board/BuR/brsmarc1/Makefile b/board/BuR/brsmarc1/Makefile
new file mode 100644
index 0000000000..1c3f64dea4
--- /dev/null
+++ b/board/BuR/brsmarc1/Makefile
@@ -0,0 +1,10 @@
+# SPDX-License-Identifier: GPL-2.0+
+#
+# Copyright (C) 2019 Hannes Schmelzer <oe5hpm@oevsv.at> -
+# B&R Industrial Automation GmbH - http://www.br-automation.com/
+#
+
+obj-$(CONFIG_SPL_BUILD) += mux.o
+obj-y += ../common/br_resetc.o
+obj-y += ../common/common.o
+obj-y += board.o
diff --git a/board/BuR/brsmarc1/board.c b/board/BuR/brsmarc1/board.c
new file mode 100644
index 0000000000..4c70346148
--- /dev/null
+++ b/board/BuR/brsmarc1/board.c
@@ -0,0 +1,168 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * board.c
+ *
+ * Board functions for B&R BRSMARC1 Board
+ *
+ * Copyright (C) 2017 Hannes Schmelzer <oe5hpm@oevsv.at>
+ * B&R Industrial Automation GmbH - http://www.br-automation.com
+ *
+ */
+#include <common.h>
+#include <errno.h>
+#include <spl.h>
+#include <asm/arch/cpu.h>
+#include <asm/arch/hardware.h>
+#include <asm/arch/omap.h>
+#include <asm/arch/ddr_defs.h>
+#include <asm/arch/clock.h>
+#include <asm/arch/sys_proto.h>
+#include <asm/arch/mem.h>
+#include <asm/io.h>
+#include <asm/gpio.h>
+#include <asm/emif.h>
+#include <power/tps65217.h>
+#include "../common/bur_common.h"
+#include "../common/br_resetc.h"
+
+/* -------------------------------------------------------------------------*/
+/* -- defines for used GPIO Hardware -- */
+#define PER_RESET (2 * 32 + 0)
+
+DECLARE_GLOBAL_DATA_PTR;
+
+#if defined(CONFIG_SPL_BUILD)
+static const struct ddr_data ddr3_data = {
+ .datardsratio0 = MT41K256M16HA125E_RD_DQS,
+ .datawdsratio0 = MT41K256M16HA125E_WR_DQS,
+ .datafwsratio0 = MT41K256M16HA125E_PHY_FIFO_WE,
+ .datawrsratio0 = MT41K256M16HA125E_PHY_WR_DATA,
+};
+
+static const struct cmd_control ddr3_cmd_ctrl_data = {
+ .cmd0csratio = MT41K256M16HA125E_RATIO,
+ .cmd0iclkout = MT41K256M16HA125E_INVERT_CLKOUT,
+
+ .cmd1csratio = MT41K256M16HA125E_RATIO,
+ .cmd1iclkout = MT41K256M16HA125E_INVERT_CLKOUT,
+
+ .cmd2csratio = MT41K256M16HA125E_RATIO,
+ .cmd2iclkout = MT41K256M16HA125E_INVERT_CLKOUT,
+};
+
+static struct emif_regs ddr3_emif_reg_data = {
+ .sdram_config = MT41K256M16HA125E_EMIF_SDCFG,
+ .ref_ctrl = MT41K256M16HA125E_EMIF_SDREF,
+ .sdram_tim1 = MT41K256M16HA125E_EMIF_TIM1,
+ .sdram_tim2 = MT41K256M16HA125E_EMIF_TIM2,
+ .sdram_tim3 = MT41K256M16HA125E_EMIF_TIM3,
+ .zq_config = MT41K256M16HA125E_ZQ_CFG,
+ .emif_ddr_phy_ctlr_1 = MT41K256M16HA125E_EMIF_READ_LATENCY,
+};
+
+static const struct ctrl_ioregs ddr3_ioregs = {
+ .cm0ioctl = MT41K256M16HA125E_IOCTRL_VALUE,
+ .cm1ioctl = MT41K256M16HA125E_IOCTRL_VALUE,
+ .cm2ioctl = MT41K256M16HA125E_IOCTRL_VALUE,
+ .dt0ioctl = MT41K256M16HA125E_IOCTRL_VALUE,
+ .dt1ioctl = MT41K256M16HA125E_IOCTRL_VALUE,
+};
+
+#define OSC (V_OSCK / 1000000)
+const struct dpll_params dpll_ddr3 = { 400, OSC - 1, 1, -1, -1, -1, -1};
+
+void am33xx_spl_board_init(void)
+{
+ struct cm_perpll *const cmper = (struct cm_perpll *)CM_PER;
+ struct cm_wkuppll *const cmwkup = (struct cm_wkuppll *)CM_WKUP;
+
+ int rc;
+ /*
+ * enable additional clocks of modules which are accessed later from
+ * VxWorks OS
+ */
+ u32 *const clk_domains[] = { 0 };
+ u32 *const clk_modules_specific[] = {
+ &cmwkup->wkup_adctscctrl,
+ &cmper->spi1clkctrl,
+ &cmper->dcan0clkctrl,
+ &cmper->dcan1clkctrl,
+ &cmper->timer4clkctrl,
+ &cmper->timer5clkctrl,
+ &cmper->lcdclkctrl,
+ &cmper->lcdcclkstctrl,
+ 0
+ };
+ do_enable_clocks(clk_domains, clk_modules_specific, 1);
+
+ /* setup I2C */
+ enable_i2c_pin_mux();
+
+ /* peripheral reset */
+ rc = gpio_request(PER_RESET, "PER_RESET");
+ if (rc != 0)
+ printf("cannot request PER_RESET GPIO!\n");
+
+ rc = gpio_direction_output(PER_RESET, 0);
+ if (rc != 0)
+ printf("cannot set PER_RESET GPIO!\n");
+
+ /* setup pmic */
+ pmicsetup(0, 0);
+}
+
+const struct dpll_params *get_dpll_ddr_params(void)
+{
+ return &dpll_ddr3;
+}
+
+void sdram_init(void)
+{
+ config_ddr(400, &ddr3_ioregs,
+ &ddr3_data,
+ &ddr3_cmd_ctrl_data,
+ &ddr3_emif_reg_data, 0);
+}
+#endif /* CONFIG_SPL_BUILD */
+#if !defined(CONFIG_SPL_BUILD)
+
+/* decision if backlight is switched on or not on powerup */
+int board_backlightstate(void)
+{
+ u8 bklmask, rstcause;
+ int rc = 0;
+
+ rc |= br_resetc_regget(RSTCTRL_SCRATCHREG1, &bklmask);
+ rc |= br_resetc_regget(RSTCTRL_ERSTCAUSE, &rstcause);
+
+ if (rc != 0) {
+ printf("%s: read rstctrl failed!\n", __func__);
+ return 1;
+ }
+
+ if ((rstcause & bklmask) != 0)
+ return 0;
+
+ return 1;
+}
+
+/* Basic board specific setup. run quite after relocation */
+int board_init(void)
+{
+ if (power_tps65217_init(0))
+ printf("WARN: cannot setup PMIC 0x24 @ bus #0, not found!.\n");
+
+ return 0;
+}
+
+#if defined(CONFIG_BOARD_LATE_INIT)
+
+int board_late_init(void)
+{
+ br_resetc_bmode();
+
+ return 0;
+}
+
+#endif /* CONFIG_BOARD_LATE_INIT */
+#endif /* !CONFIG_SPL_BUILD */
diff --git a/board/BuR/brsmarc1/config.mk b/board/BuR/brsmarc1/config.mk
new file mode 100644
index 0000000000..0692988507
--- /dev/null
+++ b/board/BuR/brsmarc1/config.mk
@@ -0,0 +1,33 @@
+# SPDX-License-Identifier: GPL-2.0+
+#
+# Copyright (C) 2019 Hannes Schmelzer <oe5hpm@oevsv.at> -
+# B&R Industrial Automation GmbH - http://www.br-automation.com
+#
+
+hw-platform-y :=$(shell echo $(CONFIG_DEFAULT_DEVICE_TREE) | sed -e 's/am335x-//')
+
+payload_off :=$(shell printf "%d" $(CONFIG_SYS_SPI_U_BOOT_OFFS))
+
+quiet_cmd_prodbin = PRODBIN $@ $(payload_off)
+cmd_prodbin = \
+ dd if=/dev/zero ibs=1M count=2 2>/dev/null | tr "\000" "\377" >$@ && \
+ dd conv=notrunc bs=1 if=MLO.byteswap of=$@ seek=0 2>/dev/null && \
+ dd bs=1 if=u-boot-dtb.img of=$@ seek=$(payload_off) 2>/dev/null
+
+quiet_cmd_prodzip = SAPZIP $@
+cmd_prodzip = \
+ test -d misc && rm -r misc; \
+ mkdir misc && \
+ cp MLO.byteswap misc/ && \
+ cp spl/u-boot-spl.bin misc/ && \
+ cp u-boot-dtb.img misc/ && \
+ zip -9 -r $@ misc/* >/dev/null $<
+
+ALL-y += $(hw-platform-y)_prog.bin
+ALL-y += $(hw-platform-y)_prod.zip
+
+$(hw-platform-y)_prog.bin: u-boot-dtb.img spl/u-boot-spl.bin
+ $(call if_changed,prodbin)
+
+$(hw-platform-y)_prod.zip: $(hw-platform-y)_prog.bin
+ $(call if_changed,prodzip) \ No newline at end of file
diff --git a/board/BuR/brsmarc1/mux.c b/board/BuR/brsmarc1/mux.c
new file mode 100644
index 0000000000..33c214d6b2
--- /dev/null
+++ b/board/BuR/brsmarc1/mux.c
@@ -0,0 +1,266 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * mux.c
+ *
+ * Pinmux Setting for B&R BRSMARC1 Board (HW-Rev. 1)
+ *
+ * Copyright (C) 2017 Hannes Schmelzer <hannes.schmelzer@br-automation.com>
+ * B&R Industrial Automation GmbH - http://www.br-automation.com
+ *
+ */
+
+#include <common.h>
+#include <asm/arch/sys_proto.h>
+#include <asm/arch/hardware.h>
+#include <asm/arch/mux.h>
+#include <asm/io.h>
+#include <i2c.h>
+
+static struct module_pin_mux spi0_pin_mux[] = {
+ /* SPI0_SCLK */
+ {OFFSET(spi0_sclk), MODE(0) | PULLUDEN | RXACTIVE},
+ /* SPI0_D0 */
+ {OFFSET(spi0_d0), MODE(0) | PULLUDEN | RXACTIVE},
+ /* SPI0_D1 */
+ {OFFSET(spi0_d1), MODE(0) | PULLUDEN | RXACTIVE},
+ /* SPI0_CS0 */
+ {OFFSET(spi0_cs0), MODE(7) | PULLUDEN | PULLUP_EN | RXACTIVE},
+ /* SPI0_CS1 */
+ {OFFSET(spi0_cs1), MODE(7) | PULLUDEN | PULLUP_EN | RXACTIVE},
+ {-1},
+};
+
+static struct module_pin_mux spi1_pin_mux[] = {
+ /* SPI1_SCLK */
+ {OFFSET(mcasp0_aclkx), MODE(3) | PULLUDEN | RXACTIVE},
+ /* SPI1_D0 */
+ {OFFSET(mcasp0_fsx), MODE(3) | PULLUDEN | RXACTIVE},
+ /* SPI1_D1 */
+ {OFFSET(mcasp0_axr0), MODE(3) | PULLUDEN | RXACTIVE},
+ /* SPI1_CS0 */
+ {OFFSET(mcasp0_ahclkr), MODE(7) | PULLUDEN | PULLUP_EN | RXACTIVE},
+ /* SPI1_CS1 */
+ {OFFSET(xdma_event_intr0), MODE(7) | PULLUDEN | PULLUP_EN | RXACTIVE},
+ {-1},
+};
+
+static struct module_pin_mux dcan0_pin_mux[] = {
+ /* DCAN0 TX */
+ {OFFSET(uart1_ctsn), MODE(2) | PULLUDEN | PULLUP_EN},
+ /* DCAN0 RX */
+ {OFFSET(uart1_rtsn), MODE(2) | RXACTIVE},
+ {-1},
+};
+
+static struct module_pin_mux dcan1_pin_mux[] = {
+ /* DCAN1 TX */
+ {OFFSET(uart0_ctsn), MODE(2) | PULLUDEN | PULLUP_EN},
+ /* DCAN1 RX */
+ {OFFSET(uart0_rtsn), MODE(2) | RXACTIVE},
+ {-1},
+};
+
+static struct module_pin_mux gpios[] = {
+ /* GPIO0_7 - LVDS_EN */
+ {OFFSET(ecap0_in_pwm0_out), (MODE(7) | PULLUDDIS | PULLDOWN_EN)},
+ /* GPIO0_20 - BKLT_PWM (timer7) */
+ {OFFSET(xdma_event_intr1), (MODE(4) | PULLUDDIS | PULLDOWN_EN)},
+ /* GPIO2_4 - DISON */
+ {OFFSET(gpmc_wen), (MODE(7) | PULLUDDIS | PULLDOWN_EN)},
+ /* GPIO1_24 - RGB_EN */
+ {OFFSET(gpmc_a8), (MODE(7) | PULLUDDIS | PULLDOWN_EN)},
+ /* GPIO1_28 - nPD */
+ {OFFSET(gpmc_be1n), (MODE(7) | PULLUDEN | PULLUP_EN)},
+ /* GPIO2_5 - Watchdog */
+ {OFFSET(gpmc_be0n_cle), (MODE(7) | PULLUDDIS | PULLDOWN_EN)},
+ /* GPIO2_0 - ResetOut */
+ {OFFSET(gpmc_csn3), (MODE(7) | PULLUDEN | PULLUP_EN)},
+ /* GPIO2_2 - BKLT_EN */
+ {OFFSET(gpmc_advn_ale), (MODE(7) | PULLUDDIS | PULLDOWN_EN)},
+ /* GPIO1_17 - GPIO0 */
+ {OFFSET(gpmc_a1), (MODE(7) | PULLUDDIS | RXACTIVE)},
+ /* GPIO1_18 - GPIO1 */
+ {OFFSET(gpmc_a2), (MODE(7) | PULLUDDIS | RXACTIVE)},
+ /* GPIO1_19 - GPIO2 */
+ {OFFSET(gpmc_a3), (MODE(7) | PULLUDDIS | RXACTIVE)},
+ /* GPIO1_22 - GPIO3 */
+ {OFFSET(gpmc_a6), (MODE(7) | PULLUDDIS | RXACTIVE)},
+ /* GPIO1_23 - GPIO4 */
+ {OFFSET(gpmc_a7), (MODE(7) | PULLUDDIS | RXACTIVE)},
+ /* GPIO1_25 - GPIO5 */
+ {OFFSET(gpmc_a9), (MODE(7) | PULLUDDIS | RXACTIVE)},
+ /* GPIO3_7 - GPIO6 */
+ {OFFSET(emu0), (MODE(7) | PULLUDDIS | RXACTIVE)},
+ /* GPIO3_8 - GPIO7 */
+ {OFFSET(emu1), (MODE(7) | PULLUDDIS | RXACTIVE)},
+ /* GPIO3_18 - GPIO8 */
+ {OFFSET(mcasp0_aclkr), (MODE(7) | PULLUDDIS | RXACTIVE)},
+ /* GPIO3_19 - GPIO9 */
+ {OFFSET(mcasp0_fsr), (MODE(7) | PULLUDDIS | RXACTIVE)},
+ /* GPIO3_20 - GPIO10 */
+ {OFFSET(mcasp0_axr1), (MODE(7) | PULLUDDIS | RXACTIVE)},
+ /* GPIO3_21 - GPIO11 */
+ {OFFSET(mcasp0_ahclkx), (MODE(7) | PULLUDDIS | RXACTIVE)},
+ /* GPIO2_28 - DRAM-strapping */
+ {OFFSET(mmc0_dat1), (MODE(7) | PULLUDEN | PULLUP_EN)},
+ /* GPIO2_4 - not routed (Pin U6) */
+ {OFFSET(gpmc_wen), (MODE(7) | PULLUDEN | PULLUP_EN | RXACTIVE)},
+ /* GPIO2_5 - not routed (Pin T6) */
+ {OFFSET(gpmc_be0n_cle), (MODE(7) | PULLUDEN | PULLUP_EN | RXACTIVE)},
+ /* GPIO2_28 - not routed (Pin G15) */
+ {OFFSET(mmc0_dat1), (MODE(7) | PULLUDEN | PULLUP_EN | RXACTIVE)},
+ /* GPIO3_18 - not routed (Pin B12) */
+ {OFFSET(mcasp0_aclkr), (MODE(7) | PULLUDEN | PULLUP_EN | RXACTIVE)},
+ {-1},
+};
+
+static struct module_pin_mux uart0_pin_mux[] = {
+ /* UART0_RXD */
+ {OFFSET(uart0_rxd), (MODE(0) | PULLUDEN | PULLUP_EN | RXACTIVE)},
+ /* UART0_TXD */
+ {OFFSET(uart0_txd), (MODE(0) | PULLUDEN)},
+ {-1},
+};
+
+static struct module_pin_mux uart234_pin_mux[] = {
+ /* UART2_RXD */
+ {OFFSET(mii1_txclk), (MODE(1) | PULLUDEN | PULLUP_EN | RXACTIVE)},
+ /* UART2_TXD */
+ {OFFSET(mii1_rxclk), (MODE(1) | PULLUDEN)},
+
+ /* UART3_RXD */
+ {OFFSET(mii1_rxd3), (MODE(1) | PULLUDEN | PULLUP_EN | RXACTIVE)},
+ /* UART3_TXD */
+ {OFFSET(mmc0_dat0), (MODE(3) | PULLUDEN)},
+ /* UART3_RTS */
+ {OFFSET(mmc0_cmd), (MODE(2) | PULLUDEN)},
+ /* UART3_CTS */
+ {OFFSET(mmc0_clk), (MODE(2) | PULLUDEN | PULLUP_EN | RXACTIVE)},
+
+ /* UART4_RXD */
+ {OFFSET(mii1_txd3), (MODE(3) | PULLUDEN | PULLUP_EN | RXACTIVE)},
+ /* UART4_TXD */
+ {OFFSET(mii1_txd2), (MODE(3) | PULLUDEN)},
+ /* UART4_RTS */
+ {OFFSET(mmc0_dat2), (MODE(3) | PULLUDEN)},
+ /* UART4_CTS */
+ {OFFSET(mmc0_dat3), (MODE(3) | PULLUDEN | PULLUP_EN | RXACTIVE)},
+
+ {-1},
+};
+
+static struct module_pin_mux i2c_pin_mux[] = {
+ /* I2C0_DATA */
+ {OFFSET(i2c0_sda), (MODE(0) | RXACTIVE | PULLUDEN | SLEWCTRL)},
+ /* I2C0_SCLK */
+ {OFFSET(i2c0_scl), (MODE(0) | RXACTIVE | PULLUDEN | SLEWCTRL)},
+ /* I2C1_DATA */
+ {OFFSET(uart1_rxd), (MODE(3) | RXACTIVE | PULLUDEN | SLEWCTRL)},
+ /* I2C1_SCLK */
+ {OFFSET(uart1_txd), (MODE(3) | RXACTIVE | PULLUDEN | SLEWCTRL)},
+ {-1},
+};
+
+static struct module_pin_mux eth_pin_mux[] = {
+ /* ETH1 */
+ {OFFSET(rmii1_refclk), MODE(0) | RXACTIVE}, /* ETH1_REFCLK */
+ {OFFSET(mii1_crs), MODE(1) | RXACTIVE}, /* RMII1_CRSDV */
+ {OFFSET(mii1_rxerr), MODE(1) | RXACTIVE}, /* RMII1_RXER */
+ {OFFSET(mii1_txen), MODE(1)}, /* RMII1_TXEN */
+ {OFFSET(mii1_rxd0), MODE(1) | RXACTIVE}, /* RMII1_RXD0 */
+ {OFFSET(mii1_rxd1), MODE(1) | RXACTIVE}, /* RMII1_RXD1 */
+ {OFFSET(mii1_txd0), MODE(1)}, /* RMII1_TXD0 */
+ {OFFSET(mii1_txd1), MODE(1)}, /* RMII1_TXD1 */
+
+ /* ETH2 */
+ {OFFSET(mii1_col), MODE(1) | RXACTIVE}, /* ETH2_REFCLK */
+ {OFFSET(gpmc_wait0), MODE(3) | RXACTIVE}, /* RMII2_CRSDV */
+ {OFFSET(gpmc_wpn), MODE(3) | RXACTIVE}, /* RMII2_RXER */
+ {OFFSET(gpmc_a0), MODE(3)}, /* RMII2_TXEN */
+ {OFFSET(gpmc_a11), MODE(3) | RXACTIVE}, /* RMII2_RXD0 */
+ {OFFSET(gpmc_a10), MODE(3) | RXACTIVE}, /* RMII2_RXD1 */
+ {OFFSET(gpmc_a5), MODE(3)}, /* RMII2_TXD0 */
+ {OFFSET(gpmc_a4), MODE(3)}, /* RMII2_TXD1 */
+
+ /* gpio2_19, gpio 3_4, not connected on board */
+ {OFFSET(mii1_rxd2), MODE(7) | PULLUDEN | PULLUP_EN | RXACTIVE},
+ {OFFSET(mii1_rxdv), MODE(7) | PULLUDEN | PULLUP_EN | RXACTIVE},
+
+ /* ETH Management */
+ {OFFSET(mdio_data), MODE(0) | RXACTIVE | PULLUP_EN}, /* MDIO_DATA */
+ {OFFSET(mdio_clk), MODE(0) | PULLUP_EN}, /* MDIO_CLK */
+
+ {-1},
+};
+
+static struct module_pin_mux mmc1_pin_mux[] = {
+ {OFFSET(gpmc_ad7), (MODE(1) | RXACTIVE | PULLUP_EN)}, /* MMC1_DAT7 */
+ {OFFSET(gpmc_ad6), (MODE(1) | RXACTIVE | PULLUP_EN)}, /* MMC1_DAT6 */
+ {OFFSET(gpmc_ad5), (MODE(1) | RXACTIVE | PULLUP_EN)}, /* MMC1_DAT5 */
+ {OFFSET(gpmc_ad4), (MODE(1) | RXACTIVE | PULLUP_EN)}, /* MMC1_DAT4 */
+ {OFFSET(gpmc_ad3), (MODE(1) | RXACTIVE | PULLUP_EN)}, /* MMC1_DAT3 */
+ {OFFSET(gpmc_ad2), (MODE(1) | RXACTIVE | PULLUP_EN)}, /* MMC1_DAT2 */
+ {OFFSET(gpmc_ad1), (MODE(1) | RXACTIVE | PULLUP_EN)}, /* MMC1_DAT1 */
+ {OFFSET(gpmc_ad0), (MODE(1) | RXACTIVE | PULLUP_EN)}, /* MMC1_DAT0 */
+ {OFFSET(gpmc_csn1), (MODE(2) | RXACTIVE | PULLUP_EN)}, /* MMC1_CLK */
+ {OFFSET(gpmc_csn2), (MODE(2) | RXACTIVE | PULLUP_EN)}, /* MMC1_CMD */
+ {-1},
+};
+
+static struct module_pin_mux lcd_pin_mux[] = {
+ {OFFSET(lcd_data0), (MODE(0) | PULLUDDIS)}, /* LCD-Data(0) */
+ {OFFSET(lcd_data1), (MODE(0) | PULLUDDIS)}, /* LCD-Data(1) */
+ {OFFSET(lcd_data2), (MODE(0) | PULLUDDIS)}, /* LCD-Data(2) */
+ {OFFSET(lcd_data3), (MODE(0) | PULLUDDIS)}, /* LCD-Data(3) */
+ {OFFSET(lcd_data4), (MODE(0) | PULLUDDIS)}, /* LCD-Data(4) */
+ {OFFSET(lcd_data5), (MODE(0) | PULLUDDIS)}, /* LCD-Data(5) */
+ {OFFSET(lcd_data6), (MODE(0) | PULLUDDIS)}, /* LCD-Data(6) */
+ {OFFSET(lcd_data7), (MODE(0) | PULLUDDIS)}, /* LCD-Data(7) */
+ {OFFSET(lcd_data8), (MODE(0) | PULLUDDIS)}, /* LCD-Data(8) */
+ {OFFSET(lcd_data9), (MODE(0) | PULLUDDIS)}, /* LCD-Data(9) */
+ {OFFSET(lcd_data10), (MODE(0) | PULLUDDIS)}, /* LCD-Data(10) */
+ {OFFSET(lcd_data11), (MODE(0) | PULLUDDIS)}, /* LCD-Data(11) */
+ {OFFSET(lcd_data12), (MODE(0) | PULLUDDIS)}, /* LCD-Data(12) */
+ {OFFSET(lcd_data13), (MODE(0) | PULLUDDIS)}, /* LCD-Data(13) */
+ {OFFSET(lcd_data14), (MODE(0) | PULLUDDIS)}, /* LCD-Data(14) */
+ {OFFSET(lcd_data15), (MODE(0) | PULLUDDIS)}, /* LCD-Data(15) */
+
+ {OFFSET(gpmc_ad8), (MODE(1) | PULLUDDIS)}, /* LCD-Data(16) */
+ {OFFSET(gpmc_ad9), (MODE(1) | PULLUDDIS)}, /* LCD-Data(17) */
+ {OFFSET(gpmc_ad10), (MODE(1) | PULLUDDIS)}, /* LCD-Data(18) */
+ {OFFSET(gpmc_ad11), (MODE(1) | PULLUDDIS)}, /* LCD-Data(19) */
+ {OFFSET(gpmc_ad12), (MODE(1) | PULLUDDIS)}, /* LCD-Data(20) */
+ {OFFSET(gpmc_ad13), (MODE(1) | PULLUDDIS)}, /* LCD-Data(21) */
+ {OFFSET(gpmc_ad14), (MODE(1) | PULLUDDIS)}, /* LCD-Data(22) */
+ {OFFSET(gpmc_ad15), (MODE(1) | PULLUDDIS)}, /* LCD-Data(23) */
+
+ {OFFSET(lcd_vsync), (MODE(0) | PULLUDDIS)}, /* LCD-VSync */
+ {OFFSET(lcd_hsync), (MODE(0) | PULLUDDIS)}, /* LCD-HSync */
+ {OFFSET(lcd_ac_bias_en), (MODE(0) | PULLUDDIS)},/* LCD-DE */
+ {OFFSET(lcd_pclk), (MODE(0) | PULLUDDIS)}, /* LCD-CLK */
+
+ {-1},
+};
+
+void enable_uart0_pin_mux(void)
+{
+ configure_module_pin_mux(uart0_pin_mux);
+}
+
+void enable_i2c_pin_mux(void)
+{
+ configure_module_pin_mux(i2c_pin_mux);
+}
+
+void enable_board_pin_mux(void)
+{
+ configure_module_pin_mux(eth_pin_mux);
+ configure_module_pin_mux(spi0_pin_mux);
+ configure_module_pin_mux(spi1_pin_mux);
+ configure_module_pin_mux(dcan0_pin_mux);
+ configure_module_pin_mux(dcan1_pin_mux);
+ configure_module_pin_mux(uart234_pin_mux);
+ configure_module_pin_mux(mmc1_pin_mux);
+ configure_module_pin_mux(lcd_pin_mux);
+ configure_module_pin_mux(gpios);
+}
diff --git a/board/BuR/brxre1/board.c b/board/BuR/brxre1/board.c
index 0d1c6c4720..873208c668 100644
--- a/board/BuR/brxre1/board.c
+++ b/board/BuR/brxre1/board.c
@@ -9,6 +9,7 @@
*
*/
#include <common.h>
+#include <env.h>
#include <errno.h>
#include <spl.h>
#include <asm/arch/cpu.h>
diff --git a/board/BuR/common/br_resetc.c b/board/BuR/common/br_resetc.c
index c8cc73ab14..c0e7fb65b2 100644
--- a/board/BuR/common/br_resetc.c
+++ b/board/BuR/common/br_resetc.c
@@ -6,6 +6,7 @@
* B&R Industrial Automation GmbH - http://www.br-automation.com/ *
*/
#include <common.h>
+#include <env.h>
#include <errno.h>
#include <i2c.h>
#include <dm/uclass.h>
diff --git a/board/BuR/common/common.c b/board/BuR/common/common.c
index 89087d7dba..148fc9075e 100644
--- a/board/BuR/common/common.c
+++ b/board/BuR/common/common.c
@@ -10,6 +10,7 @@
*/
#include <version.h>
#include <common.h>
+#include <env.h>
#include <fdtdec.h>
#include <i2c.h>
#include <lcd.h>
diff --git a/board/BuS/eb_cpu5282/eb_cpu5282.c b/board/BuS/eb_cpu5282/eb_cpu5282.c
index 379194803a..0b916d2482 100644
--- a/board/BuS/eb_cpu5282/eb_cpu5282.c
+++ b/board/BuS/eb_cpu5282/eb_cpu5282.c
@@ -11,6 +11,7 @@
#include <command.h>
#include "asm/m5282.h"
#include <bmp_layout.h>
+#include <env.h>
#include <status_led.h>
#include <bus_vcxk.h>
diff --git a/board/CZ.NIC/turris_mox/turris_mox.c b/board/CZ.NIC/turris_mox/turris_mox.c
index 3818e3752a..946e20ab49 100644
--- a/board/CZ.NIC/turris_mox/turris_mox.c
+++ b/board/CZ.NIC/turris_mox/turris_mox.c
@@ -8,13 +8,13 @@
#include <asm/io.h>
#include <dm.h>
#include <clk.h>
+#include <env.h>
#include <spi.h>
#include <mvebu/comphy.h>
#include <miiphy.h>
#include <linux/string.h>
#include <linux/libfdt.h>
#include <fdt_support.h>
-#include <environment.h>
#include "mox_sp.h"
diff --git a/board/CZ.NIC/turris_omnia/turris_omnia.c b/board/CZ.NIC/turris_omnia/turris_omnia.c
index 5f6ea35e5f..1d8d08a847 100644
--- a/board/CZ.NIC/turris_omnia/turris_omnia.c
+++ b/board/CZ.NIC/turris_omnia/turris_omnia.c
@@ -8,7 +8,7 @@
*/
#include <common.h>
-#include <environment.h>
+#include <env.h>
#include <i2c.h>
#include <miiphy.h>
#include <netdev.h>
diff --git a/board/CarMediaLab/flea3/flea3.c b/board/CarMediaLab/flea3/flea3.c
index 9eec1b7838..be0bc228ec 100644
--- a/board/CarMediaLab/flea3/flea3.c
+++ b/board/CarMediaLab/flea3/flea3.c
@@ -9,6 +9,7 @@
#include <common.h>
#include <asm/io.h>
+#include <env.h>
#include <linux/errno.h>
#include <asm/arch/imx-regs.h>
#include <asm/arch/crm_regs.h>
diff --git a/board/LaCie/net2big_v2/net2big_v2.c b/board/LaCie/net2big_v2/net2big_v2.c
index fb08e50415..686608d25a 100644
--- a/board/LaCie/net2big_v2/net2big_v2.c
+++ b/board/LaCie/net2big_v2/net2big_v2.c
@@ -10,7 +10,7 @@
#include <common.h>
#include <command.h>
-#include <environment.h>
+#include <env.h>
#include <i2c.h>
#include <asm/mach-types.h>
#include <asm/arch/cpu.h>
diff --git a/board/LaCie/netspace_v2/netspace_v2.c b/board/LaCie/netspace_v2/netspace_v2.c
index 453c0dd467..bd7ab22948 100644
--- a/board/LaCie/netspace_v2/netspace_v2.c
+++ b/board/LaCie/netspace_v2/netspace_v2.c
@@ -10,7 +10,7 @@
#include <common.h>
#include <command.h>
-#include <environment.h>
+#include <env.h>
#include <asm/mach-types.h>
#include <asm/arch/cpu.h>
#include <asm/arch/soc.h>
diff --git a/board/Synology/ds414/cmd_syno.c b/board/Synology/ds414/cmd_syno.c
index 59e6fe0310..777948f90f 100644
--- a/board/Synology/ds414/cmd_syno.c
+++ b/board/Synology/ds414/cmd_syno.c
@@ -7,6 +7,7 @@
#include <common.h>
#include <div64.h>
+#include <env.h>
#include <spi.h>
#include <spi_flash.h>
#include <linux/mtd/mtd.h>
diff --git a/board/alliedtelesis/x530/x530.c b/board/alliedtelesis/x530/x530.c
index 97dbed79dd..e0fa8067c1 100644
--- a/board/alliedtelesis/x530/x530.c
+++ b/board/alliedtelesis/x530/x530.c
@@ -6,6 +6,7 @@
#include <common.h>
#include <command.h>
#include <dm.h>
+#include <env.h>
#include <i2c.h>
#include <wdt.h>
#include <asm/gpio.h>
diff --git a/board/amazon/kc1/kc1.c b/board/amazon/kc1/kc1.c
index 031fd11092..9034c4fbff 100644
--- a/board/amazon/kc1/kc1.c
+++ b/board/amazon/kc1/kc1.c
@@ -7,6 +7,7 @@
#include <config.h>
#include <common.h>
+#include <env.h>
#include <linux/ctype.h>
#include <linux/usb/musb.h>
#include <asm/omap_musb.h>
diff --git a/board/amlogic/p200/p200.c b/board/amlogic/p200/p200.c
index 62f0f4c871..41d331dda2 100644
--- a/board/amlogic/p200/p200.c
+++ b/board/amlogic/p200/p200.c
@@ -5,7 +5,7 @@
#include <common.h>
#include <dm.h>
-#include <environment.h>
+#include <env.h>
#include <asm/io.h>
#include <asm/arch/gx.h>
#include <asm/arch/sm.h>
diff --git a/board/amlogic/p201/p201.c b/board/amlogic/p201/p201.c
index ef0c65cd9f..e46fcaea6d 100644
--- a/board/amlogic/p201/p201.c
+++ b/board/amlogic/p201/p201.c
@@ -5,7 +5,7 @@
#include <common.h>
#include <dm.h>
-#include <environment.h>
+#include <env.h>
#include <asm/io.h>
#include <asm/arch/gx.h>
#include <asm/arch/sm.h>
diff --git a/board/amlogic/p212/p212.c b/board/amlogic/p212/p212.c
index 1159cee4ce..094ab5478d 100644
--- a/board/amlogic/p212/p212.c
+++ b/board/amlogic/p212/p212.c
@@ -6,7 +6,7 @@
#include <common.h>
#include <dm.h>
-#include <environment.h>
+#include <env.h>
#include <asm/io.h>
#include <asm/arch/gx.h>
#include <asm/arch/sm.h>
diff --git a/board/amlogic/q200/q200.c b/board/amlogic/q200/q200.c
index 2ea97c362e..f1faa7418e 100644
--- a/board/amlogic/q200/q200.c
+++ b/board/amlogic/q200/q200.c
@@ -6,7 +6,7 @@
#include <common.h>
#include <dm.h>
-#include <environment.h>
+#include <env.h>
#include <asm/io.h>
#include <asm/arch/gx.h>
#include <asm/arch/mem.h>
diff --git a/board/amlogic/s400/s400.c b/board/amlogic/s400/s400.c
index 02a0e9286c..bdb4eca883 100644
--- a/board/amlogic/s400/s400.c
+++ b/board/amlogic/s400/s400.c
@@ -6,7 +6,6 @@
#include <common.h>
#include <dm.h>
-#include <environment.h>
#include <asm/io.h>
#include <asm/arch/axg.h>
#include <asm/arch/sm.h>
diff --git a/board/amlogic/sei510/MAINTAINERS b/board/amlogic/sei510/MAINTAINERS
new file mode 100644
index 0000000000..8dc655e8cc
--- /dev/null
+++ b/board/amlogic/sei510/MAINTAINERS
@@ -0,0 +1,7 @@
+SEI510
+M: Neil Armstrong <narmstrong@baylibre.com>
+S: Maintained
+L: u-boot-amlogic@groups.io
+F: board/amlogic/sei510/
+F: configs/sei510_defconfig
+F: include/configs/sei510.h
diff --git a/board/amlogic/sei510/Makefile b/board/amlogic/sei510/Makefile
new file mode 100644
index 0000000000..03399a3849
--- /dev/null
+++ b/board/amlogic/sei510/Makefile
@@ -0,0 +1,6 @@
+# SPDX-License-Identifier: GPL-2.0+
+#
+# (C) Copyright 2016 BayLibre, SAS
+# Author: Neil Armstrong <narmstrong@baylibre.com>
+
+obj-y := sei510.o
diff --git a/board/amlogic/sei510/README b/board/amlogic/sei510/README
new file mode 100644
index 0000000000..e47ebc7b3a
--- /dev/null
+++ b/board/amlogic/sei510/README
@@ -0,0 +1,123 @@
+U-Boot for Amlogic SEI510
+=======================
+
+SEI510 is a customer board manufactured by SEI Robotics with the following
+specifications:
+
+ - Amlogic S905X2 ARM Cortex-A53 quad-core SoC
+ - 2GB DDR4 SDRAM
+ - 10/100 Ethernet (Internal PHY)
+ - 1 x USB 3.0 Host
+ - eMMC
+ - SDcard
+ - Infrared receiver
+ - SDIO WiFi Module
+
+Currently the u-boot port supports the following devices:
+ - serial
+ - Ethernet
+ - Regulators
+ - Clock controller
+
+u-boot compilation
+==================
+
+ > export ARCH=arm
+ > export CROSS_COMPILE=aarch64-none-elf-
+ > make sei510_defconfig
+ > make
+
+Image creation
+==============
+
+Amlogic doesn't provide sources for the firmware and for tools needed
+to create the bootloader image, so it is necessary to obtain them from
+the git tree published by the board vendor:
+
+ > wget https://releases.linaro.org/archive/13.11/components/toolchain/binaries/gcc-linaro-aarch64-none-elf-4.8-2013.11_linux.tar.xz
+ > wget https://releases.linaro.org/archive/13.11/components/toolchain/binaries/gcc-linaro-arm-none-eabi-4.8-2013.11_linux.tar.xz
+ > tar xvfJ gcc-linaro-aarch64-none-elf-4.8-2013.11_linux.tar.xz
+ > tar xvfJ gcc-linaro-arm-none-eabi-4.8-2013.11_linux.tar.xz
+ > export PATH=$PWD/gcc-linaro-aarch64-none-elf-4.8-2013.11_linux/bin:$PWD/gcc-linaro-arm-none-eabi-4.8-2013.11_linux/bin:$PATH
+ > git clone https://github.com/BayLibre/u-boot.git -b buildroot-openlinux-20180418 amlogic-u-boot
+ > cd amlogic-u-boot
+ > make g12a_u200_v1_defconfig
+ > make
+ > export UBOOTDIR=$PWD
+
+Download the latest Amlogic Buildroot package, and extract it :
+ > wget http://openlinux2.amlogic.com:8000/ARM/filesystem/Linux_BSP/buildroot_openlinux_kernel_4.9_fbdev_20180706.tar.gz
+ > tar xfz buildroot_openlinux_kernel_4.9_fbdev_20180706.tar.gz buildroot_openlinux_kernel_4.9_fbdev_20180706/bootloader
+ > export BRDIR=$PWD/buildroot_openlinux_kernel_4.9_fbdev_20180706
+ > export FIPDIR=$BRDIR/bootloader/uboot-repo/fip
+
+Go back to mainline U-Boot source tree then :
+ > mkdir fip
+
+ > wget https://github.com/BayLibre/u-boot/releases/download/v2017.11-libretech-cc/blx_fix_g12a.sh -O fip/blx_fix.sh
+ > cp $UBOOTDIR/build/scp_task/bl301.bin fip/
+ > cp $UBOOTDIR/build/board/amlogic/g12a_u200_v1/firmware/acs.bin fip/
+ > cp $BRDIR/bootloader/uboot-repo/bl2/bin/g12a/bl2.bin fip/
+ > cp $BRDIR/bootloader/uboot-repo/bl30/bin/g12a/bl30.bin fip/
+ > cp $BRDIR/bootloader/uboot-repo/bl31_1.3/bin/g12a/bl31.img fip/
+ > cp $FIPDIR/g12a/ddr3_1d.fw fip/
+ > cp $FIPDIR/g12a/ddr4_1d.fw fip/
+ > cp $FIPDIR/g12a/ddr4_2d.fw fip/
+ > cp $FIPDIR/g12a/diag_lpddr4.fw fip/
+ > cp $FIPDIR/g12a/lpddr4_1d.fw fip/
+ > cp $FIPDIR/g12a/lpddr4_2d.fw fip/
+ > cp $FIPDIR/g12a/piei.fw fip/
+ > cp u-boot.bin fip/bl33.bin
+
+ > sh fip/blx_fix.sh \
+ fip/bl30.bin \
+ fip/zero_tmp \
+ fip/bl30_zero.bin \
+ fip/bl301.bin \
+ fip/bl301_zero.bin \
+ fip/bl30_new.bin \
+ bl30
+
+ > sh fip/blx_fix.sh \
+ fip/bl2.bin \
+ fip/zero_tmp \
+ fip/bl2_zero.bin \
+ fip/acs.bin \
+ fip/bl21_zero.bin \
+ fip/bl2_new.bin \
+ bl2
+
+ > $FIPDIR/g12a/aml_encrypt_g12a --bl30sig --input fip/bl30_new.bin \
+ --output fip/bl30_new.bin.g12a.enc \
+ --level v3
+ > $FIPDIR/g12a/aml_encrypt_g12a --bl3sig --input fip/bl30_new.bin.g12a.enc \
+ --output fip/bl30_new.bin.enc \
+ --level v3 --type bl30
+ > $FIPDIR/g12a/aml_encrypt_g12a --bl3sig --input fip/bl31.img \
+ --output fip/bl31.img.enc \
+ --level v3 --type bl31
+ > $FIPDIR/g12a/aml_encrypt_g12a --bl3sig --input fip/bl33.bin --compress lz4 \
+ --output fip/bl33.bin.enc \
+ --level v3 --type bl33
+ > $FIPDIR/g12a/aml_encrypt_g12a --bl2sig --input fip/bl2_new.bin \
+ --output fip/bl2.n.bin.sig
+ > $FIPDIR/g12a/aml_encrypt_g12a --bootmk \
+ --output fip/u-boot.bin \
+ --bl2 fip/bl2.n.bin.sig \
+ --bl30 fip/bl30_new.bin.enc \
+ --bl31 fip/bl31.img.enc \
+ --bl33 fip/bl33.bin.enc \
+ --ddrfw1 fip/ddr4_1d.fw \
+ --ddrfw2 fip/ddr4_2d.fw \
+ --ddrfw3 fip/ddr3_1d.fw \
+ --ddrfw4 fip/piei.fw \
+ --ddrfw5 fip/lpddr4_1d.fw \
+ --ddrfw6 fip/lpddr4_2d.fw \
+ --ddrfw7 fip/diag_lpddr4.fw \
+ --level v3
+
+and then write the image to SD with:
+
+ > DEV=/dev/your_sd_device
+ > dd if=fip/u-boot.bin.sd.bin of=$DEV conv=fsync,notrunc bs=512 skip=1 seek=1
+ > dd if=fip/u-boot.bin.sd.bin of=$DEV conv=fsync,notrunc bs=1 count=444
diff --git a/board/amlogic/sei510/sei510.c b/board/amlogic/sei510/sei510.c
new file mode 100644
index 0000000000..5de610d85f
--- /dev/null
+++ b/board/amlogic/sei510/sei510.c
@@ -0,0 +1,26 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (C) 2016 BayLibre, SAS
+ * Author: Neil Armstrong <narmstrong@baylibre.com>
+ */
+
+#include <common.h>
+#include <dm.h>
+#include <env_internal.h>
+#include <asm/io.h>
+#include <asm/arch/axg.h>
+#include <asm/arch/sm.h>
+#include <asm/arch/eth.h>
+#include <asm/arch/mem.h>
+
+int misc_init_r(void)
+{
+ meson_eth_init(PHY_INTERFACE_MODE_RMII,
+ MESON_USE_INTERNAL_RMII_PHY);
+
+ meson_generate_serial_ethaddr();
+
+ env_set("serial#", "AMLG12ASEI510");
+
+ return 0;
+}
diff --git a/board/amlogic/u200/u200.c b/board/amlogic/u200/u200.c
index 94ee3ce6e4..69fd29d4fe 100644
--- a/board/amlogic/u200/u200.c
+++ b/board/amlogic/u200/u200.c
@@ -6,7 +6,6 @@
#include <common.h>
#include <dm.h>
-#include <environment.h>
#include <asm/io.h>
#include <asm/arch/axg.h>
#include <asm/arch/sm.h>
diff --git a/board/amlogic/w400/w400.c b/board/amlogic/w400/w400.c
index 4737865367..e60dc3a622 100644
--- a/board/amlogic/w400/w400.c
+++ b/board/amlogic/w400/w400.c
@@ -6,7 +6,7 @@
#include <common.h>
#include <dm.h>
-#include <environment.h>
+#include <env_internal.h>
#include <asm/io.h>
#include <asm/arch/eth.h>
diff --git a/board/aristainetos/aristainetos-v2.c b/board/aristainetos/aristainetos-v2.c
index c81c441172..c0a2e41f02 100644
--- a/board/aristainetos/aristainetos-v2.c
+++ b/board/aristainetos/aristainetos-v2.c
@@ -13,6 +13,7 @@
#include <asm/arch/imx-regs.h>
#include <asm/arch/iomux.h>
#include <asm/arch/mx6-pins.h>
+#include <env.h>
#include <linux/errno.h>
#include <asm/gpio.h>
#include <asm/mach-imx/iomux-v3.h>
diff --git a/board/armadeus/apf27/apf27.c b/board/armadeus/apf27/apf27.c
index bf2586d326..20be0c3bd4 100644
--- a/board/armadeus/apf27/apf27.c
+++ b/board/armadeus/apf27/apf27.c
@@ -7,7 +7,6 @@
*/
#include <common.h>
-#include <environment.h>
#include <jffs2/jffs2.h>
#include <nand.h>
#include <netdev.h>
diff --git a/board/armltd/integrator/integrator.c b/board/armltd/integrator/integrator.c
index 69d92a32a5..0a2baa7297 100644
--- a/board/armltd/integrator/integrator.c
+++ b/board/armltd/integrator/integrator.c
@@ -18,6 +18,7 @@
#include <common.h>
#include <dm.h>
+#include <env.h>
#include <netdev.h>
#include <asm/io.h>
#include <dm/platform_data/serial_pl01x.h>
diff --git a/board/atmel/common/board.c b/board/atmel/common/board.c
index 20c3b8c086..c41706c400 100644
--- a/board/atmel/common/board.c
+++ b/board/atmel/common/board.c
@@ -5,6 +5,7 @@
*/
#include <common.h>
+#include <env.h>
#include <w1.h>
#include <w1-eeprom.h>
#include <dm/device-internal.h>
diff --git a/board/atmel/common/mac_eeprom.c b/board/atmel/common/mac_eeprom.c
index 7ff1ec7462..83a7778e99 100644
--- a/board/atmel/common/mac_eeprom.c
+++ b/board/atmel/common/mac_eeprom.c
@@ -6,7 +6,7 @@
#include <common.h>
#include <dm.h>
-#include <environment.h>
+#include <env.h>
#include <i2c_eeprom.h>
#include <netdev.h>
diff --git a/board/atmel/sama5d3xek/sama5d3xek.c b/board/atmel/sama5d3xek/sama5d3xek.c
index e373f45800..acf61486d2 100644
--- a/board/atmel/sama5d3xek/sama5d3xek.c
+++ b/board/atmel/sama5d3xek/sama5d3xek.c
@@ -12,6 +12,7 @@
#include <asm/arch/gpio.h>
#include <asm/arch/clk.h>
#include <debug_uart.h>
+#include <env.h>
#include <linux/ctype.h>
#include <phy.h>
#include <micrel.h>
diff --git a/board/bachmann/ot1200/ot1200.c b/board/bachmann/ot1200/ot1200.c
index 067a970830..36f37084b3 100644
--- a/board/bachmann/ot1200/ot1200.c
+++ b/board/bachmann/ot1200/ot1200.c
@@ -9,6 +9,7 @@
#include <asm/arch/clock.h>
#include <asm/arch/imx-regs.h>
#include <asm/arch/iomux.h>
+#include <env.h>
#include <malloc.h>
#include <asm/arch/mx6-pins.h>
#include <asm/mach-imx/iomux-v3.h>
diff --git a/board/birdland/bav335x/board.c b/board/birdland/bav335x/board.c
index b95186026f..8811583ac6 100644
--- a/board/birdland/bav335x/board.c
+++ b/board/birdland/bav335x/board.c
@@ -8,6 +8,7 @@
*/
#include <common.h>
+#include <env.h>
#include <errno.h>
#include <spl.h>
#include <asm/arch/cpu.h>
@@ -27,9 +28,8 @@
#include <cpsw.h>
#include <power/tps65217.h>
#include <power/tps65910.h>
-#include <environment.h>
+#include <env_internal.h>
#include <watchdog.h>
-#include <environment.h>
#include "board.h"
DECLARE_GLOBAL_DATA_PTR;
diff --git a/board/bluegiga/apx4devkit/apx4devkit.c b/board/bluegiga/apx4devkit/apx4devkit.c
index 9aa87f5ccf..9268aa0daa 100644
--- a/board/bluegiga/apx4devkit/apx4devkit.c
+++ b/board/bluegiga/apx4devkit/apx4devkit.c
@@ -21,6 +21,7 @@
#include <asm/arch/iomux-mx28.h>
#include <asm/arch/clock.h>
#include <asm/arch/sys_proto.h>
+#include <env.h>
#include <linux/mii.h>
#include <miiphy.h>
#include <netdev.h>
diff --git a/board/bluewater/gurnard/gurnard.c b/board/bluewater/gurnard/gurnard.c
index 3cda2fafab..48e31d9065 100644
--- a/board/bluewater/gurnard/gurnard.c
+++ b/board/bluewater/gurnard/gurnard.c
@@ -12,6 +12,7 @@
#include <atmel_lcdc.h>
#include <atmel_mci.h>
#include <dm.h>
+#include <env.h>
#include <lcd.h>
#include <net.h>
#ifndef CONFIG_DM_ETH
diff --git a/board/bosch/guardian/board.c b/board/bosch/guardian/board.c
index 86ab180f5c..ec0c4a17f6 100644
--- a/board/bosch/guardian/board.c
+++ b/board/bosch/guardian/board.c
@@ -11,8 +11,7 @@
#include <common.h>
#include <cpsw.h>
#include <dm.h>
-#include <environment.h>
-#include <environment.h>
+#include <env_internal.h>
#include <errno.h>
#include <i2c.h>
#include <miiphy.h>
diff --git a/board/bosch/shc/board.c b/board/bosch/shc/board.c
index feed63bdf2..a96fdef992 100644
--- a/board/bosch/shc/board.c
+++ b/board/bosch/shc/board.c
@@ -12,6 +12,7 @@
*/
#include <common.h>
+#include <env.h>
#include <errno.h>
#include <spl.h>
#include <asm/arch/cpu.h>
@@ -30,9 +31,8 @@
#include <miiphy.h>
#include <cpsw.h>
#include <power/tps65217.h>
-#include <environment.h>
+#include <env_internal.h>
#include <watchdog.h>
-#include <environment.h>
#include "mmc.h"
#include "board.h"
diff --git a/board/boundary/nitrogen6x/nitrogen6x.c b/board/boundary/nitrogen6x/nitrogen6x.c
index 867eade4bd..26af3f7102 100644
--- a/board/boundary/nitrogen6x/nitrogen6x.c
+++ b/board/boundary/nitrogen6x/nitrogen6x.c
@@ -5,6 +5,7 @@
*/
#include <common.h>
+#include <env.h>
#include <asm/io.h>
#include <asm/arch/clock.h>
#include <asm/arch/imx-regs.h>
diff --git a/board/broadcom/bcm23550_w1d/bcm23550_w1d.c b/board/broadcom/bcm23550_w1d/bcm23550_w1d.c
index 72a32a2765..ce9f0494ee 100644
--- a/board/broadcom/bcm23550_w1d/bcm23550_w1d.c
+++ b/board/broadcom/bcm23550_w1d/bcm23550_w1d.c
@@ -6,6 +6,7 @@
#include <common.h>
#include <asm/io.h>
#include <asm/mach-types.h>
+#include <env.h>
#include <mmc.h>
#include <asm/kona-common/kona_sdhci.h>
#include <asm/kona-common/clk.h>
diff --git a/board/broadcom/bcm28155_ap/bcm28155_ap.c b/board/broadcom/bcm28155_ap/bcm28155_ap.c
index 6faeb6a515..87616386cb 100644
--- a/board/broadcom/bcm28155_ap/bcm28155_ap.c
+++ b/board/broadcom/bcm28155_ap/bcm28155_ap.c
@@ -6,6 +6,7 @@
#include <common.h>
#include <asm/io.h>
#include <asm/mach-types.h>
+#include <env.h>
#include <mmc.h>
#include <asm/kona-common/kona_sdhci.h>
#include <asm/kona-common/clk.h>
diff --git a/board/broadcom/bcmstb/bcmstb.c b/board/broadcom/bcmstb/bcmstb.c
index 7f8e0f951d..5fc2c0591b 100644
--- a/board/broadcom/bcmstb/bcmstb.c
+++ b/board/broadcom/bcmstb/bcmstb.c
@@ -8,6 +8,7 @@
#include <linux/types.h>
#include <common.h>
+#include <env.h>
#include <asm/io.h>
#include <asm/bootm.h>
#include <mach/timer.h>
diff --git a/board/buffalo/lsxl/lsxl.c b/board/buffalo/lsxl/lsxl.c
index bf69a746e4..95d3a5e1f5 100644
--- a/board/buffalo/lsxl/lsxl.c
+++ b/board/buffalo/lsxl/lsxl.c
@@ -8,7 +8,8 @@
*/
#include <common.h>
-#include <environment.h>
+#include <env.h>
+#include <env_internal.h>
#include <net.h>
#include <malloc.h>
#include <netdev.h>
diff --git a/board/cadence/xtfpga/xtfpga.c b/board/cadence/xtfpga/xtfpga.c
index bdda9314a5..256611638a 100644
--- a/board/cadence/xtfpga/xtfpga.c
+++ b/board/cadence/xtfpga/xtfpga.c
@@ -8,6 +8,7 @@
#include <command.h>
#include <dm.h>
#include <dm/platform_data/net_ethoc.h>
+#include <env.h>
#include <linux/ctype.h>
#include <linux/string.h>
#include <linux/stringify.h>
diff --git a/board/ccv/xpress/xpress.c b/board/ccv/xpress/xpress.c
index 35e1c557b5..05286e643c 100644
--- a/board/ccv/xpress/xpress.c
+++ b/board/ccv/xpress/xpress.c
@@ -16,6 +16,7 @@
#include <asm/mach-imx/mxc_i2c.h>
#include <asm/io.h>
#include <common.h>
+#include <env.h>
#include <fsl_esdhc_imx.h>
#include <i2c.h>
#include <miiphy.h>
diff --git a/board/compulab/cl-som-imx7/cl-som-imx7.c b/board/compulab/cl-som-imx7/cl-som-imx7.c
index 94e7bf194b..395d5dce17 100644
--- a/board/compulab/cl-som-imx7/cl-som-imx7.c
+++ b/board/compulab/cl-som-imx7/cl-som-imx7.c
@@ -8,7 +8,7 @@
*/
#include <common.h>
-#include <environment.h>
+#include <env.h>
#include <mmc.h>
#include <phy.h>
#include <netdev.h>
diff --git a/board/compulab/cm_fx6/cm_fx6.c b/board/compulab/cm_fx6/cm_fx6.c
index e9262c64a5..feb7a71f00 100644
--- a/board/compulab/cm_fx6/cm_fx6.c
+++ b/board/compulab/cm_fx6/cm_fx6.c
@@ -11,7 +11,7 @@
#include <ahci.h>
#include <dm.h>
#include <dwc_ahsata.h>
-#include <environment.h>
+#include <env.h>
#include <fsl_esdhc_imx.h>
#include <miiphy.h>
#include <mtd_node.h>
diff --git a/board/compulab/cm_t335/cm_t335.c b/board/compulab/cm_t335/cm_t335.c
index 95cbb77753..6e38745191 100644
--- a/board/compulab/cm_t335/cm_t335.c
+++ b/board/compulab/cm_t335/cm_t335.c
@@ -8,7 +8,7 @@
*/
#include <common.h>
-#include <environment.h>
+#include <env.h>
#include <errno.h>
#include <miiphy.h>
#include <cpsw.h>
diff --git a/board/compulab/cm_t35/cm_t35.c b/board/compulab/cm_t35/cm_t35.c
index 4d171f4900..b52358baac 100644
--- a/board/compulab/cm_t35/cm_t35.c
+++ b/board/compulab/cm_t35/cm_t35.c
@@ -12,7 +12,7 @@
*/
#include <common.h>
-#include <environment.h>
+#include <env.h>
#include <status_led.h>
#include <netdev.h>
#include <net.h>
diff --git a/board/compulab/cm_t54/cm_t54.c b/board/compulab/cm_t54/cm_t54.c
index 504a537f45..811bbb528a 100644
--- a/board/compulab/cm_t54/cm_t54.c
+++ b/board/compulab/cm_t54/cm_t54.c
@@ -8,7 +8,7 @@
*/
#include <common.h>
-#include <environment.h>
+#include <env.h>
#include <fdt_support.h>
#include <usb.h>
#include <mmc.h>
diff --git a/board/compulab/common/omap3_display.c b/board/compulab/common/omap3_display.c
index bc9f31ab87..cb9ebae7f9 100644
--- a/board/compulab/common/omap3_display.c
+++ b/board/compulab/common/omap3_display.c
@@ -10,6 +10,7 @@
#include <common.h>
#include <asm/gpio.h>
#include <asm/io.h>
+#include <env.h>
#include <stdio_dev.h>
#include <asm/arch/dss.h>
#include <lcd.h>
diff --git a/board/congatec/cgtqmx6eval/cgtqmx6eval.c b/board/congatec/cgtqmx6eval/cgtqmx6eval.c
index 7c767fb8b4..6b3d5b833f 100644
--- a/board/congatec/cgtqmx6eval/cgtqmx6eval.c
+++ b/board/congatec/cgtqmx6eval/cgtqmx6eval.c
@@ -20,6 +20,7 @@
#include <asm/arch/sys_proto.h>
#include <asm/arch/mxc_hdmi.h>
#include <asm/arch/crm_regs.h>
+#include <env.h>
#include <mmc.h>
#include <fsl_esdhc_imx.h>
#include <i2c.h>
diff --git a/board/cssi/MCR3000/MCR3000.c b/board/cssi/MCR3000/MCR3000.c
index d26ac35b44..445b84c180 100644
--- a/board/cssi/MCR3000/MCR3000.c
+++ b/board/cssi/MCR3000/MCR3000.c
@@ -8,6 +8,7 @@
*/
#include <common.h>
+#include <env.h>
#include <hwconfig.h>
#include <mpc8xx.h>
#include <fdt_support.h>
diff --git a/board/davinci/da8xxevm/da850evm.c b/board/davinci/da8xxevm/da850evm.c
index 2d5710076d..b2b2fa272a 100644
--- a/board/davinci/da8xxevm/da850evm.c
+++ b/board/davinci/da8xxevm/da850evm.c
@@ -10,7 +10,7 @@
#include <common.h>
#include <dm.h>
-#include <environment.h>
+#include <env.h>
#include <i2c.h>
#include <net.h>
#include <spi.h>
@@ -234,7 +234,8 @@ const struct pinmux_resource pinmuxes[] = {
PINMUX_ITEM(emifa_pins_cs3),
PINMUX_ITEM(emifa_pins_cs4),
PINMUX_ITEM(emifa_pins_nand),
-#elif defined(CONFIG_USE_NOR)
+#endif
+#ifdef CONFIG_USE_NOR
PINMUX_ITEM(emifa_pins_cs2),
PINMUX_ITEM(emifa_pins_nor),
#endif
diff --git a/board/davinci/da8xxevm/omapl138_lcdk.c b/board/davinci/da8xxevm/omapl138_lcdk.c
index 578d928443..08881f039d 100644
--- a/board/davinci/da8xxevm/omapl138_lcdk.c
+++ b/board/davinci/da8xxevm/omapl138_lcdk.c
@@ -9,6 +9,7 @@
*/
#include <common.h>
+#include <env.h>
#include <i2c.h>
#include <net.h>
#include <asm/arch/hardware.h>
diff --git a/board/dhelectronics/dh_imx6/dh_imx6.c b/board/dhelectronics/dh_imx6/dh_imx6.c
index 40cc2a854e..2d0f78da11 100644
--- a/board/dhelectronics/dh_imx6/dh_imx6.c
+++ b/board/dhelectronics/dh_imx6/dh_imx6.c
@@ -21,7 +21,7 @@
#include <asm/mach-imx/sata.h>
#include <ahci.h>
#include <dwc_ahsata.h>
-#include <environment.h>
+#include <env.h>
#include <errno.h>
#include <fsl_esdhc_imx.h>
#include <fuse.h>
diff --git a/board/eets/pdu001/board.c b/board/eets/pdu001/board.c
index b857a5a935..8a3d0ada27 100644
--- a/board/eets/pdu001/board.c
+++ b/board/eets/pdu001/board.c
@@ -10,10 +10,10 @@
*/
#include <common.h>
+#include <env.h>
#include <errno.h>
#include <spl.h>
#include <i2c.h>
-#include <environment.h>
#include <watchdog.h>
#include <debug_uart.h>
#include <dm/ofnode.h>
diff --git a/board/el/el6x/el6x.c b/board/el/el6x/el6x.c
index 55db26a819..18d69a7da3 100644
--- a/board/el/el6x/el6x.c
+++ b/board/el/el6x/el6x.c
@@ -9,6 +9,7 @@
#include <asm/arch/imx-regs.h>
#include <asm/arch/iomux.h>
#include <asm/arch/mx6-pins.h>
+#include <env.h>
#include <linux/errno.h>
#include <asm/gpio.h>
#include <asm/mach-imx/mxc_i2c.h>
diff --git a/board/emulation/qemu-riscv/qemu-riscv.c b/board/emulation/qemu-riscv/qemu-riscv.c
index d6167aaef1..49e304f7eb 100644
--- a/board/emulation/qemu-riscv/qemu-riscv.c
+++ b/board/emulation/qemu-riscv/qemu-riscv.c
@@ -5,6 +5,7 @@
#include <common.h>
#include <dm.h>
+#include <env.h>
#include <fdtdec.h>
#include <virtio_types.h>
#include <virtio.h>
diff --git a/board/engicam/common/board.c b/board/engicam/common/board.c
index 567b9f63e5..0c47afe5b5 100644
--- a/board/engicam/common/board.c
+++ b/board/engicam/common/board.c
@@ -6,6 +6,7 @@
*/
#include <common.h>
+#include <env.h>
#include <mmc.h>
#include <asm/arch/sys_proto.h>
#include <watchdog.h>
diff --git a/board/esd/meesc/meesc.c b/board/esd/meesc/meesc.c
index 29b6341132..b0d2f7b6f8 100644
--- a/board/esd/meesc/meesc.c
+++ b/board/esd/meesc/meesc.c
@@ -10,6 +10,7 @@
*/
#include <common.h>
+#include <env.h>
#include <asm/io.h>
#include <asm/gpio.h>
#include <asm/mach-types.h>
diff --git a/board/freescale/b4860qds/b4860qds.c b/board/freescale/b4860qds/b4860qds.c
index 9eed95b656..33cd4b4964 100644
--- a/board/freescale/b4860qds/b4860qds.c
+++ b/board/freescale/b4860qds/b4860qds.c
@@ -5,6 +5,7 @@
#include <common.h>
#include <command.h>
+#include <env.h>
#include <i2c.h>
#include <netdev.h>
#include <linux/compiler.h>
diff --git a/board/freescale/b4860qds/spl.c b/board/freescale/b4860qds/spl.c
index 887fa04627..6dfc0c73ec 100644
--- a/board/freescale/b4860qds/spl.c
+++ b/board/freescale/b4860qds/spl.c
@@ -4,7 +4,8 @@
#include <common.h>
#include <console.h>
-#include <environment.h>
+#include <env.h>
+#include <env_internal.h>
#include <asm/spl.h>
#include <malloc.h>
#include <ns16550.h>
diff --git a/board/freescale/bsc9131rdb/bsc9131rdb.c b/board/freescale/bsc9131rdb/bsc9131rdb.c
index 9d9c83f716..30e7a1f7ed 100644
--- a/board/freescale/bsc9131rdb/bsc9131rdb.c
+++ b/board/freescale/bsc9131rdb/bsc9131rdb.c
@@ -9,6 +9,7 @@
#include <asm/cache.h>
#include <asm/immap_85xx.h>
#include <asm/io.h>
+#include <env.h>
#include <miiphy.h>
#include <linux/libfdt.h>
#include <fdt_support.h>
diff --git a/board/freescale/bsc9132qds/bsc9132qds.c b/board/freescale/bsc9132qds/bsc9132qds.c
index 36a55285e8..dd9ad90508 100644
--- a/board/freescale/bsc9132qds/bsc9132qds.c
+++ b/board/freescale/bsc9132qds/bsc9132qds.c
@@ -9,6 +9,7 @@
#include <asm/cache.h>
#include <asm/immap_85xx.h>
#include <asm/io.h>
+#include <env.h>
#include <miiphy.h>
#include <linux/libfdt.h>
#include <fdt_support.h>
diff --git a/board/freescale/c29xpcie/c29xpcie.c b/board/freescale/c29xpcie/c29xpcie.c
index 8ee3e140bb..6d103be7ff 100644
--- a/board/freescale/c29xpcie/c29xpcie.c
+++ b/board/freescale/c29xpcie/c29xpcie.c
@@ -9,6 +9,7 @@
#include <asm/cache.h>
#include <asm/immap_85xx.h>
#include <asm/io.h>
+#include <env.h>
#include <miiphy.h>
#include <linux/libfdt.h>
#include <fdt_support.h>
diff --git a/board/freescale/c29xpcie/spl.c b/board/freescale/c29xpcie/spl.c
index 5db60d8ed9..29040962cf 100644
--- a/board/freescale/c29xpcie/spl.c
+++ b/board/freescale/c29xpcie/spl.c
@@ -4,7 +4,7 @@
#include <common.h>
#include <console.h>
-#include <environment.h>
+#include <env_internal.h>
#include <ns16550.h>
#include <malloc.h>
#include <mmc.h>
diff --git a/board/freescale/common/cmd_esbc_validate.c b/board/freescale/common/cmd_esbc_validate.c
index b06235f291..36b620ca23 100644
--- a/board/freescale/common/cmd_esbc_validate.c
+++ b/board/freescale/common/cmd_esbc_validate.c
@@ -5,6 +5,7 @@
#include <common.h>
#include <command.h>
+#include <env.h>
#include <fsl_validate.h>
int do_esbc_halt(cmd_tbl_t *cmdtp, int flag, int argc,
diff --git a/board/freescale/common/fsl_chain_of_trust.c b/board/freescale/common/fsl_chain_of_trust.c
index dddfd26a13..a024e7239e 100644
--- a/board/freescale/common/fsl_chain_of_trust.c
+++ b/board/freescale/common/fsl_chain_of_trust.c
@@ -5,6 +5,7 @@
#include <common.h>
#include <dm.h>
+#include <env.h>
#include <fsl_validate.h>
#include <fsl_secboot_err.h>
#include <fsl_sfp.h>
diff --git a/board/freescale/common/sys_eeprom.c b/board/freescale/common/sys_eeprom.c
index ab0fe0baf1..510d7c266b 100644
--- a/board/freescale/common/sys_eeprom.c
+++ b/board/freescale/common/sys_eeprom.c
@@ -8,6 +8,7 @@
#include <common.h>
#include <command.h>
+#include <env.h>
#include <i2c.h>
#include <linux/ctype.h>
diff --git a/board/freescale/common/vid.c b/board/freescale/common/vid.c
index 0ca389c9ae..b804971981 100644
--- a/board/freescale/common/vid.c
+++ b/board/freescale/common/vid.c
@@ -5,6 +5,7 @@
#include <common.h>
#include <command.h>
+#include <env.h>
#include <i2c.h>
#include <asm/io.h>
#ifdef CONFIG_FSL_LSCH2
diff --git a/board/freescale/corenet_ds/corenet_ds.c b/board/freescale/corenet_ds/corenet_ds.c
index b166faf326..3ce9a76aae 100644
--- a/board/freescale/corenet_ds/corenet_ds.c
+++ b/board/freescale/corenet_ds/corenet_ds.c
@@ -5,6 +5,7 @@
#include <common.h>
#include <command.h>
+#include <env.h>
#include <netdev.h>
#include <linux/compiler.h>
#include <asm/mmu.h>
diff --git a/board/freescale/imx8mq_evk/imx8mq_evk.c b/board/freescale/imx8mq_evk/imx8mq_evk.c
index 322713cced..1463e6e696 100644
--- a/board/freescale/imx8mq_evk/imx8mq_evk.c
+++ b/board/freescale/imx8mq_evk/imx8mq_evk.c
@@ -4,6 +4,7 @@
*/
#include <common.h>
+#include <env.h>
#include <malloc.h>
#include <errno.h>
#include <asm/io.h>
diff --git a/board/freescale/imx8qm_mek/imx8qm_mek.c b/board/freescale/imx8qm_mek/imx8qm_mek.c
index b7a609b097..76634a3a28 100644
--- a/board/freescale/imx8qm_mek/imx8qm_mek.c
+++ b/board/freescale/imx8qm_mek/imx8qm_mek.c
@@ -4,9 +4,9 @@
*/
#include <common.h>
+#include <env.h>
#include <errno.h>
#include <linux/libfdt.h>
-#include <environment.h>
#include <asm/io.h>
#include <asm/gpio.h>
#include <asm/arch/clock.h>
diff --git a/board/freescale/imx8qxp_mek/imx8qxp_mek.c b/board/freescale/imx8qxp_mek/imx8qxp_mek.c
index 3cf73e1ab6..4ba8314284 100644
--- a/board/freescale/imx8qxp_mek/imx8qxp_mek.c
+++ b/board/freescale/imx8qxp_mek/imx8qxp_mek.c
@@ -4,9 +4,9 @@
*/
#include <common.h>
+#include <env.h>
#include <errno.h>
#include <linux/libfdt.h>
-#include <environment.h>
#include <fsl_esdhc_imx.h>
#include <asm/io.h>
#include <asm/gpio.h>
diff --git a/board/freescale/ls1012afrdm/ls1012afrdm.c b/board/freescale/ls1012afrdm/ls1012afrdm.c
index b4c611e19f..31e41ce169 100644
--- a/board/freescale/ls1012afrdm/ls1012afrdm.c
+++ b/board/freescale/ls1012afrdm/ls1012afrdm.c
@@ -15,7 +15,7 @@
#include <asm/arch/soc.h>
#include <fsl_esdhc.h>
#include <hwconfig.h>
-#include <environment.h>
+#include <env_internal.h>
#include <fsl_mmdc.h>
#include <netdev.h>
#include <fsl_sec.h>
diff --git a/board/freescale/ls1012aqds/ls1012aqds.c b/board/freescale/ls1012aqds/ls1012aqds.c
index a862fe6a93..86c72ee357 100644
--- a/board/freescale/ls1012aqds/ls1012aqds.c
+++ b/board/freescale/ls1012aqds/ls1012aqds.c
@@ -18,7 +18,7 @@
#include <ahci.h>
#include <hwconfig.h>
#include <mmc.h>
-#include <environment.h>
+#include <env_internal.h>
#include <scsi.h>
#include <fm_eth.h>
#include <fsl_esdhc.h>
diff --git a/board/freescale/ls1012ardb/ls1012ardb.c b/board/freescale/ls1012ardb/ls1012ardb.c
index f648a9040b..e4527c19b8 100644
--- a/board/freescale/ls1012ardb/ls1012ardb.c
+++ b/board/freescale/ls1012ardb/ls1012ardb.c
@@ -18,7 +18,7 @@
#include <mmc.h>
#include <scsi.h>
#include <fsl_esdhc.h>
-#include <environment.h>
+#include <env_internal.h>
#include <fsl_mmdc.h>
#include <netdev.h>
#include <fsl_sec.h>
diff --git a/board/freescale/ls1028a/ls1028a.c b/board/freescale/ls1028a/ls1028a.c
index e5de4eb70c..4aa7cec9ce 100644
--- a/board/freescale/ls1028a/ls1028a.c
+++ b/board/freescale/ls1028a/ls1028a.c
@@ -11,7 +11,7 @@
#include <hwconfig.h>
#include <fdt_support.h>
#include <linux/libfdt.h>
-#include <environment.h>
+#include <env_internal.h>
#include <asm/arch-fsl-layerscape/soc.h>
#include <i2c.h>
#include <asm/arch/soc.h>
diff --git a/board/freescale/ls1088a/eth_ls1088aqds.c b/board/freescale/ls1088a/eth_ls1088aqds.c
index f16b78cf03..d4ab9791e9 100644
--- a/board/freescale/ls1088a/eth_ls1088aqds.c
+++ b/board/freescale/ls1088a/eth_ls1088aqds.c
@@ -5,6 +5,7 @@
#include <common.h>
#include <command.h>
+#include <env.h>
#include <netdev.h>
#include <asm/io.h>
#include <asm/arch/fsl_serdes.h>
diff --git a/board/freescale/ls1088a/ls1088a.c b/board/freescale/ls1088a/ls1088a.c
index 6d11a134dc..f0bea7327d 100644
--- a/board/freescale/ls1088a/ls1088a.c
+++ b/board/freescale/ls1088a/ls1088a.c
@@ -3,6 +3,7 @@
* Copyright 2017-2018 NXP
*/
#include <common.h>
+#include <env.h>
#include <i2c.h>
#include <malloc.h>
#include <errno.h>
@@ -14,7 +15,7 @@
#include <fdt_support.h>
#include <linux/libfdt.h>
#include <fsl-mc/fsl_mc.h>
-#include <environment.h>
+#include <env_internal.h>
#include <asm/arch-fsl-layerscape/soc.h>
#include <asm/arch/ppa.h>
#include <hwconfig.h>
diff --git a/board/freescale/ls2080a/ls2080a.c b/board/freescale/ls2080a/ls2080a.c
index cc1822d0f5..413a698511 100644
--- a/board/freescale/ls2080a/ls2080a.c
+++ b/board/freescale/ls2080a/ls2080a.c
@@ -12,7 +12,7 @@
#include <fdt_support.h>
#include <linux/libfdt.h>
#include <fsl-mc/fsl_mc.h>
-#include <environment.h>
+#include <env_internal.h>
#include <asm/arch/soc.h>
DECLARE_GLOBAL_DATA_PTR;
diff --git a/board/freescale/ls2080aqds/eth.c b/board/freescale/ls2080aqds/eth.c
index f706fd4cb6..1b4e6c65fb 100644
--- a/board/freescale/ls2080aqds/eth.c
+++ b/board/freescale/ls2080aqds/eth.c
@@ -4,6 +4,7 @@
*/
#include <common.h>
+#include <env.h>
#include <netdev.h>
#include <asm/io.h>
#include <asm/arch/fsl_serdes.h>
diff --git a/board/freescale/ls2080aqds/ls2080aqds.c b/board/freescale/ls2080aqds/ls2080aqds.c
index a0a3301691..e9c055745f 100644
--- a/board/freescale/ls2080aqds/ls2080aqds.c
+++ b/board/freescale/ls2080aqds/ls2080aqds.c
@@ -3,6 +3,7 @@
* Copyright 2015 Freescale Semiconductor
*/
#include <common.h>
+#include <env.h>
#include <malloc.h>
#include <errno.h>
#include <netdev.h>
@@ -12,7 +13,7 @@
#include <fdt_support.h>
#include <linux/libfdt.h>
#include <fsl-mc/fsl_mc.h>
-#include <environment.h>
+#include <env_internal.h>
#include <i2c.h>
#include <rtc.h>
#include <asm/arch/soc.h>
diff --git a/board/freescale/ls2080ardb/ls2080ardb.c b/board/freescale/ls2080ardb/ls2080ardb.c
index ce419dfcae..2b2dbbb0ce 100644
--- a/board/freescale/ls2080ardb/ls2080ardb.c
+++ b/board/freescale/ls2080ardb/ls2080ardb.c
@@ -4,6 +4,7 @@
* Copyright 2017 NXP
*/
#include <common.h>
+#include <env.h>
#include <malloc.h>
#include <errno.h>
#include <netdev.h>
@@ -14,7 +15,7 @@
#include <fdt_support.h>
#include <linux/libfdt.h>
#include <fsl-mc/fsl_mc.h>
-#include <environment.h>
+#include <env_internal.h>
#include <efi_loader.h>
#include <i2c.h>
#include <asm/arch/mmu.h>
diff --git a/board/freescale/lx2160a/eth_lx2160aqds.c b/board/freescale/lx2160a/eth_lx2160aqds.c
index f6e22d7337..92c06e5060 100644
--- a/board/freescale/lx2160a/eth_lx2160aqds.c
+++ b/board/freescale/lx2160a/eth_lx2160aqds.c
@@ -5,6 +5,7 @@
*/
#include <common.h>
+#include <env.h>
#include <hwconfig.h>
#include <command.h>
#include <netdev.h>
diff --git a/board/freescale/lx2160a/lx2160a.c b/board/freescale/lx2160a/lx2160a.c
index 3b4cb86692..f3885fa8b7 100644
--- a/board/freescale/lx2160a/lx2160a.c
+++ b/board/freescale/lx2160a/lx2160a.c
@@ -16,7 +16,7 @@
#include <fdt_support.h>
#include <linux/libfdt.h>
#include <fsl-mc/fsl_mc.h>
-#include <environment.h>
+#include <env_internal.h>
#include <efi_loader.h>
#include <asm/arch/mmu.h>
#include <hwconfig.h>
diff --git a/board/freescale/mpc8323erdb/mpc8323erdb.c b/board/freescale/mpc8323erdb/mpc8323erdb.c
index 2dc6d7f5f5..e5aecc4e1f 100644
--- a/board/freescale/mpc8323erdb/mpc8323erdb.c
+++ b/board/freescale/mpc8323erdb/mpc8323erdb.c
@@ -10,6 +10,7 @@
*/
#include <common.h>
+#include <env.h>
#include <ioports.h>
#include <mpc83xx.h>
#include <i2c.h>
diff --git a/board/freescale/mpc837xemds/pci.c b/board/freescale/mpc837xemds/pci.c
index 4217638952..41b78cf5e4 100644
--- a/board/freescale/mpc837xemds/pci.c
+++ b/board/freescale/mpc837xemds/pci.c
@@ -6,6 +6,7 @@
#include <asm/mmu.h>
#include <asm/io.h>
#include <common.h>
+#include <env.h>
#include <mpc83xx.h>
#include <pci.h>
#include <i2c.h>
diff --git a/board/freescale/mpc837xerdb/mpc837xerdb.c b/board/freescale/mpc837xerdb/mpc837xerdb.c
index 18f396aac8..4ad62bcf1d 100644
--- a/board/freescale/mpc837xerdb/mpc837xerdb.c
+++ b/board/freescale/mpc837xerdb/mpc837xerdb.c
@@ -6,6 +6,7 @@
*/
#include <common.h>
+#include <env.h>
#include <hwconfig.h>
#include <i2c.h>
#include <asm/io.h>
diff --git a/board/freescale/mpc8572ds/mpc8572ds.c b/board/freescale/mpc8572ds/mpc8572ds.c
index 6abeeba43b..89f4d6c05f 100644
--- a/board/freescale/mpc8572ds/mpc8572ds.c
+++ b/board/freescale/mpc8572ds/mpc8572ds.c
@@ -5,6 +5,7 @@
#include <common.h>
#include <command.h>
+#include <env.h>
#include <pci.h>
#include <asm/processor.h>
#include <asm/mmu.h>
diff --git a/board/freescale/mx51evk/mx51evk_video.c b/board/freescale/mx51evk/mx51evk_video.c
index 995fb9a9ab..3715c5d738 100644
--- a/board/freescale/mx51evk/mx51evk_video.c
+++ b/board/freescale/mx51evk/mx51evk_video.c
@@ -5,6 +5,7 @@
*/
#include <common.h>
+#include <env.h>
#include <linux/list.h>
#include <asm/gpio.h>
#include <asm/arch/iomux-mx51.h>
diff --git a/board/freescale/mx53loco/mx53loco.c b/board/freescale/mx53loco/mx53loco.c
index d023ce667d..a177815bb8 100644
--- a/board/freescale/mx53loco/mx53loco.c
+++ b/board/freescale/mx53loco/mx53loco.c
@@ -12,6 +12,7 @@
#include <asm/arch/clock.h>
#include <asm/arch/iomux-mx53.h>
#include <asm/arch/clock.h>
+#include <env.h>
#include <linux/errno.h>
#include <asm/mach-imx/mx5_video.h>
#include <netdev.h>
diff --git a/board/freescale/mx53loco/mx53loco_video.c b/board/freescale/mx53loco/mx53loco_video.c
index 160af1ef0d..ff3fc8ce3e 100644
--- a/board/freescale/mx53loco/mx53loco_video.c
+++ b/board/freescale/mx53loco/mx53loco_video.c
@@ -5,6 +5,7 @@
*/
#include <common.h>
+#include <env.h>
#include <linux/list.h>
#include <asm/gpio.h>
#include <asm/arch/iomux-mx53.h>
diff --git a/board/freescale/mx6sabreauto/mx6sabreauto.c b/board/freescale/mx6sabreauto/mx6sabreauto.c
index e1a3b47425..dc156efbbc 100644
--- a/board/freescale/mx6sabreauto/mx6sabreauto.c
+++ b/board/freescale/mx6sabreauto/mx6sabreauto.c
@@ -11,6 +11,7 @@
#include <asm/arch/imx-regs.h>
#include <asm/arch/iomux.h>
#include <asm/arch/mx6-pins.h>
+#include <env.h>
#include <linux/errno.h>
#include <asm/gpio.h>
#include <asm/mach-imx/iomux-v3.h>
diff --git a/board/freescale/mx6sabresd/mx6sabresd.c b/board/freescale/mx6sabresd/mx6sabresd.c
index 63e1dd0a83..b0c0117968 100644
--- a/board/freescale/mx6sabresd/mx6sabresd.c
+++ b/board/freescale/mx6sabresd/mx6sabresd.c
@@ -10,6 +10,7 @@
#include <asm/arch/iomux.h>
#include <asm/arch/mx6-pins.h>
#include <asm/mach-imx/spi.h>
+#include <env.h>
#include <linux/errno.h>
#include <asm/gpio.h>
#include <asm/mach-imx/mxc_i2c.h>
diff --git a/board/freescale/mx6sxsabresd/mx6sxsabresd.c b/board/freescale/mx6sxsabresd/mx6sxsabresd.c
index 8ee85cc384..1c10958879 100644
--- a/board/freescale/mx6sxsabresd/mx6sxsabresd.c
+++ b/board/freescale/mx6sxsabresd/mx6sxsabresd.c
@@ -15,6 +15,7 @@
#include <asm/mach-imx/iomux-v3.h>
#include <asm/io.h>
#include <asm/mach-imx/mxc_i2c.h>
+#include <env.h>
#include <linux/sizes.h>
#include <common.h>
#include <fsl_esdhc_imx.h>
diff --git a/board/freescale/mx6ul_14x14_evk/mx6ul_14x14_evk.c b/board/freescale/mx6ul_14x14_evk/mx6ul_14x14_evk.c
index 785247f7e2..ccbe404478 100644
--- a/board/freescale/mx6ul_14x14_evk/mx6ul_14x14_evk.c
+++ b/board/freescale/mx6ul_14x14_evk/mx6ul_14x14_evk.c
@@ -16,6 +16,7 @@
#include <asm/mach-imx/mxc_i2c.h>
#include <asm/io.h>
#include <common.h>
+#include <env.h>
#include <fsl_esdhc_imx.h>
#include <i2c.h>
#include <miiphy.h>
diff --git a/board/freescale/mx6ullevk/mx6ullevk.c b/board/freescale/mx6ullevk/mx6ullevk.c
index 1f0f70efbd..e119347802 100644
--- a/board/freescale/mx6ullevk/mx6ullevk.c
+++ b/board/freescale/mx6ullevk/mx6ullevk.c
@@ -14,6 +14,7 @@
#include <asm/mach-imx/boot_mode.h>
#include <asm/io.h>
#include <common.h>
+#include <env.h>
#include <fsl_esdhc_imx.h>
#include <linux/sizes.h>
#include <mmc.h>
diff --git a/board/freescale/p1010rdb/p1010rdb.c b/board/freescale/p1010rdb/p1010rdb.c
index b0db353167..449df937e6 100644
--- a/board/freescale/p1010rdb/p1010rdb.c
+++ b/board/freescale/p1010rdb/p1010rdb.c
@@ -9,6 +9,7 @@
#include <asm/cache.h>
#include <asm/immap_85xx.h>
#include <asm/io.h>
+#include <env.h>
#include <miiphy.h>
#include <linux/libfdt.h>
#include <fdt_support.h>
diff --git a/board/freescale/p1010rdb/spl.c b/board/freescale/p1010rdb/spl.c
index e07640a0ed..8f050b3947 100644
--- a/board/freescale/p1010rdb/spl.c
+++ b/board/freescale/p1010rdb/spl.c
@@ -4,7 +4,8 @@
#include <common.h>
#include <console.h>
-#include <environment.h>
+#include <env.h>
+#include <env_internal.h>
#include <ns16550.h>
#include <malloc.h>
#include <mmc.h>
diff --git a/board/freescale/p1022ds/p1022ds.c b/board/freescale/p1022ds/p1022ds.c
index 835ede562e..9406e75517 100644
--- a/board/freescale/p1022ds/p1022ds.c
+++ b/board/freescale/p1022ds/p1022ds.c
@@ -7,6 +7,7 @@
#include <common.h>
#include <command.h>
+#include <env.h>
#include <pci.h>
#include <asm/processor.h>
#include <asm/mmu.h>
diff --git a/board/freescale/p1022ds/spl.c b/board/freescale/p1022ds/spl.c
index cfdd9fc9c9..06273f1d20 100644
--- a/board/freescale/p1022ds/spl.c
+++ b/board/freescale/p1022ds/spl.c
@@ -5,7 +5,8 @@
#include <common.h>
#include <console.h>
-#include <environment.h>
+#include <env.h>
+#include <env_internal.h>
#include <ns16550.h>
#include <malloc.h>
#include <mmc.h>
diff --git a/board/freescale/p1023rdb/p1023rdb.c b/board/freescale/p1023rdb/p1023rdb.c
index d0012ea38b..7db04043ca 100644
--- a/board/freescale/p1023rdb/p1023rdb.c
+++ b/board/freescale/p1023rdb/p1023rdb.c
@@ -8,6 +8,7 @@
#include <common.h>
#include <command.h>
+#include <env.h>
#include <pci.h>
#include <asm/io.h>
#include <asm/cache.h>
diff --git a/board/freescale/p1_p2_rdb_pc/p1_p2_rdb_pc.c b/board/freescale/p1_p2_rdb_pc/p1_p2_rdb_pc.c
index 4b151e8ef3..a04a73528f 100644
--- a/board/freescale/p1_p2_rdb_pc/p1_p2_rdb_pc.c
+++ b/board/freescale/p1_p2_rdb_pc/p1_p2_rdb_pc.c
@@ -5,6 +5,7 @@
#include <common.h>
#include <command.h>
+#include <env.h>
#include <hwconfig.h>
#include <pci.h>
#include <i2c.h>
diff --git a/board/freescale/p1_p2_rdb_pc/spl.c b/board/freescale/p1_p2_rdb_pc/spl.c
index 48ab271fb2..dbf9f739b2 100644
--- a/board/freescale/p1_p2_rdb_pc/spl.c
+++ b/board/freescale/p1_p2_rdb_pc/spl.c
@@ -5,7 +5,8 @@
#include <common.h>
#include <console.h>
-#include <environment.h>
+#include <env.h>
+#include <env_internal.h>
#include <ns16550.h>
#include <malloc.h>
#include <mmc.h>
diff --git a/board/freescale/p1_twr/p1_twr.c b/board/freescale/p1_twr/p1_twr.c
index fe99ebf4b2..01cac181b3 100644
--- a/board/freescale/p1_twr/p1_twr.c
+++ b/board/freescale/p1_twr/p1_twr.c
@@ -5,6 +5,7 @@
#include <common.h>
#include <command.h>
+#include <env.h>
#include <hwconfig.h>
#include <pci.h>
#include <i2c.h>
diff --git a/board/freescale/p2041rdb/p2041rdb.c b/board/freescale/p2041rdb/p2041rdb.c
index 6324027c8a..baf1506908 100644
--- a/board/freescale/p2041rdb/p2041rdb.c
+++ b/board/freescale/p2041rdb/p2041rdb.c
@@ -5,6 +5,7 @@
#include <common.h>
#include <command.h>
+#include <env.h>
#include <netdev.h>
#include <linux/compiler.h>
#include <asm/mmu.h>
diff --git a/board/freescale/qemu-ppce500/qemu-ppce500.c b/board/freescale/qemu-ppce500/qemu-ppce500.c
index 42a6b5427a..fb36d8366c 100644
--- a/board/freescale/qemu-ppce500/qemu-ppce500.c
+++ b/board/freescale/qemu-ppce500/qemu-ppce500.c
@@ -5,6 +5,7 @@
#include <common.h>
#include <command.h>
+#include <env.h>
#include <pci.h>
#include <asm/processor.h>
#include <asm/mmu.h>
diff --git a/board/freescale/t102xqds/spl.c b/board/freescale/t102xqds/spl.c
index 1b58174ed1..3008f0919f 100644
--- a/board/freescale/t102xqds/spl.c
+++ b/board/freescale/t102xqds/spl.c
@@ -4,7 +4,7 @@
#include <common.h>
#include <console.h>
-#include <environment.h>
+#include <env_internal.h>
#include <malloc.h>
#include <ns16550.h>
#include <nand.h>
diff --git a/board/freescale/t102xqds/t102xqds.c b/board/freescale/t102xqds/t102xqds.c
index d770aebebb..6c754503d1 100644
--- a/board/freescale/t102xqds/t102xqds.c
+++ b/board/freescale/t102xqds/t102xqds.c
@@ -5,6 +5,7 @@
#include <common.h>
#include <command.h>
+#include <env.h>
#include <i2c.h>
#include <netdev.h>
#include <linux/compiler.h>
diff --git a/board/freescale/t102xrdb/spl.c b/board/freescale/t102xrdb/spl.c
index a226d4b5b5..029e3d212c 100644
--- a/board/freescale/t102xrdb/spl.c
+++ b/board/freescale/t102xrdb/spl.c
@@ -4,7 +4,7 @@
#include <common.h>
#include <console.h>
-#include <environment.h>
+#include <env_internal.h>
#include <malloc.h>
#include <ns16550.h>
#include <nand.h>
diff --git a/board/freescale/t102xrdb/t102xrdb.c b/board/freescale/t102xrdb/t102xrdb.c
index acc0be07c5..793f54d69e 100644
--- a/board/freescale/t102xrdb/t102xrdb.c
+++ b/board/freescale/t102xrdb/t102xrdb.c
@@ -5,6 +5,7 @@
#include <common.h>
#include <command.h>
+#include <env.h>
#include <i2c.h>
#include <netdev.h>
#include <linux/compiler.h>
diff --git a/board/freescale/t1040qds/t1040qds.c b/board/freescale/t1040qds/t1040qds.c
index 911190b1fe..55516b9f06 100644
--- a/board/freescale/t1040qds/t1040qds.c
+++ b/board/freescale/t1040qds/t1040qds.c
@@ -5,6 +5,7 @@
#include <common.h>
#include <command.h>
+#include <env.h>
#include <i2c.h>
#include <netdev.h>
#include <linux/compiler.h>
diff --git a/board/freescale/t104xrdb/spl.c b/board/freescale/t104xrdb/spl.c
index 58a7376e7f..7b0eb8edf5 100644
--- a/board/freescale/t104xrdb/spl.c
+++ b/board/freescale/t104xrdb/spl.c
@@ -4,7 +4,7 @@
#include <common.h>
#include <console.h>
-#include <environment.h>
+#include <env_internal.h>
#include <malloc.h>
#include <ns16550.h>
#include <nand.h>
diff --git a/board/freescale/t104xrdb/t104xrdb.c b/board/freescale/t104xrdb/t104xrdb.c
index c9557b465f..c7a645108f 100644
--- a/board/freescale/t104xrdb/t104xrdb.c
+++ b/board/freescale/t104xrdb/t104xrdb.c
@@ -5,6 +5,7 @@
#include <common.h>
#include <command.h>
+#include <env.h>
#include <hwconfig.h>
#include <netdev.h>
#include <linux/compiler.h>
diff --git a/board/freescale/t208xqds/spl.c b/board/freescale/t208xqds/spl.c
index 27f3c4c84f..9695dfc2e2 100644
--- a/board/freescale/t208xqds/spl.c
+++ b/board/freescale/t208xqds/spl.c
@@ -4,7 +4,7 @@
#include <common.h>
#include <console.h>
-#include <environment.h>
+#include <env_internal.h>
#include <malloc.h>
#include <ns16550.h>
#include <nand.h>
diff --git a/board/freescale/t208xqds/t208xqds.c b/board/freescale/t208xqds/t208xqds.c
index abd069fdfe..86d6b1defe 100644
--- a/board/freescale/t208xqds/t208xqds.c
+++ b/board/freescale/t208xqds/t208xqds.c
@@ -5,6 +5,7 @@
#include <common.h>
#include <command.h>
+#include <env.h>
#include <i2c.h>
#include <netdev.h>
#include <linux/compiler.h>
diff --git a/board/freescale/t208xrdb/spl.c b/board/freescale/t208xrdb/spl.c
index ecb1e0d73c..ca7d6a28e0 100644
--- a/board/freescale/t208xrdb/spl.c
+++ b/board/freescale/t208xrdb/spl.c
@@ -4,7 +4,7 @@
#include <common.h>
#include <console.h>
-#include <environment.h>
+#include <env_internal.h>
#include <malloc.h>
#include <ns16550.h>
#include <nand.h>
diff --git a/board/freescale/t208xrdb/t208xrdb.c b/board/freescale/t208xrdb/t208xrdb.c
index adae3f96ca..d03d48bcfa 100644
--- a/board/freescale/t208xrdb/t208xrdb.c
+++ b/board/freescale/t208xrdb/t208xrdb.c
@@ -5,6 +5,7 @@
#include <common.h>
#include <command.h>
+#include <env.h>
#include <i2c.h>
#include <netdev.h>
#include <linux/compiler.h>
diff --git a/board/freescale/t4qds/spl.c b/board/freescale/t4qds/spl.c
index 16cc29eaa6..7666fe7556 100644
--- a/board/freescale/t4qds/spl.c
+++ b/board/freescale/t4qds/spl.c
@@ -4,7 +4,7 @@
#include <common.h>
#include <console.h>
-#include <environment.h>
+#include <env_internal.h>
#include <asm/spl.h>
#include <malloc.h>
#include <ns16550.h>
diff --git a/board/freescale/t4qds/t4240emu.c b/board/freescale/t4qds/t4240emu.c
index 512229a380..d9cb967c22 100644
--- a/board/freescale/t4qds/t4240emu.c
+++ b/board/freescale/t4qds/t4240emu.c
@@ -5,6 +5,7 @@
#include <common.h>
#include <command.h>
+#include <env.h>
#include <i2c.h>
#include <netdev.h>
#include <linux/compiler.h>
diff --git a/board/freescale/t4qds/t4240qds.c b/board/freescale/t4qds/t4240qds.c
index 125bfa31bf..bb18b97e6a 100644
--- a/board/freescale/t4qds/t4240qds.c
+++ b/board/freescale/t4qds/t4240qds.c
@@ -5,6 +5,7 @@
#include <common.h>
#include <command.h>
+#include <env.h>
#include <i2c.h>
#include <netdev.h>
#include <linux/compiler.h>
diff --git a/board/freescale/t4rdb/spl.c b/board/freescale/t4rdb/spl.c
index cc2b2f9ffb..a19558bd6b 100644
--- a/board/freescale/t4rdb/spl.c
+++ b/board/freescale/t4rdb/spl.c
@@ -7,7 +7,7 @@
#include <common.h>
#include <console.h>
-#include <environment.h>
+#include <env_internal.h>
#include <asm/spl.h>
#include <malloc.h>
#include <ns16550.h>
diff --git a/board/freescale/t4rdb/t4240rdb.c b/board/freescale/t4rdb/t4240rdb.c
index 3bfebb6214..0c95607762 100644
--- a/board/freescale/t4rdb/t4240rdb.c
+++ b/board/freescale/t4rdb/t4240rdb.c
@@ -5,6 +5,7 @@
#include <common.h>
#include <command.h>
+#include <env.h>
#include <i2c.h>
#include <netdev.h>
#include <linux/compiler.h>
diff --git a/board/gardena/smart-gateway-at91sam/board.c b/board/gardena/smart-gateway-at91sam/board.c
index 6a1389eb05..3e2da0d6f8 100644
--- a/board/gardena/smart-gateway-at91sam/board.c
+++ b/board/gardena/smart-gateway-at91sam/board.c
@@ -6,6 +6,7 @@
#include <common.h>
#include <debug_uart.h>
+#include <env.h>
#include <led.h>
#include <asm/arch/at91_common.h>
#include <asm/arch/clk.h>
diff --git a/board/gardena/smart-gateway-mt7688/board.c b/board/gardena/smart-gateway-mt7688/board.c
index 6e11077977..bd494c84fc 100644
--- a/board/gardena/smart-gateway-mt7688/board.c
+++ b/board/gardena/smart-gateway-mt7688/board.c
@@ -4,7 +4,8 @@
*/
#include <common.h>
-#include <environment.h>
+#include <env.h>
+#include <env_internal.h>
#include <led.h>
#include <net.h>
#include <spi.h>
diff --git a/board/gateworks/gw_ventana/common.c b/board/gateworks/gw_ventana/common.c
index a543916615..1240a9da17 100644
--- a/board/gateworks/gw_ventana/common.c
+++ b/board/gateworks/gw_ventana/common.c
@@ -10,6 +10,7 @@
#include <asm/arch/sys_proto.h>
#include <asm/gpio.h>
#include <asm/mach-imx/mxc_i2c.h>
+#include <env.h>
#include <fsl_esdhc_imx.h>
#include <hwconfig.h>
#include <power/pmic.h>
diff --git a/board/gateworks/gw_ventana/gw_ventana.c b/board/gateworks/gw_ventana/gw_ventana.c
index 92edc10381..8a694a71c9 100644
--- a/board/gateworks/gw_ventana/gw_ventana.c
+++ b/board/gateworks/gw_ventana/gw_ventana.c
@@ -21,7 +21,7 @@
#include <asm/setup.h>
#include <dm.h>
#include <dm/platform_data/serial_mxc.h>
-#include <environment.h>
+#include <env.h>
#include <hwconfig.h>
#include <i2c.h>
#include <fdt_support.h>
diff --git a/board/gateworks/gw_ventana/gw_ventana_spl.c b/board/gateworks/gw_ventana/gw_ventana_spl.c
index eaf7aa9eca..b0891379a1 100644
--- a/board/gateworks/gw_ventana/gw_ventana_spl.c
+++ b/board/gateworks/gw_ventana/gw_ventana_spl.c
@@ -5,6 +5,7 @@
*/
#include <common.h>
+#include <env.h>
#include <asm/io.h>
#include <asm/arch/crm_regs.h>
#include <asm/arch/mx6-ddr.h>
@@ -13,7 +14,7 @@
#include <asm/mach-imx/boot_mode.h>
#include <asm/mach-imx/iomux-v3.h>
#include <asm/mach-imx/mxc_i2c.h>
-#include <environment.h>
+#include <env.h>
#include <i2c.h>
#include <spl.h>
diff --git a/board/gdsys/a38x/keyprogram.c b/board/gdsys/a38x/keyprogram.c
index 291edc340d..000897984a 100644
--- a/board/gdsys/a38x/keyprogram.c
+++ b/board/gdsys/a38x/keyprogram.c
@@ -5,6 +5,7 @@
*/
#include <common.h>
+#include <env.h>
#include <tpm-v1.h>
#include <malloc.h>
#include <linux/ctype.h>
diff --git a/board/gdsys/mpc8308/gazerbeam.c b/board/gdsys/mpc8308/gazerbeam.c
index cd621744d2..ddd6ee8953 100644
--- a/board/gdsys/mpc8308/gazerbeam.c
+++ b/board/gdsys/mpc8308/gazerbeam.c
@@ -8,6 +8,7 @@
#include <common.h>
#include <board.h>
#include <dm.h>
+#include <env.h>
#include <fdt_support.h>
#include <fsl_esdhc.h>
#include <miiphy.h>
diff --git a/board/gdsys/mpc8308/hrcon.c b/board/gdsys/mpc8308/hrcon.c
index d14a28ec94..60faa4688c 100644
--- a/board/gdsys/mpc8308/hrcon.c
+++ b/board/gdsys/mpc8308/hrcon.c
@@ -5,6 +5,7 @@
*/
#include <common.h>
+#include <env.h>
#include <hwconfig.h>
#include <i2c.h>
#include <spi.h>
diff --git a/board/gdsys/mpc8308/strider.c b/board/gdsys/mpc8308/strider.c
index 1fdea675bd..886bc2b035 100644
--- a/board/gdsys/mpc8308/strider.c
+++ b/board/gdsys/mpc8308/strider.c
@@ -5,6 +5,7 @@
*/
#include <common.h>
+#include <env.h>
#include <hwconfig.h>
#include <i2c.h>
#include <spi.h>
diff --git a/board/gdsys/p1022/controlcenterd-id.c b/board/gdsys/p1022/controlcenterd-id.c
index 6ac956caca..43f5404231 100644
--- a/board/gdsys/p1022/controlcenterd-id.c
+++ b/board/gdsys/p1022/controlcenterd-id.c
@@ -12,6 +12,7 @@
#include <common.h>
#include <dm.h>
+#include <env.h>
#include <malloc.h>
#include <fs.h>
#include <i2c.h>
diff --git a/board/gdsys/p1022/controlcenterd.c b/board/gdsys/p1022/controlcenterd.c
index 7bdc924a89..6eb3d6c5d0 100644
--- a/board/gdsys/p1022/controlcenterd.c
+++ b/board/gdsys/p1022/controlcenterd.c
@@ -23,6 +23,7 @@
#include <common.h>
#include <command.h>
+#include <env.h>
#include <pci.h>
#include <asm/processor.h>
#include <asm/mmu.h>
diff --git a/board/ge/bx50v3/bx50v3.c b/board/ge/bx50v3/bx50v3.c
index 806525204f..917ecc4c18 100644
--- a/board/ge/bx50v3/bx50v3.c
+++ b/board/ge/bx50v3/bx50v3.c
@@ -9,6 +9,7 @@
#include <asm/arch/imx-regs.h>
#include <asm/arch/iomux.h>
#include <asm/arch/mx6-pins.h>
+#include <env.h>
#include <linux/errno.h>
#include <linux/libfdt.h>
#include <asm/gpio.h>
diff --git a/board/ge/common/ge_common.c b/board/ge/common/ge_common.c
index 4e6ef9c480..501c8b2daf 100644
--- a/board/ge/common/ge_common.c
+++ b/board/ge/common/ge_common.c
@@ -4,6 +4,7 @@
*/
#include <common.h>
+#include <env.h>
#include <i2c.h>
#include <rtc.h>
diff --git a/board/ge/mx53ppd/mx53ppd.c b/board/ge/mx53ppd/mx53ppd.c
index bf75bd2d46..5448567298 100644
--- a/board/ge/mx53ppd/mx53ppd.c
+++ b/board/ge/mx53ppd/mx53ppd.c
@@ -16,11 +16,11 @@
#include <asm/arch/clock.h>
#include <asm/arch/iomux-mx53.h>
#include <asm/arch/clock.h>
+#include <env.h>
#include <linux/errno.h>
#include <linux/libfdt.h>
#include <asm/mach-imx/mxc_i2c.h>
#include <asm/mach-imx/mx5_video.h>
-#include <environment.h>
#include <netdev.h>
#include <i2c.h>
#include <mmc.h>
diff --git a/board/grinn/chiliboard/board.c b/board/grinn/chiliboard/board.c
index dc0de620fc..c6d53600fa 100644
--- a/board/grinn/chiliboard/board.c
+++ b/board/grinn/chiliboard/board.c
@@ -16,7 +16,7 @@
#include <asm/emif.h>
#include <asm/io.h>
#include <cpsw.h>
-#include <environment.h>
+#include <env.h>
#include <errno.h>
#include <miiphy.h>
#include <spl.h>
diff --git a/board/grinn/liteboard/board.c b/board/grinn/liteboard/board.c
index 1491b8c3d4..1558ea4b84 100644
--- a/board/grinn/liteboard/board.c
+++ b/board/grinn/liteboard/board.c
@@ -17,6 +17,7 @@
#include <asm/mach-imx/boot_mode.h>
#include <asm/io.h>
#include <common.h>
+#include <env.h>
#include <fsl_esdhc_imx.h>
#include <linux/sizes.h>
#include <linux/fb.h>
diff --git a/board/gumstix/pepper/board.c b/board/gumstix/pepper/board.c
index ea29dcd75e..f5beb8c940 100644
--- a/board/gumstix/pepper/board.c
+++ b/board/gumstix/pepper/board.c
@@ -7,6 +7,7 @@
*/
#include <common.h>
+#include <env.h>
#include <errno.h>
#include <spl.h>
#include <asm/arch/cpu.h>
@@ -25,7 +26,6 @@
#include <miiphy.h>
#include <cpsw.h>
#include <power/tps65217.h>
-#include <environment.h>
#include <watchdog.h>
#include "board.h"
diff --git a/board/highbank/highbank.c b/board/highbank/highbank.c
index 996daffa1b..9563763dfa 100644
--- a/board/highbank/highbank.c
+++ b/board/highbank/highbank.c
@@ -5,6 +5,7 @@
#include <common.h>
#include <ahci.h>
+#include <env.h>
#include <netdev.h>
#include <scsi.h>
diff --git a/board/hisilicon/hikey960/Kconfig b/board/hisilicon/hikey960/Kconfig
new file mode 100644
index 0000000000..89f096d649
--- /dev/null
+++ b/board/hisilicon/hikey960/Kconfig
@@ -0,0 +1,15 @@
+if TARGET_HIKEY960
+
+config SYS_BOARD
+ default "hikey960"
+
+config SYS_VENDOR
+ default "hisilicon"
+
+config SYS_SOC
+ default "hi3660"
+
+config SYS_CONFIG_NAME
+ default "hikey960"
+
+endif
diff --git a/board/hisilicon/hikey960/MAINTAINERS b/board/hisilicon/hikey960/MAINTAINERS
new file mode 100644
index 0000000000..2c98932163
--- /dev/null
+++ b/board/hisilicon/hikey960/MAINTAINERS
@@ -0,0 +1,6 @@
+HIKEY960 BOARD
+M: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
+S: Maintained
+F: board/hisilicon/hikey960
+F: include/configs/hikey960.h
+F: configs/hikey960_defconfig
diff --git a/board/hisilicon/hikey960/Makefile b/board/hisilicon/hikey960/Makefile
new file mode 100644
index 0000000000..ea5a70921f
--- /dev/null
+++ b/board/hisilicon/hikey960/Makefile
@@ -0,0 +1,3 @@
+# SPDX-License-Identifier: GPL-2.0+
+
+obj-y := hikey960.o
diff --git a/board/hisilicon/hikey960/README b/board/hisilicon/hikey960/README
new file mode 100644
index 0000000000..e1e330d535
--- /dev/null
+++ b/board/hisilicon/hikey960/README
@@ -0,0 +1,247 @@
+Introduction
+============
+
+HiKey960 is one of the 96Boards Consumer Edition board from HiSilicon.
+The board/SoC has: -
+* HiSilicon Kirin960 (HI3660) SoC with 4xCortex-A73 and 4xCortex-A53
+* ARM Mali G71 MP8 GPU
+* 3GB LPDDR4 SDRAM
+* 32GB UFS Flash Storage
+* microSD
+* 802.11a/b/g/n WiFi, Bluetooth
+
+More information about this board can be found in 96Boards website:
+https://www.96boards.org/product/hikey960/
+
+Currently the u-boot port supports: -
+* SD card
+
+Compile from source
+===================
+
+First get all the sources
+
+ > mkdir -p ~/hikey960/src ~/hikey960/bin
+ > cd ~/hikey960/src
+ > git clone https://github.com/ARM-software/arm-trusted-firmware
+ > git clone https://github.com/96boards-hikey/OpenPlatformPkg -b testing/hikey960_v1.3.4
+ > git clone https://github.com/96boards-hikey/l-loader -b testing/hikey960_v1.2
+ > wget http://snapshots.linaro.org/96boards/reference-platform/components/uefi-staging/latest/hikey960/release/config
+ > wget http://snapshots.linaro.org/96boards/reference-platform/components/uefi-staging/latest/hikey960/release/hisi-sec_usb_xloader.img
+ > wget http://snapshots.linaro.org/96boards/reference-platform/components/uefi-staging/latest/hikey960/release/hisi-sec_uce_boot.img
+ > wget http://snapshots.linaro.org/96boards/reference-platform/components/uefi-staging/latest/hikey960/release/sec_xloader.img
+ > wget http://snapshots.linaro.org/96boards/reference-platform/components/uefi-staging/latest/hikey960/release/recovery.bin
+ > wget http://snapshots.linaro.org/96boards/reference-platform/components/uefi-staging/latest/hikey960/release/hikey_idt
+
+Get the SCP_BL2 lpm3.img binary. It is shipped as part of the UEFI source.
+The latest version can be obtained from the OpenPlatformPkg repo.
+
+ > cp OpenPlatformPkg/Platforms/Hisilicon/HiKey960/Binary/lpm3.img ~/hikey960/bin/
+
+Compile U-Boot
+==============
+
+ > cd ~/hikey960/src/u-boot
+ > make CROSS_COMPILE=aarch64-linux-gnu- hikey960_defconfig
+ > make CROSS_COMPILE=aarch64-linux-gnu-
+ > cp u-boot.bin ~/hikey960/bin/
+
+Compile ARM Trusted Firmware (ATF)
+==================================
+
+ > cd ~/hikey960/src/arm-trusted-firmware
+ > make CROSS_COMPILE=aarch64-linux-gnu- all fip \
+ SCP_BL2=~/hikey960/bin/lpm3.img \
+ BL33=~/hikey960/bin/u-boot.bin DEBUG=1 PLAT=hikey960
+
+Copy the resulting FIP binary
+ > cp build/hikey960/debug/fip.bin ~/hikey960/bin
+
+Compile l-loader
+================
+ > cd ~/hikey960/src/l-loader
+ > ln -sf ~/hikey960/src/arm-trusted-firmware/build/hikey960/debug/bl1.bin
+ > ln -sf ~/hikey960/src/arm-trusted-firmware/build/hikey960/debug/bl2.bin
+ > ln -sf ~/hikey960/src/arm-trusted-firmware/build/hikey960/debug/fip.bin
+ > ln -sf ~/hikey960/bin/u-boot.bin
+ > make hikey960 PTABLE_LST=linux-32g NS_BL1U=u-boot.bin
+
+Copy the resulting binaries
+ > cp *.img ~/hikey960/bin
+ > cp l-loader.bin ~/hikey960/bin
+
+These instructions are adapted from
+https://github.com/ARM-software/arm-trusted-firmware/blob/master/docs/plat/hikey960.rst
+
+Setup Console
+=============
+
+Install ser2net. Use telnet as the console since UEFI in recovery mode
+output window fails to display in minicom.
+
+ > sudo apt-get install ser2net
+
+Configure ser2net
+
+ > sudo vi /etc/ser2net.conf
+
+Append one line for serial-over-USB in #ser2net.conf
+
+ > 2004:telnet:0:/dev/ttyUSB0:115200 8DATABITS NONE 1STOPBIT banner
+
+Start ser2net
+
+ > sudo killall ser2net
+ > sudo ser2net -u
+
+Open the console.
+
+ > telnet localhost 2004
+
+And you could open the console remotely, too.
+
+Flashing
+========
+
+1. Boot Hikey960 into recovery mode as per the below document:
+https://github.com/96boards/documentation/blob/master/consumer/hikey/hikey960/installation/board-recovery.md
+
+Once Hikey960 is in recovery mode, flash the recovery binary:
+
+ > cd ~/hikey960/src
+ > chmod +x ./hikey_idt
+ > sudo ./hikey_idt -c config -p /dev/ttyUSB1
+
+Now move to the Hikey960 console and press `f` during UEFI boot. This
+will allow the board to boot into fastboot mode. Once the board is in
+fastboot mode, you should see the ID of the HiKey960 board using the
+following command
+
+ > sudo fastboot devices
+
+1ED3822A018E3372 fastboot
+
+3. Flash the images
+
+Now, the images can be flashed using fastboot:
+
+ > sudo fastboot flash ptable ~/hikey960/bin/prm_ptable.img
+ > sudo fastboot flash xloader ~/hikey960/bin/sec_xloader.img
+ > sudo fastboot flash fastboot ~/hikey960/bin/l-loader.bin
+ > sudo fastboot flash fip ~/hikey960/bin/fip.bin
+
+4. Set the "Boot Mode" switch to OFF position for normal boot mode.
+Then power on HiKey960
+
+Observe the console traces using UART6 on the Low Speed Expansion header:
+
+NOTICE: BL2: v2.1(debug):v2.1-531-g3ee48f40
+NOTICE: BL2: Built : 18:15:58, Aug 2 2019
+INFO: BL2: Doing platform setup
+INFO: UFS LUN0 contains 1024 blocks with 4096-byte size
+INFO: UFS LUN1 contains 1024 blocks with 4096-byte size
+INFO: UFS LUN2 contains 2048 blocks with 4096-byte size
+INFO: UFS LUN3 contains 7805952 blocks with 4096-byte size
+INFO: ufs: change power mode success
+INFO: BL2: Loading image id 2
+INFO: Loading image id=2 at address 0x89c80000
+INFO: Image id=2 loaded: 0x89c80000 - 0x89cb5088
+INFO: BL2: Initiating SCP_BL2 transfer to SCP
+INFO: BL2: SCP_BL2: 0x89c80000@0x35088
+INFO: BL2: SCP_BL2 HEAD:
+INFO: BL2: SCP_BL2 0x7000 0x179 0x159 0x149
+INFO: BL2: SCP_BL2 0x189 0x18b 0x18d 0x0
+INFO: BL2: SCP_BL2 0x0 0x0 0x0 0x18f
+INFO: BL2: SCP_BL2 0x191 0x0 0x193 0x195
+INFO: BL2: SCP_BL2 0x18fd 0x18fd 0x18fd 0x18fd
+INFO: BL2: SCP_BL2 0x18fd 0x18fd 0x18fd 0x18fd
+INFO: BL2: SCP_BL2 0x18fd 0x18fd 0x18fd 0x18fd
+INFO: BL2: SCP_BL2 0x4d454355 0x43494741 0x424d554e 0x21215245
+INFO: BL2: SCP_BL2 0x4a054904 0x42912000 0xf841bfbc 0xe7fa0b04
+INFO: BL2: SCP_BL2 0xb88cf000 0x3b18 0x3d1c 0x6809493e
+INFO: BL2: SCP_BL2 0x4613680a 0x201f102 0xf0002a04 0x600a804c
+INFO: BL2: SCP_BL2 0x204f04f 0xf203fb02 0xf102440a 0x60100204
+INFO: BL2: SCP_BL2 0x160f04f 0xf103fb01 0x68004834 0x61044408
+INFO: BL2: SCP_BL2 0x61866145 0xf8c061c7 0xf8c08020 0xf8c09024
+INFO: BL2: SCP_BL2 0xf8c0a028 0xf3efb02c 0xf3ef8208 0x68118309
+INFO: BL2: SCP_BL2 0xf1026401 0xf0110204 0xbf070f04 0x46113220
+INFO: BL2: SCP_BL2 TAIL:
+INFO: BL2: SCP_BL2 0x0 0x0 0x0 0x0
+INFO: BL2: SCP_BL2 0x0 0x0 0x0 0x0
+INFO: BL2: SCP_BL2 0x0 0x0 0x0 0x0
+INFO: BL2: SCP_BL2 0x0 0x0 0x0 0x0
+INFO: BL2: SCP_BL2 0x0 0x0 0x0 0x0
+INFO: BL2: SCP_BL2 0x0 0x0 0x0 0x0
+INFO: BL2: SCP_BL2 0x0 0x0 0x0 0x0
+INFO: BL2: SCP_BL2 0x0 0x0 0x0 0x0
+INFO: BL2: SCP_BL2 0x0 0x0 0x0 0x0
+INFO: BL2: SCP_BL2 0x0 0x0 0x0 0x0
+INFO: BL2: SCP_BL2 0x0 0x19cad151 0x19b80040 0x0
+INFO: BL2: SCP_BL2 0x0 0x0 0x0 0x0
+INFO: BL2: SCP_BL2 0x0 0x0 0x0 0x0
+INFO: BL2: SCP_BL2 0x0 0x0 0x0 0x0
+INFO: BL2: SCP_BL2 0x0 0x0 0x0 0x0
+INFO: BL2: SCP_BL2 0x0 0x0 0x0 0x0
+INFO: BL2: SCP_BL2 transferred to SCP
+INFO: start fw loading
+INFO: fw load success
+WARNING: BL2: Platform setup already done!!
+INFO: BL2: Loading image id 3
+INFO: Loading image id=3 at address 0x1ac58000
+INFO: Image id=3 loaded: 0x1ac58000 - 0x1ac63024
+INFO: BL2: Loading image id 5
+INFO: Loading image id=5 at address 0x1ac98000
+INFO: Image id=5 loaded: 0x1ac98000 - 0x1ad0819c
+NOTICE: BL2: Booting BL31
+INFO: Entry point address = 0x1ac58000
+INFO: SPSR = 0x3cd
+NOTICE: BL31: v2.1(debug):v2.1-531-g3ee48f40
+NOTICE: BL31: Built : 18:16:01, Aug 2 2019
+INFO: ARM GICv2 driver initialized
+INFO: BL31: Initializing runtime services
+INFO: BL31: cortex_a53: CPU workaround for 855873 was applied
+INFO: plat_setup_psci_ops: sec_entrypoint=0x1ac580fc
+INFO: BL31: Preparing for EL3 exit to normal world
+INFO: Entry point address = 0x1ac98000
+INFO: SPSR = 0x3c9
+
+
+U-Boot 2019.07-00628-g286f05a6fc-dirty (Aug 02 2019 - 17:14:05 +0530)
+Hikey960
+
+DRAM: 3 GiB
+PSCI: v1.1
+MMC: dwmmc1@ff37f000: 0
+Loading Environment from EXT4... ** File not found /uboot.env **
+
+** Unable to read "/uboot.env" from mmc0:2 **
+In: serial@fff32000
+Out: serial@fff32000
+Err: serial@fff32000
+Net: Net Initialization Skipped
+No ethernet found.
+Hit any key to stop autoboot: 0
+switch to partitions #0, OK
+mmc0 is current device
+Scanning mmc 0:1...
+Found /extlinux/extlinux.conf
+Retrieving file: /extlinux/extlinux.conf
+201 bytes read in 12 ms (15.6 KiB/s)
+1: hikey960-kernel
+Retrieving file: /Image
+24689152 bytes read in 4377 ms (5.4 MiB/s)
+append: earlycon=pl011,mmio32,0xfff32000 console=ttyAMA6,115200 rw root=/dev/mmcblk0p2 rot
+Retrieving file: /hi3660-hikey960.dtb
+35047 bytes read in 14 ms (2.4 MiB/s)
+## Flattened Device Tree blob at 10000000
+ Booting using the fdt blob at 0x10000000
+ Using Device Tree in place at 0000000010000000, end 000000001000b8e6
+
+Starting kernel ...
+
+[ 0.000000] Booting Linux on physical CPU 0x0000000000 [0x410fd034]
+[ 0.000000] Linux version 5.2.0-03138-gd75da80dce39 (mani@Mani-XPS-13-9360) (gcc versi9
+[ 0.000000] Machine model: HiKey960
+[ 0.000000] earlycon: pl11 at MMIO32 0x00000000fff32000 (options '')
+[ 0.000000] printk: bootconsole [pl11] enabled
+[ 0.000000] efi: Getting EFI parameters from FDT:
diff --git a/board/hisilicon/hikey960/hikey960.c b/board/hisilicon/hikey960/hikey960.c
new file mode 100644
index 0000000000..eb9b99eaa9
--- /dev/null
+++ b/board/hisilicon/hikey960/hikey960.c
@@ -0,0 +1,186 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * (C) Copyright 2019 Linaro
+ * Author: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
+ */
+
+#include <common.h>
+#include <dm.h>
+#include <errno.h>
+#include <asm/io.h>
+#include <asm/arch/hi3660.h>
+#include <asm/armv8/mmu.h>
+#include <asm/psci.h>
+#include <linux/arm-smccc.h>
+#include <linux/psci.h>
+
+#define PMIC_REG_TO_BUS_ADDR(x) (x << 2)
+#define PMIC_VSEL_MASK 0x7
+
+DECLARE_GLOBAL_DATA_PTR;
+
+#if !CONFIG_IS_ENABLED(OF_CONTROL)
+#include <dm/platform_data/serial_pl01x.h>
+
+static const struct pl01x_serial_platdata serial_platdata = {
+ .base = HI3660_UART6_BASE,
+ .type = TYPE_PL011,
+ .clock = 19200000
+};
+
+U_BOOT_DEVICE(hikey960_serial0) = {
+ .name = "serial_pl01x",
+ .platdata = &serial_platdata,
+};
+#endif
+
+static struct mm_region hikey_mem_map[] = {
+ {
+ .virt = 0x0UL, /* DDR */
+ .phys = 0x0UL,
+ .size = 0xC0000000UL,
+ .attrs = PTE_BLOCK_MEMTYPE(MT_NORMAL) |
+ PTE_BLOCK_INNER_SHARE
+ }, {
+ .virt = 0xE0000000UL, /* Peripheral block */
+ .phys = 0xE0000000UL,
+ .size = 0x20000000UL,
+ .attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) |
+ PTE_BLOCK_NON_SHARE |
+ PTE_BLOCK_PXN | PTE_BLOCK_UXN
+ }, {
+ /* List terminator */
+ 0,
+ }
+};
+
+struct mm_region *mem_map = hikey_mem_map;
+
+int board_early_init_f(void)
+{
+ return 0;
+}
+
+int misc_init_r(void)
+{
+ return 0;
+}
+
+int dram_init(void)
+{
+ gd->ram_size = PHYS_SDRAM_1_SIZE;
+
+ return 0;
+}
+
+int dram_init_banksize(void)
+{
+ gd->bd->bi_dram[0].start = PHYS_SDRAM_1;
+ gd->bd->bi_dram[0].size = gd->ram_size;
+
+ return 0;
+}
+
+void hikey960_sd_init(void)
+{
+ u32 data;
+
+ /* Enable FPLL0 */
+ data = readl(SCTRL_SCFPLLCTRL0);
+ data |= SCTRL_SCFPLLCTRL0_FPLL0_EN;
+ writel(data, SCTRL_SCFPLLCTRL0);
+
+ /* Configure LDO16 */
+ data = readl(PMU_REG_BASE + PMIC_REG_TO_BUS_ADDR(0x79)) &
+ PMIC_VSEL_MASK;
+ data |= 6;
+ writel(data, PMU_REG_BASE + PMIC_REG_TO_BUS_ADDR(0x79));
+
+ data = readl(PMU_REG_BASE + PMIC_REG_TO_BUS_ADDR(0x78));
+ data |= 2;
+ writel(data, PMU_REG_BASE + PMIC_REG_TO_BUS_ADDR(0x78));
+
+ udelay(100);
+
+ /* Configure LDO9 */
+ data = readl(PMU_REG_BASE + PMIC_REG_TO_BUS_ADDR(0x6b)) &
+ PMIC_VSEL_MASK;
+ data |= 5;
+ writel(data, PMU_REG_BASE + PMIC_REG_TO_BUS_ADDR(0x6b));
+
+ data = readl(PMU_REG_BASE + PMIC_REG_TO_BUS_ADDR(0x6a));
+ data |= 2;
+ writel(data, PMU_REG_BASE + PMIC_REG_TO_BUS_ADDR(0x6a));
+
+ udelay(100);
+
+ /* GPIO CD */
+ writel(0, PINMUX4_SDDET);
+
+ /* SD Pinconf */
+ writel(15 << 4, PINCONF3_SDCLK);
+ writel((1 << 0) | (8 << 4), PINCONF3_SDCMD);
+ writel((1 << 0) | (8 << 4), PINCONF3_SDDATA0);
+ writel((1 << 0) | (8 << 4), PINCONF3_SDDATA1);
+ writel((1 << 0) | (8 << 4), PINCONF3_SDDATA2);
+ writel((1 << 0) | (8 << 4), PINCONF3_SDDATA3);
+
+ /* Set SD clock mux */
+ do {
+ data = readl(CRG_REG_BASE + 0xb8);
+ data |= ((1 << 6) | (1 << 6 << 16) | (0 << 4) | (3 << 4 << 16));
+ writel(data, CRG_REG_BASE + 0xb8);
+
+ data = readl(CRG_REG_BASE + 0xb8);
+ } while ((data & ((1 << 6) | (3 << 4))) != ((1 << 6) | (0 << 4)));
+
+ /* Take SD out of reset */
+ writel(1 << 18, CRG_PERRSTDIS4);
+ do {
+ data = readl(CRG_PERRSTSTAT4);
+ } while ((data & (1 << 18)) == (1 << 18));
+
+ /* Enable hclk_gate_sd */
+ data = readl(CRG_REG_BASE + 0);
+ data |= (1 << 30);
+ writel(data, CRG_REG_BASE + 0);
+
+ /* Enable clk_andgt_mmc */
+ data = readl(CRG_REG_BASE + 0xf4);
+ data |= ((1 << 3) | (1 << 3 << 16));
+ writel(data, CRG_REG_BASE + 0xf4);
+
+ /* Enable clk_gate_sd */
+ data = readl(CRG_PEREN4);
+ data |= (1 << 17);
+ writel(data, CRG_PEREN4);
+ do {
+ data = readl(CRG_PERCLKEN4);
+ } while ((data & (1 << 17)) != (1 << 17));
+}
+
+static void show_psci_version(void)
+{
+ struct arm_smccc_res res;
+
+ arm_smccc_smc(ARM_PSCI_0_2_FN_PSCI_VERSION, 0, 0, 0, 0, 0, 0, 0, &res);
+
+ printf("PSCI: v%ld.%ld\n",
+ PSCI_VERSION_MAJOR(res.a0),
+ PSCI_VERSION_MINOR(res.a0));
+}
+
+int board_init(void)
+{
+ /* Init SD */
+ hikey960_sd_init();
+
+ show_psci_version();
+
+ return 0;
+}
+
+void reset_cpu(ulong addr)
+{
+ psci_system_reset();
+}
diff --git a/board/hisilicon/poplar/poplar.c b/board/hisilicon/poplar/poplar.c
index 77948445e2..4926419a90 100644
--- a/board/hisilicon/poplar/poplar.c
+++ b/board/hisilicon/poplar/poplar.c
@@ -155,6 +155,7 @@ static void usb2_phy_init(void)
}
#if defined(CONFIG_USB_GADGET) && defined(CONFIG_USB_GADGET_DWC2_OTG)
+#include <env.h>
#include <usb.h>
#include <usb/dwc2_udc.h>
#include <g_dnl.h>
diff --git a/board/imgtec/ci20/ci20.c b/board/imgtec/ci20/ci20.c
index 9811ef559f..5368b67b38 100644
--- a/board/imgtec/ci20/ci20.c
+++ b/board/imgtec/ci20/ci20.c
@@ -7,7 +7,7 @@
*/
#include <common.h>
-#include <environment.h>
+#include <env.h>
#include <net.h>
#include <netdev.h>
#include <asm/io.h>
diff --git a/board/intel/edison/edison.c b/board/intel/edison/edison.c
index d80ee3aa8a..f56b5b1aff 100644
--- a/board/intel/edison/edison.c
+++ b/board/intel/edison/edison.c
@@ -4,7 +4,7 @@
*/
#include <common.h>
#include <dwc3-uboot.h>
-#include <environment.h>
+#include <env.h>
#include <mmc.h>
#include <u-boot/md5.h>
#include <usb.h>
diff --git a/board/isee/igep003x/board.c b/board/isee/igep003x/board.c
index 965a009a9f..a8c2b121a4 100644
--- a/board/isee/igep003x/board.c
+++ b/board/isee/igep003x/board.c
@@ -6,6 +6,7 @@
*/
#include <common.h>
+#include <env.h>
#include <errno.h>
#include <spl.h>
#include <asm/arch/cpu.h>
@@ -25,7 +26,6 @@
#include <fdt_support.h>
#include <mtd_node.h>
#include <jffs2/load_kernel.h>
-#include <environment.h>
#include "board.h"
DECLARE_GLOBAL_DATA_PTR;
diff --git a/board/isee/igep00x0/igep00x0.c b/board/isee/igep00x0/igep00x0.c
index 367af82d4a..74fc5f0890 100644
--- a/board/isee/igep00x0/igep00x0.c
+++ b/board/isee/igep00x0/igep00x0.c
@@ -4,6 +4,7 @@
* ISEE 2007 SL, <www.iseebcn.com>
*/
#include <common.h>
+#include <env.h>
#include <status_led.h>
#include <dm.h>
#include <ns16550.h>
diff --git a/board/k+p/kp_imx53/kp_id_rev.c b/board/k+p/kp_imx53/kp_id_rev.c
index e8f51769f6..9dae54dda5 100644
--- a/board/k+p/kp_imx53/kp_id_rev.c
+++ b/board/k+p/kp_imx53/kp_id_rev.c
@@ -10,7 +10,7 @@
*/
#include <common.h>
-#include <environment.h>
+#include <env.h>
#include <i2c.h>
#include "kp_id_rev.h"
diff --git a/board/k+p/kp_imx53/kp_imx53.c b/board/k+p/kp_imx53/kp_imx53.c
index b447e13461..84cddd4894 100644
--- a/board/k+p/kp_imx53/kp_imx53.c
+++ b/board/k+p/kp_imx53/kp_imx53.c
@@ -13,6 +13,7 @@
#include <asm/arch/iomux-mx53.h>
#include <asm/arch/clock.h>
#include <asm/gpio.h>
+#include <env.h>
#include <power/pmic.h>
#include <fsl_pmic.h>
#include "kp_id_rev.h"
diff --git a/board/k+p/kp_imx6q_tpc/kp_imx6q_tpc.c b/board/k+p/kp_imx6q_tpc/kp_imx6q_tpc.c
index 7bdc64b1be..2c541ace02 100644
--- a/board/k+p/kp_imx6q_tpc/kp_imx6q_tpc.c
+++ b/board/k+p/kp_imx6q_tpc/kp_imx6q_tpc.c
@@ -17,6 +17,7 @@
#include <asm/mach-imx/boot_mode.h>
#include <asm/mach-imx/iomux-v3.h>
#include <asm/mach-imx/mxc_i2c.h>
+#include <env.h>
#include <errno.h>
#include <fsl_esdhc_imx.h>
#include <fuse.h>
diff --git a/board/keymile/common/common.c b/board/keymile/common/common.c
index 92d4a6ff61..08f7f8d884 100644
--- a/board/keymile/common/common.c
+++ b/board/keymile/common/common.c
@@ -8,6 +8,7 @@
*/
#include <common.h>
+#include <env.h>
#include <ioports.h>
#include <command.h>
#include <malloc.h>
diff --git a/board/keymile/common/ivm.c b/board/keymile/common/ivm.c
index d22f3fa75a..50df44d1c1 100644
--- a/board/keymile/common/ivm.c
+++ b/board/keymile/common/ivm.c
@@ -6,6 +6,7 @@
#include <common.h>
#include <cli_hush.h>
+#include <env.h>
#include <i2c.h>
#include "common.h"
diff --git a/board/keymile/km83xx/km83xx.c b/board/keymile/km83xx/km83xx.c
index a693845383..8846b64f7d 100644
--- a/board/keymile/km83xx/km83xx.c
+++ b/board/keymile/km83xx/km83xx.c
@@ -14,6 +14,7 @@
*/
#include <common.h>
+#include <env.h>
#include <ioports.h>
#include <mpc83xx.h>
#include <i2c.h>
diff --git a/board/keymile/km_arm/km_arm.c b/board/keymile/km_arm/km_arm.c
index 3db80615ef..922cc621f7 100644
--- a/board/keymile/km_arm/km_arm.c
+++ b/board/keymile/km_arm/km_arm.c
@@ -12,6 +12,7 @@
*/
#include <common.h>
+#include <env.h>
#include <i2c.h>
#include <nand.h>
#include <netdev.h>
diff --git a/board/keymile/kmp204x/kmp204x.c b/board/keymile/kmp204x/kmp204x.c
index e7dcefacdd..4d1e38aa3a 100644
--- a/board/keymile/kmp204x/kmp204x.c
+++ b/board/keymile/kmp204x/kmp204x.c
@@ -8,6 +8,7 @@
#include <common.h>
#include <command.h>
+#include <env.h>
#include <netdev.h>
#include <linux/compiler.h>
#include <asm/mmu.h>
diff --git a/board/kosagi/novena/novena.c b/board/kosagi/novena/novena.c
index dcf3d7ff89..b7b747d196 100644
--- a/board/kosagi/novena/novena.c
+++ b/board/kosagi/novena/novena.c
@@ -9,6 +9,7 @@
#include <dm.h>
#include <dm/device-internal.h>
#include <ahci.h>
+#include <env.h>
#include <linux/errno.h>
#include <asm/gpio.h>
#include <asm/io.h>
@@ -24,7 +25,6 @@
#include <asm/mach-imx/sata.h>
#include <asm/mach-imx/video.h>
#include <dwc_ahsata.h>
-#include <environment.h>
#include <fsl_esdhc_imx.h>
#include <i2c.h>
#include <input.h>
diff --git a/board/laird/wb50n/wb50n.c b/board/laird/wb50n/wb50n.c
index 89d3795857..a2f8eaf0ba 100644
--- a/board/laird/wb50n/wb50n.c
+++ b/board/laird/wb50n/wb50n.c
@@ -11,6 +11,7 @@
#include <asm/arch/at91_rstc.h>
#include <asm/arch/gpio.h>
#include <asm/arch/clk.h>
+#include <env.h>
#include <micrel.h>
#include <net.h>
#include <netdev.h>
diff --git a/board/lg/sniper/sniper.c b/board/lg/sniper/sniper.c
index a7de4c2167..b4205d6ed4 100644
--- a/board/lg/sniper/sniper.c
+++ b/board/lg/sniper/sniper.c
@@ -8,6 +8,7 @@
#include <config.h>
#include <common.h>
#include <dm.h>
+#include <env.h>
#include <linux/ctype.h>
#include <linux/usb/musb.h>
#include <asm/omap_musb.h>
diff --git a/board/liebherr/display5/display5.c b/board/liebherr/display5/display5.c
index ea49b7197f..037c4e69e5 100644
--- a/board/liebherr/display5/display5.c
+++ b/board/liebherr/display5/display5.c
@@ -13,6 +13,7 @@
#include <asm/arch/mx6-pins.h>
#include <asm/arch/mx6-ddr.h>
#include <asm/arch/sys_proto.h>
+#include <env.h>
#include <errno.h>
#include <asm/gpio.h>
#include <malloc.h>
@@ -25,7 +26,6 @@
#include <miiphy.h>
#include <netdev.h>
#include <i2c.h>
-#include <environment.h>
#include <dm.h>
#include <dm/platform_data/serial_mxc.h>
diff --git a/board/liebherr/display5/spl.c b/board/liebherr/display5/spl.c
index 27f843ec45..354b63e431 100644
--- a/board/liebherr/display5/spl.c
+++ b/board/liebherr/display5/spl.c
@@ -5,6 +5,7 @@
*/
#include <common.h>
+#include <env.h>
#include <spl.h>
#include <linux/libfdt.h>
#include <asm/io.h>
@@ -17,7 +18,6 @@
#include "asm/arch/iomux.h"
#include <asm/mach-imx/iomux-v3.h>
#include <asm/gpio.h>
-#include <environment.h>
#include <fsl_esdhc_imx.h>
#include <netdev.h>
#include <bootcount.h>
diff --git a/board/liebherr/mccmon6/mccmon6.c b/board/liebherr/mccmon6/mccmon6.c
index 0e069a7755..7d2751ab03 100644
--- a/board/liebherr/mccmon6/mccmon6.c
+++ b/board/liebherr/mccmon6/mccmon6.c
@@ -5,6 +5,7 @@
*/
#include <common.h>
+#include <env.h>
#include <asm/arch/clock.h>
#include <asm/arch/iomux.h>
#include <asm/arch/imx-regs.h>
diff --git a/board/logicpd/imx6/imx6logic.c b/board/logicpd/imx6/imx6logic.c
index 6e3ffa72d7..7a59b89d94 100644
--- a/board/logicpd/imx6/imx6logic.c
+++ b/board/logicpd/imx6/imx6logic.c
@@ -9,6 +9,7 @@
*/
#include <common.h>
+#include <env.h>
#include <miiphy.h>
#include <input.h>
#include <mmc.h>
diff --git a/board/logicpd/zoom1/zoom1.c b/board/logicpd/zoom1/zoom1.c
index 5e32077d64..6bfa41737f 100644
--- a/board/logicpd/zoom1/zoom1.c
+++ b/board/logicpd/zoom1/zoom1.c
@@ -15,7 +15,7 @@
*/
#include <common.h>
#include <dm.h>
-#include <environment.h>
+#include <env.h>
#include <ns16550.h>
#include <netdev.h>
#include <twl4030.h>
diff --git a/board/menlo/m53menlo/m53menlo.c b/board/menlo/m53menlo/m53menlo.c
index f2227f6992..bda5f0df5b 100644
--- a/board/menlo/m53menlo/m53menlo.c
+++ b/board/menlo/m53menlo/m53menlo.c
@@ -18,8 +18,10 @@
#include <asm/mach-imx/video.h>
#include <asm/gpio.h>
#include <asm/spl.h>
+#include <env.h>
#include <fdt_support.h>
#include <fsl_esdhc_imx.h>
+#include <gzip.h>
#include <i2c.h>
#include <ipu_pixfmt.h>
#include <linux/errno.h>
diff --git a/board/micronas/vct/vct.c b/board/micronas/vct/vct.c
index af3f11e8ac..e73d16db3e 100644
--- a/board/micronas/vct/vct.c
+++ b/board/micronas/vct/vct.c
@@ -7,6 +7,7 @@
#include <common.h>
#include <command.h>
+#include <env.h>
#include <netdev.h>
#include <asm/mipsregs.h>
#include "vct.h"
diff --git a/board/mscc/ocelot/ocelot.c b/board/mscc/ocelot/ocelot.c
index bcae8fa50c..91d03951db 100644
--- a/board/mscc/ocelot/ocelot.c
+++ b/board/mscc/ocelot/ocelot.c
@@ -7,7 +7,6 @@
#include <asm/io.h>
#include <asm/addrspace.h>
#include <asm/types.h>
-#include <environment.h>
#include <spi.h>
#include <led.h>
#include <wait_bit.h>
diff --git a/board/nokia/rx51/rx51.c b/board/nokia/rx51/rx51.c
index 76f6ede38c..71ca79deab 100644
--- a/board/nokia/rx51/rx51.c
+++ b/board/nokia/rx51/rx51.c
@@ -22,6 +22,7 @@
*/
#include <common.h>
+#include <env.h>
#include <watchdog.h>
#include <malloc.h>
#include <twl4030.h>
diff --git a/board/nvidia/p2371-2180/p2371-2180.c b/board/nvidia/p2371-2180/p2371-2180.c
index 4985302d6b..fa5288bf18 100644
--- a/board/nvidia/p2371-2180/p2371-2180.c
+++ b/board/nvidia/p2371-2180/p2371-2180.c
@@ -5,7 +5,7 @@
*/
#include <common.h>
-#include <environment.h>
+#include <env.h>
#include <fdtdec.h>
#include <i2c.h>
#include <linux/libfdt.h>
diff --git a/board/nvidia/p2771-0000/p2771-0000.c b/board/nvidia/p2771-0000/p2771-0000.c
index d294c7ae01..63cdb3a604 100644
--- a/board/nvidia/p2771-0000/p2771-0000.c
+++ b/board/nvidia/p2771-0000/p2771-0000.c
@@ -4,7 +4,7 @@
*/
#include <common.h>
-#include <environment.h>
+#include <env.h>
#include <fdtdec.h>
#include <i2c.h>
#include <linux/libfdt.h>
diff --git a/board/overo/common.c b/board/overo/common.c
index fc02d66d53..2c4f412e5d 100644
--- a/board/overo/common.c
+++ b/board/overo/common.c
@@ -17,6 +17,7 @@
#include <asm/arch/mux.h>
#include <asm/arch/sys_proto.h>
#include <asm/gpio.h>
+#include <asm/omap_mmc.h>
#include <asm/mach-types.h>
DECLARE_GLOBAL_DATA_PTR;
@@ -38,6 +39,31 @@ int board_init(void)
return 0;
}
+#if defined(CONFIG_MMC)
+int board_mmc_init(bd_t *bis)
+{
+ return omap_mmc_init(0, 0, 0, -1, -1);
+}
+#endif
+
+#if defined(CONFIG_MMC)
+void board_mmc_power_init(void)
+{
+ twl4030_power_mmc_init(0);
+}
+#endif
+
+#if defined(CONFIG_SPL_OS_BOOT)
+int spl_start_uboot(void)
+{
+ /* break into full u-boot on 'c' */
+ if (serial_tstc() && serial_getc() == 'c')
+ return 1;
+
+ return 0;
+}
+#endif /* CONFIG_SPL_OS_BOOT */
+
#define MUX_OVERO() \
/*SDRC*/\
MUX_VAL(CP(SDRC_D0), (IEN | PTD | DIS | M0)) /*SDRC_D0*/\
diff --git a/board/overo/overo.c b/board/overo/overo.c
index 8fa41f8155..442028a764 100644
--- a/board/overo/overo.c
+++ b/board/overo/overo.c
@@ -13,6 +13,7 @@
*/
#include <common.h>
#include <dm.h>
+#include <env.h>
#include <ns16550.h>
#include <netdev.h>
#include <twl4030.h>
@@ -376,20 +377,6 @@ int board_eth_init(bd_t *bis)
}
#endif
-#if defined(CONFIG_MMC)
-int board_mmc_init(bd_t *bis)
-{
- return omap_mmc_init(0, 0, 0, -1, -1);
-}
-#endif
-
-#if defined(CONFIG_MMC)
-void board_mmc_power_init(void)
-{
- twl4030_power_mmc_init(0);
-}
-#endif
-
#if defined(CONFIG_USB_EHCI_HCD)
static struct omap_usbhs_board_data usbhs_bdata = {
.port_mode[0] = OMAP_USBHS_PORT_MODE_UNUSED,
diff --git a/board/phytec/pcm051/board.c b/board/phytec/pcm051/board.c
index e720fdc0d9..43f6c5afcb 100644
--- a/board/phytec/pcm051/board.c
+++ b/board/phytec/pcm051/board.c
@@ -9,7 +9,7 @@
*/
#include <common.h>
-#include <environment.h>
+#include <env.h>
#include <errno.h>
#include <spl.h>
#include <asm/arch/cpu.h>
diff --git a/board/phytec/pcm052/pcm052.c b/board/phytec/pcm052/pcm052.c
index c30df5df9d..e1ebe8e75d 100644
--- a/board/phytec/pcm052/pcm052.c
+++ b/board/phytec/pcm052/pcm052.c
@@ -13,8 +13,8 @@
#include <asm/arch/ddrmc-vf610.h>
#include <asm/arch/crm_regs.h>
#include <asm/arch/clock.h>
+#include <env.h>
#include <led.h>
-#include <environment.h>
#include <miiphy.h>
DECLARE_GLOBAL_DATA_PTR;
@@ -376,7 +376,7 @@ int board_late_init(void)
if ((reg & SRC_SBMR1_BOOTCFG1_SDMMC) &&
!(reg & SRC_SBMR1_BOOTCFG1_MMC)) {
printf("------ SD card boot -------\n");
- set_default_env("!LVFBootloader", 0);
+ env_set_default("!LVFBootloader", 0);
env_set("bootcmd",
"run prepare_install_bk4r1_envs; run install_bk4r1rs");
}
diff --git a/board/phytec/pfla02/pfla02.c b/board/phytec/pfla02/pfla02.c
index 753cf2b87d..ae9ffe0390 100644
--- a/board/phytec/pfla02/pfla02.c
+++ b/board/phytec/pfla02/pfla02.c
@@ -15,6 +15,7 @@
#include <asm/mach-imx/boot_mode.h>
#include <asm/mach-imx/mxc_i2c.h>
#include <asm/mach-imx/spi.h>
+#include <env.h>
#include <linux/errno.h>
#include <asm/gpio.h>
#include <mmc.h>
diff --git a/board/phytec/phycore_rk3288/phycore-rk3288.c b/board/phytec/phycore_rk3288/phycore-rk3288.c
index 92f3bd25f4..5fcbf65b7c 100644
--- a/board/phytec/phycore_rk3288/phycore-rk3288.c
+++ b/board/phytec/phycore_rk3288/phycore-rk3288.c
@@ -7,8 +7,8 @@
#include <asm/io.h>
#include <common.h>
#include <dm.h>
-#include <environment.h>
-#include <fdtdec.h>
+#include <env.h>
+#include <env_internal.h>
#include <i2c.h>
#include <i2c_eeprom.h>
#include <netdev.h>
diff --git a/board/qualcomm/dragonboard410c/dragonboard410c.c b/board/qualcomm/dragonboard410c/dragonboard410c.c
index 9ceed3ad9b..d7f0f93fb1 100644
--- a/board/qualcomm/dragonboard410c/dragonboard410c.c
+++ b/board/qualcomm/dragonboard410c/dragonboard410c.c
@@ -7,10 +7,10 @@
#include <common.h>
#include <dm.h>
+#include <env.h>
#include <usb.h>
#include <asm/gpio.h>
#include <fdt_support.h>
-#include <environment.h>
#include <asm/arch/dram.h>
#include <asm/arch/misc.h>
diff --git a/board/qualcomm/dragonboard820c/dragonboard820c.c b/board/qualcomm/dragonboard820c/dragonboard820c.c
index ff6903523d..7a889646df 100644
--- a/board/qualcomm/dragonboard820c/dragonboard820c.c
+++ b/board/qualcomm/dragonboard820c/dragonboard820c.c
@@ -6,6 +6,7 @@
*/
#include <asm/arch/sysmap-apq8096.h>
+#include <env.h>
#include <linux/arm-smccc.h>
#include <linux/psci.h>
#include <common.h>
diff --git a/board/raspberrypi/rpi/rpi.c b/board/raspberrypi/rpi/rpi.c
index 617c892dde..7a6ca8f759 100644
--- a/board/raspberrypi/rpi/rpi.c
+++ b/board/raspberrypi/rpi/rpi.c
@@ -6,7 +6,7 @@
#include <common.h>
#include <config.h>
#include <dm.h>
-#include <environment.h>
+#include <env.h>
#include <efi_loader.h>
#include <fdt_support.h>
#include <fdt_simplefb.h>
diff --git a/board/renesas/alt/alt.c b/board/renesas/alt/alt.c
index 0726776a57..10ef7f931b 100644
--- a/board/renesas/alt/alt.c
+++ b/board/renesas/alt/alt.c
@@ -6,10 +6,11 @@
*/
#include <common.h>
+#include <env.h>
#include <malloc.h>
#include <dm.h>
#include <dm/platform_data/serial_sh.h>
-#include <environment.h>
+#include <env_internal.h>
#include <asm/processor.h>
#include <asm/mach-types.h>
#include <asm/io.h>
diff --git a/board/renesas/blanche/blanche.c b/board/renesas/blanche/blanche.c
index f5ada6e288..08c5448609 100644
--- a/board/renesas/blanche/blanche.c
+++ b/board/renesas/blanche/blanche.c
@@ -18,7 +18,7 @@
#include <asm/processor.h>
#include <dm.h>
#include <dm/platform_data/serial_sh.h>
-#include <environment.h>
+#include <env.h>
#include <i2c.h>
#include <linux/errno.h>
#include <malloc.h>
diff --git a/board/renesas/gose/gose.c b/board/renesas/gose/gose.c
index 7c61008739..f86c9f1a63 100644
--- a/board/renesas/gose/gose.c
+++ b/board/renesas/gose/gose.c
@@ -6,10 +6,11 @@
*/
#include <common.h>
+#include <env.h>
#include <malloc.h>
#include <dm.h>
#include <dm/platform_data/serial_sh.h>
-#include <environment.h>
+#include <env_internal.h>
#include <asm/processor.h>
#include <asm/mach-types.h>
#include <asm/io.h>
diff --git a/board/renesas/koelsch/koelsch.c b/board/renesas/koelsch/koelsch.c
index d07a7ca2ab..841d337f4d 100644
--- a/board/renesas/koelsch/koelsch.c
+++ b/board/renesas/koelsch/koelsch.c
@@ -7,10 +7,11 @@
*/
#include <common.h>
+#include <env.h>
#include <malloc.h>
#include <dm.h>
#include <dm/platform_data/serial_sh.h>
-#include <environment.h>
+#include <env_internal.h>
#include <asm/processor.h>
#include <asm/mach-types.h>
#include <asm/io.h>
diff --git a/board/renesas/lager/lager.c b/board/renesas/lager/lager.c
index f062bb0172..3cb1a56142 100644
--- a/board/renesas/lager/lager.c
+++ b/board/renesas/lager/lager.c
@@ -8,7 +8,8 @@
*/
#include <common.h>
-#include <environment.h>
+#include <env.h>
+#include <env_internal.h>
#include <malloc.h>
#include <netdev.h>
#include <dm.h>
diff --git a/board/renesas/porter/porter.c b/board/renesas/porter/porter.c
index 2e15a4cbbd..86f79da7fd 100644
--- a/board/renesas/porter/porter.c
+++ b/board/renesas/porter/porter.c
@@ -7,10 +7,11 @@
*/
#include <common.h>
+#include <env.h>
#include <malloc.h>
#include <dm.h>
#include <dm/platform_data/serial_sh.h>
-#include <environment.h>
+#include <env_internal.h>
#include <asm/processor.h>
#include <asm/mach-types.h>
#include <asm/io.h>
diff --git a/board/renesas/sh7752evb/sh7752evb.c b/board/renesas/sh7752evb/sh7752evb.c
index da33a0bd8a..d0b850f35d 100644
--- a/board/renesas/sh7752evb/sh7752evb.c
+++ b/board/renesas/sh7752evb/sh7752evb.c
@@ -4,7 +4,7 @@
*/
#include <common.h>
-#include <environment.h>
+#include <env.h>
#include <malloc.h>
#include <asm/processor.h>
#include <asm/io.h>
diff --git a/board/renesas/sh7753evb/sh7753evb.c b/board/renesas/sh7753evb/sh7753evb.c
index 5ddddb6571..e1bed7dcc3 100644
--- a/board/renesas/sh7753evb/sh7753evb.c
+++ b/board/renesas/sh7753evb/sh7753evb.c
@@ -4,7 +4,7 @@
*/
#include <common.h>
-#include <environment.h>
+#include <env.h>
#include <malloc.h>
#include <asm/processor.h>
#include <asm/io.h>
diff --git a/board/renesas/sh7757lcr/sh7757lcr.c b/board/renesas/sh7757lcr/sh7757lcr.c
index 3222701ad2..d2671202e9 100644
--- a/board/renesas/sh7757lcr/sh7757lcr.c
+++ b/board/renesas/sh7757lcr/sh7757lcr.c
@@ -4,7 +4,7 @@
*/
#include <common.h>
-#include <environment.h>
+#include <env.h>
#include <malloc.h>
#include <asm/processor.h>
#include <asm/io.h>
diff --git a/board/renesas/silk/silk.c b/board/renesas/silk/silk.c
index 59ba262ad7..25221e3c55 100644
--- a/board/renesas/silk/silk.c
+++ b/board/renesas/silk/silk.c
@@ -7,10 +7,11 @@
*/
#include <common.h>
+#include <env.h>
#include <malloc.h>
#include <dm.h>
#include <dm/platform_data/serial_sh.h>
-#include <environment.h>
+#include <env_internal.h>
#include <asm/processor.h>
#include <asm/mach-types.h>
#include <asm/io.h>
diff --git a/board/renesas/stout/stout.c b/board/renesas/stout/stout.c
index 7c515950d6..0a0ff5ff76 100644
--- a/board/renesas/stout/stout.c
+++ b/board/renesas/stout/stout.c
@@ -9,11 +9,12 @@
*/
#include <common.h>
+#include <env.h>
#include <malloc.h>
#include <netdev.h>
#include <dm.h>
#include <dm/platform_data/serial_sh.h>
-#include <environment.h>
+#include <env_internal.h>
#include <asm/processor.h>
#include <asm/mach-types.h>
#include <asm/io.h>
diff --git a/board/rockchip/tinker_rk3288/tinker-rk3288.c b/board/rockchip/tinker_rk3288/tinker-rk3288.c
index e6b018d89c..6c76c3c25c 100644
--- a/board/rockchip/tinker_rk3288/tinker-rk3288.c
+++ b/board/rockchip/tinker_rk3288/tinker-rk3288.c
@@ -5,7 +5,7 @@
#include <common.h>
#include <dm.h>
-#include <environment.h>
+#include <env.h>
#include <i2c_eeprom.h>
#include <netdev.h>
diff --git a/board/samsung/common/exynos5-dt.c b/board/samsung/common/exynos5-dt.c
index 87eb381345..387d1b9180 100644
--- a/board/samsung/common/exynos5-dt.c
+++ b/board/samsung/common/exynos5-dt.c
@@ -6,6 +6,7 @@
#include <common.h>
#include <dm.h>
#include <dwc3-uboot.h>
+#include <env.h>
#include <fdtdec.h>
#include <asm/io.h>
#include <errno.h>
diff --git a/board/samsung/common/misc.c b/board/samsung/common/misc.c
index 53cd1b2907..3ef1e79980 100644
--- a/board/samsung/common/misc.c
+++ b/board/samsung/common/misc.c
@@ -5,6 +5,7 @@
*/
#include <common.h>
+#include <env.h>
#include <lcd.h>
#include <libtizen.h>
#include <samsung/misc.h>
diff --git a/board/samsung/odroid/odroid.c b/board/samsung/odroid/odroid.c
index 3e594fd850..9aa97f0f2c 100644
--- a/board/samsung/odroid/odroid.c
+++ b/board/samsung/odroid/odroid.c
@@ -12,6 +12,7 @@
#include <asm/gpio.h>
#include <asm/arch/cpu.h>
#include <dm.h>
+#include <env.h>
#include <power/pmic.h>
#include <power/regulator.h>
#include <power/max77686_pmic.h>
diff --git a/board/samsung/trats/trats.c b/board/samsung/trats/trats.c
index e0846bcb5b..ec85f707c1 100644
--- a/board/samsung/trats/trats.c
+++ b/board/samsung/trats/trats.c
@@ -7,6 +7,7 @@
*/
#include <common.h>
+#include <env.h>
#include <lcd.h>
#include <asm/io.h>
#include <asm/gpio.h>
diff --git a/board/samsung/universal_c210/universal.c b/board/samsung/universal_c210/universal.c
index f8281f209a..ed9c5b50d9 100644
--- a/board/samsung/universal_c210/universal.c
+++ b/board/samsung/universal_c210/universal.c
@@ -6,6 +6,7 @@
*/
#include <common.h>
+#include <env.h>
#include <spi.h>
#include <lcd.h>
#include <asm/io.h>
diff --git a/board/samtec/vining_fpga/socfpga.c b/board/samtec/vining_fpga/socfpga.c
index efc8ddf162..1e095a4e7d 100644
--- a/board/samtec/vining_fpga/socfpga.c
+++ b/board/samtec/vining_fpga/socfpga.c
@@ -4,7 +4,7 @@
*/
#include <common.h>
-#include <environment.h>
+#include <env.h>
#include <asm/arch/reset_manager.h>
#include <asm/io.h>
#include <asm/gpio.h>
diff --git a/board/siemens/common/board.c b/board/siemens/common/board.c
index 622bde5f9f..676935a843 100644
--- a/board/siemens/common/board.c
+++ b/board/siemens/common/board.c
@@ -10,6 +10,7 @@
*/
#include <common.h>
+#include <env.h>
#include <errno.h>
#include <spl.h>
#include <asm/arch/cpu.h>
diff --git a/board/siemens/common/factoryset.c b/board/siemens/common/factoryset.c
index 96615424f6..7715ddf307 100644
--- a/board/siemens/common/factoryset.c
+++ b/board/siemens/common/factoryset.c
@@ -8,7 +8,9 @@
#if !defined(CONFIG_SPL_BUILD)
#include <common.h>
-#include <environment.h>
+#include <env.h>
+#include <dm.h>
+#include <env_internal.h>
#include <i2c.h>
#include <asm/io.h>
#include <asm/arch/cpu.h>
@@ -143,16 +145,39 @@ int factoryset_read_eeprom(int i2c_addr)
int i, pages = 0, size = 0;
unsigned char eeprom_buf[0x3c00], hdr[4], buf[MAX_STRING_LENGTH];
unsigned char *cp, *cp1;
+#if CONFIG_IS_ENABLED(DM_I2C)
+ struct udevice *bus, *dev;
+ int ret;
+#endif
#if defined(CONFIG_DFU_OVER_USB)
factory_dat.usb_vendor_id = CONFIG_USB_GADGET_VENDOR_NUM;
factory_dat.usb_product_id = CONFIG_USB_GADGET_PRODUCT_NUM;
#endif
+
+#if CONFIG_IS_ENABLED(DM_I2C)
+ ret = uclass_get_device_by_seq(UCLASS_I2C, EEPROM_I2C_BUS, &bus);
+ if (ret)
+ goto err;
+
+ ret = dm_i2c_probe(bus, i2c_addr, 0, &dev);
+ if (ret)
+ goto err;
+
+ ret = i2c_set_chip_offset_len(dev, 2);
+ if (ret)
+ goto err;
+
+ ret = dm_i2c_read(dev, EEPROM_FATORYSET_OFFSET, hdr, sizeof(hdr));
+ if (ret)
+ goto err;
+#else
if (i2c_probe(i2c_addr))
goto err;
if (i2c_read(i2c_addr, EEPROM_FATORYSET_OFFSET, 2, hdr, sizeof(hdr)))
goto err;
+#endif
if ((hdr[0] != 0x99) || (hdr[1] != 0x80)) {
printf("FactorySet is not right in eeprom.\n");
@@ -173,16 +198,33 @@ int factoryset_read_eeprom(int i2c_addr)
* data after every time we got a record from eeprom
*/
debug("Read eeprom page :\n");
- for (i = 0; i < pages; i++)
+ for (i = 0; i < pages; i++) {
+#if CONFIG_IS_ENABLED(DM_I2C)
+ ret = dm_i2c_read(dev, (OFF_PG + i) * EEPR_PG_SZ,
+ eeprom_buf + (i * EEPR_PG_SZ), EEPR_PG_SZ);
+ if (ret)
+ goto err;
+#else
if (i2c_read(i2c_addr, (OFF_PG + i) * EEPR_PG_SZ, 2,
eeprom_buf + (i * EEPR_PG_SZ), EEPR_PG_SZ))
goto err;
+#endif
+ }
- if (size % EEPR_PG_SZ)
+ if (size % EEPR_PG_SZ) {
+#if CONFIG_IS_ENABLED(DM_I2C)
+ ret = dm_i2c_read(dev, (OFF_PG + pages) * EEPR_PG_SZ,
+ eeprom_buf + (pages * EEPR_PG_SZ),
+ size % EEPR_PG_SZ);
+ if (ret)
+ goto err;
+#else
if (i2c_read(i2c_addr, (OFF_PG + pages) * EEPR_PG_SZ, 2,
eeprom_buf + (pages * EEPR_PG_SZ),
(size % EEPR_PG_SZ)))
goto err;
+#endif
+ }
/* we do below just for eeprom align */
for (i = 0; i < size; i++)
@@ -202,6 +244,20 @@ int factoryset_read_eeprom(int i2c_addr)
cp1 += 3;
}
+#if CONFIG_IS_ENABLED(TARGET_GIEDI) || CONFIG_IS_ENABLED(TARGET_DENEB)
+ /* get mac address for WLAN */
+ ret = get_factory_record_val(cp, size, (uchar *)"WLAN1", (uchar *)"mac",
+ buf, MAX_STRING_LENGTH);
+ if (ret > 0) {
+ cp1 = buf;
+ for (i = 0; i < 6; i++) {
+ factory_dat.mac_wlan[i] = simple_strtoul((char *)cp1,
+ NULL, 16);
+ cp1 += 3;
+ }
+ }
+#endif
+
#if defined(CONFIG_DFU_OVER_USB)
/* read vid and pid for dfu mode */
if (0 <= get_factory_record_val(cp, size, (uchar *)"USBD1",
@@ -264,42 +320,76 @@ err:
return 1;
}
-static struct ctrl_dev *cdev = (struct ctrl_dev *)CTRL_DEVICE_BASE;
+static int get_mac_from_efuse(uint8_t mac[6])
+{
+#ifdef CONFIG_AM33XX
+ struct ctrl_dev *cdev = (struct ctrl_dev *)CTRL_DEVICE_BASE;
+ uint32_t mac_hi, mac_lo;
+
+ mac_lo = readl(&cdev->macid0l);
+ mac_hi = readl(&cdev->macid0h);
+
+ mac[0] = mac_hi & 0xFF;
+ mac[1] = (mac_hi & 0xFF00) >> 8;
+ mac[2] = (mac_hi & 0xFF0000) >> 16;
+ mac[3] = (mac_hi & 0xFF000000) >> 24;
+ mac[4] = mac_lo & 0xFF;
+ mac[5] = (mac_lo & 0xFF00) >> 8;
+#else
+ /* unhandled */
+ memset(mac, 0, 6);
+#endif
+ if (!is_valid_ethaddr(mac)) {
+ puts("Warning: ethaddr not set by FactorySet or E-fuse. ");
+ puts("Set <ethaddr> variable to overcome this.\n");
+ return -1;
+ }
+ return 0;
+}
static int factoryset_mac_env_set(void)
{
uint8_t mac_addr[6];
+ /* Set mac from factoryset or try reading E-fuse */
debug("FactorySet: Set mac address\n");
if (is_valid_ethaddr(factory_dat.mac)) {
memcpy(mac_addr, factory_dat.mac, 6);
} else {
- uint32_t mac_hi, mac_lo;
-
debug("Warning: FactorySet: <ethaddr> not set. Fallback to E-fuse\n");
- mac_lo = readl(&cdev->macid0l);
- mac_hi = readl(&cdev->macid0h);
-
- mac_addr[0] = mac_hi & 0xFF;
- mac_addr[1] = (mac_hi & 0xFF00) >> 8;
- mac_addr[2] = (mac_hi & 0xFF0000) >> 16;
- mac_addr[3] = (mac_hi & 0xFF000000) >> 24;
- mac_addr[4] = mac_lo & 0xFF;
- mac_addr[5] = (mac_lo & 0xFF00) >> 8;
- if (!is_valid_ethaddr(mac_addr)) {
- printf("Warning: ethaddr not set by FactorySet or E-fuse. Set <ethaddr> variable to overcome this.\n");
+ if (get_mac_from_efuse(mac_addr) < 0)
return -1;
- }
}
eth_env_set_enetaddr("ethaddr", mac_addr);
+
+#if CONFIG_IS_ENABLED(TARGET_GIEDI) || CONFIG_IS_ENABLED(TARGET_DENEB)
+ eth_env_set_enetaddr("eth1addr", mac_addr);
+
+ /* wlan mac */
+ if (is_valid_ethaddr(factory_dat.mac_wlan))
+ eth_env_set_enetaddr("eth2addr", factory_dat.mac_wlan);
+#endif
return 0;
}
+static void factoryset_dtb_env_set(void)
+{
+ /* Set ASN in environment*/
+ if (factory_dat.asn[0] != 0) {
+ env_set("dtb_name", (char *)factory_dat.asn);
+ } else {
+ /* dtb suffix gets added in load script */
+ env_set("dtb_name", "default");
+ }
+}
+
int factoryset_env_set(void)
{
int ret = 0;
+ factoryset_dtb_env_set();
+
if (factoryset_mac_env_set() < 0)
ret = -1;
diff --git a/board/siemens/common/factoryset.h b/board/siemens/common/factoryset.h
index d4e8353249..261a217687 100644
--- a/board/siemens/common/factoryset.h
+++ b/board/siemens/common/factoryset.h
@@ -11,6 +11,9 @@
struct factorysetcontainer {
uchar mac[6];
+#if CONFIG_IS_ENABLED(TARGET_GIEDI) || CONFIG_IS_ENABLED(TARGET_DENEB)
+ uchar mac_wlan[6];
+#endif
int usb_vendor_id;
int usb_product_id;
int pxm50;
diff --git a/board/siemens/draco/board.c b/board/siemens/draco/board.c
index 95b89dac0e..a6840b895b 100644
--- a/board/siemens/draco/board.c
+++ b/board/siemens/draco/board.c
@@ -13,6 +13,7 @@
*/
#include <common.h>
+#include <env.h>
#include <errno.h>
#include <spl.h>
#include <asm/arch/cpu.h>
diff --git a/board/siemens/pxm2/board.c b/board/siemens/pxm2/board.c
index 1b9e83e248..30f0902701 100644
--- a/board/siemens/pxm2/board.c
+++ b/board/siemens/pxm2/board.c
@@ -13,7 +13,7 @@
*/
#include <common.h>
-#include <environment.h>
+#include <env.h>
#include <errno.h>
#include <spl.h>
#include <asm/arch/cpu.h>
diff --git a/board/siemens/rut/board.c b/board/siemens/rut/board.c
index 25e2ed22a6..539ecef22c 100644
--- a/board/siemens/rut/board.c
+++ b/board/siemens/rut/board.c
@@ -11,6 +11,7 @@
*/
#include <common.h>
+#include <env.h>
#include <errno.h>
#include <spi.h>
#include <spl.h>
diff --git a/board/siemens/taurus/taurus.c b/board/siemens/taurus/taurus.c
index 6ea97eb4e8..1cf1f9e1f7 100644
--- a/board/siemens/taurus/taurus.c
+++ b/board/siemens/taurus/taurus.c
@@ -14,7 +14,7 @@
#include <command.h>
#include <common.h>
#include <dm.h>
-#include <environment.h>
+#include <env.h>
#include <asm/io.h>
#include <asm/arch/at91sam9260_matrix.h>
#include <asm/arch/at91sam9_smc.h>
diff --git a/board/silica/pengwyn/board.c b/board/silica/pengwyn/board.c
index 90ea8c601c..345701fd52 100644
--- a/board/silica/pengwyn/board.c
+++ b/board/silica/pengwyn/board.c
@@ -6,7 +6,7 @@
*/
#include <common.h>
-#include <environment.h>
+#include <env.h>
#include <asm/arch/cpu.h>
#include <asm/arch/hardware.h>
#include <asm/arch/ddr_defs.h>
diff --git a/board/socrates/socrates.c b/board/socrates/socrates.c
index ff465a8ef2..da9ae5bebb 100644
--- a/board/socrates/socrates.c
+++ b/board/socrates/socrates.c
@@ -11,6 +11,7 @@
*/
#include <common.h>
+#include <env.h>
#include <pci.h>
#include <asm/processor.h>
#include <asm/immap_85xx.h>
diff --git a/board/softing/vining_2000/vining_2000.c b/board/softing/vining_2000/vining_2000.c
index 533280130e..51985b91c2 100644
--- a/board/softing/vining_2000/vining_2000.c
+++ b/board/softing/vining_2000/vining_2000.c
@@ -16,9 +16,9 @@
#include <asm/mach-imx/iomux-v3.h>
#include <asm/io.h>
#include <asm/mach-imx/mxc_i2c.h>
+#include <env.h>
#include <linux/sizes.h>
#include <common.h>
-#include <environment.h>
#include <fsl_esdhc_imx.h>
#include <mmc.h>
#include <i2c.h>
diff --git a/board/solidrun/mx6cuboxi/mx6cuboxi.c b/board/solidrun/mx6cuboxi/mx6cuboxi.c
index d333ccc446..f82fb0786a 100644
--- a/board/solidrun/mx6cuboxi/mx6cuboxi.c
+++ b/board/solidrun/mx6cuboxi/mx6cuboxi.c
@@ -18,6 +18,7 @@
#include <asm/arch/iomux.h>
#include <asm/arch/mx6-pins.h>
#include <asm/arch/mxc_hdmi.h>
+#include <env.h>
#include <linux/errno.h>
#include <asm/gpio.h>
#include <asm/mach-imx/iomux-v3.h>
diff --git a/board/st/stm32mp1/stm32mp1.c b/board/st/stm32mp1/stm32mp1.c
index b99c6c08a3..279c7b7797 100644
--- a/board/st/stm32mp1/stm32mp1.c
+++ b/board/st/stm32mp1/stm32mp1.c
@@ -8,7 +8,8 @@
#include <config.h>
#include <clk.h>
#include <dm.h>
-#include <environment.h>
+#include <env.h>
+#include <env_internal.h>
#include <g_dnl.h>
#include <generic-phy.h>
#include <i2c.h>
diff --git a/board/sunxi/board.c b/board/sunxi/board.c
index 98bc3cd0c1..e3b2d13892 100644
--- a/board/sunxi/board.c
+++ b/board/sunxi/board.c
@@ -12,6 +12,7 @@
#include <common.h>
#include <dm.h>
+#include <env.h>
#include <mmc.h>
#include <axp_pmic.h>
#include <generic-phy.h>
@@ -29,7 +30,7 @@
#include <asm/gpio.h>
#include <asm/io.h>
#include <u-boot/crc.h>
-#include <environment.h>
+#include <env_internal.h>
#include <linux/libfdt.h>
#include <nand.h>
#include <net.h>
diff --git a/board/synopsys/hsdk/env-lib.c b/board/synopsys/hsdk/env-lib.c
index 66e4581fae..f443c21e6d 100644
--- a/board/synopsys/hsdk/env-lib.c
+++ b/board/synopsys/hsdk/env-lib.c
@@ -5,6 +5,7 @@
*/
#include "env-lib.h"
+#include <env.h>
#define MAX_CMD_LEN 25
diff --git a/board/synopsys/hsdk/hsdk.c b/board/synopsys/hsdk/hsdk.c
index ac4d980c49..8a7642a0aa 100644
--- a/board/synopsys/hsdk/hsdk.c
+++ b/board/synopsys/hsdk/hsdk.c
@@ -6,6 +6,7 @@
#include <common.h>
#include <config.h>
+#include <env.h>
#include <linux/printk.h>
#include <linux/kernel.h>
#include <linux/io.h>
diff --git a/board/tcl/sl50/board.c b/board/tcl/sl50/board.c
index 6bb6482dd0..c7eed31946 100644
--- a/board/tcl/sl50/board.c
+++ b/board/tcl/sl50/board.c
@@ -8,6 +8,7 @@
*/
#include <common.h>
+#include <env.h>
#include <errno.h>
#include <spl.h>
#include <asm/arch/cpu.h>
@@ -27,9 +28,8 @@
#include <cpsw.h>
#include <power/tps65217.h>
#include <power/tps65910.h>
-#include <environment.h>
+#include <env_internal.h>
#include <watchdog.h>
-#include <environment.h>
#include "board.h"
DECLARE_GLOBAL_DATA_PTR;
diff --git a/board/technologic/ts4800/ts4800.c b/board/technologic/ts4800/ts4800.c
index 927a19d05a..82eb0c285c 100644
--- a/board/technologic/ts4800/ts4800.c
+++ b/board/technologic/ts4800/ts4800.c
@@ -11,12 +11,12 @@
#include <asm/gpio.h>
#include <asm/arch/imx-regs.h>
#include <asm/arch/iomux-mx51.h>
+#include <env.h>
#include <linux/errno.h>
#include <asm/arch/sys_proto.h>
#include <asm/arch/crm_regs.h>
#include <asm/arch/clock.h>
#include <asm/mach-imx/mx5_video.h>
-#include <environment.h>
#include <mmc.h>
#include <input.h>
#include <fsl_esdhc_imx.h>
diff --git a/board/theobroma-systems/puma_rk3399/puma-rk3399.c b/board/theobroma-systems/puma_rk3399/puma-rk3399.c
index a7e7f022ba..4113a1c6ee 100644
--- a/board/theobroma-systems/puma_rk3399/puma-rk3399.c
+++ b/board/theobroma-systems/puma_rk3399/puma-rk3399.c
@@ -5,7 +5,7 @@
#include <common.h>
#include <dm.h>
-#include <environment.h>
+#include <env.h>
#include <misc.h>
#include <spl.h>
#include <syscon.h>
diff --git a/board/ti/am335x/board.c b/board/ti/am335x/board.c
index 2c32b92d94..7eaa6cd96d 100644
--- a/board/ti/am335x/board.c
+++ b/board/ti/am335x/board.c
@@ -9,6 +9,7 @@
#include <common.h>
#include <dm.h>
+#include <env.h>
#include <errno.h>
#include <spl.h>
#include <serial.h>
@@ -33,9 +34,8 @@
#include <cpsw.h>
#include <power/tps65217.h>
#include <power/tps65910.h>
-#include <environment.h>
+#include <env_internal.h>
#include <watchdog.h>
-#include <environment.h>
#include "../common/board_detect.h"
#include "board.h"
diff --git a/board/ti/am43xx/board.c b/board/ti/am43xx/board.c
index d29a22cf05..2e09cc20e8 100644
--- a/board/ti/am43xx/board.c
+++ b/board/ti/am43xx/board.c
@@ -8,7 +8,7 @@
*/
#include <common.h>
-#include <environment.h>
+#include <env.h>
#include <i2c.h>
#include <linux/errno.h>
#include <spl.h>
diff --git a/board/ti/am57xx/board.c b/board/ti/am57xx/board.c
index 1a903f13a6..f78e6c2e1f 100644
--- a/board/ti/am57xx/board.c
+++ b/board/ti/am57xx/board.c
@@ -8,6 +8,7 @@
*/
#include <common.h>
+#include <env.h>
#include <palmas.h>
#include <sata.h>
#include <usb.h>
@@ -23,7 +24,6 @@
#include <asm/arch/sata.h>
#include <asm/arch/gpio.h>
#include <asm/arch/omap.h>
-#include <environment.h>
#include <usb.h>
#include <linux/usb/gadget.h>
#include <dwc3-uboot.h>
diff --git a/board/ti/am65x/evm.c b/board/ti/am65x/evm.c
index 7bd8c4fa66..e01adcd642 100644
--- a/board/ti/am65x/evm.c
+++ b/board/ti/am65x/evm.c
@@ -14,6 +14,7 @@
#include <asm/gpio.h>
#include <asm/io.h>
#include <asm/omap_common.h>
+#include <env.h>
#include <spl.h>
#include <asm/arch/sys_proto.h>
diff --git a/board/ti/beagle/beagle.c b/board/ti/beagle/beagle.c
index 91e0a4c026..0138fc91fc 100644
--- a/board/ti/beagle/beagle.c
+++ b/board/ti/beagle/beagle.c
@@ -14,6 +14,7 @@
*/
#include <common.h>
#include <dm.h>
+#include <env.h>
#include <ns16550.h>
#ifdef CONFIG_LED_STATUS
#include <status_led.h>
diff --git a/board/ti/common/board_detect.c b/board/ti/common/board_detect.c
index 32fa10599e..bc89cc57bd 100644
--- a/board/ti/common/board_detect.c
+++ b/board/ti/common/board_detect.c
@@ -11,6 +11,7 @@
#include <asm/arch/hardware.h>
#include <asm/omap_common.h>
#include <dm/uclass.h>
+#include <env.h>
#include <i2c.h>
#include "board_detect.h"
diff --git a/board/ti/dra7xx/evm.c b/board/ti/dra7xx/evm.c
index 179adc2fff..74d04bb1e3 100644
--- a/board/ti/dra7xx/evm.c
+++ b/board/ti/dra7xx/evm.c
@@ -10,6 +10,7 @@
* Steve Sakoman <steve@sakoman.com>
*/
#include <common.h>
+#include <env.h>
#include <palmas.h>
#include <sata.h>
#include <linux/string.h>
@@ -24,7 +25,6 @@
#include <asm/arch/sys_proto.h>
#include <asm/arch/mmc_host_def.h>
#include <asm/arch/sata.h>
-#include <environment.h>
#include <dwc3-uboot.h>
#include <dwc3-omap-uboot.h>
#include <i2c.h>
diff --git a/board/ti/evm/evm.c b/board/ti/evm/evm.c
index 93408047b2..d0b9bafbd1 100644
--- a/board/ti/evm/evm.c
+++ b/board/ti/evm/evm.c
@@ -12,6 +12,7 @@
*/
#include <common.h>
#include <dm.h>
+#include <env.h>
#include <ns16550.h>
#include <netdev.h>
#include <asm/io.h>
diff --git a/board/ti/ks2_evm/board.c b/board/ti/ks2_evm/board.c
index eed62e9cac..e9bc68049b 100644
--- a/board/ti/ks2_evm/board.c
+++ b/board/ti/ks2_evm/board.c
@@ -8,6 +8,7 @@
#include <common.h>
#include "board.h"
+#include <env.h>
#include <spl.h>
#include <exports.h>
#include <fdt_support.h>
diff --git a/board/ti/ks2_evm/board_k2g.c b/board/ti/ks2_evm/board_k2g.c
index 6d0fc21c67..4ff9a44b37 100644
--- a/board/ti/ks2_evm/board_k2g.c
+++ b/board/ti/ks2_evm/board_k2g.c
@@ -6,6 +6,7 @@
* Texas Instruments Incorporated, <www.ti.com>
*/
#include <common.h>
+#include <env.h>
#include <asm/arch/clock.h>
#include <asm/ti-common/keystone_net.h>
#include <asm/arch/psc_defs.h>
diff --git a/board/ti/panda/panda.c b/board/ti/panda/panda.c
index f88aa4dfc6..20199da390 100644
--- a/board/ti/panda/panda.c
+++ b/board/ti/panda/panda.c
@@ -11,6 +11,7 @@
#include <asm/arch/clock.h>
#include <asm/arch/gpio.h>
#include <asm/gpio.h>
+#include <env.h>
#include <twl6030.h>
#include "panda_mux_data.h"
diff --git a/board/ti/ti814x/evm.c b/board/ti/ti814x/evm.c
index d8ee51b366..2b9385d14b 100644
--- a/board/ti/ti814x/evm.c
+++ b/board/ti/ti814x/evm.c
@@ -9,7 +9,7 @@
#include <common.h>
#include <cpsw.h>
-#include <environment.h>
+#include <env.h>
#include <errno.h>
#include <spl.h>
#include <asm/arch/cpu.h>
diff --git a/board/ti/ti816x/evm.c b/board/ti/ti816x/evm.c
index 240df8cbe1..8f7b591b5c 100644
--- a/board/ti/ti816x/evm.c
+++ b/board/ti/ti816x/evm.c
@@ -7,7 +7,7 @@
*/
#include <common.h>
-#include <environment.h>
+#include <env.h>
#include <spl.h>
#include <asm/cache.h>
#include <asm/io.h>
diff --git a/board/timll/devkit8000/devkit8000.c b/board/timll/devkit8000/devkit8000.c
index 50b70a501c..490d8cbcd0 100644
--- a/board/timll/devkit8000/devkit8000.c
+++ b/board/timll/devkit8000/devkit8000.c
@@ -17,7 +17,7 @@
*/
#include <common.h>
#include <dm.h>
-#include <environment.h>
+#include <env.h>
#include <ns16550.h>
#include <twl4030.h>
#include <asm/io.h>
diff --git a/board/toradex/apalis-imx8/apalis-imx8.c b/board/toradex/apalis-imx8/apalis-imx8.c
index 5433c7581b..af48b56095 100644
--- a/board/toradex/apalis-imx8/apalis-imx8.c
+++ b/board/toradex/apalis-imx8/apalis-imx8.c
@@ -12,7 +12,7 @@
#include <asm/arch/sys_proto.h>
#include <asm/gpio.h>
#include <asm/io.h>
-#include <environment.h>
+#include <env.h>
#include <errno.h>
#include <linux/libfdt.h>
diff --git a/board/toradex/apalis-tk1/apalis-tk1.c b/board/toradex/apalis-tk1/apalis-tk1.c
index beb7e10dfe..bc98858ae0 100644
--- a/board/toradex/apalis-tk1/apalis-tk1.c
+++ b/board/toradex/apalis-tk1/apalis-tk1.c
@@ -10,7 +10,7 @@
#include <asm/io.h>
#include <asm/arch/gpio.h>
#include <asm/arch/pinmux.h>
-#include <environment.h>
+#include <env_internal.h>
#include <pci_tegra.h>
#include <power/as3722.h>
#include <power/pmic.h>
diff --git a/board/toradex/apalis_imx6/apalis_imx6.c b/board/toradex/apalis_imx6/apalis_imx6.c
index 341735153b..6421a22c25 100644
--- a/board/toradex/apalis_imx6/apalis_imx6.c
+++ b/board/toradex/apalis_imx6/apalis_imx6.c
@@ -26,7 +26,7 @@
#include <dm/device-internal.h>
#include <dm/platform_data/serial_mxc.h>
#include <dwc_ahsata.h>
-#include <environment.h>
+#include <env.h>
#include <fsl_esdhc_imx.h>
#include <imx_thermal.h>
#include <micrel.h>
diff --git a/board/toradex/colibri-imx6ull/colibri-imx6ull.c b/board/toradex/colibri-imx6ull/colibri-imx6ull.c
index 21addaf6ed..d1ae463941 100644
--- a/board/toradex/colibri-imx6ull/colibri-imx6ull.c
+++ b/board/toradex/colibri-imx6ull/colibri-imx6ull.c
@@ -17,6 +17,7 @@
#include <asm/io.h>
#include <dm.h>
#include <dm/platform_data/serial_mxc.h>
+#include <env.h>
#include <fdt_support.h>
#include <imx_thermal.h>
#include <jffs2/load_kernel.h>
diff --git a/board/toradex/colibri-imx8x/colibri-imx8x.c b/board/toradex/colibri-imx8x/colibri-imx8x.c
index 8c725b7593..eae3c591a1 100644
--- a/board/toradex/colibri-imx8x/colibri-imx8x.c
+++ b/board/toradex/colibri-imx8x/colibri-imx8x.c
@@ -12,7 +12,7 @@
#include <asm/arch/sys_proto.h>
#include <asm/gpio.h>
#include <asm/io.h>
-#include <environment.h>
+#include <env.h>
#include <errno.h>
#include <linux/libfdt.h>
diff --git a/board/toradex/colibri_imx6/colibri_imx6.c b/board/toradex/colibri_imx6/colibri_imx6.c
index 6417ba4980..ad40b589c1 100644
--- a/board/toradex/colibri_imx6/colibri_imx6.c
+++ b/board/toradex/colibri_imx6/colibri_imx6.c
@@ -8,6 +8,7 @@
#include <common.h>
#include <dm.h>
+#include <env.h>
#include <asm/arch/clock.h>
#include <asm/arch/crm_regs.h>
@@ -24,7 +25,6 @@
#include <asm/mach-imx/video.h>
#include <cpu.h>
#include <dm/platform_data/serial_mxc.h>
-#include <environment.h>
#include <fsl_esdhc_imx.h>
#include <imx_thermal.h>
#include <micrel.h>
diff --git a/board/toradex/colibri_vf/colibri_vf.c b/board/toradex/colibri_vf/colibri_vf.c
index dad754b31f..04d8ffd1e6 100644
--- a/board/toradex/colibri_vf/colibri_vf.c
+++ b/board/toradex/colibri_vf/colibri_vf.c
@@ -15,6 +15,7 @@
#include <asm/arch/iomux-vf610.h>
#include <asm/gpio.h>
#include <asm/io.h>
+#include <env.h>
#include <fdt_support.h>
#include <fsl_dcu_fb.h>
#include <g_dnl.h>
diff --git a/board/toradex/common/tdx-cfg-block.c b/board/toradex/common/tdx-cfg-block.c
index c19d7611c2..9c86230595 100644
--- a/board/toradex/common/tdx-cfg-block.c
+++ b/board/toradex/common/tdx-cfg-block.c
@@ -21,6 +21,7 @@
#endif
#include <cli.h>
#include <console.h>
+#include <env.h>
#include <flash.h>
#include <malloc.h>
#include <mmc.h>
diff --git a/board/toradex/common/tdx-common.c b/board/toradex/common/tdx-common.c
index 2d560cceaf..e9441a7979 100644
--- a/board/toradex/common/tdx-common.c
+++ b/board/toradex/common/tdx-common.c
@@ -4,7 +4,7 @@
*/
#include <common.h>
-#include <environment.h>
+#include <env.h>
#include <g_dnl.h>
#include <linux/libfdt.h>
diff --git a/board/tqc/tqma6/tqma6.c b/board/tqc/tqma6/tqma6.c
index 5f0c7aace3..5b20afd488 100644
--- a/board/tqc/tqma6/tqma6.c
+++ b/board/tqc/tqma6/tqma6.c
@@ -12,6 +12,7 @@
#include <asm/arch/imx-regs.h>
#include <asm/arch/iomux.h>
#include <asm/arch/sys_proto.h>
+#include <env.h>
#include <linux/errno.h>
#include <asm/gpio.h>
#include <asm/io.h>
diff --git a/board/udoo/neo/neo.c b/board/udoo/neo/neo.c
index d51f648178..5c468a6a97 100644
--- a/board/udoo/neo/neo.c
+++ b/board/udoo/neo/neo.c
@@ -15,6 +15,7 @@
#include <asm/arch/mx6-pins.h>
#include <asm/gpio.h>
#include <asm/mach-imx/iomux-v3.h>
+#include <env.h>
#include <mmc.h>
#include <fsl_esdhc_imx.h>
#include <asm/arch/crm_regs.h>
diff --git a/board/udoo/udoo.c b/board/udoo/udoo.c
index c34a5a636b..f2c2bf47b0 100644
--- a/board/udoo/udoo.c
+++ b/board/udoo/udoo.c
@@ -8,6 +8,7 @@
#include <asm/arch/clock.h>
#include <asm/arch/imx-regs.h>
#include <asm/arch/iomux.h>
+#include <env.h>
#include <malloc.h>
#include <asm/arch/mx6-pins.h>
#include <linux/errno.h>
diff --git a/board/varisys/common/sys_eeprom.c b/board/varisys/common/sys_eeprom.c
index dea9af9b5d..77772a6923 100644
--- a/board/varisys/common/sys_eeprom.c
+++ b/board/varisys/common/sys_eeprom.c
@@ -12,6 +12,7 @@
#include <common.h>
#include <command.h>
+#include <env.h>
#include <i2c.h>
#include <linux/ctype.h>
diff --git a/board/varisys/cyrus/cyrus.c b/board/varisys/cyrus/cyrus.c
index 4ccce8a736..fa02fefefa 100644
--- a/board/varisys/cyrus/cyrus.c
+++ b/board/varisys/cyrus/cyrus.c
@@ -5,6 +5,7 @@
#include <common.h>
#include <command.h>
+#include <env.h>
#include <netdev.h>
#include <linux/compiler.h>
#include <asm/mmu.h>
diff --git a/board/vscom/baltos/board.c b/board/vscom/baltos/board.c
index c5949ad267..f5540841c9 100644
--- a/board/vscom/baltos/board.c
+++ b/board/vscom/baltos/board.c
@@ -8,6 +8,7 @@
*/
#include <common.h>
+#include <env.h>
#include <errno.h>
#include <linux/libfdt.h>
#include <spl.h>
@@ -28,7 +29,6 @@
#include <miiphy.h>
#include <cpsw.h>
#include <power/tps65910.h>
-#include <environment.h>
#include <watchdog.h>
#include "board.h"
diff --git a/board/wandboard/wandboard.c b/board/wandboard/wandboard.c
index 74d7a17028..69cdf3e9c9 100644
--- a/board/wandboard/wandboard.c
+++ b/board/wandboard/wandboard.c
@@ -20,6 +20,7 @@
#include <asm/mach-imx/video.h>
#include <asm/mach-imx/sata.h>
#include <asm/io.h>
+#include <env.h>
#include <linux/sizes.h>
#include <common.h>
#include <miiphy.h>
diff --git a/board/warp7/warp7.c b/board/warp7/warp7.c
index 134a6c99d7..39ae982257 100644
--- a/board/warp7/warp7.c
+++ b/board/warp7/warp7.c
@@ -13,6 +13,7 @@
#include <asm/mach-imx/iomux-v3.h>
#include <asm/io.h>
#include <common.h>
+#include <env.h>
#include <asm/arch/crm_regs.h>
#include <netdev.h>
#include <power/pmic.h>
diff --git a/board/work-microwave/work_92105/work_92105_display.c b/board/work-microwave/work_92105/work_92105_display.c
index ffa0fcfa87..db04dcabc7 100644
--- a/board/work-microwave/work_92105/work_92105_display.c
+++ b/board/work-microwave/work_92105/work_92105_display.c
@@ -15,6 +15,7 @@
#include <asm/arch/cpu.h>
#include <asm/arch/emc.h>
#include <asm/gpio.h>
+#include <env.h>
#include <spi.h>
#include <i2c.h>
#include <version.h>
diff --git a/board/xes/common/board.c b/board/xes/common/board.c
index 66467c6485..43575bc302 100644
--- a/board/xes/common/board.c
+++ b/board/xes/common/board.c
@@ -4,6 +4,7 @@
*/
#include <common.h>
+#include <env.h>
#include "fsl_8xxx_misc.h"
int checkboard(void)
diff --git a/board/xilinx/zynq/board.c b/board/xilinx/zynq/board.c
index 6857f2c0b8..35191b2f81 100644
--- a/board/xilinx/zynq/board.c
+++ b/board/xilinx/zynq/board.c
@@ -6,6 +6,7 @@
#include <common.h>
#include <dm/uclass.h>
+#include <env.h>
#include <fdtdec.h>
#include <fpga.h>
#include <malloc.h>
diff --git a/board/xilinx/zynqmp/cmds.c b/board/xilinx/zynqmp/cmds.c
index 321670d4e3..ed7ba58c64 100644
--- a/board/xilinx/zynqmp/cmds.c
+++ b/board/xilinx/zynqmp/cmds.c
@@ -5,6 +5,7 @@
*/
#include <common.h>
+#include <env.h>
#include <malloc.h>
#include <asm/arch/hardware.h>
#include <asm/arch/sys_proto.h>
diff --git a/board/xilinx/zynqmp/zynqmp.c b/board/xilinx/zynqmp/zynqmp.c
index 057ca1fbf7..d649daba96 100644
--- a/board/xilinx/zynqmp/zynqmp.c
+++ b/board/xilinx/zynqmp/zynqmp.c
@@ -5,6 +5,7 @@
*/
#include <common.h>
+#include <env.h>
#include <sata.h>
#include <ahci.h>
#include <scsi.h>
diff --git a/cmd/Kconfig b/cmd/Kconfig
index 22a3737b4e..041de1d831 100644
--- a/cmd/Kconfig
+++ b/cmd/Kconfig
@@ -1042,14 +1042,6 @@ config CMD_PCI
peripherals. Sub-commands allow bus enumeration, displaying and
changing configuration space and a few other features.
-config CMD_PCMCIA
- bool "pinit - Set up PCMCIA device"
- help
- Provides a means to initialise a PCMCIA (Personal Computer Memory
- Card International Association) device. This is an old standard from
- about 1990. These devices are typically removable memory or network
- cards using a standard 68-pin connector.
-
config CMD_PINMUX
bool "pinmux - show pins muxing"
default y if PINCTRL
diff --git a/cmd/Makefile b/cmd/Makefile
index 43a6b0ee21..58827b5679 100644
--- a/cmd/Makefile
+++ b/cmd/Makefile
@@ -106,7 +106,6 @@ obj-$(CONFIG_CMD_PART) += part.o
ifdef CONFIG_PCI
obj-$(CONFIG_CMD_PCI) += pci.o
endif
-obj-$(CONFIG_CMD_PCMCIA) += pcmcia.o
obj-$(CONFIG_CMD_PINMUX) += pinmux.o
obj-$(CONFIG_CMD_PXE) += pxe.o
obj-$(CONFIG_CMD_WOL) += wol.o
diff --git a/cmd/aes.c b/cmd/aes.c
index 25efb9642a..7ff4a71709 100644
--- a/cmd/aes.c
+++ b/cmd/aes.c
@@ -7,7 +7,6 @@
#include <common.h>
#include <command.h>
-#include <environment.h>
#include <uboot_aes.h>
#include <malloc.h>
#include <asm/byteorder.h>
diff --git a/cmd/avb.c b/cmd/avb.c
index 3f6fd763a0..5bc158252b 100644
--- a/cmd/avb.c
+++ b/cmd/avb.c
@@ -7,6 +7,7 @@
#include <avb_verify.h>
#include <command.h>
+#include <env.h>
#include <image.h>
#include <malloc.h>
#include <mmc.h>
diff --git a/cmd/bdinfo.c b/cmd/bdinfo.c
index 86c17dc427..ae6006f85f 100644
--- a/cmd/bdinfo.c
+++ b/cmd/bdinfo.c
@@ -9,6 +9,7 @@
*/
#include <common.h>
#include <command.h>
+#include <env.h>
#include <linux/compiler.h>
DECLARE_GLOBAL_DATA_PTR;
diff --git a/cmd/binop.c b/cmd/binop.c
index 116a2c0d55..6d2df5f3dd 100644
--- a/cmd/binop.c
+++ b/cmd/binop.c
@@ -2,6 +2,7 @@
#include <common.h>
#include <command.h>
+#include <env.h>
#include <hexdump.h>
#include <malloc.h>
#include <mapmem.h>
diff --git a/cmd/blob.c b/cmd/blob.c
index d3b6e454bf..80478b8802 100644
--- a/cmd/blob.c
+++ b/cmd/blob.c
@@ -6,7 +6,6 @@
#include <common.h>
#include <command.h>
-#include <environment.h>
#include <malloc.h>
#include <asm/byteorder.h>
#include <linux/compiler.h>
diff --git a/cmd/bmp.c b/cmd/bmp.c
index 00f0256a30..d2a39f677f 100644
--- a/cmd/bmp.c
+++ b/cmd/bmp.c
@@ -9,16 +9,16 @@
*/
#include <common.h>
-#include <dm.h>
-#include <lcd.h>
-#include <mapmem.h>
#include <bmp_layout.h>
#include <command.h>
-#include <asm/byteorder.h>
+#include <dm.h>
+#include <gzip.h>
+#include <lcd.h>
#include <malloc.h>
#include <mapmem.h>
#include <splash.h>
#include <video.h>
+#include <asm/byteorder.h>
static int bmp_info (ulong addr);
diff --git a/cmd/bootefi.c b/cmd/bootefi.c
index a45bfd139f..f613cce7e2 100644
--- a/cmd/bootefi.c
+++ b/cmd/bootefi.c
@@ -11,6 +11,7 @@
#include <dm.h>
#include <efi_loader.h>
#include <efi_selftest.h>
+#include <env.h>
#include <errno.h>
#include <linux/libfdt.h>
#include <linux/libfdt_env.h>
diff --git a/cmd/bootm.c b/cmd/bootm.c
index 41b341e2e5..8279f2b7cc 100644
--- a/cmd/bootm.c
+++ b/cmd/bootm.c
@@ -10,7 +10,7 @@
#include <common.h>
#include <bootm.h>
#include <command.h>
-#include <environment.h>
+#include <env.h>
#include <errno.h>
#include <image.h>
#include <malloc.h>
diff --git a/cmd/bootmenu.c b/cmd/bootmenu.c
index 0ae9d5a681..3dc2c854ac 100644
--- a/cmd/bootmenu.c
+++ b/cmd/bootmenu.c
@@ -6,6 +6,7 @@
#include <common.h>
#include <command.h>
#include <ansi.h>
+#include <env.h>
#include <menu.h>
#include <watchdog.h>
#include <malloc.h>
diff --git a/cmd/cbfs.c b/cmd/cbfs.c
index c118a952ac..3d1fc95972 100644
--- a/cmd/cbfs.c
+++ b/cmd/cbfs.c
@@ -8,6 +8,7 @@
*/
#include <common.h>
#include <command.h>
+#include <env.h>
#include <cbfs.h>
static int do_cbfs_init(cmd_tbl_t *cmdtp, int flag, int argc,
diff --git a/cmd/config.c b/cmd/config.c
index fcc9116a49..d2810d573b 100644
--- a/cmd/config.c
+++ b/cmd/config.c
@@ -5,6 +5,7 @@
#include <common.h>
#include <command.h>
+#include <gzip.h>
#include <malloc.h>
#include "config_data_gz.h"
diff --git a/cmd/cramfs.c b/cmd/cramfs.c
index 598028cfad..2188910b2a 100644
--- a/cmd/cramfs.c
+++ b/cmd/cramfs.c
@@ -12,6 +12,7 @@
*/
#include <common.h>
#include <command.h>
+#include <env.h>
#include <malloc.h>
#include <mapmem.h>
#include <linux/list.h>
diff --git a/cmd/dtimg.c b/cmd/dtimg.c
index ae7d82f26d..6c5d53cc68 100644
--- a/cmd/dtimg.c
+++ b/cmd/dtimg.c
@@ -4,6 +4,7 @@
* Sam Protsenko <semen.protsenko@linaro.org>
*/
+#include <env.h>
#include <image-android-dt.h>
#include <common.h>
diff --git a/cmd/efidebug.c b/cmd/efidebug.c
index 961e8fad22..ef97e19d07 100644
--- a/cmd/efidebug.c
+++ b/cmd/efidebug.c
@@ -9,7 +9,6 @@
#include <common.h>
#include <command.h>
#include <efi_loader.h>
-#include <environment.h>
#include <exports.h>
#include <hexdump.h>
#include <malloc.h>
diff --git a/cmd/elf.c b/cmd/elf.c
index d883be4193..538562fda5 100644
--- a/cmd/elf.c
+++ b/cmd/elf.c
@@ -16,7 +16,7 @@
#include <common.h>
#include <command.h>
#include <elf.h>
-#include <environment.h>
+#include <env.h>
#include <net.h>
#include <vxworks.h>
#ifdef CONFIG_X86
diff --git a/cmd/ethsw.c b/cmd/ethsw.c
index 473324f878..8846805799 100644
--- a/cmd/ethsw.c
+++ b/cmd/ethsw.c
@@ -7,7 +7,7 @@
#include <common.h>
#include <command.h>
-#include <environment.h>
+#include <env.h>
#include <errno.h>
#include <env_flags.h>
#include <ethsw.h>
diff --git a/cmd/fdt.c b/cmd/fdt.c
index 10d8f3230b..25a6ed40d2 100644
--- a/cmd/fdt.c
+++ b/cmd/fdt.c
@@ -9,6 +9,7 @@
#include <common.h>
#include <command.h>
+#include <env.h>
#include <linux/ctype.h>
#include <linux/types.h>
#include <asm/global_data.h>
diff --git a/cmd/fpga.c b/cmd/fpga.c
index eba989a730..b1c7b5453b 100644
--- a/cmd/fpga.c
+++ b/cmd/fpga.c
@@ -9,8 +9,10 @@
*/
#include <common.h>
#include <command.h>
+#include <env.h>
#include <fpga.h>
#include <fs.h>
+#include <gzip.h>
#include <malloc.h>
static long do_fpga_get_device(char *arg)
diff --git a/cmd/gpt.c b/cmd/gpt.c
index 33cda51396..0c4349f4b2 100644
--- a/cmd/gpt.c
+++ b/cmd/gpt.c
@@ -11,6 +11,7 @@
*/
#include <common.h>
+#include <env.h>
#include <malloc.h>
#include <command.h>
#include <part_efi.h>
diff --git a/cmd/i2c.c b/cmd/i2c.c
index 09c4ba9a1c..e0f8ece597 100644
--- a/cmd/i2c.c
+++ b/cmd/i2c.c
@@ -71,7 +71,6 @@
#include <console.h>
#include <dm.h>
#include <edid.h>
-#include <environment.h>
#include <errno.h>
#include <i2c.h>
#include <malloc.h>
diff --git a/cmd/ide.c b/cmd/ide.c
index 1c58efc55a..2f93ba7904 100644
--- a/cmd/ide.c
+++ b/cmd/ide.c
@@ -17,10 +17,6 @@
#include <asm/byteorder.h>
#include <asm/io.h>
-#if defined(CONFIG_IDE_PCMCIA)
-# include <pcmcia.h>
-#endif
-
#include <ide.h>
#include <ata.h>
diff --git a/cmd/ini.c b/cmd/ini.c
index 8c28fa6394..0c425262d0 100644
--- a/cmd/ini.c
+++ b/cmd/ini.c
@@ -13,7 +13,7 @@
#include <common.h>
#include <command.h>
-#include <environment.h>
+#include <env.h>
#include <linux/ctype.h>
#include <linux/string.h>
diff --git a/cmd/itest.c b/cmd/itest.c
index fd6f4166f1..8b630d71e6 100644
--- a/cmd/itest.c
+++ b/cmd/itest.c
@@ -14,6 +14,7 @@
#include <common.h>
#include <config.h>
#include <command.h>
+#include <env.h>
#include <mapmem.h>
#include <asm/io.h>
diff --git a/cmd/jffs2.c b/cmd/jffs2.c
index 64621f2546..b47cd3d989 100644
--- a/cmd/jffs2.c
+++ b/cmd/jffs2.c
@@ -72,6 +72,7 @@
*/
#include <common.h>
#include <command.h>
+#include <env.h>
#include <malloc.h>
#include <jffs2/jffs2.h>
#include <linux/list.h>
diff --git a/cmd/license.c b/cmd/license.c
index 1c0794f095..c5b04c331b 100644
--- a/cmd/license.c
+++ b/cmd/license.c
@@ -6,6 +6,7 @@
#include <common.h>
#include <command.h>
+#include <gzip.h>
#include <malloc.h>
#include "license_data_gz.h"
diff --git a/cmd/load.c b/cmd/load.c
index dd1e8dac13..713fe56b55 100644
--- a/cmd/load.c
+++ b/cmd/load.c
@@ -10,6 +10,7 @@
#include <common.h>
#include <command.h>
#include <console.h>
+#include <env.h>
#include <s_record.h>
#include <net.h>
#include <exports.h>
diff --git a/cmd/lzmadec.c b/cmd/lzmadec.c
index 6860b5f758..e3b9cc75ac 100644
--- a/cmd/lzmadec.c
+++ b/cmd/lzmadec.c
@@ -11,6 +11,7 @@
#include <common.h>
#include <command.h>
+#include <env.h>
#include <mapmem.h>
#include <asm/io.h>
diff --git a/cmd/md5sum.c b/cmd/md5sum.c
index 9d2d4180c5..63cbae0364 100644
--- a/cmd/md5sum.c
+++ b/cmd/md5sum.c
@@ -9,6 +9,7 @@
#include <common.h>
#include <command.h>
+#include <env.h>
#include <mapmem.h>
#include <u-boot/md5.h>
#include <asm/io.h>
diff --git a/cmd/mtdparts.c b/cmd/mtdparts.c
index f7ed1a0779..46155cabf6 100644
--- a/cmd/mtdparts.c
+++ b/cmd/mtdparts.c
@@ -72,6 +72,7 @@
#include <common.h>
#include <command.h>
+#include <env.h>
#include <malloc.h>
#include <jffs2/load_kernel.h>
#include <linux/list.h>
diff --git a/cmd/mvebu/bubt.c b/cmd/mvebu/bubt.c
index b4d371f305..84d2d531f0 100644
--- a/cmd/mvebu/bubt.c
+++ b/cmd/mvebu/bubt.c
@@ -7,6 +7,7 @@
#include <config.h>
#include <common.h>
#include <command.h>
+#include <env.h>
#include <vsprintf.h>
#include <errno.h>
#include <dm.h>
diff --git a/cmd/nand.c b/cmd/nand.c
index 899d504533..27efef20bc 100644
--- a/cmd/nand.c
+++ b/cmd/nand.c
@@ -23,6 +23,7 @@
#include <linux/mtd/mtd.h>
#include <command.h>
#include <console.h>
+#include <env.h>
#include <watchdog.h>
#include <malloc.h>
#include <asm/byteorder.h>
diff --git a/cmd/net.c b/cmd/net.c
index 89721b8f8b..237403977e 100644
--- a/cmd/net.c
+++ b/cmd/net.c
@@ -9,6 +9,7 @@
*/
#include <common.h>
#include <command.h>
+#include <env.h>
#include <net.h>
static int netboot_common(enum proto_t, cmd_tbl_t *, int, char * const []);
diff --git a/cmd/nvedit.c b/cmd/nvedit.c
index 46b1e60f0a..1cb0bc1460 100644
--- a/cmd/nvedit.c
+++ b/cmd/nvedit.c
@@ -27,7 +27,8 @@
#include <cli.h>
#include <command.h>
#include <console.h>
-#include <environment.h>
+#include <env.h>
+#include <env_internal.h>
#include <search.h>
#include <errno.h>
#include <malloc.h>
@@ -69,14 +70,14 @@ NAND|NVRAM|ONENAND|SATA|SPI_FLASH|REMOTE|UBI} or CONFIG_ENV_IS_NOWHERE
/*
* This variable is incremented on each do_env_set(), so it can
- * be used via get_env_id() as an indication, if the environment
+ * be used via env_get_id() as an indication, if the environment
* has changed or not. So it is possible to reread an environment
* variable only if the environment was changed ... done so for
* example in NetInitLoop()
*/
static int env_id = 1;
-int get_env_id(void)
+int env_get_id(void)
{
return env_id;
}
@@ -93,11 +94,11 @@ static int env_print(char *name, int flag)
ssize_t len;
if (name) { /* print a single name */
- ENTRY e, *ep;
+ struct env_entry e, *ep;
e.key = name;
e.data = NULL;
- hsearch_r(e, FIND, &ep, &env_htab, flag);
+ hsearch_r(e, ENV_FIND, &ep, &env_htab, flag);
if (ep == NULL)
return 0;
len = printf("%s=%s\n", ep->key, ep->data);
@@ -224,7 +225,7 @@ static int _do_env_set(int flag, int argc, char * const argv[], int env_flag)
{
int i, len;
char *name, *value, *s;
- ENTRY e, *ep;
+ struct env_entry e, *ep;
debug("Initial value for argc=%d\n", argc);
@@ -287,7 +288,7 @@ static int _do_env_set(int flag, int argc, char * const argv[], int env_flag)
e.key = name;
e.data = value;
- hsearch_r(e, ENTER, &ep, &env_htab, env_flag);
+ hsearch_r(e, ENV_ENTER, &ep, &env_htab, env_flag);
free(value);
if (!ep) {
printf("## Error inserting \"%s\" variable, errno=%d\n",
@@ -357,18 +358,6 @@ ulong env_get_hex(const char *varname, ulong default_val)
return value;
}
-void eth_parse_enetaddr(const char *addr, uint8_t *enetaddr)
-{
- char *end;
- int i;
-
- for (i = 0; i < 6; ++i) {
- enetaddr[i] = addr ? simple_strtoul(addr, &end, 16) : 0;
- if (addr)
- addr = (*end) ? end + 1 : end;
- }
-}
-
int eth_env_get_enetaddr(const char *name, uint8_t *enetaddr)
{
eth_parse_enetaddr(env_get(name), enetaddr);
@@ -484,7 +473,7 @@ static int print_static_binding(const char *var_name, const char *callback_name,
return 0;
}
-static int print_active_callback(ENTRY *entry)
+static int print_active_callback(struct env_entry *entry)
{
struct env_clbk_tbl *clbkp;
int i;
@@ -565,7 +554,7 @@ static int print_static_flags(const char *var_name, const char *flags,
return 0;
}
-static int print_active_flags(ENTRY *entry)
+static int print_active_flags(struct env_entry *entry)
{
enum env_flags_vartype type;
enum env_flags_varaccess access;
@@ -673,13 +662,13 @@ static int do_env_edit(cmd_tbl_t *cmdtp, int flag, int argc,
char *env_get(const char *name)
{
if (gd->flags & GD_FLG_ENV_READY) { /* after import into hashtable */
- ENTRY e, *ep;
+ struct env_entry e, *ep;
WATCHDOG_RESET();
e.key = name;
e.data = NULL;
- hsearch_r(e, FIND, &ep, &env_htab, 0);
+ hsearch_r(e, ENV_FIND, &ep, &env_htab, 0);
return ep ? ep->data : NULL;
}
@@ -708,7 +697,7 @@ int env_get_f(const char *name, char *buf, unsigned len)
return -1;
}
- val = envmatch((uchar *)name, i);
+ val = env_match((uchar *)name, i);
if (val < 0)
continue;
@@ -784,15 +773,7 @@ U_BOOT_CMD(
#endif
#endif /* CONFIG_SPL_BUILD */
-
-/*
- * Match a name / name=value pair
- *
- * s1 is either a simple 'name', or a 'name=value' pair.
- * i2 is the environment index for a 'name2=value2' pair.
- * If the names match, return the index for the value2, else -1.
- */
-int envmatch(uchar *s1, int i2)
+int env_match(uchar *s1, int i2)
{
if (s1 == NULL)
return -1;
@@ -833,13 +814,13 @@ static int do_env_default(cmd_tbl_t *cmdtp, int flag,
debug("Final value for argc=%d\n", argc);
if (all && (argc == 0)) {
/* Reset the whole environment */
- set_default_env("## Resetting to default environment\n",
+ env_set_default("## Resetting to default environment\n",
env_flag);
return 0;
}
if (!all && (argc > 0)) {
/* Reset individual variables */
- set_default_vars(argc, argv, env_flag);
+ env_set_default_vars(argc, argv, env_flag);
return 0;
}
@@ -1021,7 +1002,7 @@ NXTARG: ;
envp->crc = crc32(0, envp->data,
size ? size - offsetof(env_t, data) : ENV_SIZE);
#ifdef CONFIG_ENV_ADDR_REDUND
- envp->flags = ACTIVE_FLAG;
+ envp->flags = ENV_REDUND_ACTIVE;
#endif
}
env_set_hex("filesize", len + offsetof(env_t, data));
@@ -1281,14 +1262,14 @@ static int do_env_info(cmd_tbl_t *cmdtp, int flag,
static int do_env_exists(cmd_tbl_t *cmdtp, int flag, int argc,
char * const argv[])
{
- ENTRY e, *ep;
+ struct env_entry e, *ep;
if (argc < 2)
return CMD_RET_USAGE;
e.key = argv[1];
e.data = NULL;
- hsearch_r(e, FIND, &ep, &env_htab, 0);
+ hsearch_r(e, ENV_FIND, &ep, &env_htab, 0);
return (ep == NULL) ? 1 : 0;
}
diff --git a/cmd/nvedit_efi.c b/cmd/nvedit_efi.c
index 60a8ac84c8..ed6d09a530 100644
--- a/cmd/nvedit_efi.c
+++ b/cmd/nvedit_efi.c
@@ -9,6 +9,7 @@
#include <common.h>
#include <command.h>
#include <efi_loader.h>
+#include <env.h>
#include <exports.h>
#include <hexdump.h>
#include <malloc.h>
diff --git a/cmd/part.c b/cmd/part.c
index 653e13ced1..6cfb67b279 100644
--- a/cmd/part.c
+++ b/cmd/part.c
@@ -18,6 +18,7 @@
#include <common.h>
#include <config.h>
#include <command.h>
+#include <env.h>
#include <part.h>
#include <vsprintf.h>
diff --git a/cmd/pcmcia.c b/cmd/pcmcia.c
deleted file mode 100644
index 3b7537b105..0000000000
--- a/cmd/pcmcia.c
+++ /dev/null
@@ -1,341 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0+
-/*
- * (C) Copyright 2000-2006
- * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
- *
- ********************************************************************
- *
- * Lots of code copied from:
- *
- * m8xx_pcmcia.c - Linux PCMCIA socket driver for the mpc8xx series.
- * (C) 1999-2000 Magnus Damm <damm@bitsmart.com>
- *
- * "The ExCA standard specifies that socket controllers should provide
- * two IO and five memory windows per socket, which can be independently
- * configured and positioned in the host address space and mapped to
- * arbitrary segments of card address space. " - David A Hinds. 1999
- *
- * This controller does _not_ meet the ExCA standard.
- *
- * m8xx pcmcia controller brief info:
- * + 8 windows (attrib, mem, i/o)
- * + up to two slots (SLOT_A and SLOT_B)
- * + inputpins, outputpins, event and mask registers.
- * - no offset register. sigh.
- *
- * Because of the lacking offset register we must map the whole card.
- * We assign each memory window PCMCIA_MEM_WIN_SIZE address space.
- * Make sure there is (PCMCIA_MEM_WIN_SIZE * PCMCIA_MEM_WIN_NO
- * * PCMCIA_SOCKETS_NO) bytes at PCMCIA_MEM_WIN_BASE.
- * The i/o windows are dynamically allocated at PCMCIA_IO_WIN_BASE.
- * They are maximum 64KByte each...
- */
-
-/* #define DEBUG 1 */
-
-/*
- * PCMCIA support
- */
-#include <common.h>
-#include <command.h>
-#include <config.h>
-#include <pcmcia.h>
-#include <asm/io.h>
-
-/* -------------------------------------------------------------------- */
-
-#if defined(CONFIG_CMD_PCMCIA)
-
-extern int pcmcia_on (void);
-extern int pcmcia_off (void);
-
-int do_pinit (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
-{
- int rcode = 0;
-
- if (argc != 2) {
- printf ("Usage: pinit {on | off}\n");
- return 1;
- }
- if (strcmp(argv[1],"on") == 0) {
- rcode = pcmcia_on ();
- } else if (strcmp(argv[1],"off") == 0) {
- rcode = pcmcia_off ();
- } else {
- printf ("Usage: pinit {on | off}\n");
- return 1;
- }
-
- return rcode;
-}
-
-U_BOOT_CMD(
- pinit, 2, 0, do_pinit,
- "PCMCIA sub-system",
- "on - power on PCMCIA socket\n"
- "pinit off - power off PCMCIA socket"
-);
-
-#endif
-
-/* -------------------------------------------------------------------- */
-
-#undef CHECK_IDE_DEVICE
-
-#if defined(CONFIG_PXA_PCMCIA)
-#define CHECK_IDE_DEVICE
-#endif
-
-#ifdef CHECK_IDE_DEVICE
-
-int ide_devices_found;
-static uchar *known_cards[] = {
- (uchar *)"ARGOSY PnPIDE D5",
- NULL
-};
-
-#define MAX_TUPEL_SZ 512
-#define MAX_FEATURES 4
-
-#define MAX_IDENT_CHARS 64
-#define MAX_IDENT_FIELDS 4
-
-#define indent "\t "
-
-static void print_funcid (int func)
-{
- puts (indent);
- switch (func) {
- case CISTPL_FUNCID_MULTI:
- puts (" Multi-Function");
- break;
- case CISTPL_FUNCID_MEMORY:
- puts (" Memory");
- break;
- case CISTPL_FUNCID_SERIAL:
- puts (" Serial Port");
- break;
- case CISTPL_FUNCID_PARALLEL:
- puts (" Parallel Port");
- break;
- case CISTPL_FUNCID_FIXED:
- puts (" Fixed Disk");
- break;
- case CISTPL_FUNCID_VIDEO:
- puts (" Video Adapter");
- break;
- case CISTPL_FUNCID_NETWORK:
- puts (" Network Adapter");
- break;
- case CISTPL_FUNCID_AIMS:
- puts (" AIMS Card");
- break;
- case CISTPL_FUNCID_SCSI:
- puts (" SCSI Adapter");
- break;
- default:
- puts (" Unknown");
- break;
- }
- puts (" Card\n");
-}
-
-static void print_fixed (volatile uchar *p)
-{
- if (p == NULL)
- return;
-
- puts(indent);
-
- switch (*p) {
- case CISTPL_FUNCE_IDE_IFACE:
- { uchar iface = *(p+2);
-
- puts ((iface == CISTPL_IDE_INTERFACE) ? " IDE" : " unknown");
- puts (" interface ");
- break;
- }
- case CISTPL_FUNCE_IDE_MASTER:
- case CISTPL_FUNCE_IDE_SLAVE:
- { uchar f1 = *(p+2);
- uchar f2 = *(p+4);
-
- puts ((f1 & CISTPL_IDE_SILICON) ? " [silicon]" : " [rotating]");
-
- if (f1 & CISTPL_IDE_UNIQUE)
- puts (" [unique]");
-
- puts ((f1 & CISTPL_IDE_DUAL) ? " [dual]" : " [single]");
-
- if (f2 & CISTPL_IDE_HAS_SLEEP)
- puts (" [sleep]");
-
- if (f2 & CISTPL_IDE_HAS_STANDBY)
- puts (" [standby]");
-
- if (f2 & CISTPL_IDE_HAS_IDLE)
- puts (" [idle]");
-
- if (f2 & CISTPL_IDE_LOW_POWER)
- puts (" [low power]");
-
- if (f2 & CISTPL_IDE_REG_INHIBIT)
- puts (" [reg inhibit]");
-
- if (f2 & CISTPL_IDE_HAS_INDEX)
- puts (" [index]");
-
- if (f2 & CISTPL_IDE_IOIS16)
- puts (" [IOis16]");
-
- break;
- }
- }
- putc ('\n');
-}
-
-static int identify (volatile uchar *p)
-{
- uchar id_str[MAX_IDENT_CHARS];
- uchar data;
- uchar *t;
- uchar **card;
- int i, done;
-
- if (p == NULL)
- return (0); /* Don't know */
-
- t = id_str;
- done =0;
-
- for (i=0; i<=4 && !done; ++i, p+=2) {
- while ((data = *p) != '\0') {
- if (data == 0xFF) {
- done = 1;
- break;
- }
- *t++ = data;
- if (t == &id_str[MAX_IDENT_CHARS-1]) {
- done = 1;
- break;
- }
- p += 2;
- }
- if (!done)
- *t++ = ' ';
- }
- *t = '\0';
- while (--t > id_str) {
- if (*t == ' ')
- *t = '\0';
- else
- break;
- }
- puts ((char *)id_str);
- putc ('\n');
-
- for (card=known_cards; *card; ++card) {
- debug ("## Compare against \"%s\"\n", *card);
- if (strcmp((char *)*card, (char *)id_str) == 0) { /* found! */
- debug ("## CARD FOUND ##\n");
- return (1);
- }
- }
-
- return (0); /* don't know */
-}
-
-int check_ide_device (int slot)
-{
- volatile uchar *ident = NULL;
- volatile uchar *feature_p[MAX_FEATURES];
- volatile uchar *p, *start, *addr;
- int n_features = 0;
- uchar func_id = ~0;
- uchar code, len;
- ushort config_base = 0;
- int found = 0;
- int i;
-
- addr = (volatile uchar *)(CONFIG_SYS_PCMCIA_MEM_ADDR +
- CONFIG_SYS_PCMCIA_MEM_SIZE * (slot * 4));
- debug ("PCMCIA MEM: %08lX\n", (ulong)addr);
-
- start = p = (volatile uchar *) addr;
-
- while ((p - start) < MAX_TUPEL_SZ) {
-
- code = *p; p += 2;
-
- if (code == 0xFF) { /* End of chain */
- break;
- }
-
- len = *p; p += 2;
-#if defined(DEBUG) && (DEBUG > 1)
- { volatile uchar *q = p;
- printf ("\nTuple code %02x length %d\n\tData:",
- code, len);
-
- for (i = 0; i < len; ++i) {
- printf (" %02x", *q);
- q+= 2;
- }
- }
-#endif /* DEBUG */
- switch (code) {
- case CISTPL_VERS_1:
- ident = p + 4;
- break;
- case CISTPL_FUNCID:
- /* Fix for broken SanDisk which may have 0x80 bit set */
- func_id = *p & 0x7F;
- break;
- case CISTPL_FUNCE:
- if (n_features < MAX_FEATURES)
- feature_p[n_features++] = p;
- break;
- case CISTPL_CONFIG:
- config_base = (*(p+6) << 8) + (*(p+4));
- debug ("\n## Config_base = %04x ###\n", config_base);
- default:
- break;
- }
- p += 2 * len;
- }
-
- found = identify (ident);
-
- if (func_id != ((uchar)~0)) {
- print_funcid (func_id);
-
- if (func_id == CISTPL_FUNCID_FIXED)
- found = 1;
- else
- return (1); /* no disk drive */
- }
-
- for (i=0; i<n_features; ++i) {
- print_fixed (feature_p[i]);
- }
-
- if (!found) {
- printf ("unknown card type\n");
- return (1);
- }
-
- ide_devices_found |= (1 << slot);
-
- /* set I/O area in config reg -> only valid for ARGOSY D5!!! */
- *((uchar *)(addr + config_base)) = 1;
-#if 0
- printf("\n## Config_base = %04x ###\n", config_base);
- printf("Configuration Option Register: %02x @ %x\n", readb(addr + config_base), addr + config_base);
- printf("Card Configuration and Status Register: %02x\n", readb(addr + config_base + 2));
- printf("Pin Replacement Register Register: %02x\n", readb(addr + config_base + 4));
- printf("Socket and Copy Register: %02x\n", readb(addr + config_base + 6));
-#endif
- return (0);
-}
-
-#endif /* CHECK_IDE_DEVICE */
diff --git a/cmd/pxe.c b/cmd/pxe.c
index 1dd0a74ea3..2059975446 100644
--- a/cmd/pxe.c
+++ b/cmd/pxe.c
@@ -6,6 +6,7 @@
#include <common.h>
#include <command.h>
+#include <env.h>
#include <malloc.h>
#include <mapmem.h>
#include <lcd.h>
diff --git a/cmd/qfw.c b/cmd/qfw.c
index 7bf700538c..af826627a2 100644
--- a/cmd/qfw.c
+++ b/cmd/qfw.c
@@ -5,6 +5,7 @@
#include <common.h>
#include <command.h>
+#include <env.h>
#include <errno.h>
#include <qfw.h>
diff --git a/cmd/reiser.c b/cmd/reiser.c
index 2c0bca1c54..7f51b927a4 100644
--- a/cmd/reiser.c
+++ b/cmd/reiser.c
@@ -11,6 +11,7 @@
#include <common.h>
#include <config.h>
#include <command.h>
+#include <env.h>
#include <image.h>
#include <linux/ctype.h>
#include <asm/byteorder.h>
diff --git a/cmd/setexpr.c b/cmd/setexpr.c
index 1a6cecdeda..0182f19938 100644
--- a/cmd/setexpr.c
+++ b/cmd/setexpr.c
@@ -11,6 +11,7 @@
#include <common.h>
#include <config.h>
#include <command.h>
+#include <env.h>
#include <mapmem.h>
static ulong get_arg(char *s, int w)
diff --git a/cmd/source.c b/cmd/source.c
index 1a9a71aa37..3a51ebf0b6 100644
--- a/cmd/source.c
+++ b/cmd/source.c
@@ -16,6 +16,7 @@
#include <common.h>
#include <command.h>
+#include <env.h>
#include <image.h>
#include <malloc.h>
#include <mapmem.h>
diff --git a/cmd/spl.c b/cmd/spl.c
index 038f48818d..56051b8a4b 100644
--- a/cmd/spl.c
+++ b/cmd/spl.c
@@ -7,6 +7,7 @@
#include <common.h>
#include <command.h>
#include <cmd_spl.h>
+#include <env.h>
#include <linux/libfdt.h>
DECLARE_GLOBAL_DATA_PTR;
diff --git a/cmd/tpm-common.c b/cmd/tpm-common.c
index 89f2aa001b..38900fb159 100644
--- a/cmd/tpm-common.c
+++ b/cmd/tpm-common.c
@@ -6,6 +6,7 @@
#include <common.h>
#include <command.h>
#include <dm.h>
+#include <env.h>
#include <asm/unaligned.h>
#include <linux/string.h>
#include <tpm-common.h>
diff --git a/cmd/tpm-v1.c b/cmd/tpm-v1.c
index b75e0933a1..2807331524 100644
--- a/cmd/tpm-v1.c
+++ b/cmd/tpm-v1.c
@@ -4,6 +4,7 @@
*/
#include <common.h>
+#include <env.h>
#include <malloc.h>
#include <asm/unaligned.h>
#include <tpm-common.h>
diff --git a/cmd/tpm_test.c b/cmd/tpm_test.c
index 56a5aa4aa5..c14dd75a26 100644
--- a/cmd/tpm_test.c
+++ b/cmd/tpm_test.c
@@ -5,7 +5,6 @@
#include <common.h>
#include <command.h>
-#include <environment.h>
#include <tpm-v1.h>
#include "tpm-user-utils.h"
diff --git a/cmd/trace.c b/cmd/trace.c
index 7d328f88be..392b129536 100644
--- a/cmd/trace.c
+++ b/cmd/trace.c
@@ -5,6 +5,7 @@
#include <common.h>
#include <command.h>
+#include <env.h>
#include <mapmem.h>
#include <trace.h>
#include <asm/io.h>
diff --git a/cmd/ubi.c b/cmd/ubi.c
index c511a2fb76..ca5dc9021b 100644
--- a/cmd/ubi.c
+++ b/cmd/ubi.c
@@ -13,6 +13,7 @@
#include <common.h>
#include <command.h>
+#include <env.h>
#include <exports.h>
#include <memalign.h>
#include <mtd.h>
diff --git a/cmd/unzip.c b/cmd/unzip.c
index 6c0f97cb4b..afd58e7cdb 100644
--- a/cmd/unzip.c
+++ b/cmd/unzip.c
@@ -6,6 +6,8 @@
#include <common.h>
#include <command.h>
+#include <env.h>
+#include <gzip.h>
static int do_unzip(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
{
diff --git a/cmd/ximg.c b/cmd/ximg.c
index 9e53cc4557..a9481004f0 100644
--- a/cmd/ximg.c
+++ b/cmd/ximg.c
@@ -13,6 +13,8 @@
*/
#include <common.h>
#include <command.h>
+#include <env.h>
+#include <gzip.h>
#include <image.h>
#include <mapmem.h>
#include <watchdog.h>
diff --git a/cmd/zfs.c b/cmd/zfs.c
index 384ac4c939..ed5402bb13 100644
--- a/cmd/zfs.c
+++ b/cmd/zfs.c
@@ -12,6 +12,7 @@
#include <part.h>
#include <config.h>
#include <command.h>
+#include <env.h>
#include <image.h>
#include <linux/ctype.h>
#include <asm/byteorder.h>
diff --git a/cmd/zip.c b/cmd/zip.c
index 9cd400a7e8..8ef46e9815 100644
--- a/cmd/zip.c
+++ b/cmd/zip.c
@@ -6,6 +6,7 @@
#include <common.h>
#include <command.h>
+#include <env.h>
static int do_zip(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
{
diff --git a/common/autoboot.c b/common/autoboot.c
index 7a91736a00..b28bd6823d 100644
--- a/common/autoboot.c
+++ b/common/autoboot.c
@@ -9,6 +9,7 @@
#include <bootretry.h>
#include <cli.h>
#include <console.h>
+#include <env.h>
#include <fdtdec.h>
#include <hash.h>
#include <memalign.h>
diff --git a/common/board_f.c b/common/board_f.c
index 4760d728f3..31181a9dc4 100644
--- a/common/board_f.c
+++ b/common/board_f.c
@@ -14,11 +14,13 @@
#include <console.h>
#include <cpu.h>
#include <dm.h>
-#include <environment.h>
+#include <env.h>
+#include <env_internal.h>
#include <fdtdec.h>
#include <fs.h>
#include <i2c.h>
#include <initcall.h>
+#include <lcd.h>
#include <malloc.h>
#include <mapmem.h>
#include <os.h>
@@ -425,13 +427,6 @@ static int reserve_video(void)
gd->relocaddr = lcd_setmem(gd->relocaddr);
gd->fb_base = gd->relocaddr;
# endif /* CONFIG_FB_ADDR */
-#elif defined(CONFIG_VIDEO) && \
- (!defined(CONFIG_PPC)) && \
- !defined(CONFIG_ARM) && !defined(CONFIG_X86) && \
- !defined(CONFIG_M68K)
- /* reserve memory for video display (always full pages) */
- gd->relocaddr = video_setmem(gd->relocaddr);
- gd->fb_base = gd->relocaddr;
#endif
return 0;
diff --git a/common/board_r.c b/common/board_r.c
index 84aec7fc71..b7f68bba4a 100644
--- a/common/board_r.c
+++ b/common/board_r.c
@@ -18,7 +18,8 @@
#include <command.h>
#include <console.h>
#include <dm.h>
-#include <environment.h>
+#include <env.h>
+#include <env_internal.h>
#include <fdtdec.h>
#include <ide.h>
#include <initcall.h>
@@ -447,7 +448,7 @@ static int initr_env(void)
if (should_load_env())
env_relocate();
else
- set_default_env(NULL, 0);
+ env_set_default(NULL, 0);
#ifdef CONFIG_OF_CONTROL
env_set_hex("fdtcontroladdr",
(unsigned long)map_to_sysmem(gd->fdt_blob));
@@ -582,15 +583,6 @@ static int initr_post(void)
}
#endif
-#if defined(CONFIG_CMD_PCMCIA) && !defined(CONFIG_IDE)
-static int initr_pcmcia(void)
-{
- puts("PCMCIA:");
- pcmcia_init();
- return 0;
-}
-#endif
-
#if defined(CONFIG_IDE) && !defined(CONFIG_BLK)
static int initr_ide(void)
{
@@ -819,9 +811,6 @@ static init_fnc_t init_sequence_r[] = {
#ifdef CONFIG_POST
initr_post,
#endif
-#if defined(CONFIG_CMD_PCMCIA) && !defined(CONFIG_IDE)
- initr_pcmcia,
-#endif
#if defined(CONFIG_IDE) && !defined(CONFIG_BLK)
initr_ide,
#endif
diff --git a/common/bootm.c b/common/bootm.c
index 4629cdd82d..02295daf79 100644
--- a/common/bootm.c
+++ b/common/bootm.c
@@ -7,6 +7,7 @@
#ifndef USE_HOSTCC
#include <common.h>
#include <bootstage.h>
+#include <env.h>
#include <errno.h>
#include <fdt_support.h>
#include <lmb.h>
diff --git a/common/bootm_os.c b/common/bootm_os.c
index 855c471c28..6fb7d658da 100644
--- a/common/bootm_os.c
+++ b/common/bootm_os.c
@@ -6,6 +6,7 @@
#include <common.h>
#include <bootm.h>
+#include <env.h>
#include <fdt_support.h>
#include <linux/libfdt.h>
#include <malloc.h>
diff --git a/common/bootretry.c b/common/bootretry.c
index 072055b010..47aaaa8220 100644
--- a/common/bootretry.c
+++ b/common/bootretry.c
@@ -7,6 +7,7 @@
#include <common.h>
#include <bootretry.h>
#include <cli.h>
+#include <env.h>
#include <errno.h>
#include <watchdog.h>
diff --git a/common/cli.c b/common/cli.c
index f4054fb1fc..49b910666b 100644
--- a/common/cli.c
+++ b/common/cli.c
@@ -12,6 +12,7 @@
#include <cli.h>
#include <cli_hush.h>
#include <console.h>
+#include <env.h>
#include <fdtdec.h>
#include <malloc.h>
diff --git a/common/cli_hush.c b/common/cli_hush.c
index 955e8fe536..8f86e4aa4a 100644
--- a/common/cli_hush.c
+++ b/common/cli_hush.c
@@ -75,6 +75,7 @@
#define __U_BOOT__
#ifdef __U_BOOT__
+#include <env.h>
#include <malloc.h> /* malloc, free, realloc*/
#include <linux/ctype.h> /* isalpha, isdigit */
#include <common.h> /* readline */
diff --git a/common/cli_simple.c b/common/cli_simple.c
index 311880ad56..6c881c133c 100644
--- a/common/cli_simple.c
+++ b/common/cli_simple.c
@@ -12,6 +12,7 @@
#include <bootretry.h>
#include <cli.h>
#include <console.h>
+#include <env.h>
#include <linux/ctype.h>
#define DEBUG_PARSER 0 /* set to 1 to debug */
diff --git a/common/command.c b/common/command.c
index db25bf54e0..4b887a267f 100644
--- a/common/command.c
+++ b/common/command.c
@@ -11,6 +11,7 @@
#include <common.h>
#include <command.h>
#include <console.h>
+#include <env.h>
#include <linux/ctype.h>
/*
diff --git a/common/console.c b/common/console.c
index d086feabb1..89b1e9590c 100644
--- a/common/console.c
+++ b/common/console.c
@@ -8,6 +8,7 @@
#include <console.h>
#include <debug_uart.h>
#include <dm.h>
+#include <env.h>
#include <stdarg.h>
#include <iomux.h>
#include <malloc.h>
@@ -16,7 +17,7 @@
#include <serial.h>
#include <stdio_dev.h>
#include <exports.h>
-#include <environment.h>
+#include <env_internal.h>
#include <watchdog.h>
DECLARE_GLOBAL_DATA_PTR;
diff --git a/common/fdt_support.c b/common/fdt_support.c
index 86de5b8f05..baf7924ff6 100644
--- a/common/fdt_support.c
+++ b/common/fdt_support.c
@@ -7,6 +7,7 @@
*/
#include <common.h>
+#include <env.h>
#include <mapmem.h>
#include <stdio_dev.h>
#include <linux/ctype.h>
diff --git a/common/hash.c b/common/hash.c
index 413a5bfcda..d33e329897 100644
--- a/common/hash.c
+++ b/common/hash.c
@@ -12,6 +12,7 @@
#ifndef USE_HOSTCC
#include <common.h>
#include <command.h>
+#include <env.h>
#include <malloc.h>
#include <mapmem.h>
#include <hw_sha.h>
diff --git a/common/hwconfig.c b/common/hwconfig.c
index e9e956a322..72f3c4e0fa 100644
--- a/common/hwconfig.c
+++ b/common/hwconfig.c
@@ -11,6 +11,7 @@
#ifndef HWCONFIG_TEST
#include <config.h>
#include <common.h>
+#include <env.h>
#include <exports.h>
#include <hwconfig.h>
#include <linux/types.h>
diff --git a/common/image-android.c b/common/image-android.c
index 6c9568a655..264bf90007 100644
--- a/common/image-android.c
+++ b/common/image-android.c
@@ -4,6 +4,7 @@
*/
#include <common.h>
+#include <env.h>
#include <image.h>
#include <android_image.h>
#include <malloc.h>
diff --git a/common/image-fdt.c b/common/image-fdt.c
index e70da3dcb3..4247dcee0c 100644
--- a/common/image-fdt.c
+++ b/common/image-fdt.c
@@ -11,6 +11,7 @@
#include <common.h>
#include <fdt_support.h>
#include <fdtdec.h>
+#include <env.h>
#include <errno.h>
#include <image.h>
#include <linux/libfdt.h>
diff --git a/common/image.c b/common/image.c
index 495883185d..84e859a30f 100644
--- a/common/image.c
+++ b/common/image.c
@@ -8,6 +8,7 @@
#ifndef USE_HOSTCC
#include <common.h>
+#include <env.h>
#include <watchdog.h>
#ifdef CONFIG_SHOW_BOOT_PROGRESS
@@ -16,7 +17,7 @@
#include <rtc.h>
-#include <environment.h>
+#include <gzip.h>
#include <image.h>
#include <mapmem.h>
diff --git a/common/init/board_init.c b/common/init/board_init.c
index 526fee35ff..e52106966d 100644
--- a/common/init/board_init.c
+++ b/common/init/board_init.c
@@ -18,6 +18,23 @@ __weak void arch_setup_gd(struct global_data *gd_ptr)
}
#endif /* !CONFIG_X86 && !CONFIG_ARM */
+/**
+ * This function is called after the position of the initial stack is
+ * determined in gd->start_addr_sp. Boards can override it to set up
+ * stack-checking markers.
+ */
+__weak void board_init_f_init_stack_protection(void)
+{
+#if CONFIG_IS_ENABLED(SYS_REPORT_STACK_F_USAGE)
+ ulong stack_bottom = gd->start_addr_sp -
+ CONFIG_VAL(SIZE_LIMIT_PROVIDE_STACK);
+
+ /* substact some safety margin (0x20) since stack is in use here */
+ memset((void *)stack_bottom, CONFIG_VAL(SYS_STACK_F_CHECK_BYTE),
+ CONFIG_VAL(SIZE_LIMIT_PROVIDE_STACK) - 0x20);
+#endif
+}
+
/*
* Allocate reserved space for use as 'globals' from 'top' address and
* return 'bottom' address of allocated space
@@ -126,6 +143,9 @@ void board_init_f_init_reserve(ulong base)
/* next alloc will be higher by one 'early malloc arena' size */
base += CONFIG_VAL(SYS_MALLOC_F_LEN);
#endif
+
+ if (CONFIG_IS_ENABLED(SYS_REPORT_STACK_F_USAGE))
+ board_init_f_init_stack_protection();
}
/*
diff --git a/common/main.c b/common/main.c
index ce39c8d189..3a657c3d9a 100644
--- a/common/main.c
+++ b/common/main.c
@@ -10,6 +10,7 @@
#include <autoboot.h>
#include <cli.h>
#include <console.h>
+#include <env.h>
#include <version.h>
/*
diff --git a/common/spl/Kconfig b/common/spl/Kconfig
index 54154b93c9..630491699c 100644
--- a/common/spl/Kconfig
+++ b/common/spl/Kconfig
@@ -62,6 +62,25 @@ config SPL_SIZE_LIMIT_PROVIDE_STACK
of SRAM available for SPL when the stack required before reolcation
uses this SRAM, too.
+config SPL_SYS_STACK_F_CHECK_BYTE
+ hex
+ default 0xaa
+ help
+ Constant used to check the stack
+
+config SPL_SYS_REPORT_STACK_F_USAGE
+ depends on SPL_SIZE_LIMIT_PROVIDE_STACK != 0
+ bool "Check and report stack usage in SPL before relocation"
+ help
+ If this option is enabled, the initial SPL stack is filled with 0xaa
+ very early, up to the size configured with
+ SPL_SIZE_LIMIT_PROVIDE_STACK.
+ Later when SPL is done using this initial stack and switches to a
+ stack in DRAM, the actually used size of this initial stack is
+ reported by examining the memory and searching for the lowest
+ occurrence of non 0xaa bytes.
+ This default implementation works for stacks growing down only.
+
menu "PowerPC SPL Boot options"
depends on PPC && (SUPPORT_SPL && !SPL_FRAMEWORK)
diff --git a/common/spl/spl.c b/common/spl/spl.c
index c182705b3f..2c696f2a79 100644
--- a/common/spl/spl.c
+++ b/common/spl/spl.c
@@ -710,6 +710,28 @@ void preloader_console_init(void)
#endif
/**
+ * This function is called before the stack is changed from initial stack to
+ * relocated stack. It tries to dump the stack size used
+ */
+__weak void spl_relocate_stack_check(void)
+{
+#if CONFIG_IS_ENABLED(SYS_REPORT_STACK_F_USAGE)
+ ulong init_sp = gd->start_addr_sp;
+ ulong stack_bottom = init_sp - CONFIG_VAL(SIZE_LIMIT_PROVIDE_STACK);
+ u8 *ptr = (u8 *)stack_bottom;
+ ulong i;
+
+ for (i = 0; i < CONFIG_VAL(SIZE_LIMIT_PROVIDE_STACK); i++) {
+ if (*ptr != CONFIG_VAL(SYS_STACK_F_CHECK_BYTE))
+ break;
+ ptr++;
+ }
+ printf("SPL initial stack usage: %lu bytes\n",
+ CONFIG_VAL(SIZE_LIMIT_PROVIDE_STACK) - i);
+#endif
+}
+
+/**
* spl_relocate_stack_gd() - Relocate stack ready for board_init_r() execution
*
* Sometimes board_init_f() runs with a stack in SRAM but we want to use SDRAM
@@ -733,6 +755,9 @@ ulong spl_relocate_stack_gd(void)
gd_t *new_gd;
ulong ptr = CONFIG_SPL_STACK_R_ADDR;
+ if (CONFIG_IS_ENABLED(SYS_REPORT_STACK_F_USAGE))
+ spl_relocate_stack_check();
+
#if defined(CONFIG_SPL_SYS_MALLOC_SIMPLE) && CONFIG_VAL(SYS_MALLOC_F_LEN)
if (CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN) {
debug("SPL malloc() before relocation used 0x%lx bytes (%ld KB)\n",
diff --git a/common/spl/spl_dfu.c b/common/spl/spl_dfu.c
index c0225dc4e1..5728d43ad3 100644
--- a/common/spl/spl_dfu.c
+++ b/common/spl/spl_dfu.c
@@ -6,6 +6,7 @@
* Ravi B <ravibabu@ti.com>
*/
#include <common.h>
+#include <env.h>
#include <spl.h>
#include <linux/compiler.h>
#include <errno.h>
@@ -14,7 +15,6 @@
#include <g_dnl.h>
#include <usb.h>
#include <dfu.h>
-#include <environment.h>
static int run_dfu(int usb_index, char *interface, char *devstring)
{
@@ -38,7 +38,7 @@ int spl_dfu_cmd(int usbctrl, char *dfu_alt_info, char *interface, char *devstr)
int ret;
/* set default environment */
- set_default_env(NULL, 0);
+ env_set_default(NULL, 0);
str_env = env_get(dfu_alt_info);
if (!str_env) {
pr_err("\"%s\" env variable not defined!\n", dfu_alt_info);
diff --git a/common/spl/spl_ext.c b/common/spl/spl_ext.c
index fe05223605..2a6252229c 100644
--- a/common/spl/spl_ext.c
+++ b/common/spl/spl_ext.c
@@ -1,6 +1,7 @@
// SPDX-License-Identifier: GPL-2.0+
#include <common.h>
+#include <env.h>
#include <spl.h>
#include <asm/u-boot.h>
#include <ext4fs.h>
diff --git a/common/spl/spl_fat.c b/common/spl/spl_fat.c
index 163e540622..aa371ab52c 100644
--- a/common/spl/spl_fat.c
+++ b/common/spl/spl_fat.c
@@ -9,6 +9,7 @@
*/
#include <common.h>
+#include <env.h>
#include <spl.h>
#include <asm/u-boot.h>
#include <fat.h>
diff --git a/common/spl/spl_fit.c b/common/spl/spl_fit.c
index 969f7775c1..2e2e09eafb 100644
--- a/common/spl/spl_fit.c
+++ b/common/spl/spl_fit.c
@@ -7,6 +7,7 @@
#include <common.h>
#include <errno.h>
#include <fpga.h>
+#include <gzip.h>
#include <image.h>
#include <linux/libfdt.h>
#include <spl.h>
diff --git a/common/spl/spl_net.c b/common/spl/spl_net.c
index c91ad2b6dd..803303249c 100644
--- a/common/spl/spl_net.c
+++ b/common/spl/spl_net.c
@@ -7,6 +7,7 @@
* Ilya Yanok <ilya.yanok@gmail.com>
*/
#include <common.h>
+#include <env.h>
#include <errno.h>
#include <spl.h>
#include <net.h>
diff --git a/common/spl/spl_ymodem.c b/common/spl/spl_ymodem.c
index fa539ecd7a..20f4260062 100644
--- a/common/spl/spl_ymodem.c
+++ b/common/spl/spl_ymodem.c
@@ -9,6 +9,7 @@
* Matt Porter <mporter@ti.com>
*/
#include <common.h>
+#include <gzip.h>
#include <spl.h>
#include <xyzModem.h>
#include <asm/u-boot.h>
diff --git a/common/splash.c b/common/splash.c
index 79d50577ee..e15cc847b6 100644
--- a/common/splash.c
+++ b/common/splash.c
@@ -21,6 +21,7 @@
*/
#include <common.h>
+#include <env.h>
#include <splash.h>
#include <lcd.h>
diff --git a/common/splash_source.c b/common/splash_source.c
index 8f276a34ca..d37b4b304c 100644
--- a/common/splash_source.c
+++ b/common/splash_source.c
@@ -7,6 +7,7 @@
#include <common.h>
#include <bmp_layout.h>
+#include <env.h>
#include <errno.h>
#include <fs.h>
#include <fdt_support.h>
diff --git a/common/update.c b/common/update.c
index f237ea53bb..457b29f42a 100644
--- a/common/update.c
+++ b/common/update.c
@@ -17,6 +17,7 @@
#endif
#include <command.h>
+#include <env.h>
#include <flash.h>
#include <net.h>
#include <net/tftp.h>
diff --git a/common/usb_hub.c b/common/usb_hub.c
index 9069f4b33a..25c2ac4345 100644
--- a/common/usb_hub.c
+++ b/common/usb_hub.c
@@ -24,6 +24,7 @@
#include <common.h>
#include <command.h>
#include <dm.h>
+#include <env.h>
#include <errno.h>
#include <memalign.h>
#include <asm/processor.h>
diff --git a/common/usb_kbd.c b/common/usb_kbd.c
index cc99c6be07..3873737461 100644
--- a/common/usb_kbd.c
+++ b/common/usb_kbd.c
@@ -9,6 +9,7 @@
#include <common.h>
#include <console.h>
#include <dm.h>
+#include <env.h>
#include <errno.h>
#include <malloc.h>
#include <memalign.h>
diff --git a/configs/am335x_evm_defconfig b/configs/am335x_evm_defconfig
index ff96f192e0..c0f7cccd8b 100644
--- a/configs/am335x_evm_defconfig
+++ b/configs/am335x_evm_defconfig
@@ -58,6 +58,9 @@ CONFIG_DM_SPI=y
CONFIG_OMAP3_SPI=y
CONFIG_TIMER=y
CONFIG_OMAP_TIMER=y
+CONFIG_WDT=y
+CONFIG_WDT_OMAP3=y
+# CONFIG_SPL_WDT is not set
CONFIG_USB=y
CONFIG_DM_USB=y
CONFIG_DM_USB_GADGET=y
diff --git a/configs/am65x_evm_a53_defconfig b/configs/am65x_evm_a53_defconfig
index d43df6a187..7e33e4c9db 100644
--- a/configs/am65x_evm_a53_defconfig
+++ b/configs/am65x_evm_a53_defconfig
@@ -34,6 +34,8 @@ CONFIG_CMD_ASKENV=y
CONFIG_CMD_GPT=y
CONFIG_CMD_I2C=y
CONFIG_CMD_MMC=y
+CONFIG_CMD_PCI=y
+CONFIG_CMD_REMOTEPROC=y
# CONFIG_CMD_SETEXPR is not set
CONFIG_CMD_TIME=y
# CONFIG_ISO_PARTITION is not set
@@ -68,8 +70,14 @@ CONFIG_MMC_SDHCI_AM654=y
CONFIG_PHY_TI=y
CONFIG_PHY_FIXED=y
CONFIG_DM_ETH=y
+CONFIG_E1000=y
+CONFIG_CMD_E1000=y
CONFIG_TI_AM65_CPSW_NUSS=y
+CONFIG_PCI=y
+CONFIG_DM_PCI=y
+CONFIG_PCI_KEYSTONE=y
CONFIG_PHY=y
+CONFIG_AM654_PHY=y
CONFIG_PINCTRL=y
# CONFIG_PINCTRL_GENERIC is not set
CONFIG_SPL_PINCTRL=y
diff --git a/configs/brsmarc1_defconfig b/configs/brsmarc1_defconfig
new file mode 100644
index 0000000000..9066b1ca8a
--- /dev/null
+++ b/configs/brsmarc1_defconfig
@@ -0,0 +1,109 @@
+CONFIG_ARM=y
+CONFIG_ARCH_OMAP2PLUS=y
+CONFIG_SPL_GPIO_SUPPORT=y
+CONFIG_SPL_LIBCOMMON_SUPPORT=y
+CONFIG_SPL_LIBGENERIC_SUPPORT=y
+CONFIG_SYS_MALLOC_F_LEN=0x2000
+CONFIG_AM33XX=y
+CONFIG_SYS_MPUCLK=600
+CONFIG_TARGET_BRSMARC1=y
+CONFIG_SPL_SERIAL_SUPPORT=y
+CONFIG_ENV_SIZE=0x10000
+CONFIG_ENV_OFFSET=0x20000
+CONFIG_SPL_SYS_MALLOC_F_LEN=0x4000
+CONFIG_SPL=y
+CONFIG_ENV_SECT_SIZE=0x10000
+CONFIG_SPL_SPI_FLASH_SUPPORT=y
+CONFIG_SPL_SPI_SUPPORT=y
+CONFIG_TPL_SYS_MALLOC_F_LEN=0x0
+# CONFIG_EXPERT is not set
+# CONFIG_FIT is not set
+CONFIG_OF_BOARD_SETUP=y
+CONFIG_BOOTDELAY=0
+CONFIG_USE_BOOTCOMMAND=y
+CONFIG_BOOTCOMMAND="run b_default"
+CONFIG_SYS_CONSOLE_IS_IN_ENV=y
+CONFIG_SYS_CONSOLE_OVERWRITE_ROUTINE=y
+CONFIG_SYS_CONSOLE_INFO_QUIET=y
+CONFIG_VERSION_VARIABLE=y
+# CONFIG_DISPLAY_CPUINFO is not set
+# CONFIG_DISPLAY_BOARDINFO is not set
+CONFIG_ARCH_MISC_INIT=y
+# CONFIG_SPL_RAW_IMAGE_SUPPORT is not set
+CONFIG_SPL_SYS_MALLOC_SIMPLE=y
+CONFIG_SPL_SEPARATE_BSS=y
+# CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR is not set
+CONFIG_SPL_I2C_SUPPORT=y
+# CONFIG_SPL_NAND_SUPPORT is not set
+CONFIG_SPL_POWER_SUPPORT=y
+CONFIG_SPL_SPI_LOAD=y
+CONFIG_SPL_YMODEM_SUPPORT=y
+CONFIG_HUSH_PARSER=y
+# CONFIG_CMD_BOOTD is not set
+CONFIG_CMD_BOOTZ=y
+# CONFIG_CMD_IMI is not set
+# CONFIG_CMD_XIMG is not set
+# CONFIG_CMD_EDITENV is not set
+# CONFIG_CMD_CRC32 is not set
+CONFIG_CMD_CLK=y
+# CONFIG_CMD_FLASH is not set
+CONFIG_CMD_GPIO=y
+CONFIG_CMD_I2C=y
+# CONFIG_CMD_LOADS is not set
+CONFIG_CMD_MMC=y
+CONFIG_CMD_SF=y
+CONFIG_CMD_SPI=y
+CONFIG_CMD_USB=y
+# CONFIG_CMD_ITEST is not set
+CONFIG_CMD_DHCP=y
+# CONFIG_CMD_NFS is not set
+CONFIG_CMD_MII=y
+CONFIG_CMD_PING=y
+CONFIG_CMD_TIME=y
+CONFIG_CMD_EXT4=y
+CONFIG_CMD_EXT4_WRITE=y
+CONFIG_CMD_FAT=y
+CONFIG_CMD_FS_GENERIC=y
+# CONFIG_SPL_DOS_PARTITION is not set
+CONFIG_OF_CONTROL=y
+CONFIG_SPL_OF_CONTROL=y
+CONFIG_DEFAULT_DEVICE_TREE="am335x-brsmarc1"
+CONFIG_ENV_IS_IN_SPI_FLASH=y
+CONFIG_NET_RANDOM_ETHADDR=y
+CONFIG_NETCONSOLE=y
+CONFIG_DM=y
+CONFIG_SPL_DM=y
+CONFIG_SPL_DM_SEQ_ALIAS=y
+# CONFIG_OF_TRANSLATE is not set
+# CONFIG_SPL_BLK is not set
+CONFIG_DM_GPIO=y
+CONFIG_DM_I2C=y
+CONFIG_MISC=y
+CONFIG_DM_MMC=y
+CONFIG_MMC_OMAP_HS=y
+CONFIG_DM_SPI_FLASH=y
+CONFIG_SPI_FLASH=y
+CONFIG_SF_DEFAULT_SPEED=24000000
+CONFIG_SPI_FLASH_SPANSION=y
+CONFIG_SPI_FLASH_STMICRO=y
+CONFIG_SPI_FLASH_WINBOND=y
+# CONFIG_SPI_FLASH_USE_4K_SECTORS is not set
+CONFIG_PHY_NATSEMI=y
+CONFIG_DM_ETH=y
+CONFIG_DRIVER_TI_CPSW=y
+CONFIG_DM_SERIAL=y
+CONFIG_SPI=y
+CONFIG_DM_SPI=y
+CONFIG_OMAP3_SPI=y
+CONFIG_USB=y
+CONFIG_DM_USB=y
+CONFIG_USB_MUSB_HOST=y
+CONFIG_USB_MUSB_GADGET=y
+CONFIG_USB_MUSB_TI=y
+CONFIG_USB_STORAGE=y
+CONFIG_USB_GADGET=y
+# CONFIG_OMAP_WATCHDOG is not set
+CONFIG_SPL_TINY_MEMSET=y
+CONFIG_SHA1=y
+CONFIG_SHA256=y
+# CONFIG_EFI_LOADER is not set
diff --git a/configs/da850evm_direct_nor_defconfig b/configs/da850evm_direct_nor_defconfig
index 2eaa29fb8f..e889751b8c 100644
--- a/configs/da850evm_direct_nor_defconfig
+++ b/configs/da850evm_direct_nor_defconfig
@@ -21,17 +21,18 @@ CONFIG_SYS_PROMPT="U-Boot > "
CONFIG_CMD_IMLS=y
CONFIG_CRC32_VERIFY=y
CONFIG_CMD_DM=y
-# CONFIG_CMD_GPIO is not set
# CONFIG_CMD_GPT is not set
# CONFIG_CMD_MMC is not set
+CONFIG_CMD_MTD=y
+CONFIG_CMD_NAND=y
# CONFIG_CMD_PART is not set
+# CONFIG_CMD_SF is not set
# CONFIG_CMD_SPI is not set
# CONFIG_CMD_SETEXPR is not set
# CONFIG_CMD_TIME is not set
-# CONFIG_CMD_EXT2 is not set
-# CONFIG_CMD_EXT4 is not set
-# CONFIG_CMD_FAT is not set
-# CONFIG_CMD_FS_GENERIC is not set
+CONFIG_CMD_MTDPARTS=y
+CONFIG_MTDIDS_DEFAULT="nor0=physmap-flash.2,nor1=spi1.0,nand0=nand512"
+CONFIG_MTDPARTS_DEFAULT="mtdparts=physmap-flash.2:1m(u-boot),128k(u-boot-env),-(spare);spi1.0:32k(SPL),480k(u-boot),64k(u-boot-env),7552k(kernel-spare),64k(MAC-Address);nand512:128k(u-boot env),512k(u-boot),128k(spl-os),8m(kernel),-(rootfs)"
CONFIG_CMD_DIAG=y
CONFIG_OF_CONTROL=y
CONFIG_DEFAULT_DEVICE_TREE="da850-evm"
@@ -45,12 +46,17 @@ CONFIG_SYS_I2C_DAVINCI=y
CONFIG_MTD=y
CONFIG_MTD_NOR_FLASH=y
CONFIG_FLASH_CFI_DRIVER=y
+CONFIG_SYS_FLASH_USE_BUFFER_WRITE=y
+CONFIG_FLASH_CFI_MTD=y
CONFIG_SYS_FLASH_PROTECTION=y
CONFIG_SYS_FLASH_CFI=y
+CONFIG_NAND=y
+CONFIG_NAND_DAVINCI=y
CONFIG_DM_SPI_FLASH=y
CONFIG_SPI_FLASH=y
CONFIG_SPI_FLASH_STMICRO=y
CONFIG_SPI_FLASH_WINBOND=y
+CONFIG_SPI_FLASH_MTD=y
CONFIG_DM_ETH=y
CONFIG_MII=y
CONFIG_DRIVER_TI_EMAC=y
@@ -66,7 +72,6 @@ CONFIG_DM_SPI=y
CONFIG_DAVINCI_SPI=y
CONFIG_USB=y
CONFIG_DM_USB=y
-# CONFIG_SPL_DM_USB is not set
CONFIG_USB_OHCI_HCD=y
CONFIG_USB_OHCI_DA8XX=y
CONFIG_USB_MUSB_HOST=y
diff --git a/configs/hikey960_defconfig b/configs/hikey960_defconfig
new file mode 100644
index 0000000000..6ed252f658
--- /dev/null
+++ b/configs/hikey960_defconfig
@@ -0,0 +1,30 @@
+CONFIG_ARM=y
+CONFIG_TARGET_HIKEY960=y
+CONFIG_SYS_TEXT_BASE=0x1ac98000
+CONFIG_SYS_MALLOC_F_LEN=0x2000
+CONFIG_NR_DRAM_BANKS=1
+CONFIG_IDENT_STRING="\nHikey960"
+# CONFIG_DISPLAY_CPUINFO is not set
+# CONFIG_DISPLAY_BOARDINFO is not set
+CONFIG_DISTRO_DEFAULTS=y
+CONFIG_BOOTDELAY=3
+CONFIG_SYS_PROMPT="U-Boot => "
+CONFIG_USE_BOOTARGS=y
+CONFIG_BOOTARGS="console=ttyAMA6,115200n8 root=/dev/mmcblk0p2 rw"
+CONFIG_MISC_INIT_R=y
+CONFIG_BOARD_EARLY_INIT_F=y
+CONFIG_DEFAULT_DEVICE_TREE="hi3660-hikey960"
+CONFIG_OF_LIBFDT_OVERLAY=y
+CONFIG_CMD_MMC=y
+CONFIG_CMD_GPT=y
+CONFIG_CMD_MD5SUM=y
+CONFIG_CMD_MEMINFO=y
+CONFIG_ENV_IS_IN_EXT4=y
+CONFIG_ENV_EXT4_INTERFACE="mmc"
+CONFIG_ENV_EXT4_DEVICE_AND_PART="0:2"
+CONFIG_ENV_EXT4_FILE="/uboot.env"
+CONFIG_DM_MMC=y
+CONFIG_MMC_DW=y
+CONFIG_MMC_DW_K3=y
+CONFIG_PINCTRL=y
+CONFIG_PINCTRL_SINGLE=y
diff --git a/configs/sei510_defconfig b/configs/sei510_defconfig
new file mode 100644
index 0000000000..6c89d4a381
--- /dev/null
+++ b/configs/sei510_defconfig
@@ -0,0 +1,75 @@
+CONFIG_ARM=y
+CONFIG_SYS_CONFIG_NAME="sei510"
+CONFIG_SYS_BOARD="sei510"
+CONFIG_ARCH_MESON=y
+CONFIG_SYS_TEXT_BASE=0x01000000
+CONFIG_MESON_G12A=y
+CONFIG_DEBUG_UART_BASE=0xff803000
+CONFIG_DEBUG_UART_CLOCK=24000000
+CONFIG_IDENT_STRING=" sei510"
+# CONFIG_PSCI_RESET is not set
+CONFIG_DEBUG_UART=y
+CONFIG_NR_DRAM_BANKS=1
+CONFIG_OF_BOARD_SETUP=y
+CONFIG_MISC_INIT_R=y
+# CONFIG_DISPLAY_CPUINFO is not set
+CONFIG_DISPLAY_BOARDINFO=y
+# CONFIG_CMD_BDI is not set
+# CONFIG_CMD_IMI is not set
+CONFIG_CMD_GPIO=y
+# CONFIG_CMD_LOADS is not set
+CONFIG_CMD_MMC=y
+CONFIG_CMD_FDT=y
+# CONFIG_CMD_SETEXPR is not set
+CONFIG_LZ4=y
+CONFIG_CMD_REGULATOR=y
+CONFIG_OF_CONTROL=y
+CONFIG_DEFAULT_DEVICE_TREE="meson-g12a-sei510"
+CONFIG_ENV_IS_IN_MMC=y
+CONFIG_NET_RANDOM_ETHADDR=y
+CONFIG_DM_GPIO=y
+CONFIG_DM_MMC=y
+CONFIG_MMC_MESON_GX=y
+CONFIG_PHY_ADDR_ENABLE=y
+CONFIG_PHY_ADDR=8
+CONFIG_DM_ETH=y
+CONFIG_ETH_DESIGNWARE=y
+CONFIG_PINCTRL=y
+CONFIG_PINCTRL_MESON_G12A=y
+CONFIG_DM_REGULATOR=y
+CONFIG_DM_REGULATOR_FIXED=y
+CONFIG_DM_RESET=y
+CONFIG_DEBUG_UART_MESON=y
+CONFIG_DEBUG_UART_ANNOUNCE=y
+CONFIG_DEBUG_UART_SKIP_INIT=y
+CONFIG_MESON_SERIAL=y
+CONFIG_OF_LIBFDT_OVERLAY=y
+CONFIG_USB=y
+CONFIG_USB_HOST=y
+CONFIG_USB_GADGET=y
+CONFIG_USB_GADGET_DOWNLOAD=y
+CONFIG_PHY=y
+CONFIG_MESON_G12A_USB_PHY=y
+CONFIG_DM_USB=y
+CONFIG_USB_GADGET_DWC2_OTG=y
+CONFIG_USB_GADGET_DWC2_OTG_PHY_BUS_WIDTH_8=y
+CONFIG_USB_XHCI_HCD=y
+CONFIG_USB_XHCI_DWC3=y
+CONFIG_USB_DWC3=y
+CONFIG_USB_DWC3_MESON_G12A=y
+CONFIG_FASTBOOT=y
+CONFIG_USB_FUNCTION_FASTBOOT=y
+CONFIG_FASTBOOT_BUF_ADDR=0x6000000
+CONFIG_CMD_FASTBOOT=y
+CONFIG_CMD_USB=y
+CONFIG_CMD_USB_MASS_STORAGE=y
+CONFIG_USB_GADGET_VENDOR_NUM=0x18d1
+CONFIG_USB_GADGET_PRODUCT_NUM=0xfada
+CONFIG_OF_LIBFDT=y
+CONFIG_EFI_PARTITION=y
+CONFIG_FASTBOOT_CMD_OEM_FORMAT=y
+CONFIG_CMD_GPT=y
+CONFIG_CMD_PART=y
+CONFIG_FASTBOOT_FLASH=y
+CONFIG_FASTBOOT_FLASH_MMC=y
+CONFIG_FASTBOOT_FLASH_MMC_DEV=2
diff --git a/disk/part.c b/disk/part.c
index 7e84214731..8982ef3bae 100644
--- a/disk/part.c
+++ b/disk/part.c
@@ -6,6 +6,7 @@
#include <common.h>
#include <command.h>
+#include <env.h>
#include <errno.h>
#include <ide.h>
#include <malloc.h>
diff --git a/disk/part_amiga.c b/disk/part_amiga.c
index 86d008d476..5a2bb718b5 100644
--- a/disk/part_amiga.c
+++ b/disk/part_amiga.c
@@ -6,6 +6,7 @@
*/
#include <common.h>
#include <command.h>
+#include <env.h>
#include <ide.h>
#include "part_amiga.h"
diff --git a/doc/README.marubun-pcmcia b/doc/README.marubun-pcmcia
deleted file mode 100644
index 0a363b2ada..0000000000
--- a/doc/README.marubun-pcmcia
+++ /dev/null
@@ -1,65 +0,0 @@
-
-U-Boot MARUBUN MR-SHPC-01 PCMCIA controller driver
- Last update 21/11/2007 by Nobuhiro Iwamatsu
-
-========================================================================================
-
-0. What's this?
- This driver supports MARUBUN MR-SHPC-01.
- url: http://www.marubun.co.jp/product/semicon/devices/qgc18e0000002n2z.html
- (Sorry Japanese only.)
-
- This chip is used with SuperH well, and adopted by the
- reference board.
- ex. * MS7750SE01
- * MS7722SE01
- * other
-
- This chip doesn't support CardBus.
-
-1. base source code
- The code is based on sources from the Linux kernel
- ( arch/sh/kernel/cf-enabler.c ).
-
-2. How to use
- The options you have to specify in the config file are (with the
- value for my board as an example):
-
- * CONFIG_MARUBUN_PCCARD
- If you want to use this device driver, should define CONFIG_MARUBUN_PCCARD.
- ex. #define CONFIG_MARUBUN_PCCARD
-
- * CONFIG_PCMCIA_SLOT_A
- Most devices have only one slot. You should define CONFIG_PCMCIA_SLOT_A .
- ex. #define CONFIG_PCMCIA_SLOT_A 1
-
- * CONFIG_SYS_MARUBUN_MRSHPC
- This is MR-SHPC-01 PCMCIA controller base address.
- You should do the setting matched to your environment.
- ex. #define CONFIG_SYS_MARUBUN_MRSHPC 0xb03fffe0
- ( for MS7722SE01 environment )
-
- * CONFIG_SYS_MARUBUN_MW1
- This is MR-SHPC-01 memory window base address.
- You should do the setting matched to your environment.
- ex. #define CONFIG_SYS_MARUBUN_MW1 0xb0400000
- ( for MS7722SE01 environment )
-
- * CONFIG_SYS_MARUBUN_MW1
- This is MR-SHPC-01 attribute window base address.
- You should do the setting matched to your environment.
- ex. #define CONFIG_SYS_MARUBUN_MW2 0xb0500000
- ( for MS7722SE01 environment )
-
- * CONFIG_SYS_MARUBUN_MW1
- This is MR-SHPC-01 I/O window base address.
- You should do the setting matched to your environment.
- ex. #define CONFIG_SYS_MARUBUN_IO 0xb0600000
- ( for MS7722SE01 environment )
-
-3. Other
- * Check Compact Flash only.
- * Maybe, NE2000 compatible NIC is sure to move.
-
-Copyright (c) 2007
- Nobuhiro Iwamatsu <iwamatsu@nigaur.org>
diff --git a/doc/README.ne2000 b/doc/README.ne2000
index d5ae9a9eb1..0f6a2e04ff 100644
--- a/doc/README.ne2000
+++ b/doc/README.ne2000
@@ -21,17 +21,6 @@ value for my board as an example):
- Address where the board is mapped
-#define CONFIG_DRIVER_NE2000_CCR (0x28000000+0x3f8)
-
-- Address of the CCR (card configuration register). It could be found
-by enabling DEBUG in cmd_pcmcia.c. If this is not defined nothing is
-done as far as PCMCIA support is concerned.
-
-#define CONFIG_DRIVER_NE2000_VAL (0x20)
-
-- The value to be written in the CCR. It selects among different I/O
-spaces that could be used by the card.
-
Enjoy!
diff --git a/drivers/Kconfig b/drivers/Kconfig
index 5a9d01b508..350acf81f3 100644
--- a/drivers/Kconfig
+++ b/drivers/Kconfig
@@ -70,8 +70,6 @@ source "drivers/pci_endpoint/Kconfig"
source "drivers/pch/Kconfig"
-source "drivers/pcmcia/Kconfig"
-
source "drivers/phy/Kconfig"
source "drivers/phy/allwinner/Kconfig"
diff --git a/drivers/Makefile b/drivers/Makefile
index 41933605ce..a4bb5e4975 100644
--- a/drivers/Makefile
+++ b/drivers/Makefile
@@ -88,7 +88,6 @@ obj-y += misc/
obj-$(CONFIG_MMC) += mmc/
obj-$(CONFIG_NVME) += nvme/
obj-$(CONFIG_PCI_ENDPOINT) += pci_endpoint/
-obj-y += pcmcia/
obj-y += dfu/
obj-$(CONFIG_PCH) += pch/
obj-y += phy/allwinner/
diff --git a/drivers/bootcount/bootcount_env.c b/drivers/bootcount/bootcount_env.c
index 9084ca8a6e..b75c9002b2 100644
--- a/drivers/bootcount/bootcount_env.c
+++ b/drivers/bootcount/bootcount_env.c
@@ -5,7 +5,7 @@
*/
#include <common.h>
-#include <environment.h>
+#include <env.h>
void bootcount_store(ulong a)
{
diff --git a/drivers/clk/clk-uclass.c b/drivers/clk/clk-uclass.c
index cee4d912b0..c66b6f3c4e 100644
--- a/drivers/clk/clk-uclass.c
+++ b/drivers/clk/clk-uclass.c
@@ -518,6 +518,19 @@ int clk_get_by_id(ulong id, struct clk **clkp)
return -ENOENT;
}
+bool clk_is_match(const struct clk *p, const struct clk *q)
+{
+ /* trivial case: identical struct clk's or both NULL */
+ if (p == q)
+ return true;
+
+ /* same device, id and data */
+ if (p->dev == q->dev && p->id == q->id && p->data == q->data)
+ return true;
+
+ return false;
+}
+
UCLASS_DRIVER(clk) = {
.id = UCLASS_CLK,
.name = "clk",
diff --git a/drivers/core/fdtaddr.c b/drivers/core/fdtaddr.c
index c2873861da..6850003a28 100644
--- a/drivers/core/fdtaddr.c
+++ b/drivers/core/fdtaddr.c
@@ -129,6 +129,23 @@ fdt_addr_t devfdt_get_addr_name(struct udevice *dev, const char *name)
#endif
}
+fdt_addr_t devfdt_get_addr_size_name(struct udevice *dev, const char *name,
+ fdt_size_t *size)
+{
+#if CONFIG_IS_ENABLED(OF_CONTROL)
+ int index;
+
+ index = fdt_stringlist_search(gd->fdt_blob, dev_of_offset(dev),
+ "reg-names", name);
+ if (index < 0)
+ return index;
+
+ return devfdt_get_addr_size_index(dev, index, size);
+#else
+ return FDT_ADDR_T_NONE;
+#endif
+}
+
fdt_addr_t devfdt_get_addr(struct udevice *dev)
{
return devfdt_get_addr_index(dev, 0);
diff --git a/drivers/core/read.c b/drivers/core/read.c
index 1a044b05e8..8b5502de11 100644
--- a/drivers/core/read.c
+++ b/drivers/core/read.c
@@ -82,6 +82,15 @@ fdt_addr_t dev_read_addr_index(struct udevice *dev, int index)
return devfdt_get_addr_index(dev, index);
}
+fdt_addr_t dev_read_addr_size_index(struct udevice *dev, int index,
+ fdt_size_t *size)
+{
+ if (ofnode_is_np(dev_ofnode(dev)))
+ return ofnode_get_addr_size_index(dev_ofnode(dev), index, size);
+ else
+ return devfdt_get_addr_size_index(dev, index, size);
+}
+
void *dev_remap_addr_index(struct udevice *dev, int index)
{
fdt_addr_t addr = dev_read_addr_index(dev, index);
@@ -102,6 +111,17 @@ fdt_addr_t dev_read_addr_name(struct udevice *dev, const char *name)
return dev_read_addr_index(dev, index);
}
+fdt_addr_t dev_read_addr_size_name(struct udevice *dev, const char *name,
+ fdt_size_t *size)
+{
+ int index = dev_read_stringlist_search(dev, "reg-names", name);
+
+ if (index < 0)
+ return FDT_ADDR_T_NONE;
+ else
+ return dev_read_addr_size_index(dev, index, size);
+}
+
void *dev_remap_addr_name(struct udevice *dev, const char *name)
{
fdt_addr_t addr = dev_read_addr_name(dev, name);
diff --git a/drivers/ddr/fsl/fsl_ddr_gen4.c b/drivers/ddr/fsl/fsl_ddr_gen4.c
index 30f7863b39..17a4a8282b 100644
--- a/drivers/ddr/fsl/fsl_ddr_gen4.c
+++ b/drivers/ddr/fsl/fsl_ddr_gen4.c
@@ -4,6 +4,7 @@
*/
#include <common.h>
+#include <env.h>
#include <asm/io.h>
#include <fsl_ddr_sdram.h>
#include <asm/processor.h>
diff --git a/drivers/ddr/fsl/interactive.c b/drivers/ddr/fsl/interactive.c
index 4de0eae5f2..8e171e67fe 100644
--- a/drivers/ddr/fsl/interactive.c
+++ b/drivers/ddr/fsl/interactive.c
@@ -13,6 +13,7 @@
#include <common.h>
#include <cli.h>
+#include <env.h>
#include <linux/ctype.h>
#include <asm/types.h>
#include <asm/io.h>
diff --git a/drivers/ddr/fsl/options.c b/drivers/ddr/fsl/options.c
index 4573ffa115..b9179315f2 100644
--- a/drivers/ddr/fsl/options.c
+++ b/drivers/ddr/fsl/options.c
@@ -5,6 +5,7 @@
*/
#include <common.h>
+#include <env.h>
#include <hwconfig.h>
#include <fsl_ddr_sdram.h>
diff --git a/drivers/dfu/dfu.c b/drivers/dfu/dfu.c
index 318949529b..d2b67b18cf 100644
--- a/drivers/dfu/dfu.c
+++ b/drivers/dfu/dfu.c
@@ -7,6 +7,7 @@
*/
#include <common.h>
+#include <env.h>
#include <errno.h>
#include <malloc.h>
#include <mmc.h>
diff --git a/drivers/fastboot/fb_command.c b/drivers/fastboot/fb_command.c
index 200f9910c5..4864344853 100644
--- a/drivers/fastboot/fb_command.c
+++ b/drivers/fastboot/fb_command.c
@@ -4,6 +4,7 @@
*/
#include <common.h>
+#include <env.h>
#include <fastboot.h>
#include <fastboot-internal.h>
#include <fb_mmc.h>
diff --git a/drivers/fastboot/fb_common.c b/drivers/fastboot/fb_common.c
index 17eca73be0..e76af8ecc3 100644
--- a/drivers/fastboot/fb_common.c
+++ b/drivers/fastboot/fb_common.c
@@ -11,6 +11,7 @@
*/
#include <common.h>
+#include <env.h>
#include <fastboot.h>
#include <net/fastboot.h>
diff --git a/drivers/fastboot/fb_getvar.c b/drivers/fastboot/fb_getvar.c
index ebe5c8a104..95cb434189 100644
--- a/drivers/fastboot/fb_getvar.c
+++ b/drivers/fastboot/fb_getvar.c
@@ -4,6 +4,7 @@
*/
#include <common.h>
+#include <env.h>
#include <fastboot.h>
#include <fastboot-internal.h>
#include <fb_mmc.h>
diff --git a/drivers/fastboot/fb_mmc.c b/drivers/fastboot/fb_mmc.c
index 0a335db3a6..b0b19c5762 100644
--- a/drivers/fastboot/fb_mmc.c
+++ b/drivers/fastboot/fb_mmc.c
@@ -6,6 +6,7 @@
#include <config.h>
#include <common.h>
#include <blk.h>
+#include <env.h>
#include <fastboot.h>
#include <fastboot-internal.h>
#include <fb_mmc.h>
diff --git a/drivers/firmware/ti_sci.c b/drivers/firmware/ti_sci.c
index 1fd29f2cdf..62b1dc2006 100644
--- a/drivers/firmware/ti_sci.c
+++ b/drivers/firmware/ti_sci.c
@@ -3170,6 +3170,7 @@ devm_ti_sci_get_of_resource(const struct ti_sci_handle *handle,
u32 resource_subtype;
u16 resource_type;
struct ti_sci_resource *res;
+ bool valid_set = false;
int sets, i, ret;
u32 *temp;
@@ -3209,12 +3210,15 @@ devm_ti_sci_get_of_resource(const struct ti_sci_handle *handle,
&res->desc[i].start,
&res->desc[i].num);
if (ret) {
- dev_err(dev, "type %d subtype %d not allocated for host %d\n",
+ dev_dbg(dev, "type %d subtype %d not allocated for host %d\n",
resource_type, resource_subtype,
handle_to_ti_sci_info(handle)->host_id);
- return ERR_PTR(ret);
+ res->desc[i].start = 0;
+ res->desc[i].num = 0;
+ continue;
}
+ valid_set = true;
dev_dbg(dev, "res type = %d, subtype = %d, start = %d, num = %d\n",
resource_type, resource_subtype, res->desc[i].start,
res->desc[i].num);
@@ -3226,7 +3230,10 @@ devm_ti_sci_get_of_resource(const struct ti_sci_handle *handle,
return ERR_PTR(-ENOMEM);
}
- return res;
+ if (valid_set)
+ return res;
+
+ return ERR_PTR(-EINVAL);
}
/* Description for K2G */
diff --git a/drivers/input/i8042.c b/drivers/input/i8042.c
index 9a5dc46207..98015899f2 100644
--- a/drivers/input/i8042.c
+++ b/drivers/input/i8042.c
@@ -8,6 +8,7 @@
#include <common.h>
#include <dm.h>
+#include <env.h>
#include <errno.h>
#include <i8042.h>
#include <input.h>
diff --git a/drivers/input/input.c b/drivers/input/input.c
index 4f514dba56..6ab378b979 100644
--- a/drivers/input/input.c
+++ b/drivers/input/input.c
@@ -9,6 +9,7 @@
#include <common.h>
#include <console.h>
#include <dm.h>
+#include <env.h>
#include <errno.h>
#include <stdio_dev.h>
#include <input.h>
diff --git a/drivers/misc/fs_loader.c b/drivers/misc/fs_loader.c
index f42eeff8f6..88e486e9d5 100644
--- a/drivers/misc/fs_loader.c
+++ b/drivers/misc/fs_loader.c
@@ -5,6 +5,7 @@
*/
#include <common.h>
#include <dm.h>
+#include <env.h>
#include <errno.h>
#include <blk.h>
#include <fs.h>
diff --git a/drivers/mmc/hi6220_dw_mmc.c b/drivers/mmc/hi6220_dw_mmc.c
index effd1e4c7c..6de7924383 100644
--- a/drivers/mmc/hi6220_dw_mmc.c
+++ b/drivers/mmc/hi6220_dw_mmc.c
@@ -22,6 +22,11 @@ struct hi6220_dwmmc_priv_data {
struct dwmci_host host;
};
+struct hisi_mmc_data {
+ unsigned int clock;
+ bool use_fifo;
+};
+
static int hi6220_dwmmc_ofdata_to_platdata(struct udevice *dev)
{
struct hi6220_dwmmc_priv_data *priv = dev_get_priv(dev);
@@ -49,13 +54,17 @@ static int hi6220_dwmmc_probe(struct udevice *dev)
struct mmc_uclass_priv *upriv = dev_get_uclass_priv(dev);
struct hi6220_dwmmc_priv_data *priv = dev_get_priv(dev);
struct dwmci_host *host = &priv->host;
+ struct hisi_mmc_data *mmc_data;
+
+ mmc_data = (struct hisi_mmc_data *)dev_get_driver_data(dev);
/* Use default bus speed due to absence of clk driver */
- host->bus_hz = 50000000;
+ host->bus_hz = mmc_data->clock;
dwmci_setup_cfg(&plat->cfg, host, host->bus_hz, 400000);
host->mmc = &plat->mmc;
+ host->fifo_mode = mmc_data->use_fifo;
host->mmc->priv = &priv->host;
upriv->mmc = host->mmc;
host->mmc->dev = dev;
@@ -75,9 +84,23 @@ static int hi6220_dwmmc_bind(struct udevice *dev)
return 0;
}
+static const struct hisi_mmc_data hi3660_mmc_data = {
+ .clock = 3200000,
+ .use_fifo = true,
+};
+
+static const struct hisi_mmc_data hi6220_mmc_data = {
+ .clock = 50000000,
+ .use_fifo = false,
+};
+
static const struct udevice_id hi6220_dwmmc_ids[] = {
- { .compatible = "hisilicon,hi6220-dw-mshc" },
- { .compatible = "hisilicon,hi3798cv200-dw-mshc" },
+ { .compatible = "hisilicon,hi6220-dw-mshc",
+ .data = (ulong)&hi6220_mmc_data },
+ { .compatible = "hisilicon,hi3798cv200-dw-mshc",
+ .data = (ulong)&hi6220_mmc_data },
+ { .compatible = "hisilicon,hi3660-dw-mshc",
+ .data = (ulong)&hi3660_mmc_data },
{ }
};
diff --git a/drivers/mtd/cfi_flash.c b/drivers/mtd/cfi_flash.c
index 6b97e145e9..c59254c76e 100644
--- a/drivers/mtd/cfi_flash.c
+++ b/drivers/mtd/cfi_flash.c
@@ -19,13 +19,14 @@
#include <common.h>
#include <console.h>
#include <dm.h>
+#include <env.h>
#include <errno.h>
#include <fdt_support.h>
#include <asm/processor.h>
#include <asm/io.h>
#include <asm/byteorder.h>
#include <asm/unaligned.h>
-#include <environment.h>
+#include <env_internal.h>
#include <mtd/cfi_flash.h>
#include <watchdog.h>
diff --git a/drivers/mtd/jedec_flash.c b/drivers/mtd/jedec_flash.c
index a3540c1115..f59b2bc62f 100644
--- a/drivers/mtd/jedec_flash.c
+++ b/drivers/mtd/jedec_flash.c
@@ -15,7 +15,6 @@
#include <asm/processor.h>
#include <asm/io.h>
#include <asm/byteorder.h>
-#include <environment.h>
#define P_ID_AMD_STD CFI_CMDSET_AMD_LEGACY
diff --git a/drivers/mtd/mtd_uboot.c b/drivers/mtd/mtd_uboot.c
index 0a41ed477c..5574227598 100644
--- a/drivers/mtd/mtd_uboot.c
+++ b/drivers/mtd/mtd_uboot.c
@@ -4,6 +4,7 @@
* Heiko Schocher, DENX Software Engineering, hs@denx.de.
*/
#include <common.h>
+#include <env.h>
#include <dm/device.h>
#include <dm/uclass-internal.h>
#include <jffs2/jffs2.h> /* LEGACY */
diff --git a/drivers/net/dc2114x.c b/drivers/net/dc2114x.c
index e3c403c13f..43c2253f10 100644
--- a/drivers/net/dc2114x.c
+++ b/drivers/net/dc2114x.c
@@ -1,6 +1,7 @@
// SPDX-License-Identifier: GPL-2.0+
#include <common.h>
+#include <env.h>
#include <malloc.h>
#include <net.h>
#include <netdev.h>
diff --git a/drivers/net/fec_mxc.c b/drivers/net/fec_mxc.c
index 96e3ad9a1a..080dbcf7db 100644
--- a/drivers/net/fec_mxc.c
+++ b/drivers/net/fec_mxc.c
@@ -9,7 +9,7 @@
#include <common.h>
#include <dm.h>
-#include <environment.h>
+#include <env.h>
#include <malloc.h>
#include <memalign.h>
#include <miiphy.h>
diff --git a/drivers/net/fm/b4860.c b/drivers/net/fm/b4860.c
index 1e20685803..5be0ad2ab3 100644
--- a/drivers/net/fm/b4860.c
+++ b/drivers/net/fm/b4860.c
@@ -4,6 +4,7 @@
* Roy Zang <tie-fei.zang@freescale.com>
*/
#include <common.h>
+#include <env.h>
#include <phy.h>
#include <fm_eth.h>
#include <asm/io.h>
diff --git a/drivers/net/fm/fdt.c b/drivers/net/fm/fdt.c
index 6125797125..72d1294751 100644
--- a/drivers/net/fm/fdt.c
+++ b/drivers/net/fm/fdt.c
@@ -3,6 +3,7 @@
* Copyright 2016 Freescale Semiconductor, Inc.
*/
#include <asm/io.h>
+#include <env.h>
#include <fsl_qe.h> /* For struct qe_firmware */
#ifdef CONFIG_SYS_DPAA_FMAN
diff --git a/drivers/net/fm/fm.c b/drivers/net/fm/fm.c
index 0a43dfe74e..4c9dce8dc5 100644
--- a/drivers/net/fm/fm.c
+++ b/drivers/net/fm/fm.c
@@ -4,6 +4,7 @@
* Dave Liu <daveliu@freescale.com>
*/
#include <common.h>
+#include <env.h>
#include <malloc.h>
#include <asm/io.h>
#include <linux/errno.h>
@@ -14,7 +15,6 @@
#include <nand.h>
#include <spi_flash.h>
#include <mmc.h>
-#include <environment.h>
#ifdef CONFIG_ARM64
#include <asm/armv8/mmu.h>
diff --git a/drivers/net/fsl-mc/mc.c b/drivers/net/fsl-mc/mc.c
index cc59b21f9f..1d96e4bdc2 100644
--- a/drivers/net/fsl-mc/mc.c
+++ b/drivers/net/fsl-mc/mc.c
@@ -5,6 +5,7 @@
* Copyright 2017-2018 NXP
*/
#include <common.h>
+#include <env.h>
#include <errno.h>
#include <linux/bug.h>
#include <asm/io.h>
diff --git a/drivers/net/fsl_mcdmafec.c b/drivers/net/fsl_mcdmafec.c
index 88309b186c..e66fb16de8 100644
--- a/drivers/net/fsl_mcdmafec.c
+++ b/drivers/net/fsl_mcdmafec.c
@@ -8,7 +8,7 @@
*/
#include <common.h>
-#include <environment.h>
+#include <env.h>
#include <malloc.h>
#include <command.h>
#include <config.h>
diff --git a/drivers/net/ftmac100.c b/drivers/net/ftmac100.c
index c08889c4b1..d8f1dde657 100644
--- a/drivers/net/ftmac100.c
+++ b/drivers/net/ftmac100.c
@@ -8,6 +8,7 @@
#include <config.h>
#include <common.h>
+#include <env.h>
#include <malloc.h>
#include <net.h>
#include <linux/io.h>
diff --git a/drivers/net/lan91c96.c b/drivers/net/lan91c96.c
index f2489aaf82..c08bd21f95 100644
--- a/drivers/net/lan91c96.c
+++ b/drivers/net/lan91c96.c
@@ -46,6 +46,7 @@
#include <common.h>
#include <command.h>
+#include <env.h>
#include <malloc.h>
#include "lan91c96.h"
#include <net.h>
diff --git a/drivers/net/mcffec.c b/drivers/net/mcffec.c
index 2b54e3a549..fb93041256 100644
--- a/drivers/net/mcffec.c
+++ b/drivers/net/mcffec.c
@@ -8,7 +8,7 @@
*/
#include <common.h>
-#include <environment.h>
+#include <env.h>
#include <malloc.h>
#include <command.h>
diff --git a/drivers/net/ne2000_base.c b/drivers/net/ne2000_base.c
index 421aa20ea6..a240d06ad4 100644
--- a/drivers/net/ne2000_base.c
+++ b/drivers/net/ne2000_base.c
@@ -74,7 +74,7 @@ Add SNMP
#include <common.h>
#include <command.h>
-#include <environment.h>
+#include <env.h>
#include <net.h>
#include <malloc.h>
#include <linux/compiler.h>
@@ -693,16 +693,6 @@ static int ne2k_setup_driver(struct eth_device *dev)
}
}
-#ifdef CONFIG_DRIVER_NE2000_CCR
- {
- vu_char *p = (vu_char *) CONFIG_DRIVER_NE2000_CCR;
-
- PRINTK("CCR before is %x\n", *p);
- *p = CONFIG_DRIVER_NE2000_VAL;
- PRINTK("CCR after is %x\n", *p);
- }
-#endif
-
nic.base = (u8 *) CONFIG_DRIVER_NE2000_BASE;
nic.data = nic.base + DP_DATA;
diff --git a/drivers/net/netconsole.c b/drivers/net/netconsole.c
index ce5a15ef57..73005ff94d 100644
--- a/drivers/net/netconsole.c
+++ b/drivers/net/netconsole.c
@@ -6,6 +6,7 @@
#include <common.h>
#include <command.h>
+#include <env.h>
#include <stdio_dev.h>
#include <net.h>
@@ -55,7 +56,7 @@ static int is_broadcast(struct in_addr ip)
static struct in_addr netmask;
static struct in_addr our_ip;
static int env_changed_id;
- int env_id = get_env_id();
+ int env_id = env_get_id();
/* update only when the environment has changed */
if (env_changed_id != env_id) {
@@ -75,7 +76,7 @@ static int refresh_settings_from_env(void)
{
const char *p;
static int env_changed_id;
- int env_id = get_env_id();
+ int env_id = env_get_id();
/* update only when the environment has changed */
if (env_changed_id != env_id) {
diff --git a/drivers/net/phy/micrel_ksz90x1.c b/drivers/net/phy/micrel_ksz90x1.c
index f18e40a2fe..0105fc5af1 100644
--- a/drivers/net/phy/micrel_ksz90x1.c
+++ b/drivers/net/phy/micrel_ksz90x1.c
@@ -10,6 +10,7 @@
*/
#include <common.h>
#include <dm.h>
+#include <env.h>
#include <errno.h>
#include <micrel.h>
#include <phy.h>
diff --git a/drivers/net/sandbox-raw.c b/drivers/net/sandbox-raw.c
index 7e6625d020..3707ee35eb 100644
--- a/drivers/net/sandbox-raw.c
+++ b/drivers/net/sandbox-raw.c
@@ -9,6 +9,7 @@
#include <asm/eth-raw-os.h>
#include <common.h>
#include <dm.h>
+#include <env.h>
#include <malloc.h>
#include <net.h>
diff --git a/drivers/net/sh_eth.c b/drivers/net/sh_eth.c
index 2d5c97062f..749f651920 100644
--- a/drivers/net/sh_eth.c
+++ b/drivers/net/sh_eth.c
@@ -10,7 +10,7 @@
#include <config.h>
#include <common.h>
-#include <environment.h>
+#include <env.h>
#include <malloc.h>
#include <net.h>
#include <netdev.h>
diff --git a/drivers/net/ti/cpsw-common.c b/drivers/net/ti/cpsw-common.c
index ac12cfe9b8..21b8bbda3d 100644
--- a/drivers/net/ti/cpsw-common.c
+++ b/drivers/net/ti/cpsw-common.c
@@ -7,7 +7,6 @@
#include <common.h>
#include <dm.h>
-#include <environment.h>
#include <fdt_support.h>
#include <asm/io.h>
#include <cpsw.h>
diff --git a/drivers/pci/Kconfig b/drivers/pci/Kconfig
index 3fe38f7315..bdfc0c1796 100644
--- a/drivers/pci/Kconfig
+++ b/drivers/pci/Kconfig
@@ -145,4 +145,10 @@ config PCI_MVEBU
Say Y here if you want to enable PCIe controller support on
Armada XP/38x SoCs.
+config PCI_KEYSTONE
+ bool "TI Keystone PCIe controller"
+ depends on DM_PCI
+ help
+ Say Y here if you want to enable PCI controller support on AM654 SoC.
+
endif
diff --git a/drivers/pci/Makefile b/drivers/pci/Makefile
index b5ebd50c85..e54a98b8c9 100644
--- a/drivers/pci/Makefile
+++ b/drivers/pci/Makefile
@@ -38,3 +38,4 @@ obj-$(CONFIG_PCIE_LAYERSCAPE_GEN4) += pcie_layerscape_gen4.o \
pcie_layerscape_gen4_fixup.o
obj-$(CONFIG_PCI_XILINX) += pcie_xilinx.o
obj-$(CONFIG_PCIE_INTEL_FPGA) += pcie_intel_fpga.o
+obj-$(CONFIG_PCI_KEYSTONE) += pcie_dw_ti.o
diff --git a/drivers/pci/fsl_pci_init.c b/drivers/pci/fsl_pci_init.c
index b4c8556686..ab5e49941f 100644
--- a/drivers/pci/fsl_pci_init.c
+++ b/drivers/pci/fsl_pci_init.c
@@ -4,6 +4,7 @@
*/
#include <common.h>
+#include <env.h>
#include <malloc.h>
#include <asm/fsl_serdes.h>
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index e2195726c8..5db24f1c51 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -17,6 +17,7 @@
#include <common.h>
#include <command.h>
+#include <env.h>
#include <errno.h>
#include <asm/processor.h>
#include <asm/io.h>
diff --git a/drivers/pci/pci_common.c b/drivers/pci/pci_common.c
index 9f2d2678e3..5231b69dc9 100644
--- a/drivers/pci/pci_common.c
+++ b/drivers/pci/pci_common.c
@@ -11,6 +11,7 @@
#include <common.h>
#include <dm.h>
+#include <env.h>
#include <errno.h>
#include <pci.h>
#include <asm/io.h>
diff --git a/drivers/pci/pcie_dw_ti.c b/drivers/pci/pcie_dw_ti.c
new file mode 100644
index 0000000000..b37fc2de7f
--- /dev/null
+++ b/drivers/pci/pcie_dw_ti.c
@@ -0,0 +1,725 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (C) 2018 Texas Instruments, Inc
+ */
+
+#include <common.h>
+#include <dm.h>
+#include <pci.h>
+#include <generic-phy.h>
+#include <power-domain.h>
+#include <regmap.h>
+#include <syscon.h>
+#include <asm/io.h>
+#include <asm-generic/gpio.h>
+
+DECLARE_GLOBAL_DATA_PTR;
+
+#define PCIE_VENDORID_MASK GENMASK(15, 0)
+#define PCIE_DEVICEID_SHIFT 16
+
+/* PCI DBICS registers */
+#define PCIE_CONFIG_BAR0 0x10
+#define PCIE_LINK_STATUS_REG 0x80
+#define PCIE_LINK_STATUS_SPEED_OFF 16
+#define PCIE_LINK_STATUS_SPEED_MASK (0xf << PCIE_LINK_STATUS_SPEED_OFF)
+#define PCIE_LINK_STATUS_WIDTH_OFF 20
+#define PCIE_LINK_STATUS_WIDTH_MASK (0xf << PCIE_LINK_STATUS_WIDTH_OFF)
+
+#define PCIE_LINK_CAPABILITY 0x7c
+#define PCIE_LINK_CTL_2 0xa0
+#define TARGET_LINK_SPEED_MASK 0xf
+#define LINK_SPEED_GEN_1 0x1
+#define LINK_SPEED_GEN_2 0x2
+#define LINK_SPEED_GEN_3 0x3
+
+#define PCIE_MISC_CONTROL_1_OFF 0x8bc
+#define PCIE_DBI_RO_WR_EN BIT(0)
+
+#define PLR_OFFSET 0x700
+#define PCIE_PORT_DEBUG0 (PLR_OFFSET + 0x28)
+#define PORT_LOGIC_LTSSM_STATE_MASK 0x1f
+#define PORT_LOGIC_LTSSM_STATE_L0 0x11
+
+#define PCIE_LINK_WIDTH_SPEED_CONTROL 0x80c
+#define PORT_LOGIC_SPEED_CHANGE (0x1 << 17)
+
+#define PCIE_LINK_UP_TIMEOUT_MS 100
+
+/*
+ * iATU Unroll-specific register definitions
+ * From 4.80 core version the address translation will be made by unroll.
+ * The registers are offset from atu_base
+ */
+#define PCIE_ATU_UNR_REGION_CTRL1 0x00
+#define PCIE_ATU_UNR_REGION_CTRL2 0x04
+#define PCIE_ATU_UNR_LOWER_BASE 0x08
+#define PCIE_ATU_UNR_UPPER_BASE 0x0c
+#define PCIE_ATU_UNR_LIMIT 0x10
+#define PCIE_ATU_UNR_LOWER_TARGET 0x14
+#define PCIE_ATU_UNR_UPPER_TARGET 0x18
+
+#define PCIE_ATU_REGION_INDEX1 (0x1 << 0)
+#define PCIE_ATU_REGION_INDEX0 (0x0 << 0)
+#define PCIE_ATU_TYPE_MEM (0x0 << 0)
+#define PCIE_ATU_TYPE_IO (0x2 << 0)
+#define PCIE_ATU_TYPE_CFG0 (0x4 << 0)
+#define PCIE_ATU_TYPE_CFG1 (0x5 << 0)
+#define PCIE_ATU_ENABLE (0x1 << 31)
+#define PCIE_ATU_BAR_MODE_ENABLE (0x1 << 30)
+#define PCIE_ATU_BUS(x) (((x) & 0xff) << 24)
+#define PCIE_ATU_DEV(x) (((x) & 0x1f) << 19)
+#define PCIE_ATU_FUNC(x) (((x) & 0x7) << 16)
+
+/* Register address builder */
+#define PCIE_GET_ATU_OUTB_UNR_REG_OFFSET(region) ((region) << 9)
+
+/* Offsets from App base */
+#define PCIE_CMD_STATUS 0x04
+#define LTSSM_EN_VAL BIT(0)
+
+/* Parameters for the waiting for iATU enabled routine */
+#define LINK_WAIT_MAX_IATU_RETRIES 5
+#define LINK_WAIT_IATU 10000
+
+#define AM654_PCIE_DEV_TYPE_MASK 0x3
+#define EP 0x0
+#define LEG_EP 0x1
+#define RC 0x2
+
+/**
+ * struct pcie_dw_ti - TI DW PCIe controller state
+ *
+ * @app_base: The base address of application register space
+ * @dbics_base: The base address of dbics register space
+ * @cfg_base: The base address of configuration space
+ * @atu_base: The base address of ATU space
+ * @cfg_size: The size of the configuration space which is needed
+ * as it gets written into the PCIE_ATU_LIMIT register
+ * @first_busno: This driver supports multiple PCIe controllers.
+ * first_busno stores the bus number of the PCIe root-port
+ * number which may vary depending on the PCIe setup
+ * (PEX switches etc).
+ */
+struct pcie_dw_ti {
+ void *app_base;
+ void *dbi_base;
+ void *cfg_base;
+ void *atu_base;
+ fdt_size_t cfg_size;
+ int first_busno;
+ struct udevice *dev;
+
+ /* IO and MEM PCI regions */
+ struct pci_region io;
+ struct pci_region mem;
+};
+
+enum dw_pcie_device_mode {
+ DW_PCIE_UNKNOWN_TYPE,
+ DW_PCIE_EP_TYPE,
+ DW_PCIE_LEG_EP_TYPE,
+ DW_PCIE_RC_TYPE,
+};
+
+static int pcie_dw_get_link_speed(struct pcie_dw_ti *pci)
+{
+ return (readl(pci->dbi_base + PCIE_LINK_STATUS_REG) &
+ PCIE_LINK_STATUS_SPEED_MASK) >> PCIE_LINK_STATUS_SPEED_OFF;
+}
+
+static int pcie_dw_get_link_width(struct pcie_dw_ti *pci)
+{
+ return (readl(pci->dbi_base + PCIE_LINK_STATUS_REG) &
+ PCIE_LINK_STATUS_WIDTH_MASK) >> PCIE_LINK_STATUS_WIDTH_OFF;
+}
+
+static void dw_pcie_writel_ob_unroll(struct pcie_dw_ti *pci, u32 index, u32 reg,
+ u32 val)
+{
+ u32 offset = PCIE_GET_ATU_OUTB_UNR_REG_OFFSET(index);
+ void __iomem *base = pci->atu_base;
+
+ writel(val, base + offset + reg);
+}
+
+static u32 dw_pcie_readl_ob_unroll(struct pcie_dw_ti *pci, u32 index, u32 reg)
+{
+ u32 offset = PCIE_GET_ATU_OUTB_UNR_REG_OFFSET(index);
+ void __iomem *base = pci->atu_base;
+
+ return readl(base + offset + reg);
+}
+
+/**
+ * pcie_dw_prog_outbound_atu_unroll() - Configure ATU for outbound accesses
+ *
+ * @pcie: Pointer to the PCI controller state
+ * @index: ATU region index
+ * @type: ATU accsess type
+ * @cpu_addr: the physical address for the translation entry
+ * @pci_addr: the pcie bus address for the translation entry
+ * @size: the size of the translation entry
+ */
+static void pcie_dw_prog_outbound_atu_unroll(struct pcie_dw_ti *pci, int index,
+ int type, u64 cpu_addr,
+ u64 pci_addr, u32 size)
+{
+ u32 retries, val;
+
+ debug("ATU programmed with: index: %d, type: %d, cpu addr: %8llx, pci addr: %8llx, size: %8x\n",
+ index, type, cpu_addr, pci_addr, size);
+
+ dw_pcie_writel_ob_unroll(pci, index, PCIE_ATU_UNR_LOWER_BASE,
+ lower_32_bits(cpu_addr));
+ dw_pcie_writel_ob_unroll(pci, index, PCIE_ATU_UNR_UPPER_BASE,
+ upper_32_bits(cpu_addr));
+ dw_pcie_writel_ob_unroll(pci, index, PCIE_ATU_UNR_LIMIT,
+ lower_32_bits(cpu_addr + size - 1));
+ dw_pcie_writel_ob_unroll(pci, index, PCIE_ATU_UNR_LOWER_TARGET,
+ lower_32_bits(pci_addr));
+ dw_pcie_writel_ob_unroll(pci, index, PCIE_ATU_UNR_UPPER_TARGET,
+ upper_32_bits(pci_addr));
+ dw_pcie_writel_ob_unroll(pci, index, PCIE_ATU_UNR_REGION_CTRL1,
+ type);
+ dw_pcie_writel_ob_unroll(pci, index, PCIE_ATU_UNR_REGION_CTRL2,
+ PCIE_ATU_ENABLE);
+
+ /*
+ * Make sure ATU enable takes effect before any subsequent config
+ * and I/O accesses.
+ */
+ for (retries = 0; retries < LINK_WAIT_MAX_IATU_RETRIES; retries++) {
+ val = dw_pcie_readl_ob_unroll(pci, index,
+ PCIE_ATU_UNR_REGION_CTRL2);
+ if (val & PCIE_ATU_ENABLE)
+ return;
+
+ udelay(LINK_WAIT_IATU);
+ }
+ dev_err(pci->dev, "outbound iATU is not being enabled\n");
+}
+
+/**
+ * set_cfg_address() - Configure the PCIe controller config space access
+ *
+ * @pcie: Pointer to the PCI controller state
+ * @d: PCI device to access
+ * @where: Offset in the configuration space
+ *
+ * Configures the PCIe controller to access the configuration space of
+ * a specific PCIe device and returns the address to use for this
+ * access.
+ *
+ * Return: Address that can be used to access the configation space
+ * of the requested device / offset
+ */
+static uintptr_t set_cfg_address(struct pcie_dw_ti *pcie,
+ pci_dev_t d, uint where)
+{
+ int bus = PCI_BUS(d) - pcie->first_busno;
+ uintptr_t va_address;
+ u32 atu_type;
+
+ /* Use dbi_base for own configuration read and write */
+ if (!bus) {
+ va_address = (uintptr_t)pcie->dbi_base;
+ goto out;
+ }
+
+ if (bus == 1)
+ /* For local bus, change TLP Type field to 4. */
+ atu_type = PCIE_ATU_TYPE_CFG0;
+ else
+ /* Otherwise, change TLP Type field to 5. */
+ atu_type = PCIE_ATU_TYPE_CFG1;
+
+ /*
+ * Not accessing root port configuration space?
+ * Region #0 is used for Outbound CFG space access.
+ * Direction = Outbound
+ * Region Index = 0
+ */
+ d = PCI_MASK_BUS(d);
+ d = PCI_ADD_BUS(bus, d);
+ pcie_dw_prog_outbound_atu_unroll(pcie, PCIE_ATU_REGION_INDEX1,
+ atu_type, (u64)pcie->cfg_base,
+ d << 8, pcie->cfg_size);
+
+ va_address = (uintptr_t)pcie->cfg_base;
+
+out:
+ va_address += where & ~0x3;
+
+ return va_address;
+}
+
+/**
+ * pcie_dw_addr_valid() - Check for valid bus address
+ *
+ * @d: The PCI device to access
+ * @first_busno: Bus number of the PCIe controller root complex
+ *
+ * Return 1 (true) if the PCI device can be accessed by this controller.
+ *
+ * Return: 1 on valid, 0 on invalid
+ */
+static int pcie_dw_addr_valid(pci_dev_t d, int first_busno)
+{
+ if ((PCI_BUS(d) == first_busno) && (PCI_DEV(d) > 0))
+ return 0;
+ if ((PCI_BUS(d) == first_busno + 1) && (PCI_DEV(d) > 0))
+ return 0;
+
+ return 1;
+}
+
+/**
+ * pcie_dw_ti_read_config() - Read from configuration space
+ *
+ * @bus: Pointer to the PCI bus
+ * @bdf: Identifies the PCIe device to access
+ * @offset: The offset into the device's configuration space
+ * @valuep: A pointer at which to store the read value
+ * @size: Indicates the size of access to perform
+ *
+ * Read a value of size @size from offset @offset within the configuration
+ * space of the device identified by the bus, device & function numbers in @bdf
+ * on the PCI bus @bus.
+ *
+ * Return: 0 on success
+ */
+static int pcie_dw_ti_read_config(struct udevice *bus, pci_dev_t bdf,
+ uint offset, ulong *valuep,
+ enum pci_size_t size)
+{
+ struct pcie_dw_ti *pcie = dev_get_priv(bus);
+ uintptr_t va_address;
+ ulong value;
+
+ debug("PCIE CFG read: bdf=%2x:%2x:%2x ",
+ PCI_BUS(bdf), PCI_DEV(bdf), PCI_FUNC(bdf));
+
+ if (!pcie_dw_addr_valid(bdf, pcie->first_busno)) {
+ debug("- out of range\n");
+ *valuep = pci_get_ff(size);
+ return 0;
+ }
+
+ va_address = set_cfg_address(pcie, bdf, offset);
+
+ value = readl(va_address);
+
+ debug("(addr,val)=(0x%04x, 0x%08lx)\n", offset, value);
+ *valuep = pci_conv_32_to_size(value, offset, size);
+
+ pcie_dw_prog_outbound_atu_unroll(pcie, PCIE_ATU_REGION_INDEX1,
+ PCIE_ATU_TYPE_IO, pcie->io.phys_start,
+ pcie->io.bus_start, pcie->io.size);
+
+ return 0;
+}
+
+/**
+ * pcie_dw_ti_write_config() - Write to configuration space
+ *
+ * @bus: Pointer to the PCI bus
+ * @bdf: Identifies the PCIe device to access
+ * @offset: The offset into the device's configuration space
+ * @value: The value to write
+ * @size: Indicates the size of access to perform
+ *
+ * Write the value @value of size @size from offset @offset within the
+ * configuration space of the device identified by the bus, device & function
+ * numbers in @bdf on the PCI bus @bus.
+ *
+ * Return: 0 on success
+ */
+static int pcie_dw_ti_write_config(struct udevice *bus, pci_dev_t bdf,
+ uint offset, ulong value,
+ enum pci_size_t size)
+{
+ struct pcie_dw_ti *pcie = dev_get_priv(bus);
+ uintptr_t va_address;
+ ulong old;
+
+ debug("PCIE CFG write: (b,d,f)=(%2d,%2d,%2d) ",
+ PCI_BUS(bdf), PCI_DEV(bdf), PCI_FUNC(bdf));
+ debug("(addr,val)=(0x%04x, 0x%08lx)\n", offset, value);
+
+ if (!pcie_dw_addr_valid(bdf, pcie->first_busno)) {
+ debug("- out of range\n");
+ return 0;
+ }
+
+ va_address = set_cfg_address(pcie, bdf, offset);
+
+ old = readl(va_address);
+ value = pci_conv_size_to_32(old, value, offset, size);
+ writel(value, va_address);
+
+ pcie_dw_prog_outbound_atu_unroll(pcie, PCIE_ATU_REGION_INDEX1,
+ PCIE_ATU_TYPE_IO, pcie->io.phys_start,
+ pcie->io.bus_start, pcie->io.size);
+
+ return 0;
+}
+
+static inline void dw_pcie_dbi_write_enable(struct pcie_dw_ti *pci, bool en)
+{
+ u32 val;
+
+ val = readl(pci->dbi_base + PCIE_MISC_CONTROL_1_OFF);
+ if (en)
+ val |= PCIE_DBI_RO_WR_EN;
+ else
+ val &= ~PCIE_DBI_RO_WR_EN;
+ writel(val, pci->dbi_base + PCIE_MISC_CONTROL_1_OFF);
+}
+
+/**
+ * pcie_dw_configure() - Configure link capabilities and speed
+ *
+ * @regs_base: A pointer to the PCIe controller registers
+ * @cap_speed: The capabilities and speed to configure
+ *
+ * Configure the link capabilities and speed in the PCIe root complex.
+ */
+static void pcie_dw_configure(struct pcie_dw_ti *pci, u32 cap_speed)
+{
+ u32 val;
+
+ dw_pcie_dbi_write_enable(pci, true);
+
+ val = readl(pci->dbi_base + PCIE_LINK_CAPABILITY);
+ val &= ~TARGET_LINK_SPEED_MASK;
+ val |= cap_speed;
+ writel(val, pci->dbi_base + PCIE_LINK_CAPABILITY);
+
+ val = readl(pci->dbi_base + PCIE_LINK_CTL_2);
+ val &= ~TARGET_LINK_SPEED_MASK;
+ val |= cap_speed;
+ writel(val, pci->dbi_base + PCIE_LINK_CTL_2);
+
+ dw_pcie_dbi_write_enable(pci, false);
+}
+
+/**
+ * is_link_up() - Return the link state
+ *
+ * @regs_base: A pointer to the PCIe DBICS registers
+ *
+ * Return: 1 (true) for active line and 0 (false) for no link
+ */
+static int is_link_up(struct pcie_dw_ti *pci)
+{
+ u32 val;
+
+ val = readl(pci->dbi_base + PCIE_PORT_DEBUG0);
+ val &= PORT_LOGIC_LTSSM_STATE_MASK;
+
+ return (val == PORT_LOGIC_LTSSM_STATE_L0);
+}
+
+/**
+ * wait_link_up() - Wait for the link to come up
+ *
+ * @regs_base: A pointer to the PCIe controller registers
+ *
+ * Return: 1 (true) for active line and 0 (false) for no link (timeout)
+ */
+static int wait_link_up(struct pcie_dw_ti *pci)
+{
+ unsigned long timeout;
+
+ timeout = get_timer(0) + PCIE_LINK_UP_TIMEOUT_MS;
+ while (!is_link_up(pci)) {
+ if (get_timer(0) > timeout)
+ return 0;
+ };
+
+ return 1;
+}
+
+static int pcie_dw_ti_pcie_link_up(struct pcie_dw_ti *pci, u32 cap_speed)
+{
+ u32 val;
+
+ if (is_link_up(pci)) {
+ printf("PCI Link already up before configuration!\n");
+ return 1;
+ }
+
+ /* DW pre link configurations */
+ pcie_dw_configure(pci, cap_speed);
+
+ /* Initiate link training */
+ val = readl(pci->app_base + PCIE_CMD_STATUS);
+ val |= LTSSM_EN_VAL;
+ writel(val, pci->app_base + PCIE_CMD_STATUS);
+
+ /* Check that link was established */
+ if (!wait_link_up(pci))
+ return 0;
+
+ /*
+ * Link can be established in Gen 1. still need to wait
+ * till MAC nagaotiation is completed
+ */
+ udelay(100);
+
+ return 1;
+}
+
+/**
+ * pcie_dw_setup_host() - Setup the PCIe controller for RC opertaion
+ *
+ * @pcie: Pointer to the PCI controller state
+ *
+ * Configure the host BARs of the PCIe controller root port so that
+ * PCI(e) devices may access the system memory.
+ */
+static void pcie_dw_setup_host(struct pcie_dw_ti *pci)
+{
+ u32 val;
+
+ /* setup RC BARs */
+ writel(PCI_BASE_ADDRESS_MEM_TYPE_64,
+ pci->dbi_base + PCI_BASE_ADDRESS_0);
+ writel(0x0, pci->dbi_base + PCI_BASE_ADDRESS_1);
+
+ /* setup interrupt pins */
+ dw_pcie_dbi_write_enable(pci, true);
+ val = readl(pci->dbi_base + PCI_INTERRUPT_LINE);
+ val &= 0xffff00ff;
+ val |= 0x00000100;
+ writel(val, pci->dbi_base + PCI_INTERRUPT_LINE);
+ dw_pcie_dbi_write_enable(pci, false);
+
+ /* setup bus numbers */
+ val = readl(pci->dbi_base + PCI_PRIMARY_BUS);
+ val &= 0xff000000;
+ val |= 0x00ff0100;
+ writel(val, pci->dbi_base + PCI_PRIMARY_BUS);
+
+ /* setup command register */
+ val = readl(pci->dbi_base + PCI_COMMAND);
+ val &= 0xffff0000;
+ val |= PCI_COMMAND_IO | PCI_COMMAND_MEMORY |
+ PCI_COMMAND_MASTER | PCI_COMMAND_SERR;
+ writel(val, pci->dbi_base + PCI_COMMAND);
+
+ /* Enable write permission for the DBI read-only register */
+ dw_pcie_dbi_write_enable(pci, true);
+ /* program correct class for RC */
+ writew(PCI_CLASS_BRIDGE_PCI, pci->dbi_base + PCI_CLASS_DEVICE);
+ /* Better disable write permission right after the update */
+ dw_pcie_dbi_write_enable(pci, false);
+
+ val = readl(pci->dbi_base + PCIE_LINK_WIDTH_SPEED_CONTROL);
+ val |= PORT_LOGIC_SPEED_CHANGE;
+ writel(val, pci->dbi_base + PCIE_LINK_WIDTH_SPEED_CONTROL);
+}
+
+static int pcie_am654_set_mode(struct pcie_dw_ti *pci,
+ enum dw_pcie_device_mode mode)
+{
+ struct regmap *syscon;
+ u32 val;
+ u32 mask;
+ int ret;
+
+ syscon = syscon_regmap_lookup_by_phandle(pci->dev,
+ "ti,syscon-pcie-mode");
+ if (IS_ERR(syscon))
+ return 0;
+
+ mask = AM654_PCIE_DEV_TYPE_MASK;
+
+ switch (mode) {
+ case DW_PCIE_RC_TYPE:
+ val = RC;
+ break;
+ case DW_PCIE_EP_TYPE:
+ val = EP;
+ break;
+ default:
+ dev_err(pci->dev, "INVALID device type %d\n", mode);
+ return -EINVAL;
+ }
+
+ ret = regmap_update_bits(syscon, 0, mask, val);
+ if (ret) {
+ dev_err(pci->dev, "failed to set pcie mode\n");
+ return ret;
+ }
+
+ return 0;
+}
+
+static int pcie_dw_init_id(struct pcie_dw_ti *pci)
+{
+ struct regmap *devctrl_regs;
+ unsigned int id;
+ int ret;
+
+ devctrl_regs = syscon_regmap_lookup_by_phandle(pci->dev,
+ "ti,syscon-pcie-id");
+ if (IS_ERR(devctrl_regs))
+ return PTR_ERR(devctrl_regs);
+
+ ret = regmap_read(devctrl_regs, 0, &id);
+ if (ret)
+ return ret;
+
+ dw_pcie_dbi_write_enable(pci, true);
+ writew(id & PCIE_VENDORID_MASK, pci->dbi_base + PCI_VENDOR_ID);
+ writew(id >> PCIE_DEVICEID_SHIFT, pci->dbi_base + PCI_DEVICE_ID);
+ dw_pcie_dbi_write_enable(pci, false);
+
+ return 0;
+}
+
+/**
+ * pcie_dw_ti_probe() - Probe the PCIe bus for active link
+ *
+ * @dev: A pointer to the device being operated on
+ *
+ * Probe for an active link on the PCIe bus and configure the controller
+ * to enable this port.
+ *
+ * Return: 0 on success, else -ENODEV
+ */
+static int pcie_dw_ti_probe(struct udevice *dev)
+{
+ struct pcie_dw_ti *pci = dev_get_priv(dev);
+ struct udevice *ctlr = pci_get_controller(dev);
+ struct pci_controller *hose = dev_get_uclass_priv(ctlr);
+ struct power_domain pci_pwrdmn;
+ struct phy phy0, phy1;
+ int ret;
+
+ ret = power_domain_get_by_index(dev, &pci_pwrdmn, 0);
+ if (ret) {
+ dev_err(dev, "failed to get power domain\n");
+ return ret;
+ }
+
+ ret = power_domain_on(&pci_pwrdmn);
+ if (ret) {
+ dev_err(dev, "Power domain on failed\n");
+ return ret;
+ }
+
+ ret = generic_phy_get_by_name(dev, "pcie-phy0", &phy0);
+ if (ret) {
+ dev_err(dev, "Unable to get phy0");
+ return ret;
+ }
+ generic_phy_reset(&phy0);
+ generic_phy_init(&phy0);
+ generic_phy_power_on(&phy0);
+
+ ret = generic_phy_get_by_name(dev, "pcie-phy1", &phy1);
+ if (ret) {
+ dev_err(dev, "Unable to get phy1");
+ return ret;
+ }
+ generic_phy_reset(&phy1);
+ generic_phy_init(&phy1);
+ generic_phy_power_on(&phy1);
+
+ pci->first_busno = dev->seq;
+ pci->dev = dev;
+
+ pcie_dw_setup_host(pci);
+ pcie_dw_init_id(pci);
+
+ if (device_is_compatible(dev, "ti,am654-pcie-rc"))
+ pcie_am654_set_mode(pci, DW_PCIE_RC_TYPE);
+
+ if (!pcie_dw_ti_pcie_link_up(pci, LINK_SPEED_GEN_2)) {
+ printf("PCIE-%d: Link down\n", dev->seq);
+ return -ENODEV;
+ }
+
+ printf("PCIE-%d: Link up (Gen%d-x%d, Bus%d)\n", dev->seq,
+ pcie_dw_get_link_speed(pci),
+ pcie_dw_get_link_width(pci),
+ hose->first_busno);
+
+ /* Store the IO and MEM windows settings for future use by the ATU */
+ pci->io.phys_start = hose->regions[0].phys_start; /* IO base */
+ pci->io.bus_start = hose->regions[0].bus_start; /* IO_bus_addr */
+ pci->io.size = hose->regions[0].size; /* IO size */
+
+ pci->mem.phys_start = hose->regions[1].phys_start; /* MEM base */
+ pci->mem.bus_start = hose->regions[1].bus_start; /* MEM_bus_addr */
+ pci->mem.size = hose->regions[1].size; /* MEM size */
+
+ pcie_dw_prog_outbound_atu_unroll(pci, PCIE_ATU_REGION_INDEX0,
+ PCIE_ATU_TYPE_MEM,
+ pci->mem.phys_start,
+ pci->mem.bus_start, pci->mem.size);
+
+ return 0;
+}
+
+/**
+ * pcie_dw_ti_ofdata_to_platdata() - Translate from DT to device state
+ *
+ * @dev: A pointer to the device being operated on
+ *
+ * Translate relevant data from the device tree pertaining to device @dev into
+ * state that the driver will later make use of. This state is stored in the
+ * device's private data structure.
+ *
+ * Return: 0 on success, else -EINVAL
+ */
+static int pcie_dw_ti_ofdata_to_platdata(struct udevice *dev)
+{
+ struct pcie_dw_ti *pcie = dev_get_priv(dev);
+
+ /* Get the controller base address */
+ pcie->dbi_base = (void *)dev_read_addr_name(dev, "dbics");
+ if ((fdt_addr_t)pcie->dbi_base == FDT_ADDR_T_NONE)
+ return -EINVAL;
+
+ /* Get the config space base address and size */
+ pcie->cfg_base = (void *)dev_read_addr_size_name(dev, "config",
+ &pcie->cfg_size);
+ if ((fdt_addr_t)pcie->cfg_base == FDT_ADDR_T_NONE)
+ return -EINVAL;
+
+ /* Get the iATU base address and size */
+ pcie->atu_base = (void *)dev_read_addr_name(dev, "atu");
+ if ((fdt_addr_t)pcie->atu_base == FDT_ADDR_T_NONE)
+ return -EINVAL;
+
+ /* Get the app base address and size */
+ pcie->app_base = (void *)dev_read_addr_name(dev, "app");
+ if ((fdt_addr_t)pcie->app_base == FDT_ADDR_T_NONE)
+ return -EINVAL;
+
+ return 0;
+}
+
+static const struct dm_pci_ops pcie_dw_ti_ops = {
+ .read_config = pcie_dw_ti_read_config,
+ .write_config = pcie_dw_ti_write_config,
+};
+
+static const struct udevice_id pcie_dw_ti_ids[] = {
+ { .compatible = "ti,am654-pcie-rc" },
+ { }
+};
+
+U_BOOT_DRIVER(pcie_dw_ti) = {
+ .name = "pcie_dw_ti",
+ .id = UCLASS_PCI,
+ .of_match = pcie_dw_ti_ids,
+ .ops = &pcie_dw_ti_ops,
+ .ofdata_to_platdata = pcie_dw_ti_ofdata_to_platdata,
+ .probe = pcie_dw_ti_probe,
+ .priv_auto_alloc_size = sizeof(struct pcie_dw_ti),
+};
diff --git a/drivers/pci/pcie_intel_fpga.c b/drivers/pci/pcie_intel_fpga.c
index 3cdf05b314..a5ea4888f3 100644
--- a/drivers/pci/pcie_intel_fpga.c
+++ b/drivers/pci/pcie_intel_fpga.c
@@ -36,16 +36,18 @@
#define RP_CFG_ADDR(pcie, reg) \
((pcie->hip_base) + (reg) + (1 << 20))
+#define RP_SECONDARY(pcie) \
+ readb(RP_CFG_ADDR(pcie, PCI_SECONDARY_BUS))
#define TLP_REQ_ID(bus, devfn) (((bus) << 8) | (devfn))
#define TLP_CFGRD_DW0(pcie, bus) \
- ((((bus != pcie->first_busno) ? TLP_FMTTYPE_CFGRD0 \
- : TLP_FMTTYPE_CFGRD1) << 24) | \
+ ((((bus > RP_SECONDARY(pcie)) ? TLP_FMTTYPE_CFGRD1 \
+ : TLP_FMTTYPE_CFGRD0) << 24) | \
TLP_PAYLOAD_SIZE)
#define TLP_CFGWR_DW0(pcie, bus) \
- ((((bus != pcie->first_busno) ? TLP_FMTTYPE_CFGWR0 \
- : TLP_FMTTYPE_CFGWR1) << 24) | \
+ ((((bus > RP_SECONDARY(pcie)) ? TLP_FMTTYPE_CFGWR1 \
+ : TLP_FMTTYPE_CFGWR0) << 24) | \
TLP_PAYLOAD_SIZE)
#define TLP_CFG_DW1(pcie, tag, be) \
@@ -56,7 +58,7 @@
#define TLP_COMP_STATUS(s) (((s) >> 13) & 7)
#define TLP_BYTE_COUNT(s) (((s) >> 0) & 0xfff)
#define TLP_HDR_SIZE 3
-#define TLP_LOOP 500
+#define TLP_LOOP 20000
#define DWORD_MASK 3
#define IS_ROOT_PORT(pcie, bdf) \
@@ -161,8 +163,10 @@ static int tlp_read_packet(struct intel_fpga_pcie *pcie, u32 *value)
dw[count++] = cra_readl(pcie, RP_RXCPL_REG);
if (ctrl & RP_RXCPL_EOP) {
comp_status = TLP_COMP_STATUS(dw[1]);
- if (comp_status)
- return -EFAULT;
+ if (comp_status) {
+ *value = pci_get_ff(PCI_SIZE_32);
+ return 0;
+ }
if (value &&
TLP_BYTE_COUNT(dw[1]) == sizeof(u32) &&
diff --git a/drivers/pcmcia/Kconfig b/drivers/pcmcia/Kconfig
deleted file mode 100644
index e69de29bb2..0000000000
--- a/drivers/pcmcia/Kconfig
+++ /dev/null
diff --git a/drivers/pcmcia/Makefile b/drivers/pcmcia/Makefile
deleted file mode 100644
index 8374a56c34..0000000000
--- a/drivers/pcmcia/Makefile
+++ /dev/null
@@ -1,6 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0+
-#
-# (C) Copyright 2000-2007
-# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
-
-obj-$(CONFIG_MARUBUN_PCCARD) += marubun_pcmcia.o
diff --git a/drivers/pcmcia/marubun_pcmcia.c b/drivers/pcmcia/marubun_pcmcia.c
deleted file mode 100644
index b2eea6c601..0000000000
--- a/drivers/pcmcia/marubun_pcmcia.c
+++ /dev/null
@@ -1,99 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0+
-/*
- * Marubun MR-SHPC-01 PCMCIA controller device driver
- *
- * (c) 2007 Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
- */
-
-#include <common.h>
-#include <config.h>
-#include <pcmcia.h>
-#include <asm/io.h>
-
-#undef CONFIG_PCMCIA
-
-#if defined(CONFIG_CMD_PCMCIA)
-#define CONFIG_PCMCIA
-#endif
-
-#if defined(CONFIG_IDE)
-#define CONFIG_PCMCIA
-#endif
-
-#if defined(CONFIG_PCMCIA)
-
-/* MR-SHPC-01 register */
-#define MRSHPC_MODE (CONFIG_SYS_MARUBUN_MRSHPC + 4)
-#define MRSHPC_OPTION (CONFIG_SYS_MARUBUN_MRSHPC + 6)
-#define MRSHPC_CSR (CONFIG_SYS_MARUBUN_MRSHPC + 8)
-#define MRSHPC_ISR (CONFIG_SYS_MARUBUN_MRSHPC + 10)
-#define MRSHPC_ICR (CONFIG_SYS_MARUBUN_MRSHPC + 12)
-#define MRSHPC_CPWCR (CONFIG_SYS_MARUBUN_MRSHPC + 14)
-#define MRSHPC_MW0CR1 (CONFIG_SYS_MARUBUN_MRSHPC + 16)
-#define MRSHPC_MW1CR1 (CONFIG_SYS_MARUBUN_MRSHPC + 18)
-#define MRSHPC_IOWCR1 (CONFIG_SYS_MARUBUN_MRSHPC + 20)
-#define MRSHPC_MW0CR2 (CONFIG_SYS_MARUBUN_MRSHPC + 22)
-#define MRSHPC_MW1CR2 (CONFIG_SYS_MARUBUN_MRSHPC + 24)
-#define MRSHPC_IOWCR2 (CONFIG_SYS_MARUBUN_MRSHPC + 26)
-#define MRSHPC_CDCR (CONFIG_SYS_MARUBUN_MRSHPC + 28)
-#define MRSHPC_PCIC_INFO (CONFIG_SYS_MARUBUN_MRSHPC + 30)
-
-int pcmcia_on (void)
-{
- printf("Enable PCMCIA " PCMCIA_SLOT_MSG "\n");
-
- /* Init */
- outw( 0x0000 , MRSHPC_MODE );
-
- if ((inw(MRSHPC_CSR) & 0x000c) == 0){ /* if card detect is true */
- if ((inw(MRSHPC_CSR) & 0x0080) == 0){
- outw(0x0674 ,MRSHPC_CPWCR); /* Card Vcc is 3.3v? */
- }else{
- outw(0x0678 ,MRSHPC_CPWCR); /* Card Vcc is 5V */
- }
- udelay( 100000 ); /* wait for power on */
- }else{
- return 1;
- }
- /*
- * PC-Card window open
- * flag == COMMON/ATTRIBUTE/IO
- */
- /* common window open */
- outw(0x8a84,MRSHPC_MW0CR1); /* window 0xb8400000 */
- if ((inw(MRSHPC_CSR) & 0x4000) != 0)
- outw(0x0b00,MRSHPC_MW0CR2); /* common mode & bus width 16bit SWAP = 1 */
- else
- outw(0x0300,MRSHPC_MW0CR2); /* common mode & bus width 16bit SWAP = 0 */
-
- /* attribute window open */
- outw(0x8a85,MRSHPC_MW1CR1); /* window 0xb8500000 */
- if ((inw(MRSHPC_CSR) & 0x4000) != 0)
- outw(0x0a00,MRSHPC_MW1CR2); /* attribute mode & bus width 16bit SWAP = 1 */
- else
- outw(0x0200,MRSHPC_MW1CR2); /* attribute mode & bus width 16bit SWAP = 0 */
-
- /* I/O window open */
- outw(0x8a86,MRSHPC_IOWCR1); /* I/O window 0xb8600000 */
- outw(0x0008,MRSHPC_CDCR); /* I/O card mode */
- if ((inw(MRSHPC_CSR) & 0x4000) != 0)
- outw(0x0a00,MRSHPC_IOWCR2); /* bus width 16bit SWAP = 1 */
- else
- outw(0x0200,MRSHPC_IOWCR2); /* bus width 16bit SWAP = 0 */
-
- outw(0x0000,MRSHPC_ISR);
- outw(0x2000,MRSHPC_ICR);
- outb(0x00,(CONFIG_SYS_MARUBUN_MW2 + 0x206));
- outb(0x42,(CONFIG_SYS_MARUBUN_MW2 + 0x200));
-
- return 0;
-}
-
-int pcmcia_off (void)
-{
- printf ("Disable PCMCIA " PCMCIA_SLOT_MSG "\n");
-
- return 0;
-}
-
-#endif /* CONFIG_PCMCIA */
diff --git a/drivers/phy/Kconfig b/drivers/phy/Kconfig
index 8209ca7323..3942f035eb 100644
--- a/drivers/phy/Kconfig
+++ b/drivers/phy/Kconfig
@@ -108,6 +108,15 @@ config SPL_PIPE3_PHY
This PHY is found on omap devices supporting SATA such as dra7, am57x
and omap5
+config AM654_PHY
+ tristate "TI AM654 SERDES support"
+ depends on PHY && ARCH_K3
+ select REGMAP
+ select SYSCON
+ help
+ This option enables support for TI AM654 SerDes PHY used for
+ PCIe.
+
config STI_USB_PHY
bool "STMicroelectronics USB2 picoPHY driver for STiH407 family"
depends on PHY && ARCH_STI
diff --git a/drivers/phy/Makefile b/drivers/phy/Makefile
index b9f5195e1c..3157f1b7ee 100644
--- a/drivers/phy/Makefile
+++ b/drivers/phy/Makefile
@@ -11,6 +11,7 @@ obj-$(CONFIG_BCM6358_USBH_PHY) += bcm6358-usbh-phy.o
obj-$(CONFIG_BCM6368_USBH_PHY) += bcm6368-usbh-phy.o
obj-$(CONFIG_PHY_SANDBOX) += sandbox-phy.o
obj-$(CONFIG_$(SPL_)PIPE3_PHY) += ti-pipe3-phy.o
+obj-$(CONFIG_AM654_PHY) += phy-ti-am654.o
obj-$(CONFIG_STI_USB_PHY) += sti_usb_phy.o
obj-$(CONFIG_PHY_RCAR_GEN2) += phy-rcar-gen2.o
obj-$(CONFIG_PHY_RCAR_GEN3) += phy-rcar-gen3.o
diff --git a/drivers/phy/phy-ti-am654.c b/drivers/phy/phy-ti-am654.c
new file mode 100644
index 0000000000..39490124ea
--- /dev/null
+++ b/drivers/phy/phy-ti-am654.c
@@ -0,0 +1,411 @@
+// SPDX-License-Identifier: GPL-2.0+
+/**
+ * PCIe SERDES driver for AM654x SoC
+ *
+ * Copyright (C) 2018 Texas Instruments
+ * Author: Kishon Vijay Abraham I <kishon@ti.com>
+ */
+
+#include <common.h>
+#include <clk-uclass.h>
+#include <dm.h>
+#include <dm/device.h>
+#include <dm/lists.h>
+#include <dt-bindings/phy/phy.h>
+#include <generic-phy.h>
+#include <asm/io.h>
+#include <asm/arch/sys_proto.h>
+#include <power-domain.h>
+#include <regmap.h>
+#include <syscon.h>
+
+#define CMU_R07C 0x7c
+#define CMU_MASTER_CDN_O BIT(24)
+
+#define COMLANE_R138 0xb38
+#define CONFIG_VERSION_REG_MASK GENMASK(23, 16)
+#define CONFIG_VERSION_REG_SHIFT 16
+#define VERSION 0x70
+
+#define COMLANE_R190 0xb90
+#define L1_MASTER_CDN_O BIT(9)
+
+#define COMLANE_R194 0xb94
+#define CMU_OK_I_0 BIT(19)
+
+#define SERDES_CTRL 0x1fd0
+#define POR_EN BIT(29)
+
+#define WIZ_LANEXCTL_STS 0x1fe0
+#define TX0_ENABLE_OVL BIT(31)
+#define TX0_ENABLE_MASK GENMASK(30, 29)
+#define TX0_ENABLE_SHIFT 29
+#define TX0_DISABLE_STATE 0x0
+#define TX0_SLEEP_STATE 0x1
+#define TX0_SNOOZE_STATE 0x2
+#define TX0_ENABLE_STATE 0x3
+#define RX0_ENABLE_OVL BIT(15)
+#define RX0_ENABLE_MASK GENMASK(14, 13)
+#define RX0_ENABLE_SHIFT 13
+#define RX0_DISABLE_STATE 0x0
+#define RX0_SLEEP_STATE 0x1
+#define RX0_SNOOZE_STATE 0x2
+#define RX0_ENABLE_STATE 0x3
+
+#define WIZ_PLL_CTRL 0x1ff4
+#define PLL_ENABLE_OVL BIT(31)
+#define PLL_ENABLE_MASK GENMASK(30, 29)
+#define PLL_ENABLE_SHIFT 29
+#define PLL_DISABLE_STATE 0x0
+#define PLL_SLEEP_STATE 0x1
+#define PLL_SNOOZE_STATE 0x2
+#define PLL_ENABLE_STATE 0x3
+#define PLL_OK BIT(28)
+
+#define PLL_LOCK_TIME 1000 /* in milliseconds */
+#define SLEEP_TIME 100 /* in microseconds */
+
+#define LANE_USB3 0x0
+#define LANE_PCIE0_LANE0 0x1
+
+#define LANE_PCIE1_LANE0 0x0
+#define LANE_PCIE0_LANE1 0x1
+
+#define SERDES_NUM_CLOCKS 3
+
+/* SERDES control MMR bit offsets */
+#define SERDES_CTL_LANE_FUNC_SEL_SHIFT 0
+#define SERDES_CTL_LANE_FUNC_SEL_MASK GENMASK(1, 0)
+#define SERDES_CTL_CLK_SEL_SHIFT 4
+#define SERDES_CTL_CLK_SEL_MASK GENMASK(7, 4)
+
+/**
+ * struct serdes_am654_mux_clk_data - clock controller information structure
+ */
+struct serdes_am654_mux_clk_data {
+ struct regmap *regmap;
+ struct clk_bulk parents;
+};
+
+static int serdes_am654_mux_clk_probe(struct udevice *dev)
+{
+ struct serdes_am654_mux_clk_data *data = dev_get_priv(dev);
+ struct udevice *syscon;
+ struct regmap *regmap;
+ int ret;
+
+ debug("%s(dev=%s)\n", __func__, dev->name);
+
+ if (!data)
+ return -ENOMEM;
+
+ ret = uclass_get_device_by_phandle(UCLASS_SYSCON, dev,
+ "ti,serdes-clk", &syscon);
+ if (ret) {
+ dev_err(dev, "unable to find syscon device\n");
+ return ret;
+ }
+
+ regmap = syscon_get_regmap(syscon);
+ if (IS_ERR(regmap)) {
+ dev_err(dev, "Fail to get Syscon regmap\n");
+ return PTR_ERR(regmap);
+ }
+
+ data->regmap = regmap;
+
+ ret = clk_get_bulk(dev, &data->parents);
+ if (ret) {
+ dev_err(dev, "Failed to obtain parent clocks\n");
+ return ret;
+ }
+
+ return 0;
+}
+
+static int mux_table[SERDES_NUM_CLOCKS][3] = {
+ /*
+ * The entries represent values for selecting between
+ * {left input, external reference clock, right input}
+ * Only one of Left Output or Right Output should be used since
+ * both left and right output clock uses the same bits and modifying
+ * one clock will impact the other.
+ */
+ { BIT(2), 0, BIT(0) }, /* Mux of CMU refclk */
+ { -1, BIT(3), BIT(1) }, /* Mux of Left Output */
+ { BIT(1), BIT(3) | BIT(1), -1 }, /* Mux of Right Output */
+};
+
+static int serdes_am654_mux_clk_set_parent(struct clk *clk, struct clk *parent)
+{
+ struct serdes_am654_mux_clk_data *data = dev_get_priv(clk->dev);
+ u32 val;
+ int i;
+
+ debug("%s(clk=%s, parent=%s)\n", __func__, clk->dev->name,
+ parent->dev->name);
+
+ /*
+ * Since we have the same device-tree node represent both the
+ * clock and serdes device, we have two devices associated with
+ * the serdes node. assigned-clocks for this node is processed twice,
+ * once for the clock device and another time for the serdes
+ * device. When it is processed for the clock device, it is before
+ * the probe for clock device has been called. We ignore this case
+ * and rely on assigned-clocks to be processed correctly for the
+ * serdes case.
+ */
+ if (!data->regmap)
+ return 0;
+
+ for (i = 0; i < data->parents.count; i++) {
+ if (clk_is_match(&data->parents.clks[i], parent))
+ break;
+ }
+
+ if (i >= data->parents.count)
+ return -EINVAL;
+
+ val = mux_table[clk->id][i];
+ val <<= SERDES_CTL_CLK_SEL_SHIFT;
+
+ regmap_update_bits(data->regmap, 0, SERDES_CTL_CLK_SEL_MASK, val);
+
+ return 0;
+}
+
+static struct clk_ops serdes_am654_mux_clk_ops = {
+ .set_parent = serdes_am654_mux_clk_set_parent,
+};
+
+U_BOOT_DRIVER(serdes_am654_mux_clk) = {
+ .name = "ti-serdes-am654-mux-clk",
+ .id = UCLASS_CLK,
+ .probe = serdes_am654_mux_clk_probe,
+ .priv_auto_alloc_size = sizeof(struct serdes_am654_mux_clk_data),
+ .ops = &serdes_am654_mux_clk_ops,
+};
+
+struct serdes_am654 {
+ struct regmap *regmap;
+ struct regmap *serdes_ctl;
+};
+
+static int serdes_am654_enable_pll(struct serdes_am654 *phy)
+{
+ u32 mask = PLL_ENABLE_OVL | PLL_ENABLE_MASK;
+ u32 val = PLL_ENABLE_OVL | (PLL_ENABLE_STATE << PLL_ENABLE_SHIFT);
+
+ regmap_update_bits(phy->regmap, WIZ_PLL_CTRL, mask, val);
+
+ return regmap_read_poll_timeout(phy->regmap, WIZ_PLL_CTRL, val,
+ val & PLL_OK, 1000, PLL_LOCK_TIME);
+}
+
+static void serdes_am654_disable_pll(struct serdes_am654 *phy)
+{
+ u32 mask = PLL_ENABLE_OVL | PLL_ENABLE_MASK;
+
+ regmap_update_bits(phy->regmap, WIZ_PLL_CTRL, mask, 0);
+}
+
+static int serdes_am654_enable_txrx(struct serdes_am654 *phy)
+{
+ u32 mask;
+ u32 val;
+
+ /* Enable TX */
+ mask = TX0_ENABLE_OVL | TX0_ENABLE_MASK;
+ val = TX0_ENABLE_OVL | (TX0_ENABLE_STATE << TX0_ENABLE_SHIFT);
+ regmap_update_bits(phy->regmap, WIZ_LANEXCTL_STS, mask, val);
+
+ /* Enable RX */
+ mask = RX0_ENABLE_OVL | RX0_ENABLE_MASK;
+ val = RX0_ENABLE_OVL | (RX0_ENABLE_STATE << RX0_ENABLE_SHIFT);
+ regmap_update_bits(phy->regmap, WIZ_LANEXCTL_STS, mask, val);
+
+ return 0;
+}
+
+static int serdes_am654_disable_txrx(struct serdes_am654 *phy)
+{
+ u32 mask;
+
+ /* Disable TX */
+ mask = TX0_ENABLE_OVL | TX0_ENABLE_MASK;
+ regmap_update_bits(phy->regmap, WIZ_LANEXCTL_STS, mask, 0);
+
+ /* Disable RX */
+ mask = RX0_ENABLE_OVL | RX0_ENABLE_MASK;
+ regmap_update_bits(phy->regmap, WIZ_LANEXCTL_STS, mask, 0);
+
+ return 0;
+}
+
+static int serdes_am654_power_on(struct phy *x)
+{
+ struct serdes_am654 *phy = dev_get_priv(x->dev);
+ int ret;
+ u32 val;
+
+ ret = serdes_am654_enable_pll(phy);
+ if (ret) {
+ dev_err(x->dev, "Failed to enable PLL\n");
+ return ret;
+ }
+
+ ret = serdes_am654_enable_txrx(phy);
+ if (ret) {
+ dev_err(x->dev, "Failed to enable TX RX\n");
+ return ret;
+ }
+
+ return regmap_read_poll_timeout(phy->regmap, COMLANE_R194, val,
+ val & CMU_OK_I_0, SLEEP_TIME,
+ PLL_LOCK_TIME);
+}
+
+static int serdes_am654_power_off(struct phy *x)
+{
+ struct serdes_am654 *phy = dev_get_priv(x->dev);
+
+ serdes_am654_disable_txrx(phy);
+ serdes_am654_disable_pll(phy);
+
+ return 0;
+}
+
+static int serdes_am654_init(struct phy *x)
+{
+ struct serdes_am654 *phy = dev_get_priv(x->dev);
+ u32 mask;
+ u32 val;
+
+ mask = CONFIG_VERSION_REG_MASK;
+ val = VERSION << CONFIG_VERSION_REG_SHIFT;
+ regmap_update_bits(phy->regmap, COMLANE_R138, mask, val);
+
+ val = CMU_MASTER_CDN_O;
+ regmap_update_bits(phy->regmap, CMU_R07C, val, val);
+
+ val = L1_MASTER_CDN_O;
+ regmap_update_bits(phy->regmap, COMLANE_R190, val, val);
+
+ return 0;
+}
+
+static int serdes_am654_reset(struct phy *x)
+{
+ struct serdes_am654 *phy = dev_get_priv(x->dev);
+ u32 val;
+
+ val = POR_EN;
+ regmap_update_bits(phy->regmap, SERDES_CTRL, val, val);
+ mdelay(1);
+ regmap_update_bits(phy->regmap, SERDES_CTRL, val, 0);
+
+ return 0;
+}
+
+static int serdes_am654_of_xlate(struct phy *x,
+ struct ofnode_phandle_args *args)
+{
+ struct serdes_am654 *phy = dev_get_priv(x->dev);
+
+ if (args->args_count != 2) {
+ dev_err(phy->dev, "Invalid DT PHY argument count: %d\n",
+ args->args_count);
+ return -EINVAL;
+ }
+
+ if (args->args[0] != PHY_TYPE_PCIE) {
+ dev_err(phy->dev, "Unrecognized PHY type: %d\n",
+ args->args[0]);
+ return -EINVAL;
+ }
+
+ x->id = args->args[0] | (args->args[1] << 16);
+
+ /* Setup mux mode using second argument */
+ regmap_update_bits(phy->serdes_ctl, 0, SERDES_CTL_LANE_FUNC_SEL_MASK,
+ args->args[1]);
+
+ return 0;
+}
+
+static int serdes_am654_bind(struct udevice *dev)
+{
+ int ret;
+
+ ret = device_bind_driver_to_node(dev->parent,
+ "ti-serdes-am654-mux-clk",
+ dev_read_name(dev), dev->node,
+ NULL);
+ if (ret) {
+ dev_err(dev, "%s: not able to bind clock driver\n", __func__);
+ return ret;
+ }
+
+ return 0;
+}
+
+static int serdes_am654_probe(struct udevice *dev)
+{
+ struct serdes_am654 *phy = dev_get_priv(dev);
+ struct power_domain serdes_pwrdmn;
+ struct regmap *serdes_ctl;
+ struct regmap *map;
+ int ret;
+
+ ret = regmap_init_mem(dev_ofnode(dev), &map);
+ if (ret)
+ return ret;
+
+ phy->regmap = map;
+
+ serdes_ctl = syscon_regmap_lookup_by_phandle(dev, "ti,serdes-clk");
+ if (IS_ERR(serdes_ctl)) {
+ dev_err(dev, "unable to find syscon device\n");
+ return PTR_ERR(serdes_ctl);
+ }
+
+ phy->serdes_ctl = serdes_ctl;
+
+ ret = power_domain_get_by_index(dev, &serdes_pwrdmn, 0);
+ if (ret) {
+ dev_err(dev, "failed to get power domain\n");
+ return ret;
+ }
+
+ ret = power_domain_on(&serdes_pwrdmn);
+ if (ret) {
+ dev_err(dev, "Power domain on failed\n");
+ return ret;
+ }
+
+ return 0;
+}
+
+static const struct udevice_id serdes_am654_phy_ids[] = {
+ {
+ .compatible = "ti,phy-am654-serdes",
+ },
+};
+
+static const struct phy_ops serdes_am654_phy_ops = {
+ .reset = serdes_am654_reset,
+ .init = serdes_am654_init,
+ .power_on = serdes_am654_power_on,
+ .power_off = serdes_am654_power_off,
+ .of_xlate = serdes_am654_of_xlate,
+};
+
+U_BOOT_DRIVER(am654_serdes_phy) = {
+ .name = "am654_serdes_phy",
+ .id = UCLASS_PHY,
+ .of_match = serdes_am654_phy_ids,
+ .bind = serdes_am654_bind,
+ .ops = &serdes_am654_phy_ops,
+ .probe = serdes_am654_probe,
+ .priv_auto_alloc_size = sizeof(struct serdes_am654),
+};
diff --git a/drivers/power/domain/ti-sci-power-domain.c b/drivers/power/domain/ti-sci-power-domain.c
index b9cd37b612..4c4351d2d9 100644
--- a/drivers/power/domain/ti-sci-power-domain.c
+++ b/drivers/power/domain/ti-sci-power-domain.c
@@ -68,8 +68,8 @@ static int ti_sci_power_domain_on(struct power_domain *pd)
ret = dops->get_device(sci, pd->id);
if (ret)
- dev_err(power_domain->dev, "%s: get_device failed (%d)\n",
- __func__, ret);
+ dev_err(pd->dev, "%s: get_device(%lu) failed (%d)\n",
+ __func__, pd->id, ret);
return ret;
}
@@ -85,8 +85,8 @@ static int ti_sci_power_domain_off(struct power_domain *pd)
ret = dops->put_device(sci, pd->id);
if (ret)
- dev_err(power_domain->dev, "%s: put_device failed (%d)\n",
- __func__, ret);
+ dev_err(pd->dev, "%s: put_device(%lu) failed (%d)\n",
+ __func__, pd->id, ret);
return ret;
}
diff --git a/drivers/qe/qe.c b/drivers/qe/qe.c
index 505ae9b45f..6e4d732a07 100644
--- a/drivers/qe/qe.c
+++ b/drivers/qe/qe.c
@@ -14,7 +14,6 @@
#include <linux/immap_qe.h>
#include <fsl_qe.h>
#include <mmc.h>
-#include <environment.h>
#ifdef CONFIG_ARCH_LS1021A
#include <asm/arch/immap_ls102xa.h>
diff --git a/drivers/reset/reset-socfpga.c b/drivers/reset/reset-socfpga.c
index 822a3fe265..93ec9cfdb6 100644
--- a/drivers/reset/reset-socfpga.c
+++ b/drivers/reset/reset-socfpga.c
@@ -16,6 +16,7 @@
#include <dm.h>
#include <dm/lists.h>
#include <dm/of_access.h>
+#include <env.h>
#include <reset-uclass.h>
#include <linux/bitops.h>
#include <linux/io.h>
diff --git a/drivers/rtc/m41t60.c b/drivers/rtc/m41t60.c
index c84c8e11b3..532d2105e1 100644
--- a/drivers/rtc/m41t60.c
+++ b/drivers/rtc/m41t60.c
@@ -17,6 +17,7 @@
#include <common.h>
#include <command.h>
+#include <env.h>
#include <rtc.h>
#include <i2c.h>
diff --git a/drivers/scsi/scsi.c b/drivers/scsi/scsi.c
index 75900d8228..48cb2a2818 100644
--- a/drivers/scsi/scsi.c
+++ b/drivers/scsi/scsi.c
@@ -6,6 +6,7 @@
#include <common.h>
#include <dm.h>
+#include <env.h>
#include <pci.h>
#include <scsi.h>
#include <dm/device-internal.h>
diff --git a/drivers/serial/serial-uclass.c b/drivers/serial/serial-uclass.c
index d4488a2cc2..dcdaedefe7 100644
--- a/drivers/serial/serial-uclass.c
+++ b/drivers/serial/serial-uclass.c
@@ -5,7 +5,7 @@
#include <common.h>
#include <dm.h>
-#include <environment.h>
+#include <env_internal.h>
#include <errno.h>
#include <os.h>
#include <serial.h>
diff --git a/drivers/serial/serial.c b/drivers/serial/serial.c
index 09365ba6a1..b907508dbe 100644
--- a/drivers/serial/serial.c
+++ b/drivers/serial/serial.c
@@ -5,7 +5,7 @@
*/
#include <common.h>
-#include <environment.h>
+#include <env_internal.h>
#include <serial.h>
#include <stdio_dev.h>
#include <post.h>
diff --git a/drivers/serial/serial_lpuart.c b/drivers/serial/serial_lpuart.c
index 57dd4a72c6..4b0a964d1b 100644
--- a/drivers/serial/serial_lpuart.c
+++ b/drivers/serial/serial_lpuart.c
@@ -106,7 +106,7 @@ u32 __weak get_lpuart_clk(void)
return CONFIG_SYS_CLK_FREQ;
}
-#if IS_ENABLED(CONFIG_CLK)
+#if CONFIG_IS_ENABLED(CLK)
static int get_lpuart_clk_rate(struct udevice *dev, u32 *clk)
{
struct clk per_clk;
@@ -148,7 +148,7 @@ static void _lpuart_serial_setbrg(struct udevice *dev,
u16 sbr;
int ret;
- if (IS_ENABLED(CONFIG_CLK)) {
+ if (CONFIG_IS_ENABLED(CLK)) {
ret = get_lpuart_clk_rate(dev, &clk);
if (ret)
return;
@@ -237,7 +237,7 @@ static void _lpuart32_serial_setbrg_7ulp(struct udevice *dev,
u32 clk;
int ret;
- if (IS_ENABLED(CONFIG_CLK)) {
+ if (CONFIG_IS_ENABLED(CLK)) {
ret = get_lpuart_clk_rate(dev, &clk);
if (ret)
return;
@@ -306,7 +306,7 @@ static void _lpuart32_serial_setbrg(struct udevice *dev,
u32 sbr;
int ret;
- if (IS_ENABLED(CONFIG_CLK)) {
+ if (CONFIG_IS_ENABLED(CLK)) {
ret = get_lpuart_clk_rate(dev, &clk);
if (ret)
return;
diff --git a/drivers/serial/usbtty.c b/drivers/serial/usbtty.c
index d0465b844e..76d9c8a3a6 100644
--- a/drivers/serial/usbtty.c
+++ b/drivers/serial/usbtty.c
@@ -10,6 +10,7 @@
#include <common.h>
#include <config.h>
#include <circbuf.h>
+#include <env.h>
#include <stdio_dev.h>
#include <asm/unaligned.h>
#include "usbtty.h"
diff --git a/drivers/tee/sandbox.c b/drivers/tee/sandbox.c
index 2f3355c7b7..4b91e7db1b 100644
--- a/drivers/tee/sandbox.c
+++ b/drivers/tee/sandbox.c
@@ -79,7 +79,7 @@ static u32 ta_avb_invoke_func(struct udevice *dev, u32 func, uint num_params,
struct tee_param *params)
{
struct sandbox_tee_state *state = dev_get_priv(dev);
- ENTRY e, *ep;
+ struct env_entry e, *ep;
char *name;
u32 res;
uint slot;
@@ -174,7 +174,7 @@ static u32 ta_avb_invoke_func(struct udevice *dev, u32 func, uint num_params,
e.key = name;
e.data = NULL;
- hsearch_r(e, FIND, &ep, &state->pstorage_htab, 0);
+ hsearch_r(e, ENV_FIND, &ep, &state->pstorage_htab, 0);
if (!ep)
return TEE_ERROR_ITEM_NOT_FOUND;
@@ -198,13 +198,13 @@ static u32 ta_avb_invoke_func(struct udevice *dev, u32 func, uint num_params,
e.key = name;
e.data = NULL;
- hsearch_r(e, FIND, &ep, &state->pstorage_htab, 0);
+ hsearch_r(e, ENV_FIND, &ep, &state->pstorage_htab, 0);
if (ep)
hdelete_r(e.key, &state->pstorage_htab, 0);
e.key = name;
e.data = value;
- hsearch_r(e, ENTER, &ep, &state->pstorage_htab, 0);
+ hsearch_r(e, ENV_ENTER, &ep, &state->pstorage_htab, 0);
if (!ep)
return TEE_ERROR_OUT_OF_MEMORY;
diff --git a/drivers/usb/gadget/designware_udc.c b/drivers/usb/gadget/designware_udc.c
index fa947dade6..432f312cee 100644
--- a/drivers/usb/gadget/designware_udc.c
+++ b/drivers/usb/gadget/designware_udc.c
@@ -10,6 +10,7 @@
#include <common.h>
#include <asm/io.h>
+#include <env.h>
#include <usbdevice.h>
#include "ep0.h"
#include <usb/designware_udc.h>
diff --git a/drivers/usb/gadget/ether.c b/drivers/usb/gadget/ether.c
index 0b5a1a4796..a118283984 100644
--- a/drivers/usb/gadget/ether.c
+++ b/drivers/usb/gadget/ether.c
@@ -9,7 +9,7 @@
#include <common.h>
#include <console.h>
-#include <environment.h>
+#include <env.h>
#include <linux/errno.h>
#include <linux/netdevice.h>
#include <linux/usb/ch9.h>
diff --git a/drivers/usb/gadget/f_dfu.c b/drivers/usb/gadget/f_dfu.c
index e27f146605..6756155133 100644
--- a/drivers/usb/gadget/f_dfu.c
+++ b/drivers/usb/gadget/f_dfu.c
@@ -14,6 +14,7 @@
* (C) Copyright 2006 by Harald Welte <hwelte at hmw-consulting.de>
*/
+#include <env.h>
#include <errno.h>
#include <common.h>
#include <malloc.h>
diff --git a/drivers/usb/gadget/f_fastboot.c b/drivers/usb/gadget/f_fastboot.c
index 3ad4346f2d..fc27dbe8de 100644
--- a/drivers/usb/gadget/f_fastboot.c
+++ b/drivers/usb/gadget/f_fastboot.c
@@ -11,6 +11,7 @@
*/
#include <config.h>
#include <common.h>
+#include <env.h>
#include <errno.h>
#include <fastboot.h>
#include <malloc.h>
diff --git a/drivers/usb/gadget/f_rockusb.c b/drivers/usb/gadget/f_rockusb.c
index f3d24772cd..1cfeabcd31 100644
--- a/drivers/usb/gadget/f_rockusb.c
+++ b/drivers/usb/gadget/f_rockusb.c
@@ -6,6 +6,7 @@
*/
#include <config.h>
#include <common.h>
+#include <env.h>
#include <errno.h>
#include <malloc.h>
#include <memalign.h>
diff --git a/drivers/usb/gadget/f_sdp.c b/drivers/usb/gadget/f_sdp.c
index fab7ce6f97..bcd1c5d47c 100644
--- a/drivers/usb/gadget/f_sdp.c
+++ b/drivers/usb/gadget/f_sdp.c
@@ -19,6 +19,7 @@
#include <errno.h>
#include <common.h>
#include <console.h>
+#include <env.h>
#include <malloc.h>
#include <linux/usb/ch9.h>
diff --git a/drivers/usb/host/ehci-fsl.c b/drivers/usb/host/ehci-fsl.c
index b8f8e7a794..ced295ef0f 100644
--- a/drivers/usb/host/ehci-fsl.c
+++ b/drivers/usb/host/ehci-fsl.c
@@ -8,6 +8,7 @@
*/
#include <common.h>
+#include <env.h>
#include <pci.h>
#include <usb.h>
#include <asm/io.h>
diff --git a/drivers/video/ati_radeon_fb.c b/drivers/video/ati_radeon_fb.c
index 87557e52c0..6fce033636 100644
--- a/drivers/video/ati_radeon_fb.c
+++ b/drivers/video/ati_radeon_fb.c
@@ -19,6 +19,7 @@
#include <command.h>
#include <bios_emul.h>
+#include <env.h>
#include <pci.h>
#include <asm/processor.h>
#include <linux/errno.h>
diff --git a/drivers/video/cfb_console.c b/drivers/video/cfb_console.c
index 636c3e8c18..e5c077e4f5 100644
--- a/drivers/video/cfb_console.c
+++ b/drivers/video/cfb_console.c
@@ -65,7 +65,9 @@
*/
#include <common.h>
+#include <env.h>
#include <fdtdec.h>
+#include <gzip.h>
#include <version.h>
#include <malloc.h>
#include <video.h>
diff --git a/drivers/video/mb862xx.c b/drivers/video/mb862xx.c
index 1a3c970b3d..301c1f0df1 100644
--- a/drivers/video/mb862xx.c
+++ b/drivers/video/mb862xx.c
@@ -12,6 +12,7 @@
#include <common.h>
#include <asm/io.h>
+#include <env.h>
#include <pci.h>
#include <video_fb.h>
#include "videomodes.h"
diff --git a/drivers/video/mx3fb.c b/drivers/video/mx3fb.c
index 176ae70b7c..a984443ef9 100644
--- a/drivers/video/mx3fb.c
+++ b/drivers/video/mx3fb.c
@@ -6,6 +6,7 @@
* HALE electronic GmbH, <helmut.raiger@hale.at>
*/
#include <common.h>
+#include <env.h>
#include <malloc.h>
#include <video_fb.h>
diff --git a/drivers/video/mxsfb.c b/drivers/video/mxsfb.c
index 6c9a7c05e8..6922a130c6 100644
--- a/drivers/video/mxsfb.c
+++ b/drivers/video/mxsfb.c
@@ -6,6 +6,7 @@
*/
#include <common.h>
#include <dm.h>
+#include <env.h>
#include <linux/errno.h>
#include <malloc.h>
#include <video.h>
diff --git a/drivers/video/videomodes.c b/drivers/video/videomodes.c
index d7614329ff..ac25b45f81 100644
--- a/drivers/video/videomodes.c
+++ b/drivers/video/videomodes.c
@@ -58,6 +58,7 @@
#include <common.h>
#include <edid.h>
+#include <env.h>
#include <errno.h>
#include <linux/ctype.h>
diff --git a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig
index 1e5d14c4ff..a66a9bcbe2 100644
--- a/drivers/watchdog/Kconfig
+++ b/drivers/watchdog/Kconfig
@@ -28,7 +28,6 @@ config OMAP_WATCHDOG
bool "TI OMAP watchdog driver"
depends on ARCH_OMAP2PLUS
select HW_WATCHDOG
- default y if AM33XX
help
Say Y here to enable the OMAP3+ watchdog driver.
@@ -113,6 +112,14 @@ config WDT_MTK
The watchdog timer is stopped when initialized.
It performs full SoC reset.
+config WDT_OMAP3
+ bool "TI OMAP watchdog timer support"
+ depends on WDT && ARCH_OMAP2PLUS
+ default y if AM33XX
+ help
+ This enables OMAP3+ watchdog timer driver, which can be
+ found on some TI chipsets and inline with driver model.
+
config WDT_ORION
bool "Orion watchdog timer support"
depends on WDT
diff --git a/drivers/watchdog/Makefile b/drivers/watchdog/Makefile
index 414ba2430a..955caef815 100644
--- a/drivers/watchdog/Makefile
+++ b/drivers/watchdog/Makefile
@@ -25,6 +25,7 @@ obj-$(CONFIG_WDT_CDNS) += cdns_wdt.o
obj-$(CONFIG_WDT_MPC8xx) += mpc8xx_wdt.o
obj-$(CONFIG_WDT_MT7621) += mt7621_wdt.o
obj-$(CONFIG_WDT_MTK) += mtk_wdt.o
+obj-$(CONFIG_WDT_OMAP3) += omap_wdt.o
obj-$(CONFIG_WDT_SP805) += sp805_wdt.o
obj-$(CONFIG_WDT_STM32MP) += stm32mp_wdt.o
obj-$(CONFIG_WDT_TANGIER) += tangier_wdt.o
diff --git a/drivers/watchdog/omap_wdt.c b/drivers/watchdog/omap_wdt.c
index 343adb00c7..d5857be867 100644
--- a/drivers/watchdog/omap_wdt.c
+++ b/drivers/watchdog/omap_wdt.c
@@ -42,10 +42,14 @@
#include <asm/io.h>
#include <asm/processor.h>
#include <asm/arch/cpu.h>
+#include <wdt.h>
+#include <dm.h>
+#include <errno.h>
/* Hardware timeout in seconds */
#define WDT_HW_TIMEOUT 60
+#if !CONFIG_IS_ENABLED(WDT)
static unsigned int wdt_trgr_pattern = 0x1234;
void hw_watchdog_reset(void)
@@ -134,3 +138,120 @@ void hw_watchdog_init(void)
while ((readl(&wdt->wdtwwps)) & WDT_WWPS_PEND_WSPR)
;
}
+
+void watchdog_reset(void)
+{
+ hw_watchdog_reset();
+}
+
+#else
+
+static int omap3_wdt_reset(struct udevice *dev)
+{
+ struct omap3_wdt_priv *priv = dev_get_priv(dev);
+
+ priv->wdt_trgr_pattern = 0x1234;
+/*
+ * Somebody just triggered watchdog reset and write to WTGR register
+ * is in progress. It is resetting right now, no need to trigger it
+ * again
+ */
+ if ((readl(&priv->regs->wdtwwps)) & WDT_WWPS_PEND_WTGR)
+ return 0;
+
+ priv->wdt_trgr_pattern = ~(priv->wdt_trgr_pattern);
+ writel(priv->wdt_trgr_pattern, &priv->regs->wdtwtgr);
+/*
+ * Don't wait for posted write to complete, i.e. don't check
+ * WDT_WWPS_PEND_WTGR bit in WWPS register. There is no writes to
+ * WTGR register outside of this func, and if entering it
+ * we see WDT_WWPS_PEND_WTGR bit set, it means watchdog reset
+ * was just triggered. This prevents us from wasting time in busy
+ * polling of WDT_WWPS_PEND_WTGR bit.
+ */
+ return 0;
+}
+
+static int omap3_wdt_stop(struct udevice *dev)
+{
+ struct omap3_wdt_priv *priv = dev_get_priv(dev);
+
+/* disable watchdog */
+ writel(0xAAAA, &priv->regs->wdtwspr);
+ while (readl(&priv->regs->wdtwwps) != 0x0)
+ ;
+ writel(0x5555, &priv->regs->wdtwspr);
+ while (readl(&priv->regs->wdtwwps) != 0x0)
+ ;
+ return 0;
+}
+
+static int omap3_wdt_start(struct udevice *dev, u64 timeout_ms, ulong flags)
+{
+ struct omap3_wdt_priv *priv = dev_get_priv(dev);
+ u32 pre_margin = GET_WLDR_VAL(timeout_ms);
+/*
+ * Make sure the watchdog is disabled. This is unfortunately required
+ * because writing to various registers with the watchdog running has no
+ * effect.
+ */
+ omap3_wdt_stop(dev);
+
+/* initialize prescaler */
+ while (readl(&priv->regs->wdtwwps) & WDT_WWPS_PEND_WCLR)
+ ;
+
+ writel(WDT_WCLR_PRE | (PTV << WDT_WCLR_PTV_OFF), &priv->regs->wdtwclr);
+ while (readl(&priv->regs->wdtwwps) & WDT_WWPS_PEND_WCLR)
+ ;
+/* just count up at 32 KHz */
+ while (readl(&priv->regs->wdtwwps) & WDT_WWPS_PEND_WLDR)
+ ;
+
+ writel(pre_margin, &priv->regs->wdtwldr);
+ while (readl(&priv->regs->wdtwwps) & WDT_WWPS_PEND_WLDR)
+ ;
+/* Sequence to enable the watchdog */
+ writel(0xBBBB, &priv->regs->wdtwspr);
+ while ((readl(&priv->regs->wdtwwps)) & WDT_WWPS_PEND_WSPR)
+ ;
+
+ writel(0x4444, &priv->regs->wdtwspr);
+ while ((readl(&priv->regs->wdtwwps)) & WDT_WWPS_PEND_WSPR)
+ ;
+
+ return 0;
+}
+
+static int omap3_wdt_probe(struct udevice *dev)
+{
+ struct omap3_wdt_priv *priv = dev_get_priv(dev);
+
+ priv->regs = (struct wd_timer *)devfdt_get_addr(dev);
+ if (!priv->regs)
+ return -EINVAL;
+
+ debug("%s: Probing wdt%u\n", __func__, dev->seq);
+ return 0;
+}
+
+static const struct wdt_ops omap3_wdt_ops = {
+ .start = omap3_wdt_start,
+ .stop = omap3_wdt_stop,
+ .reset = omap3_wdt_reset,
+};
+
+static const struct udevice_id omap3_wdt_ids[] = {
+ { .compatible = "ti,omap3-wdt" },
+ { }
+};
+
+U_BOOT_DRIVER(omap3_wdt) = {
+ .name = "omap3_wdt",
+ .id = UCLASS_WDT,
+ .of_match = omap3_wdt_ids,
+ .ops = &omap3_wdt_ops,
+ .probe = omap3_wdt_probe,
+ .priv_auto_alloc_size = sizeof(struct omap3_wdt_priv),
+};
+#endif /* !CONFIG_IS_ENABLED(WDT) */
diff --git a/env/callback.c b/env/callback.c
index 54d2de4a96..f0904cfdc5 100644
--- a/env/callback.c
+++ b/env/callback.c
@@ -5,7 +5,8 @@
*/
#include <common.h>
-#include <environment.h>
+#include <env.h>
+#include <env_internal.h>
#if defined(CONFIG_NEEDS_MANUAL_RELOC)
DECLARE_GLOBAL_DATA_PTR;
@@ -42,7 +43,7 @@ static const char *callback_list;
* This is called specifically when the variable did not exist in the hash
* previously, so the blanket update did not find this variable.
*/
-void env_callback_init(ENTRY *var_entry)
+void env_callback_init(struct env_entry *var_entry)
{
const char *var_name = var_entry->key;
char callback_name[256] = "";
@@ -79,7 +80,7 @@ void env_callback_init(ENTRY *var_entry)
* Called on each existing env var prior to the blanket update since removing
* a callback association should remove its callback.
*/
-static int clear_callback(ENTRY *entry)
+static int clear_callback(struct env_entry *entry)
{
entry->callback = NULL;
@@ -91,13 +92,13 @@ static int clear_callback(ENTRY *entry)
*/
static int set_callback(const char *name, const char *value, void *priv)
{
- ENTRY e, *ep;
+ struct env_entry e, *ep;
struct env_clbk_tbl *clbkp;
e.key = name;
e.data = NULL;
e.callback = NULL;
- hsearch_r(e, FIND, &ep, &env_htab, 0);
+ hsearch_r(e, ENV_FIND, &ep, &env_htab, 0);
/* does the env variable actually exist? */
if (ep != NULL) {
diff --git a/env/common.c b/env/common.c
index bd340fe9d5..3fb60509dd 100644
--- a/env/common.c
+++ b/env/common.c
@@ -9,7 +9,8 @@
#include <common.h>
#include <command.h>
-#include <environment.h>
+#include <env.h>
+#include <env_internal.h>
#include <linux/stddef.h>
#include <search.h>
#include <errno.h>
@@ -61,7 +62,7 @@ char *env_get_default(const char *name)
return ret_val;
}
-void set_default_env(const char *s, int flags)
+void env_set_default(const char *s, int flags)
{
if (sizeof(default_environment) > ENV_SIZE) {
puts("*** Error - default environment is too large\n\n");
@@ -91,7 +92,7 @@ void set_default_env(const char *s, int flags)
/* [re]set individual variables to their value in the default environment */
-int set_default_vars(int nvars, char * const vars[], int flags)
+int env_set_default_vars(int nvars, char * const vars[], int flags)
{
/*
* Special use-case: import from default environment
@@ -117,7 +118,7 @@ int env_import(const char *buf, int check)
memcpy(&crc, &ep->crc, sizeof(crc));
if (crc32(0, ep->data, ENV_SIZE) != crc) {
- set_default_env("bad CRC", 0);
+ env_set_default("bad CRC", 0);
return -ENOMSG; /* needed for env_load() */
}
}
@@ -130,7 +131,7 @@ int env_import(const char *buf, int check)
pr_err("Cannot import environment: errno = %d\n", errno);
- set_default_env("import failed", 0);
+ env_set_default("import failed", 0);
return -EIO;
}
@@ -155,7 +156,7 @@ int env_import_redund(const char *buf1, int buf1_read_fail,
}
if (buf1_read_fail && buf2_read_fail) {
- set_default_env("bad env area", 0);
+ env_set_default("bad env area", 0);
return -EIO;
} else if (!buf1_read_fail && buf2_read_fail) {
gd->env_valid = ENV_VALID;
@@ -171,7 +172,7 @@ int env_import_redund(const char *buf1, int buf1_read_fail,
tmp_env2->crc;
if (!crc1_ok && !crc2_ok) {
- set_default_env("bad CRC", 0);
+ env_set_default("bad CRC", 0);
return -ENOMSG; /* needed for env_load() */
} else if (crc1_ok && !crc2_ok) {
gd->env_valid = ENV_VALID;
@@ -235,10 +236,10 @@ void env_relocate(void)
if (gd->env_valid == ENV_INVALID) {
#if defined(CONFIG_ENV_IS_NOWHERE) || defined(CONFIG_SPL_BUILD)
/* Environment not changable */
- set_default_env(NULL, 0);
+ env_set_default(NULL, 0);
#else
bootstage_error(BOOTSTAGE_ID_NET_CHECKSUM);
- set_default_env("bad CRC", 0);
+ env_set_default("bad CRC", 0);
#endif
} else {
env_load();
@@ -249,7 +250,7 @@ void env_relocate(void)
int env_complete(char *var, int maxv, char *cmdv[], int bufsz, char *buf,
bool dollar_comp)
{
- ENTRY *match;
+ struct env_entry *match;
int found, idx;
if (dollar_comp) {
diff --git a/env/eeprom.c b/env/eeprom.c
index ac2689cc14..cb04d2ac88 100644
--- a/env/eeprom.c
+++ b/env/eeprom.c
@@ -9,7 +9,8 @@
#include <common.h>
#include <command.h>
-#include <environment.h>
+#include <env.h>
+#include <env_internal.h>
#include <linux/stddef.h>
#if defined(CONFIG_I2C_ENV_EEPROM_BUS)
#include <i2c.h>
@@ -131,9 +132,11 @@ static int env_eeprom_load(void)
gd->env_valid = ENV_REDUND;
} else {
/* both ok - check serial */
- if (flags[0] == ACTIVE_FLAG && flags[1] == OBSOLETE_FLAG)
+ if (flags[0] == ENV_REDUND_ACTIVE &&
+ flags[1] == ENV_REDUND_OBSOLETE)
gd->env_valid = ENV_VALID;
- else if (flags[0] == OBSOLETE_FLAG && flags[1] == ACTIVE_FLAG)
+ else if (flags[0] == ENV_REDUND_OBSOLETE &&
+ flags[1] == ENV_REDUND_ACTIVE)
gd->env_valid = ENV_REDUND;
else if (flags[0] == 0xFF && flags[1] == 0)
gd->env_valid = ENV_REDUND;
@@ -193,7 +196,7 @@ static int env_eeprom_save(void)
unsigned int off = CONFIG_ENV_OFFSET;
#ifdef CONFIG_ENV_OFFSET_REDUND
unsigned int off_red = CONFIG_ENV_OFFSET_REDUND;
- char flag_obsolete = OBSOLETE_FLAG;
+ char flag_obsolete = ENV_REDUND_OBSOLETE;
#endif
rc = env_export(&env_new);
@@ -206,7 +209,7 @@ static int env_eeprom_save(void)
off_red = CONFIG_ENV_OFFSET;
}
- env_new.flags = ACTIVE_FLAG;
+ env_new.flags = ENV_REDUND_ACTIVE;
#endif
rc = eeprom_bus_write(CONFIG_SYS_DEF_EEPROM_ADDR,
diff --git a/env/embedded.c b/env/embedded.c
index b1090e90e5..a38e169fe0 100644
--- a/env/embedded.c
+++ b/env/embedded.c
@@ -12,7 +12,7 @@
#define __ASM_STUB_PROCESSOR_H__ /* don't include asm/processor. */
#include <config.h>
#undef __ASSEMBLY__
-#include <environment.h>
+#include <env_internal.h>
#include <linux/stringify.h>
/* Handle HOSTS that have prepended crap on symbol names, not TARGETS. */
diff --git a/env/env.c b/env/env.c
index d3cbe2f915..9237bb9c74 100644
--- a/env/env.c
+++ b/env/env.c
@@ -5,7 +5,8 @@
*/
#include <common.h>
-#include <environment.h>
+#include <env.h>
+#include <env_internal.h>
DECLARE_GLOBAL_DATA_PTR;
diff --git a/env/ext4.c b/env/ext4.c
index 9947381bfd..1f6b1b5bd8 100644
--- a/env/ext4.c
+++ b/env/ext4.c
@@ -21,7 +21,8 @@
#include <common.h>
#include <command.h>
-#include <environment.h>
+#include <env.h>
+#include <env_internal.h>
#include <linux/stddef.h>
#include <malloc.h>
#include <memalign.h>
@@ -127,7 +128,7 @@ static int env_ext4_load(void)
return env_import(buf, 1);
err_env_relocate:
- set_default_env(NULL, 0);
+ env_set_default(NULL, 0);
return -EIO;
}
diff --git a/env/fat.c b/env/fat.c
index 7f74c64dfe..1836556f36 100644
--- a/env/fat.c
+++ b/env/fat.c
@@ -9,7 +9,8 @@
#include <common.h>
#include <command.h>
-#include <environment.h>
+#include <env.h>
+#include <env_internal.h>
#include <linux/stddef.h>
#include <malloc.h>
#include <memalign.h>
@@ -122,7 +123,7 @@ static int env_fat_load(void)
return env_import(buf, 1);
err_env_relocate:
- set_default_env(NULL, 0);
+ env_set_default(NULL, 0);
return -EIO;
}
diff --git a/env/flags.c b/env/flags.c
index 79dccc05fe..418d6cc742 100644
--- a/env/flags.c
+++ b/env/flags.c
@@ -4,6 +4,7 @@
* Joe Hershberger, National Instruments, joe.hershberger@ni.com
*/
+#include <env.h>
#include <linux/string.h>
#include <linux/ctype.h>
@@ -18,7 +19,7 @@
#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
#else
#include <common.h>
-#include <environment.h>
+#include <env_internal.h>
#endif
#ifdef CONFIG_CMD_NET
@@ -418,7 +419,7 @@ static const char *flags_list;
* This is called specifically when the variable did not exist in the hash
* previously, so the blanket update did not find this variable.
*/
-void env_flags_init(ENTRY *var_entry)
+void env_flags_init(struct env_entry *var_entry)
{
const char *var_name = var_entry->key;
char flags[ENV_FLAGS_ATTR_MAX_LEN + 1] = "";
@@ -440,7 +441,7 @@ void env_flags_init(ENTRY *var_entry)
* Called on each existing env var prior to the blanket update since removing
* a flag in the flag list should remove its flags.
*/
-static int clear_flags(ENTRY *entry)
+static int clear_flags(struct env_entry *entry)
{
entry->flags = 0;
@@ -452,12 +453,12 @@ static int clear_flags(ENTRY *entry)
*/
static int set_flags(const char *name, const char *value, void *priv)
{
- ENTRY e, *ep;
+ struct env_entry e, *ep;
e.key = name;
e.data = NULL;
e.callback = NULL;
- hsearch_r(e, FIND, &ep, &env_htab, 0);
+ hsearch_r(e, ENV_FIND, &ep, &env_htab, 0);
/* does the env variable actually exist? */
if (ep != NULL) {
@@ -495,8 +496,8 @@ U_BOOT_ENV_CALLBACK(flags, on_flags);
* overwriting of write-once variables.
*/
-int env_flags_validate(const ENTRY *item, const char *newval, enum env_op op,
- int flag)
+int env_flags_validate(const struct env_entry *item, const char *newval,
+ enum env_op op, int flag)
{
const char *name;
const char *oldval = NULL;
diff --git a/env/flash.c b/env/flash.c
index dca6567a09..231a5fdf24 100644
--- a/env/flash.c
+++ b/env/flash.c
@@ -11,7 +11,8 @@
#include <common.h>
#include <command.h>
-#include <environment.h>
+#include <env.h>
+#include <env_internal.h>
#include <linux/stddef.h>
#include <malloc.h>
#include <search.h>
@@ -47,7 +48,7 @@ DECLARE_GLOBAL_DATA_PTR;
#if defined(CONFIG_ENV_ADDR_REDUND) && defined(CMD_SAVEENV) || \
!defined(CONFIG_ENV_ADDR_REDUND) && defined(INITENV)
#ifdef ENV_IS_EMBEDDED
-static env_t *env_ptr = &environment;
+static env_t *env_ptr = &embedded_environment;
#else /* ! ENV_IS_EMBEDDED */
static env_t *env_ptr = (env_t *)CONFIG_ENV_ADDR;
@@ -94,10 +95,12 @@ static int env_flash_init(void)
} else if (!crc1_ok && !crc2_ok) {
gd->env_addr = addr_default;
gd->env_valid = ENV_INVALID;
- } else if (flag1 == ACTIVE_FLAG && flag2 == OBSOLETE_FLAG) {
+ } else if (flag1 == ENV_REDUND_ACTIVE &&
+ flag2 == ENV_REDUND_OBSOLETE) {
gd->env_addr = addr1;
gd->env_valid = ENV_VALID;
- } else if (flag1 == OBSOLETE_FLAG && flag2 == ACTIVE_FLAG) {
+ } else if (flag1 == ENV_REDUND_OBSOLETE &&
+ flag2 == ENV_REDUND_ACTIVE) {
gd->env_addr = addr2;
gd->env_valid = ENV_VALID;
} else if (flag1 == flag2) {
@@ -120,7 +123,7 @@ static int env_flash_save(void)
{
env_t env_new;
char *saved_data = NULL;
- char flag = OBSOLETE_FLAG, new_flag = ACTIVE_FLAG;
+ char flag = ENV_REDUND_OBSOLETE, new_flag = ENV_REDUND_ACTIVE;
int rc = 1;
#if CONFIG_ENV_SECT_SIZE > CONFIG_ENV_SIZE
ulong up_data = 0;
@@ -321,9 +324,9 @@ static int env_flash_load(void)
end_addr_new = ltmp;
}
- if (flash_addr_new->flags != OBSOLETE_FLAG &&
+ if (flash_addr_new->flags != ENV_REDUND_OBSOLETE &&
crc32(0, flash_addr_new->data, ENV_SIZE) == flash_addr_new->crc) {
- char flag = OBSOLETE_FLAG;
+ char flag = ENV_REDUND_OBSOLETE;
gd->env_valid = ENV_REDUND;
flash_sect_protect(0, (ulong)flash_addr_new, end_addr_new);
@@ -333,9 +336,9 @@ static int env_flash_load(void)
flash_sect_protect(1, (ulong)flash_addr_new, end_addr_new);
}
- if (flash_addr->flags != ACTIVE_FLAG &&
- (flash_addr->flags & ACTIVE_FLAG) == ACTIVE_FLAG) {
- char flag = ACTIVE_FLAG;
+ if (flash_addr->flags != ENV_REDUND_ACTIVE &&
+ (flash_addr->flags & ENV_REDUND_ACTIVE) == ENV_REDUND_ACTIVE) {
+ char flag = ENV_REDUND_ACTIVE;
gd->env_valid = ENV_REDUND;
flash_sect_protect(0, (ulong)flash_addr, end_addr);
diff --git a/env/mmc.c b/env/mmc.c
index b7b833f423..9f1878def1 100644
--- a/env/mmc.c
+++ b/env/mmc.c
@@ -8,7 +8,8 @@
#include <common.h>
#include <command.h>
-#include <environment.h>
+#include <env.h>
+#include <env_internal.h>
#include <fdtdec.h>
#include <linux/stddef.h>
#include <malloc.h>
@@ -346,7 +347,7 @@ fini:
fini_mmc_for_env(mmc);
err:
if (ret)
- set_default_env(errmsg, 0);
+ env_set_default(errmsg, 0);
#endif
return ret;
@@ -387,7 +388,7 @@ fini:
fini_mmc_for_env(mmc);
err:
if (ret)
- set_default_env(errmsg, 0);
+ env_set_default(errmsg, 0);
#endif
return ret;
}
diff --git a/env/nand.c b/env/nand.c
index d0b95f483d..9f3dc635cf 100644
--- a/env/nand.c
+++ b/env/nand.c
@@ -15,7 +15,8 @@
#include <common.h>
#include <command.h>
-#include <environment.h>
+#include <env.h>
+#include <env_internal.h>
#include <linux/stddef.h>
#include <malloc.h>
#include <memalign.h>
@@ -325,7 +326,7 @@ static int env_nand_load(void)
tmp_env2 = (env_t *)malloc(CONFIG_ENV_SIZE);
if (tmp_env1 == NULL || tmp_env2 == NULL) {
puts("Can't allocate buffers for environment\n");
- set_default_env("malloc() failed", 0);
+ env_set_default("malloc() failed", 0);
ret = -EIO;
goto done;
}
@@ -364,14 +365,14 @@ static int env_nand_load(void)
if (mtd && !get_nand_env_oob(mtd, &nand_env_oob_offset)) {
printf("Found Environment offset in OOB..\n");
} else {
- set_default_env("no env offset in OOB", 0);
+ env_set_default("no env offset in OOB", 0);
return;
}
#endif
ret = readenv(CONFIG_ENV_OFFSET, (u_char *)buf);
if (ret) {
- set_default_env("readenv() failed", 0);
+ env_set_default("readenv() failed", 0);
return -EIO;
}
diff --git a/env/nowhere.c b/env/nowhere.c
index ea6c32eb3b..f5b0a17652 100644
--- a/env/nowhere.c
+++ b/env/nowhere.c
@@ -9,7 +9,8 @@
#include <common.h>
#include <command.h>
-#include <environment.h>
+#include <env.h>
+#include <env_internal.h>
#include <linux/stddef.h>
DECLARE_GLOBAL_DATA_PTR;
diff --git a/env/nvram.c b/env/nvram.c
index df1b37913d..79201bd788 100644
--- a/env/nvram.c
+++ b/env/nvram.c
@@ -25,7 +25,8 @@
#include <common.h>
#include <command.h>
-#include <environment.h>
+#include <env.h>
+#include <env_internal.h>
#include <linux/stddef.h>
#include <search.h>
#include <errno.h>
diff --git a/env/onenand.c b/env/onenand.c
index d371bd757c..dfd4e939f8 100644
--- a/env/onenand.c
+++ b/env/onenand.c
@@ -9,7 +9,7 @@
#include <common.h>
#include <command.h>
-#include <environment.h>
+#include <env_internal.h>
#include <linux/stddef.h>
#include <malloc.h>
#include <search.h>
diff --git a/env/remote.c b/env/remote.c
index b1a7d1a4c1..02531f427b 100644
--- a/env/remote.c
+++ b/env/remote.c
@@ -7,7 +7,7 @@
#include <common.h>
#include <command.h>
-#include <environment.h>
+#include <env_internal.h>
#include <linux/stddef.h>
#ifdef ENV_IS_EMBEDDED
diff --git a/env/sata.c b/env/sata.c
index a2ff5c66f7..9369710081 100644
--- a/env/sata.c
+++ b/env/sata.c
@@ -8,7 +8,8 @@
#include <common.h>
#include <command.h>
-#include <environment.h>
+#include <env.h>
+#include <env_internal.h>
#include <linux/stddef.h>
#include <errno.h>
#include <memalign.h>
@@ -106,7 +107,7 @@ static void env_sata_load(void)
}
if (read_env(sata, CONFIG_ENV_SIZE, CONFIG_ENV_OFFSET, buf)) {
- set_default_env(NULL, 0);
+ env_set_default(NULL, 0);
return -EIO;
}
diff --git a/env/sf.c b/env/sf.c
index 4f92ae0568..590d0cedd8 100644
--- a/env/sf.c
+++ b/env/sf.c
@@ -10,7 +10,8 @@
*/
#include <common.h>
#include <dm.h>
-#include <environment.h>
+#include <env.h>
+#include <env_internal.h>
#include <malloc.h>
#include <spi.h>
#include <spi_flash.h>
@@ -29,8 +30,6 @@ static ulong env_offset = CONFIG_ENV_OFFSET;
static ulong env_new_offset = CONFIG_ENV_OFFSET_REDUND;
#endif
-#define ACTIVE_FLAG 1
-#define OBSOLETE_FLAG 0
#endif /* CONFIG_ENV_OFFSET_REDUND */
DECLARE_GLOBAL_DATA_PTR;
@@ -48,7 +47,7 @@ static int setup_flash_device(void)
CONFIG_ENV_SPI_MAX_HZ, CONFIG_ENV_SPI_MODE,
&new);
if (ret) {
- set_default_env("spi_flash_probe_bus_cs() failed", 0);
+ env_set_default("spi_flash_probe_bus_cs() failed", 0);
return ret;
}
@@ -60,7 +59,7 @@ static int setup_flash_device(void)
CONFIG_ENV_SPI_CS,
CONFIG_ENV_SPI_MAX_HZ, CONFIG_ENV_SPI_MODE);
if (!env_flash) {
- set_default_env("spi_flash_probe() failed", 0);
+ env_set_default("spi_flash_probe() failed", 0);
return -EIO;
}
}
@@ -73,7 +72,7 @@ static int setup_flash_device(void)
static int env_sf_save(void)
{
env_t env_new;
- char *saved_buffer = NULL, flag = OBSOLETE_FLAG;
+ char *saved_buffer = NULL, flag = ENV_REDUND_OBSOLETE;
u32 saved_size, saved_offset, sector;
int ret;
@@ -84,7 +83,7 @@ static int env_sf_save(void)
ret = env_export(&env_new);
if (ret)
return -EIO;
- env_new.flags = ACTIVE_FLAG;
+ env_new.flags = ENV_REDUND_ACTIVE;
if (gd->env_valid == ENV_VALID) {
env_new_offset = CONFIG_ENV_OFFSET_REDUND;
@@ -161,7 +160,7 @@ static int env_sf_load(void)
tmp_env2 = (env_t *)memalign(ARCH_DMA_MINALIGN,
CONFIG_ENV_SIZE);
if (!tmp_env1 || !tmp_env2) {
- set_default_env("malloc() failed", 0);
+ env_set_default("malloc() failed", 0);
ret = -EIO;
goto out;
}
@@ -256,7 +255,7 @@ static int env_sf_load(void)
buf = (char *)memalign(ARCH_DMA_MINALIGN, CONFIG_ENV_SIZE);
if (!buf) {
- set_default_env("malloc() failed", 0);
+ env_set_default("malloc() failed", 0);
return -EIO;
}
@@ -267,7 +266,7 @@ static int env_sf_load(void)
ret = spi_flash_read(env_flash,
CONFIG_ENV_OFFSET, CONFIG_ENV_SIZE, buf);
if (ret) {
- set_default_env("spi_flash_read() failed", 0);
+ env_set_default("spi_flash_read() failed", 0);
goto err_read;
}
diff --git a/env/ubi.c b/env/ubi.c
index e4b85167ec..08aac47df2 100644
--- a/env/ubi.c
+++ b/env/ubi.c
@@ -7,7 +7,8 @@
#include <common.h>
#include <command.h>
-#include <environment.h>
+#include <env.h>
+#include <env_internal.h>
#include <errno.h>
#include <malloc.h>
#include <memalign.h>
@@ -123,7 +124,7 @@ static int env_ubi_load(void)
if (ubi_part(CONFIG_ENV_UBI_PART, UBI_VID_OFFSET)) {
printf("\n** Cannot find mtd partition \"%s\"\n",
CONFIG_ENV_UBI_PART);
- set_default_env(NULL, 0);
+ env_set_default(NULL, 0);
return -EIO;
}
@@ -160,14 +161,14 @@ static int env_ubi_load(void)
if (ubi_part(CONFIG_ENV_UBI_PART, UBI_VID_OFFSET)) {
printf("\n** Cannot find mtd partition \"%s\"\n",
CONFIG_ENV_UBI_PART);
- set_default_env(NULL, 0);
+ env_set_default(NULL, 0);
return -EIO;
}
if (ubi_volume_read(CONFIG_ENV_UBI_VOLUME, buf, CONFIG_ENV_SIZE)) {
printf("\n** Unable to read env from %s:%s **\n",
CONFIG_ENV_UBI_PART, CONFIG_ENV_UBI_VOLUME);
- set_default_env(NULL, 0);
+ env_set_default(NULL, 0);
return -EIO;
}
diff --git a/examples/api/demo.c b/examples/api/demo.c
index e177bf17eb..e7523786b4 100644
--- a/examples/api/demo.c
+++ b/examples/api/demo.c
@@ -6,6 +6,7 @@
*/
#include <common.h>
+#include <env.h>
#include <linux/types.h>
#include <api_public.h>
diff --git a/examples/api/glue.c b/examples/api/glue.c
index 9c8ed8d11c..4086616a94 100644
--- a/examples/api/glue.c
+++ b/examples/api/glue.c
@@ -4,6 +4,7 @@
*/
#include <common.h>
+#include <env.h>
#include <linux/types.h>
#include <api_public.h>
@@ -365,7 +366,7 @@ const char * ub_env_enum(const char *last)
/*
* It's OK to pass only the name piece as last (and not the whole
- * 'name=val' string), since the API_ENUM_ENV call uses envmatch()
+ * 'name=val' string), since the API_ENUM_ENV call uses env_match()
* internally, which handles such case
*/
if (!syscall(API_ENV_ENUM, NULL, last, &env))
diff --git a/fs/fs.c b/fs/fs.c
index 48d8f1f6da..d8a4ced469 100644
--- a/fs/fs.c
+++ b/fs/fs.c
@@ -6,6 +6,7 @@
#include <config.h>
#include <errno.h>
#include <common.h>
+#include <env.h>
#include <mapmem.h>
#include <part.h>
#include <ext4fs.h>
diff --git a/fs/ubifs/ubifs.c b/fs/ubifs/ubifs.c
index d5101d3c45..67a0e8caae 100644
--- a/fs/ubifs/ubifs.c
+++ b/fs/ubifs/ubifs.c
@@ -12,6 +12,8 @@
*/
#include <common.h>
+#include <env.h>
+#include <gzip.h>
#include <memalign.h>
#include "ubifs.h"
#include <u-boot/zlib.h>
diff --git a/include/bootcount.h b/include/bootcount.h
index daee84316c..8fa8cf8218 100644
--- a/include/bootcount.h
+++ b/include/bootcount.h
@@ -9,6 +9,7 @@
#include <common.h>
#include <asm/io.h>
#include <asm/byteorder.h>
+#include <env.h>
#ifdef CONFIG_DM_BOOTCOUNT
diff --git a/include/clk.h b/include/clk.h
index 2ebc905e04..3ca2796b57 100644
--- a/include/clk.h
+++ b/include/clk.h
@@ -333,6 +333,18 @@ int clk_disable(struct clk *clk);
*/
int clk_disable_bulk(struct clk_bulk *bulk);
+/**
+ * clk_is_match - check if two clk's point to the same hardware clock
+ * @p: clk compared against q
+ * @q: clk compared against p
+ *
+ * Returns true if the two struct clk pointers both point to the same hardware
+ * clock node.
+ *
+ * Returns false otherwise. Note that two NULL clks are treated as matching.
+ */
+bool clk_is_match(const struct clk *p, const struct clk *q);
+
int soc_clk_dump(void);
/**
diff --git a/include/command.h b/include/command.h
index 2bfee89df3..f6170e7151 100644
--- a/include/command.h
+++ b/include/command.h
@@ -10,6 +10,7 @@
#ifndef __COMMAND_H
#define __COMMAND_H
+#include <env.h>
#include <linker_lists.h>
#ifndef NULL
diff --git a/include/common.h b/include/common.h
index 2c21dee850..d8f302ea92 100644
--- a/include/common.h
+++ b/include/common.h
@@ -1,5 +1,11 @@
/* SPDX-License-Identifier: GPL-2.0+ */
/*
+ * Common header file for U-Boot
+ *
+ * This file still includes quite a bit of stuff that should be in separate
+ * headers like command.h, cpu.h and timer.h. Please think before adding more
+ * things. Patches to remove things are welcome.
+ *
* (C) Copyright 2000-2009
* Wolfgang Denk, DENX Software Engineering, wd@denx.de.
*/
@@ -45,16 +51,6 @@ typedef void (interrupt_handler_t)(void *);
#include <asm/u-boot.h> /* boot information for Linux kernel */
#include <asm/global_data.h> /* global data used for startup functions */
-#if defined(CONFIG_ENV_IS_EMBEDDED)
-#define TOTAL_MALLOC_LEN CONFIG_SYS_MALLOC_LEN
-#elif ( ((CONFIG_ENV_ADDR+CONFIG_ENV_SIZE) < CONFIG_SYS_MONITOR_BASE) || \
- (CONFIG_ENV_ADDR >= (CONFIG_SYS_MONITOR_BASE + CONFIG_SYS_MONITOR_LEN)) ) || \
- defined(CONFIG_ENV_IS_IN_NVRAM)
-#define TOTAL_MALLOC_LEN (CONFIG_SYS_MALLOC_LEN + CONFIG_ENV_SIZE)
-#else
-#define TOTAL_MALLOC_LEN CONFIG_SYS_MALLOC_LEN
-#endif
-
/* startup functions, used in:
* common/board_f.c
* common/init/board_init.c
@@ -145,114 +141,6 @@ int do_fat_fsload(cmd_tbl_t *, int, int, char * const []);
/* common/cmd_ext2.c */
int do_ext2load(cmd_tbl_t *, int, int, char * const []);
-/* common/cmd_nvedit.c */
-int env_init (void);
-void env_relocate (void);
-int envmatch (uchar *, int);
-
-/**
- * env_get() - Look up the value of an environment variable
- *
- * In U-Boot proper this can be called before relocation (which is when the
- * environment is loaded from storage, i.e. GD_FLG_ENV_READY is 0). In that
- * case this function calls env_get_f().
- *
- * @varname: Variable to look up
- * @return value of variable, or NULL if not found
- */
-char *env_get(const char *varname);
-
-/**
- * env_get_f() - Look up the value of an environment variable (early)
- *
- * This function is called from env_get() if the environment has not been
- * loaded yet (GD_FLG_ENV_READY flag is 0). Some environment locations will
- * support reading the value (slowly) and some will not.
- *
- * @varname: Variable to look up
- * @return value of variable, or NULL if not found
- */
-int env_get_f(const char *name, char *buf, unsigned len);
-
-/**
- * env_get_ulong() - Return an environment variable as an integer value
- *
- * Most U-Boot environment variables store hex values. For those which store
- * (e.g.) base-10 integers, this function can be used to read the value.
- *
- * @name: Variable to look up
- * @base: Base to use (e.g. 10 for base 10, 2 for binary)
- * @default_val: Default value to return if no value is found
- * @return the value found, or @default_val if none
- */
-ulong env_get_ulong(const char *name, int base, ulong default_val);
-
-/**
- * env_get_hex() - Return an environment variable as a hex value
- *
- * Decode an environment as a hex number (it may or may not have a 0x
- * prefix). If the environment variable cannot be found, or does not start
- * with hex digits, the default value is returned.
- *
- * @varname: Variable to decode
- * @default_val: Value to return on error
- */
-ulong env_get_hex(const char *varname, ulong default_val);
-
-/*
- * Read an environment variable as a boolean
- * Return -1 if variable does not exist (default to true)
- */
-int env_get_yesno(const char *var);
-
-/**
- * env_set() - set an environment variable
- *
- * This sets or deletes the value of an environment variable. For setting the
- * value the variable is created if it does not already exist.
- *
- * @varname: Variable to adjust
- * @value: Value to set for the variable, or NULL or "" to delete the variable
- * @return 0 if OK, 1 on error
- */
-int env_set(const char *varname, const char *value);
-
-/**
- * env_set_ulong() - set an environment variable to an integer
- *
- * @varname: Variable to adjust
- * @value: Value to set for the variable (will be converted to a string)
- * @return 0 if OK, 1 on error
- */
-int env_set_ulong(const char *varname, ulong value);
-
-/**
- * env_set_hex() - set an environment variable to a hex value
- *
- * @varname: Variable to adjust
- * @value: Value to set for the variable (will be converted to a hex string)
- * @return 0 if OK, 1 on error
- */
-int env_set_hex(const char *varname, ulong value);
-
-/**
- * env_set_addr - Set an environment variable to an address in hex
- *
- * @varname: Environment variable to set
- * @addr: Value to set it to
- * @return 0 if ok, 1 on error
- */
-static inline int env_set_addr(const char *varname, const void *addr)
-{
- return env_set_hex(varname, (ulong)addr);
-}
-
-#ifdef CONFIG_AUTO_COMPLETE
-int env_complete(char *var, int maxv, char *cmdv[], int maxsz, char *buf,
- bool dollar_comp);
-#endif
-int get_env_id (void);
-
void pci_init_board(void);
/* common/exports.c */
@@ -379,23 +267,12 @@ void enable_interrupts (void);
int disable_interrupts (void);
/* $(CPU)/.../commproc.c */
-int dpram_init (void);
-uint dpram_base(void);
-uint dpram_base_align(uint align);
-uint dpram_alloc(uint size);
-uint dpram_alloc_align(uint size,uint align);
void bootcount_store (ulong);
ulong bootcount_load (void);
/* $(CPU)/.../<eth> */
void mii_init (void);
-/* $(CPU)/.../lcd.c */
-ulong lcd_setmem (ulong);
-
-/* $(CPU)/.../video.c */
-ulong video_setmem (ulong);
-
/* arch/$(ARCH)/lib/cache.c */
void enable_caches(void);
void flush_cache (unsigned long, unsigned long);
@@ -428,51 +305,6 @@ void wait_ticks (unsigned long);
ulong usec2ticks (unsigned long usec);
ulong ticks2usec (unsigned long ticks);
-/* lib/gunzip.c */
-int gzip_parse_header(const unsigned char *src, unsigned long len);
-int gunzip(void *, int, unsigned char *, unsigned long *);
-int zunzip(void *dst, int dstlen, unsigned char *src, unsigned long *lenp,
- int stoponerr, int offset);
-
-/**
- * gzwrite progress indicators: defined weak to allow board-specific
- * overrides:
- *
- * gzwrite_progress_init called on startup
- * gzwrite_progress called during decompress/write loop
- * gzwrite_progress_finish called at end of loop to
- * indicate success (retcode=0) or failure
- */
-void gzwrite_progress_init(u64 expected_size);
-
-void gzwrite_progress(int iteration,
- u64 bytes_written,
- u64 total_bytes);
-
-void gzwrite_progress_finish(int retcode,
- u64 totalwritten,
- u64 totalsize,
- u32 expected_crc,
- u32 calculated_crc);
-
-/**
- * decompress and write gzipped image from memory to block device
- *
- * @param src compressed image address
- * @param len compressed image length in bytes
- * @param dev block device descriptor
- * @param szwritebuf bytes per write (pad to erase size)
- * @param startoffs offset in bytes of first write
- * @param szexpected expected uncompressed length
- * may be zero to use gzip trailer
- * for files under 4GiB
- */
-int gzwrite(unsigned char *src, int len,
- struct blk_desc *dev,
- unsigned long szwritebuf,
- u64 startoffs,
- u64 szexpected);
-
/* lib/lz4_wrapper.c */
int ulz4fn(const void *src, size_t srcn, void *dst, size_t *dstn);
@@ -506,13 +338,6 @@ unsigned int rand_r(unsigned int *seedp);
int serial_printf (const char *fmt, ...)
__attribute__ ((format (__printf__, 1, 2)));
-/* lib/gzip.c */
-int gzip(void *dst, unsigned long *lenp,
- unsigned char *src, unsigned long srclen);
-int zzip(void *dst, unsigned long *lenp, unsigned char *src,
- unsigned long srclen, int stoponerr,
- int (*func)(unsigned long, unsigned long));
-
/* lib/net_utils.c */
#include <net.h>
static inline struct in_addr env_get_ip(char *var)
@@ -520,8 +345,6 @@ static inline struct in_addr env_get_ip(char *var)
return string_to_ip(env_get(var));
}
-int pcmcia_init (void);
-
#ifdef CONFIG_LED_STATUS
# include <status_led.h>
#endif
@@ -575,7 +398,7 @@ int cpu_release(u32 nr, int argc, char * const argv[]);
/* Pull in stuff for the build system */
#ifdef DO_DEPS_ONLY
-# include <environment.h>
+# include <env_internal.h>
#endif
#endif /* __COMMON_H_ */
diff --git a/include/configs/brsmarc1.h b/include/configs/brsmarc1.h
new file mode 100644
index 0000000000..c18445816e
--- /dev/null
+++ b/include/configs/brsmarc1.h
@@ -0,0 +1,83 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * brsmarc1.h
+ *
+ * specific parts for B&R BRSMARC1 Motherboard
+ *
+ * Copyright (C) 2017 Hannes Schmelzer <oe5hpm@oevsv.at> -
+ * B&R Industrial Automation GmbH - http://www.br-automation.com
+ *
+ */
+
+#ifndef __CONFIG_BRSMARC1_H__
+#define __CONFIG_BRSMARC1_H__
+
+#include <configs/bur_cfg_common.h>
+#include <configs/bur_am335x_common.h>
+/* ------------------------------------------------------------------------- */
+#define CONFIG_BOARD_TYPES
+
+/* memory */
+#define CONFIG_SYS_MALLOC_LEN (5 * 1024 * 1024)
+#define CONFIG_SYS_BOOTM_LEN (32 * 1024 * 1024)
+
+/* Clock Defines */
+#define V_OSCK 26000000 /* Clock output from T2 */
+#define V_SCLK (V_OSCK)
+
+#define CONFIG_MACH_TYPE 3589
+
+#ifndef CONFIG_SPL_BUILD
+
+/* Default environment */
+#define CONFIG_EXTRA_ENV_SETTINGS \
+BUR_COMMON_ENV \
+"autoload=0\0" \
+"scradr=" __stringify(CONFIG_SYS_LOAD_ADDR) "\0" \
+"cfgscr=mw ${dtbaddr} 0;" \
+" sf probe && sf read ${scradr} 0xC0000 0x10000 && source ${scradr};" \
+" fdt addr ${dtbaddr} || cp ${fdtcontroladdr} ${dtbaddr} 4000\0" \
+"dtbaddr=0x84000000\0" \
+"loadaddr=0x82000000\0" \
+"b_break=0\0" \
+"b_tgts_std=mmc0 mmc1 def net usb0\0" \
+"b_tgts_rcy=def net usb0\0" \
+"b_tgts_pme=net usb0 mmc0 mmc1\0" \
+"b_deftgts=if test ${b_mode} = 12; then setenv b_tgts ${b_tgts_pme};" \
+" elif test ${b_mode} = 0; then setenv b_tgts ${b_tgts_rcy};" \
+" else setenv b_tgts ${b_tgts_std}; fi\0" \
+"b_mmc0=load mmc 1 ${scradr} bootscr.img && source ${scradr}\0" \
+"b_mmc1=load mmc 1 ${loadaddr} arimg.ugz && run startsys\0" \
+"b_def=sf read ${loadaddr} 100000 700000; run startsys\0" \
+"b_net=tftp ${scradr} netscript.img && source ${scradr}\0" \
+"b_usb0=usb start && load usb 0 ${scradr} bootscr.img && source ${scradr}\0" \
+"b_default=run b_deftgts; for target in ${b_tgts};"\
+" do run b_${target}; if test ${b_break} = 1; then; exit; fi; done\0" \
+"vxargs=setenv bootargs cpsw(0,0)host:vxWorks h=${serverip}" \
+" e=${ipaddr}:${netmask} g=${gatewayip} u=vxWorksFTP pw=vxWorks\0" \
+"vxfdt=fdt addr ${dtbaddr}; fdt resize 0x8000;" \
+" fdt boardsetup\0" \
+"startsys=run vxargs && mw 0x80001100 0 && run vxfdt &&" \
+" bootm ${loadaddr} - ${dtbaddr}\0"
+#endif /* !CONFIG_SPL_BUILD*/
+
+/* undefine command which we not need here */
+#undef CONFIG_BOOTM_NETBSD
+#undef CONFIG_BOOTM_PLAN9
+#undef CONFIG_BOOTM_RTEMS
+
+/* Support both device trees and ATAGs. */
+#define CONFIG_CMDLINE_TAG
+#define CONFIG_SETUP_MEMORY_TAGS
+#define CONFIG_INITRD_TAG
+
+/* SPI Flash */
+#define CONFIG_SYS_SPI_U_BOOT_OFFS 0x40000
+
+/* Environment */
+#define CONFIG_SYS_REDUNDAND_ENVIRONMENT
+#define CONFIG_ENV_OFFSET_REDUND (CONFIG_ENV_OFFSET + \
+ CONFIG_ENV_SECT_SIZE)
+
+#define CONFIG_CONS_INDEX 1
+#endif /* __CONFIG_BRSMARC1_H__ */
diff --git a/include/configs/da850evm.h b/include/configs/da850evm.h
index ff536131ba..9bd6da015e 100644
--- a/include/configs/da850evm.h
+++ b/include/configs/da850evm.h
@@ -26,7 +26,7 @@
#define CONFIG_SYS_OSCIN_FREQ 24000000
#define CONFIG_SYS_TIMERBASE DAVINCI_TIMER0_BASE
#define CONFIG_SYS_HZ_CLOCK clk_get(DAVINCI_AUXCLK_CLKID)
-#define CONFIG_SKIP_LOWLEVEL_INIT
+#define CONFIG_SKIP_LOWLEVEL_INIT_ONLY
#ifdef CONFIG_DIRECT_NOR_BOOT
#define CONFIG_ARCH_CPU_INIT
@@ -192,7 +192,7 @@
#ifdef CONFIG_USE_NOR
#define CONFIG_SYS_MAX_FLASH_BANKS 1 /* max number of flash banks */
#define CONFIG_SYS_FLASH_SECT_SZ (128 << 10) /* 128KB */
-#define CONFIG_ENV_OFFSET (CONFIG_SYS_FLASH_SECT_SZ * 3)
+#define CONFIG_ENV_OFFSET (SZ_1M)
#define CONFIG_ENV_SIZE (10 << 10) /* 10KB */
#define CONFIG_SYS_FLASH_BASE DAVINCI_ASYNC_EMIF_DATA_CE2_BASE
#define PHYS_FLASH_SIZE (8 << 20) /* Flash size 8MB */
diff --git a/include/configs/hikey960.h b/include/configs/hikey960.h
new file mode 100644
index 0000000000..f6f9c8d85a
--- /dev/null
+++ b/include/configs/hikey960.h
@@ -0,0 +1,60 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * (C) Copyright 2019 Linaro
+ * Author: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
+ */
+
+#ifndef __HIKEY_H
+#define __HIKEY_H
+
+#include <linux/sizes.h>
+
+#define CONFIG_SYS_BOOTM_LEN SZ_64M
+
+/* Physical Memory Map */
+
+/* CONFIG_SYS_TEXT_BASE needs to align with where ATF loads bl33.bin */
+
+#define PHYS_SDRAM_1 0x00000000
+#define PHYS_SDRAM_1_SIZE 0xC0000000
+
+#define CONFIG_SYS_SDRAM_BASE PHYS_SDRAM_1
+
+#define CONFIG_SYS_INIT_RAM_SIZE 0x1000
+
+#define CONFIG_SYS_INIT_SP_ADDR (CONFIG_SYS_SDRAM_BASE + 0x7fff0)
+
+#define CONFIG_SYS_LOAD_ADDR (CONFIG_SYS_SDRAM_BASE + 0x80000)
+
+/* Generic Timer Definitions */
+#define COUNTER_FREQUENCY 19000000
+
+/* Generic Interrupt Controller Definitions */
+#define GICD_BASE 0xe82b1000
+#define GICC_BASE 0xe82b2000
+
+/* Size of malloc() pool */
+#define CONFIG_SYS_MALLOC_LEN (CONFIG_ENV_SIZE + SZ_8M)
+
+#define CONFIG_ENV_SIZE 0x1000
+
+#define BOOT_TARGET_DEVICES(func) \
+ func(MMC, mmc, 0)
+#include <config_distro_bootcmd.h>
+
+#define CONFIG_EXTRA_ENV_SETTINGS \
+ "image=Image\0" \
+ "fdtfile=hi3660-hikey960.dtb\0" \
+ "fdt_addr_r=0x10000000\0" \
+ "kernel_addr_r=0x11000000\0" \
+ "scriptaddr=0x00020000\0" \
+ "fdt_high=0xffffffffffffffff\0" \
+ "initrd_high=0xffffffffffffffff\0" \
+ BOOTENV
+
+#define CONFIG_ENV_SIZE 0x1000
+
+/* TODO: Remove this once the SD clock is fixed */
+#define CONFIG_SYS_MMC_MAX_BLK_COUNT 1024
+
+#endif /* __HIKEY_H */
diff --git a/include/configs/meson64.h b/include/configs/meson64.h
index 78b1615d5c..f8d3eee292 100644
--- a/include/configs/meson64.h
+++ b/include/configs/meson64.h
@@ -37,7 +37,9 @@
#define CONFIG_CPU_ARMV8
#define CONFIG_REMAKE_ELF
+#ifndef CONFIG_ENV_SIZE
#define CONFIG_ENV_SIZE 0x2000
+#endif
#define CONFIG_SYS_MAXARGS 32
#define CONFIG_SYS_MALLOC_LEN (32 << 20)
#define CONFIG_SYS_CBSIZE 1024
diff --git a/include/configs/sei510.h b/include/configs/sei510.h
new file mode 100644
index 0000000000..9957902250
--- /dev/null
+++ b/include/configs/sei510.h
@@ -0,0 +1,137 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * Configuration for the SEI510
+ *
+ * Copyright (C) 2019 Baylibre, SAS
+ * Author: Jerome Brunet <jbrunet@baylibre.com>
+ */
+
+#ifndef __CONFIG_H
+#define __CONFIG_H
+
+#define CONFIG_SYS_MMC_ENV_DEV 2
+#define CONFIG_SYS_MMC_ENV_PART 1
+#define CONFIG_ENV_SIZE 0x10000
+#define CONFIG_ENV_OFFSET (-0x10000)
+
+#define CACHE_UUID "99207ae6-5207-11e9-999e-6f77a3612069;"
+#define SYSTEM_UUID "99f9b7ac-5207-11e9-8507-c3c037e393f3;"
+#define VENDOR_UUID "9d082802-5207-11e9-954c-cbbce08ba108;"
+#define USERDATA_UUID "9b976e42-5207-11e9-8f16-ff47ac594b22;"
+#define ROOT_UUID "ddb8c3f6-d94d-4394-b633-3134139cc2e0;"
+
+#define PARTS_DEFAULT \
+ "uuid_disk=${uuid_gpt_disk};" \
+ "name=boot,size=64M,bootable,uuid=${uuid_gpt_boot};" \
+ "name=cache,size=256M,uuid=" CACHE_UUID \
+ "name=system,size=1536M,uuid=" SYSTEM_UUID \
+ "name=vendor,size=256M,uuid=" VENDOR_UUID \
+ "name=userdata,size=4746M,uuid=" USERDATA_UUID \
+ "name=rootfs,size=-,uuid=" ROOT_UUID
+
+#define BOOTENV_DEV_FASTBOOT(devtypeu, devtypel, instance) \
+ "bootcmd_fastboot=" \
+ "sm reboot_reason reason;" \
+ "setenv run_fastboot 0;" \
+ "if gpt verify mmc ${mmcdev} ${partitions}; then; " \
+ "else " \
+ "echo Broken MMC partition scheme;" \
+ "setenv run_fastboot 1;" \
+ "fi;" \
+ "if test \"${reason}\" = \"bootloader\" -o " \
+ "\"${reason}\" = \"fastboot\"; then " \
+ "echo Fastboot asked by reboot reason;" \
+ "setenv run_fastboot 1;" \
+ "fi;" \
+ "if test \"${skip_fastboot}\" -eq 1; then " \
+ "echo Fastboot skipped by environment;" \
+ "setenv run_fastboot 0;" \
+ "fi;" \
+ "if test \"${force_fastboot}\" -eq 1; then " \
+ "echo Fastboot forced by environment;" \
+ "setenv run_fastboot 1;" \
+ "fi;" \
+ "if test \"${run_fastboot}\" -eq 1; then " \
+ "echo Running Fastboot...;" \
+ "fastboot 0;" \
+ "fi\0"
+
+#define BOOTENV_DEV_NAME_FASTBOOT(devtypeu, devtypel, instance) \
+ "fastboot "
+
+/* TOFIX: Run actual recovery instead of fastboot */
+#define BOOTENV_DEV_RECOVERY(devtypeu, devtypel, instance) \
+ "bootcmd_recovery=" \
+ "pinmux dev pinctrl@14;" \
+ "pinmux dev pinctrl@40;" \
+ "sm reboot_reason reason;" \
+ "setenv run_recovery 0;" \
+ "if run check_button; then " \
+ "echo Recovery button is pressed;" \
+ "setenv run_recovery 1;" \
+ "elif test \"${reason}\" = \"recovery\" -o " \
+ "\"${reason}\" = \"update\"; then " \
+ "echo Recovery asked by reboot reason;" \
+ "setenv run_recovery 1;" \
+ "fi;" \
+ "if test \"${skip_recovery}\" -eq 1; then " \
+ "echo Recovery skipped by environment;" \
+ "setenv run_recovery 0;" \
+ "fi;" \
+ "if test \"${force_recovery}\" -eq 1; then " \
+ "echo Recovery forced by environment;" \
+ "setenv run_recovery 1;" \
+ "fi;" \
+ "if test \"${run_recovery}\" -eq 1; then " \
+ "echo Running Recovery...;" \
+ "fastboot 0;" \
+ "fi\0"
+
+#define BOOTENV_DEV_NAME_RECOVERY(devtypeu, devtypel, instance) \
+ "recovery "
+
+#define BOOTENV_DEV_SYSTEM(devtypeu, devtypel, instance) \
+ "bootcmd_system=" \
+ "echo Loading Android boot partition...;" \
+ "mmc dev ${mmcdev};" \
+ "setenv bootargs ${bootargs} console=${console} androidboot.serialno=${serial#};" \
+ "part start mmc ${mmcdev} ${bootpart} boot_start;" \
+ "part size mmc ${mmcdev} ${bootpart} boot_size;" \
+ "if mmc read ${loadaddr} ${boot_start} ${boot_size}; then " \
+ "echo Running Android...;" \
+ "bootm ${loadaddr};" \
+ "fi;" \
+ "echo Failed to boot Android...;" \
+ "reset\0"
+
+#define BOOTENV_DEV_NAME_SYSTEM(devtypeu, devtypel, instance) \
+ "system "
+
+#define BOOT_TARGET_DEVICES(func) \
+ func(ROMUSB, romusb, na) \
+ func(FASTBOOT, fastboot, na) \
+ func(RECOVERY, recovery, na) \
+ func(SYSTEM, system, na) \
+
+#define CONFIG_EXTRA_ENV_SETTINGS \
+ "partitions=" PARTS_DEFAULT "\0" \
+ "mmcdev=2\0" \
+ "bootpart=1\0" \
+ "gpio_recovery=88\0" \
+ "check_button=gpio input ${gpio_recovery};test $? -eq 0;\0" \
+ "console=/dev/ttyAML0\0" \
+ "bootargs=no_console_suspend\0" \
+ "stdin=" STDIN_CFG "\0" \
+ "stdout=" STDOUT_CFG "\0" \
+ "stderr=" STDOUT_CFG "\0" \
+ "loadaddr=0x01000000\0" \
+ "fdt_addr_r=0x01000000\0" \
+ "scriptaddr=0x08000000\0" \
+ "kernel_addr_r=0x01080000\0" \
+ "pxefile_addr_r=0x01080000\0" \
+ "ramdisk_addr_r=0x13000000\0" \
+ "fdtfile=amlogic/" CONFIG_DEFAULT_DEVICE_TREE ".dtb\0" BOOTENV
+
+#include <configs/meson64.h>
+
+#endif /* __CONFIG_H */
diff --git a/include/dm/fdtaddr.h b/include/dm/fdtaddr.h
index 3bc2599b6c..57b326cb33 100644
--- a/include/dm/fdtaddr.h
+++ b/include/dm/fdtaddr.h
@@ -120,4 +120,22 @@ fdt_addr_t devfdt_get_addr_size_index(struct udevice *dev, int index,
*/
fdt_addr_t devfdt_get_addr_name(struct udevice *dev, const char *name);
+/**
+ * devfdt_get_addr_size_name() - Get the reg property and its size for a device,
+ * indexed by name
+ *
+ * Returns the address and size specified in the 'reg' property of a device.
+ *
+ * @dev: Pointer to a device
+ * @name: the 'reg' property can hold a list of <addr, size> pairs, with the
+ * 'reg-names' property providing named-based identification. @index
+ * indicates the value to search for in 'reg-names'.
+ * @size: Pointer to size variable - this function returns the size
+ * specified in the 'reg' property here
+ *
+ * @return addr
+ */
+fdt_addr_t devfdt_get_addr_size_name(struct udevice *dev, const char *name,
+ fdt_size_t *size);
+
#endif
diff --git a/include/dm/read.h b/include/dm/read.h
index 6ecd062e20..0c62d62f11 100644
--- a/include/dm/read.h
+++ b/include/dm/read.h
@@ -145,6 +145,19 @@ int dev_read_size(struct udevice *dev, const char *propname);
fdt_addr_t dev_read_addr_index(struct udevice *dev, int index);
/**
+ * dev_read_addr_size_index() - Get the indexed reg property of a device
+ *
+ * @dev: Device to read from
+ * @index: the 'reg' property can hold a list of <addr, size> pairs
+ * and @index is used to select which one is required
+ * @size: place to put size value (on success)
+ *
+ * @return address or FDT_ADDR_T_NONE if not found
+ */
+fdt_addr_t dev_read_addr_size_index(struct udevice *dev, int index,
+ fdt_size_t *size);
+
+/**
* dev_remap_addr_index() - Get the indexed reg property of a device
* as a memory-mapped I/O pointer
*
@@ -169,6 +182,20 @@ void *dev_remap_addr_index(struct udevice *dev, int index);
fdt_addr_t dev_read_addr_name(struct udevice *dev, const char* name);
/**
+ * dev_read_addr_size_name() - Get the reg property of a device, indexed by name
+ *
+ * @dev: Device to read from
+ * @name: the 'reg' property can hold a list of <addr, size> pairs, with the
+ * 'reg-names' property providing named-based identification. @index
+ * indicates the value to search for in 'reg-names'.
+ * @size: place to put size value (on success)
+ *
+ * @return address or FDT_ADDR_T_NONE if not found
+ */
+fdt_addr_t dev_read_addr_size_name(struct udevice *dev, const char *name,
+ fdt_size_t *size);
+
+/**
* dev_remap_addr_name() - Get the reg property of a device, indexed by name,
* as a memory-mapped I/O pointer
*
@@ -601,12 +628,26 @@ static inline fdt_addr_t dev_read_addr_index(struct udevice *dev, int index)
return devfdt_get_addr_index(dev, index);
}
+static inline fdt_addr_t dev_read_addr_size_index(struct udevice *dev,
+ int index,
+ fdt_size_t *size)
+{
+ return devfdt_get_addr_size_index(dev, index, size);
+}
+
static inline fdt_addr_t dev_read_addr_name(struct udevice *dev,
const char *name)
{
return devfdt_get_addr_name(dev, name);
}
+static inline fdt_addr_t dev_read_addr_size_name(struct udevice *dev,
+ const char *name,
+ fdt_size_t *size)
+{
+ return devfdt_get_addr_size_name(dev, name, size);
+}
+
static inline fdt_addr_t dev_read_addr(struct udevice *dev)
{
return devfdt_get_addr(dev);
diff --git a/include/dt-bindings/clock/hi3660-clock.h b/include/dt-bindings/clock/hi3660-clock.h
new file mode 100644
index 0000000000..e1374e1809
--- /dev/null
+++ b/include/dt-bindings/clock/hi3660-clock.h
@@ -0,0 +1,214 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+/*
+ * Copyright (c) 2016-2017 Linaro Ltd.
+ * Copyright (c) 2016-2017 HiSilicon Technologies Co., Ltd.
+ */
+
+#ifndef __DTS_HI3660_CLOCK_H
+#define __DTS_HI3660_CLOCK_H
+
+/* fixed rate clocks */
+#define HI3660_CLKIN_SYS 0
+#define HI3660_CLKIN_REF 1
+#define HI3660_CLK_FLL_SRC 2
+#define HI3660_CLK_PPLL0 3
+#define HI3660_CLK_PPLL1 4
+#define HI3660_CLK_PPLL2 5
+#define HI3660_CLK_PPLL3 6
+#define HI3660_CLK_SCPLL 7
+#define HI3660_PCLK 8
+#define HI3660_CLK_UART0_DBG 9
+#define HI3660_CLK_UART6 10
+#define HI3660_OSC32K 11
+#define HI3660_OSC19M 12
+#define HI3660_CLK_480M 13
+#define HI3660_CLK_INV 14
+
+/* clk in crgctrl */
+#define HI3660_FACTOR_UART3 15
+#define HI3660_CLK_FACTOR_MMC 16
+#define HI3660_CLK_GATE_I2C0 17
+#define HI3660_CLK_GATE_I2C1 18
+#define HI3660_CLK_GATE_I2C2 19
+#define HI3660_CLK_GATE_I2C6 20
+#define HI3660_CLK_DIV_SYSBUS 21
+#define HI3660_CLK_DIV_320M 22
+#define HI3660_CLK_DIV_A53 23
+#define HI3660_CLK_GATE_SPI0 24
+#define HI3660_CLK_GATE_SPI2 25
+#define HI3660_PCIEPHY_REF 26
+#define HI3660_CLK_ABB_USB 27
+#define HI3660_HCLK_GATE_SDIO0 28
+#define HI3660_HCLK_GATE_SD 29
+#define HI3660_CLK_GATE_AOMM 30
+#define HI3660_PCLK_GPIO0 31
+#define HI3660_PCLK_GPIO1 32
+#define HI3660_PCLK_GPIO2 33
+#define HI3660_PCLK_GPIO3 34
+#define HI3660_PCLK_GPIO4 35
+#define HI3660_PCLK_GPIO5 36
+#define HI3660_PCLK_GPIO6 37
+#define HI3660_PCLK_GPIO7 38
+#define HI3660_PCLK_GPIO8 39
+#define HI3660_PCLK_GPIO9 40
+#define HI3660_PCLK_GPIO10 41
+#define HI3660_PCLK_GPIO11 42
+#define HI3660_PCLK_GPIO12 43
+#define HI3660_PCLK_GPIO13 44
+#define HI3660_PCLK_GPIO14 45
+#define HI3660_PCLK_GPIO15 46
+#define HI3660_PCLK_GPIO16 47
+#define HI3660_PCLK_GPIO17 48
+#define HI3660_PCLK_GPIO18 49
+#define HI3660_PCLK_GPIO19 50
+#define HI3660_PCLK_GPIO20 51
+#define HI3660_PCLK_GPIO21 52
+#define HI3660_CLK_GATE_SPI3 53
+#define HI3660_CLK_GATE_I2C7 54
+#define HI3660_CLK_GATE_I2C3 55
+#define HI3660_CLK_GATE_SPI1 56
+#define HI3660_CLK_GATE_UART1 57
+#define HI3660_CLK_GATE_UART2 58
+#define HI3660_CLK_GATE_UART4 59
+#define HI3660_CLK_GATE_UART5 60
+#define HI3660_CLK_GATE_I2C4 61
+#define HI3660_CLK_GATE_DMAC 62
+#define HI3660_PCLK_GATE_DSS 63
+#define HI3660_ACLK_GATE_DSS 64
+#define HI3660_CLK_GATE_LDI1 65
+#define HI3660_CLK_GATE_LDI0 66
+#define HI3660_CLK_GATE_VIVOBUS 67
+#define HI3660_CLK_GATE_EDC0 68
+#define HI3660_CLK_GATE_TXDPHY0_CFG 69
+#define HI3660_CLK_GATE_TXDPHY0_REF 70
+#define HI3660_CLK_GATE_TXDPHY1_CFG 71
+#define HI3660_CLK_GATE_TXDPHY1_REF 72
+#define HI3660_ACLK_GATE_USB3OTG 73
+#define HI3660_CLK_GATE_SPI4 74
+#define HI3660_CLK_GATE_SD 75
+#define HI3660_CLK_GATE_SDIO0 76
+#define HI3660_CLK_GATE_UFS_SUBSYS 77
+#define HI3660_PCLK_GATE_DSI0 78
+#define HI3660_PCLK_GATE_DSI1 79
+#define HI3660_ACLK_GATE_PCIE 80
+#define HI3660_PCLK_GATE_PCIE_SYS 81
+#define HI3660_CLK_GATE_PCIEAUX 82
+#define HI3660_PCLK_GATE_PCIE_PHY 83
+#define HI3660_CLK_ANDGT_LDI0 84
+#define HI3660_CLK_ANDGT_LDI1 85
+#define HI3660_CLK_ANDGT_EDC0 86
+#define HI3660_CLK_GATE_UFSPHY_GT 87
+#define HI3660_CLK_ANDGT_MMC 88
+#define HI3660_CLK_ANDGT_SD 89
+#define HI3660_CLK_A53HPM_ANDGT 90
+#define HI3660_CLK_ANDGT_SDIO 91
+#define HI3660_CLK_ANDGT_UART0 92
+#define HI3660_CLK_ANDGT_UART1 93
+#define HI3660_CLK_ANDGT_UARTH 94
+#define HI3660_CLK_ANDGT_SPI 95
+#define HI3660_CLK_VIVOBUS_ANDGT 96
+#define HI3660_CLK_AOMM_ANDGT 97
+#define HI3660_CLK_320M_PLL_GT 98
+#define HI3660_AUTODIV_EMMC0BUS 99
+#define HI3660_AUTODIV_SYSBUS 100
+#define HI3660_CLK_GATE_UFSPHY_CFG 101
+#define HI3660_CLK_GATE_UFSIO_REF 102
+#define HI3660_CLK_MUX_SYSBUS 103
+#define HI3660_CLK_MUX_UART0 104
+#define HI3660_CLK_MUX_UART1 105
+#define HI3660_CLK_MUX_UARTH 106
+#define HI3660_CLK_MUX_SPI 107
+#define HI3660_CLK_MUX_I2C 108
+#define HI3660_CLK_MUX_MMC_PLL 109
+#define HI3660_CLK_MUX_LDI1 110
+#define HI3660_CLK_MUX_LDI0 111
+#define HI3660_CLK_MUX_SD_PLL 112
+#define HI3660_CLK_MUX_SD_SYS 113
+#define HI3660_CLK_MUX_EDC0 114
+#define HI3660_CLK_MUX_SDIO_SYS 115
+#define HI3660_CLK_MUX_SDIO_PLL 116
+#define HI3660_CLK_MUX_VIVOBUS 117
+#define HI3660_CLK_MUX_A53HPM 118
+#define HI3660_CLK_MUX_320M 119
+#define HI3660_CLK_MUX_IOPERI 120
+#define HI3660_CLK_DIV_UART0 121
+#define HI3660_CLK_DIV_UART1 122
+#define HI3660_CLK_DIV_UARTH 123
+#define HI3660_CLK_DIV_MMC 124
+#define HI3660_CLK_DIV_SD 125
+#define HI3660_CLK_DIV_EDC0 126
+#define HI3660_CLK_DIV_LDI0 127
+#define HI3660_CLK_DIV_SDIO 128
+#define HI3660_CLK_DIV_LDI1 129
+#define HI3660_CLK_DIV_SPI 130
+#define HI3660_CLK_DIV_VIVOBUS 131
+#define HI3660_CLK_DIV_I2C 132
+#define HI3660_CLK_DIV_UFSPHY 133
+#define HI3660_CLK_DIV_CFGBUS 134
+#define HI3660_CLK_DIV_MMC0BUS 135
+#define HI3660_CLK_DIV_MMC1BUS 136
+#define HI3660_CLK_DIV_UFSPERI 137
+#define HI3660_CLK_DIV_AOMM 138
+#define HI3660_CLK_DIV_IOPERI 139
+#define HI3660_VENC_VOLT_HOLD 140
+#define HI3660_PERI_VOLT_HOLD 141
+#define HI3660_CLK_GATE_VENC 142
+#define HI3660_CLK_GATE_VDEC 143
+#define HI3660_CLK_ANDGT_VENC 144
+#define HI3660_CLK_ANDGT_VDEC 145
+#define HI3660_CLK_MUX_VENC 146
+#define HI3660_CLK_MUX_VDEC 147
+#define HI3660_CLK_DIV_VENC 148
+#define HI3660_CLK_DIV_VDEC 149
+#define HI3660_CLK_FAC_ISP_SNCLK 150
+#define HI3660_CLK_GATE_ISP_SNCLK0 151
+#define HI3660_CLK_GATE_ISP_SNCLK1 152
+#define HI3660_CLK_GATE_ISP_SNCLK2 153
+#define HI3660_CLK_ANGT_ISP_SNCLK 154
+#define HI3660_CLK_MUX_ISP_SNCLK 155
+#define HI3660_CLK_DIV_ISP_SNCLK 156
+
+/* clk in pmuctrl */
+#define HI3660_GATE_ABB_192 0
+
+/* clk in pctrl */
+#define HI3660_GATE_UFS_TCXO_EN 0
+#define HI3660_GATE_USB_TCXO_EN 1
+
+/* clk in sctrl */
+#define HI3660_PCLK_AO_GPIO0 0
+#define HI3660_PCLK_AO_GPIO1 1
+#define HI3660_PCLK_AO_GPIO2 2
+#define HI3660_PCLK_AO_GPIO3 3
+#define HI3660_PCLK_AO_GPIO4 4
+#define HI3660_PCLK_AO_GPIO5 5
+#define HI3660_PCLK_AO_GPIO6 6
+#define HI3660_PCLK_GATE_MMBUF 7
+#define HI3660_CLK_GATE_DSS_AXI_MM 8
+#define HI3660_PCLK_MMBUF_ANDGT 9
+#define HI3660_CLK_MMBUF_PLL_ANDGT 10
+#define HI3660_CLK_FLL_MMBUF_ANDGT 11
+#define HI3660_CLK_SYS_MMBUF_ANDGT 12
+#define HI3660_CLK_GATE_PCIEPHY_GT 13
+#define HI3660_ACLK_MUX_MMBUF 14
+#define HI3660_CLK_SW_MMBUF 15
+#define HI3660_CLK_DIV_AOBUS 16
+#define HI3660_PCLK_DIV_MMBUF 17
+#define HI3660_ACLK_DIV_MMBUF 18
+#define HI3660_CLK_DIV_PCIEPHY 19
+
+/* clk in iomcu */
+#define HI3660_CLK_I2C0_IOMCU 0
+#define HI3660_CLK_I2C1_IOMCU 1
+#define HI3660_CLK_I2C2_IOMCU 2
+#define HI3660_CLK_I2C6_IOMCU 3
+#define HI3660_CLK_IOMCU_PERI0 4
+
+/* clk in stub clock */
+#define HI3660_CLK_STUB_CLUSTER0 0
+#define HI3660_CLK_STUB_CLUSTER1 1
+#define HI3660_CLK_STUB_GPU 2
+#define HI3660_CLK_STUB_DDR 3
+#define HI3660_CLK_STUB_NUM 4
+
+#endif /* __DTS_HI3660_CLOCK_H */
diff --git a/include/dt-bindings/phy/phy-am654-serdes.h b/include/dt-bindings/phy/phy-am654-serdes.h
new file mode 100644
index 0000000000..e8d901729e
--- /dev/null
+++ b/include/dt-bindings/phy/phy-am654-serdes.h
@@ -0,0 +1,13 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * This header provides constants for AM654 SERDES.
+ */
+
+#ifndef _DT_BINDINGS_AM654_SERDES
+#define _DT_BINDINGS_AM654_SERDES
+
+#define AM654_SERDES_CMU_REFCLK 0
+#define AM654_SERDES_LO_REFCLK 1
+#define AM654_SERDES_RO_REFCLK 2
+
+#endif /* _DT_BINDINGS_AM654_SERDES */
diff --git a/include/env.h b/include/env.h
new file mode 100644
index 0000000000..a74a261337
--- /dev/null
+++ b/include/env.h
@@ -0,0 +1,335 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * Common environment functions and definitions
+ *
+ * (C) Copyright 2000-2009
+ * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
+ */
+
+#ifndef __ENV_H
+#define __ENV_H
+
+#include <stdbool.h>
+#include <linux/types.h>
+
+struct environment_s;
+
+/* Value for environment validity */
+enum env_valid {
+ ENV_INVALID, /* No valid environment */
+ ENV_VALID, /* First or only environment is valid */
+ ENV_REDUND, /* Redundant environment is valid */
+};
+
+/** enum env_op - environment callback operation */
+enum env_op {
+ env_op_create,
+ env_op_delete,
+ env_op_overwrite,
+};
+
+/** struct env_clbk_tbl - declares a new callback */
+struct env_clbk_tbl {
+ const char *name; /* Callback name */
+ int (*callback)(const char *name, const char *value, enum env_op op,
+ int flags);
+};
+
+/*
+ * Define a callback that can be associated with variables.
+ * when associated through the ".callbacks" environment variable, the callback
+ * will be executed any time the variable is inserted, overwritten, or deleted.
+ *
+ * For SPL these are silently dropped to reduce code size, since environment
+ * callbacks are not supported with SPL.
+ */
+#ifdef CONFIG_SPL_BUILD
+#define U_BOOT_ENV_CALLBACK(name, callback) \
+ static inline __maybe_unused void _u_boot_env_noop_##name(void) \
+ { \
+ (void)callback; \
+ }
+#else
+#define U_BOOT_ENV_CALLBACK(name, callback) \
+ ll_entry_declare(struct env_clbk_tbl, name, env_clbk) = \
+ {#name, callback}
+#endif
+
+/** enum env_redund_flags - Flags for the redundand_environment */
+enum env_redund_flags {
+ ENV_REDUND_OBSOLETE = 0,
+ ENV_REDUND_ACTIVE = 1,
+};
+
+/**
+ * env_get_id() - Gets a sequence number for the environment
+ *
+ * This value increments every time the environment changes, so can be used an
+ * an indication of this
+ *
+ * @return environment ID
+ */
+int env_get_id(void);
+
+/**
+ * env_init() - Set up the pre-relocation environment
+ *
+ * This locates the environment or uses the default if nothing is available.
+ * This must be called before env_get() will work.
+ *
+ * @return 0 if OK, -ENODEV if no environment drivers are enabled
+ */
+int env_init(void);
+
+/**
+ * env_relocate() - Set up the post-relocation environment
+ *
+ * This loads the environment into RAM so that it can be modified. This is
+ * called after relocation, before the environment is used
+ */
+void env_relocate(void);
+
+/**
+ * env_match() - Match a name / name=value pair
+ *
+ * This is used prior to relocation for finding envrionment variables
+ *
+ * @name: A simple 'name', or a 'name=value' pair.
+ * @index: The environment index for a 'name2=value2' pair.
+ * @return index for the value if the names match, else -1.
+ */
+int env_match(unsigned char *name, int index);
+
+/**
+ * env_get() - Look up the value of an environment variable
+ *
+ * In U-Boot proper this can be called before relocation (which is when the
+ * environment is loaded from storage, i.e. GD_FLG_ENV_READY is 0). In that
+ * case this function calls env_get_f().
+ *
+ * @varname: Variable to look up
+ * @return value of variable, or NULL if not found
+ */
+char *env_get(const char *varname);
+
+/**
+ * env_get_f() - Look up the value of an environment variable (early)
+ *
+ * This function is called from env_get() if the environment has not been
+ * loaded yet (GD_FLG_ENV_READY flag is 0). Some environment locations will
+ * support reading the value (slowly) and some will not.
+ *
+ * @varname: Variable to look up
+ * @return value of variable, or NULL if not found
+ */
+int env_get_f(const char *name, char *buf, unsigned int len);
+
+/**
+ * env_get_yesno() - Read an environment variable as a boolean
+ *
+ * @return 1 if yes/true (Y/y/T/t), -1 if variable does not exist (i.e. default
+ * to true), 0 if otherwise
+ */
+int env_get_yesno(const char *var);
+
+/**
+ * env_set() - set an environment variable
+ *
+ * This sets or deletes the value of an environment variable. For setting the
+ * value the variable is created if it does not already exist.
+ *
+ * @varname: Variable to adjust
+ * @value: Value to set for the variable, or NULL or "" to delete the variable
+ * @return 0 if OK, 1 on error
+ */
+int env_set(const char *varname, const char *value);
+
+/**
+ * env_get_ulong() - Return an environment variable as an integer value
+ *
+ * Most U-Boot environment variables store hex values. For those which store
+ * (e.g.) base-10 integers, this function can be used to read the value.
+ *
+ * @name: Variable to look up
+ * @base: Base to use (e.g. 10 for base 10, 2 for binary)
+ * @default_val: Default value to return if no value is found
+ * @return the value found, or @default_val if none
+ */
+ulong env_get_ulong(const char *name, int base, ulong default_val);
+
+/**
+ * env_set_ulong() - set an environment variable to an integer
+ *
+ * @varname: Variable to adjust
+ * @value: Value to set for the variable (will be converted to a string)
+ * @return 0 if OK, 1 on error
+ */
+int env_set_ulong(const char *varname, ulong value);
+
+/**
+ * env_get_hex() - Return an environment variable as a hex value
+ *
+ * Decode an environment as a hex number (it may or may not have a 0x
+ * prefix). If the environment variable cannot be found, or does not start
+ * with hex digits, the default value is returned.
+ *
+ * @varname: Variable to decode
+ * @default_val: Value to return on error
+ */
+ulong env_get_hex(const char *varname, ulong default_val);
+
+/**
+ * env_set_hex() - set an environment variable to a hex value
+ *
+ * @varname: Variable to adjust
+ * @value: Value to set for the variable (will be converted to a hex string)
+ * @return 0 if OK, 1 on error
+ */
+int env_set_hex(const char *varname, ulong value);
+
+/**
+ * env_set_addr - Set an environment variable to an address in hex
+ *
+ * @varname: Environment variable to set
+ * @addr: Value to set it to
+ * @return 0 if ok, 1 on error
+ */
+static inline int env_set_addr(const char *varname, const void *addr)
+{
+ return env_set_hex(varname, (ulong)addr);
+}
+
+/**
+ * env_complete() - return an auto-complete for environment variables
+ *
+ * @var: partial name to auto-complete
+ * @maxv: Maximum number of matches to return
+ * @cmdv: Returns a list of possible matches
+ * @maxsz: Size of buffer to use for matches
+ * @buf: Buffer to use for matches
+ * @dollar_comp: non-zero to wrap each match in ${...}
+ * @return number of matches found (in @cmdv)
+ */
+int env_complete(char *var, int maxv, char *cmdv[], int maxsz, char *buf,
+ bool dollar_comp);
+
+/**
+ * eth_env_get_enetaddr() - Get an ethernet address from the environmnet
+ *
+ * @name: Environment variable to get (e.g. "ethaddr")
+ * @enetaddr: Place to put MAC address (6 bytes)
+ * @return 0 if OK, 1 on error
+ */
+int eth_env_get_enetaddr(const char *name, uint8_t *enetaddr);
+
+/**
+ * eth_env_set_enetaddr() - Set an ethernet address in the environmnet
+ *
+ * @name: Environment variable to set (e.g. "ethaddr")
+ * @enetaddr: Pointer to MAC address to put into the variable (6 bytes)
+ * @return 0 if OK, 1 on error
+ */
+int eth_env_set_enetaddr(const char *name, const uint8_t *enetaddr);
+
+/**
+ * env_fix_drivers() - Updates envdriver as per relocation
+ */
+void env_fix_drivers(void);
+
+/**
+ * env_set_default_vars() - reset variables to their default value
+ *
+ * This resets individual variables to their value in the default environment
+ *
+ * @nvars: Number of variables to set/reset
+ * @vars: List of variables to set/reset
+ * @flags: Flags controlling matching (H_... - see search.h)
+ */
+int env_set_default_vars(int nvars, char *const vars[], int flags);
+
+/**
+ * env_load() - Load the environment from storage
+ *
+ * @return 0 if OK, -ve on error
+ */
+int env_load(void);
+
+/**
+ * env_save() - Save the environment to storage
+ *
+ * @return 0 if OK, -ve on error
+ */
+int env_save(void);
+
+/**
+ * env_erase() - Erase the environment on storage
+ *
+ * @return 0 if OK, -ve on error
+ */
+int env_erase(void);
+
+/**
+ * env_import() - Import from a binary representation into hash table
+ *
+ * This imports the environment from a buffer. The format for each variable is
+ * var=value\0 with a double \0 at the end of the buffer.
+ *
+ * @buf: Buffer containing the environment (struct environemnt_s *)
+ * @check: non-zero to check the CRC at the start of the environment, 0 to
+ * ignore it
+ * @return 0 if imported successfully, -ENOMSG if the CRC was bad, -EIO if
+ * something else went wrong
+ */
+int env_import(const char *buf, int check);
+
+/**
+ * env_export() - Export the environment to a buffer
+ *
+ * Export from hash table into binary representation
+ *
+ * @env_out: Buffer to contain the environment (must be large enough!)
+ * @return 0 if OK, 1 on error
+ */
+int env_export(struct environment_s *env_out);
+
+/**
+ * env_import_redund() - Select and import one of two redundant environments
+ *
+ * @buf1: First environment (struct environemnt_s *)
+ * @buf1_read_fail: 0 if buf1 is valid, non-zero if invalid
+ * @buf2: Second environment (struct environemnt_s *)
+ * @buf2_read_fail: 0 if buf2 is valid, non-zero if invalid
+ * @return 0 if OK, -EIO if no environment is valid, -ENOMSG if the CRC was bad
+ */
+int env_import_redund(const char *buf1, int buf1_read_fail,
+ const char *buf2, int buf2_read_fail);
+
+/**
+ * env_get_default() - Look up a variable from the default environment
+ *
+ * @name: Variable to look up
+ * @return value if found, NULL if not found in default environment
+ */
+char *env_get_default(const char *name);
+
+/* [re]set to the default environment */
+void env_set_default(const char *s, int flags);
+
+/**
+ * env_get_char() - Get a character from the early environment
+ *
+ * This reads from the pre-relocation environment
+ *
+ * @index: Index of character to read (0 = first)
+ * @return character read, or -ve on error
+ */
+int env_get_char(int index);
+
+/**
+ * env_reloc() - Relocate the 'env' sub-commands
+ *
+ * This is used for those unfortunate archs with crappy toolchains
+ */
+void env_reloc(void);
+
+#endif
diff --git a/include/env_callback.h b/include/env_callback.h
index 507a52e13c..982c07854d 100644
--- a/include/env_callback.h
+++ b/include/env_callback.h
@@ -72,29 +72,6 @@
"serial#:serialno," \
CONFIG_ENV_CALLBACK_LIST_STATIC
-struct env_clbk_tbl {
- const char *name; /* Callback name */
- int (*callback)(const char *name, const char *value, enum env_op op,
- int flags);
-};
-
-void env_callback_init(ENTRY *var_entry);
-
-/*
- * Define a callback that can be associated with variables.
- * when associated through the ".callbacks" environment variable, the callback
- * will be executed any time the variable is inserted, overwritten, or deleted.
- */
-#ifdef CONFIG_SPL_BUILD
-#define U_BOOT_ENV_CALLBACK(name, callback) \
- static inline __maybe_unused void _u_boot_env_noop_##name(void) \
- { \
- (void)callback; \
- }
-#else
-#define U_BOOT_ENV_CALLBACK(name, callback) \
- ll_entry_declare(struct env_clbk_tbl, name, env_clbk) = \
- {#name, callback}
-#endif
+void env_callback_init(struct env_entry *var_entry);
#endif /* __ENV_CALLBACK_H__ */
diff --git a/include/env_default.h b/include/env_default.h
index 86b639d3e2..56a8bae39a 100644
--- a/include/env_default.h
+++ b/include/env_default.h
@@ -10,7 +10,7 @@
#include <env_callback.h>
#ifdef DEFAULT_ENV_INSTANCE_EMBEDDED
-env_t environment __UBOOT_ENV_SECTION__(environment) = {
+env_t embedded_environment __UBOOT_ENV_SECTION__(environment) = {
ENV_CRC, /* CRC Sum */
#ifdef CONFIG_SYS_REDUNDAND_ENVIRONMENT
1, /* Flags: valid */
diff --git a/include/env_flags.h b/include/env_flags.h
index 23744e395c..e5380f2948 100644
--- a/include/env_flags.h
+++ b/include/env_flags.h
@@ -146,19 +146,20 @@ int env_flags_validate_env_set_params(char *name, char *const val[], int count);
#else /* !USE_HOSTCC */
+#include <env.h>
#include <search.h>
/*
* When adding a variable to the environment, initialize the flags for that
* variable.
*/
-void env_flags_init(ENTRY *var_entry);
+void env_flags_init(struct env_entry *var_entry);
/*
* Validate the newval for to conform with the requirements defined by its flags
*/
-int env_flags_validate(const ENTRY *item, const char *newval, enum env_op op,
- int flag);
+int env_flags_validate(const struct env_entry *item, const char *newval,
+ enum env_op op, int flag);
#endif /* USE_HOSTCC */
diff --git a/include/environment.h b/include/env_internal.h
index de67cf4f0e..b1ddcb5adf 100644
--- a/include/environment.h
+++ b/include/env_internal.h
@@ -1,11 +1,19 @@
/* SPDX-License-Identifier: GPL-2.0+ */
/*
+ * Internal environment header file. This includes direct access to environment
+ * information such as its size and offset, direct access to the default
+ * environment and embedded environment (if used). It also provides environment
+ * drivers with various declarations.
+ *
+ * It should not be included by board files, drivers and code other than that
+ * related to the environment implementation.
+ *
* (C) Copyright 2002
* Wolfgang Denk, DENX Software Engineering, wd@denx.de.
*/
-#ifndef _ENVIRONMENT_H_
-#define _ENVIRONMENT_H_
+#ifndef _ENV_INTERNAL_H_
+#define _ENV_INTERNAL_H_
#include <linux/kconfig.h>
@@ -135,33 +143,40 @@ extern unsigned long nand_env_oob_offset;
#ifdef CONFIG_SYS_REDUNDAND_ENVIRONMENT
# define ENV_HEADER_SIZE (sizeof(uint32_t) + 1)
-
-# define ACTIVE_FLAG 1
-# define OBSOLETE_FLAG 0
#else
# define ENV_HEADER_SIZE (sizeof(uint32_t))
#endif
#define ENV_SIZE (CONFIG_ENV_SIZE - ENV_HEADER_SIZE)
+/*
+ * If the environment is in RAM, allocate extra space for it in the malloc
+ * region.
+ */
+#if defined(CONFIG_ENV_IS_EMBEDDED)
+#define TOTAL_MALLOC_LEN CONFIG_SYS_MALLOC_LEN
+#elif (CONFIG_ENV_ADDR + CONFIG_ENV_SIZE < CONFIG_SYS_MONITOR_BASE) || \
+ (CONFIG_ENV_ADDR >= CONFIG_SYS_MONITOR_BASE + CONFIG_SYS_MONITOR_LEN) || \
+ defined(CONFIG_ENV_IS_IN_NVRAM)
+#define TOTAL_MALLOC_LEN (CONFIG_SYS_MALLOC_LEN + CONFIG_ENV_SIZE)
+#else
+#define TOTAL_MALLOC_LEN CONFIG_SYS_MALLOC_LEN
+#endif
+
typedef struct environment_s {
uint32_t crc; /* CRC32 over data bytes */
#ifdef CONFIG_SYS_REDUNDAND_ENVIRONMENT
- unsigned char flags; /* active/obsolete flags */
+ unsigned char flags; /* active/obsolete flags ENVF_REDUND_ */
#endif
unsigned char data[ENV_SIZE]; /* Environment data */
} env_t;
#ifdef ENV_IS_EMBEDDED
-extern env_t environment;
+extern env_t embedded_environment;
#endif /* ENV_IS_EMBEDDED */
extern const unsigned char default_environment[];
-#if defined(CONFIG_NEEDS_MANUAL_RELOC)
-extern void env_reloc(void);
-#endif
-
#ifndef DO_DEPS_ONLY
#include <env_attr.h>
@@ -169,13 +184,6 @@ extern void env_reloc(void);
#include <env_flags.h>
#include <search.h>
-/* Value for environment validity */
-enum env_valid {
- ENV_INVALID, /* No valid environment */
- ENV_VALID, /* First or only environment is valid */
- ENV_REDUND, /* Redundant environment is valid */
-};
-
enum env_location {
ENVL_UNKNOWN,
ENVL_EEPROM,
@@ -265,70 +273,6 @@ struct env_driver {
extern struct hsearch_data env_htab;
-/* Function that updates CRC of the enironment */
-void env_crc_update(void);
-
-/* Look up the variable from the default environment */
-char *env_get_default(const char *name);
-
-/* [re]set to the default environment */
-void set_default_env(const char *s, int flags);
-
-/* [re]set individual variables to their value in the default environment */
-int set_default_vars(int nvars, char * const vars[], int flags);
-
-/* Import from binary representation into hash table */
-int env_import(const char *buf, int check);
-
-/* Export from hash table into binary representation */
-int env_export(env_t *env_out);
-
-#ifdef CONFIG_SYS_REDUNDAND_ENVIRONMENT
-/* Select and import one of two redundant environments */
-int env_import_redund(const char *buf1, int buf1_status,
- const char *buf2, int buf2_status);
-#endif
-
-/**
- * env_get_char() - Get a character from the early environment
- *
- * This reads from the pre-relocation environment
- *
- * @index: Index of character to read (0 = first)
- * @return character read, or -ve on error
- */
-int env_get_char(int index);
-
-/**
- * env_load() - Load the environment from storage
- *
- * @return 0 if OK, -ve on error
- */
-int env_load(void);
-
-/**
- * env_save() - Save the environment to storage
- *
- * @return 0 if OK, -ve on error
- */
-int env_save(void);
-
-/**
- * env_erase() - Erase the environment on storage
- *
- * @return 0 if OK, -ve on error
- */
-int env_erase(void);
-
-/**
- * env_fix_drivers() - Updates envdriver as per relocation
- */
-void env_fix_drivers(void);
-
-void eth_parse_enetaddr(const char *addr, uint8_t *enetaddr);
-int eth_env_get_enetaddr(const char *name, uint8_t *enetaddr);
-int eth_env_set_enetaddr(const char *name, const uint8_t *enetaddr);
-
#endif /* DO_DEPS_ONLY */
-#endif /* _ENVIRONMENT_H_ */
+#endif /* _ENV_INTERNAL_H_ */
diff --git a/include/exports.h b/include/exports.h
index bf8d53c6b0..147a00f860 100644
--- a/include/exports.h
+++ b/include/exports.h
@@ -3,6 +3,7 @@
#ifndef __ASSEMBLY__
#ifdef CONFIG_PHY_AQUANTIA
+#include <env.h>
#include <phy_interface.h>
#endif
diff --git a/include/gzip.h b/include/gzip.h
new file mode 100644
index 0000000000..2e340673c3
--- /dev/null
+++ b/include/gzip.h
@@ -0,0 +1,103 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * (C) Copyright 2000-2009
+ * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
+ */
+
+#ifndef __GZIP_H
+#define __GZIP_H
+
+/**
+ * gzip_parse_header() - Parse a header from a gzip file
+ *
+ * This returns the length of the header.
+ *
+ * @src: Pointer to gzip file
+ * @len: Length of data
+ * @return length of header in bytes, or -1 if not enough data
+ */
+int gzip_parse_header(const unsigned char *src, unsigned long len);
+
+/**
+ * gunzip() - Decompress gzipped data
+ *
+ * @dst: Destination for uncompressed data
+ * @dstlen: Size of destination buffer
+ * @src: Source data to decompress
+ * @lenp: Returns length of uncompressed data
+ * @return 0 if OK, -1 on error
+ */
+int gunzip(void *dst, int dstlen, unsigned char *src, unsigned long *lenp);
+
+/**
+ * zunzip() - Uncompress blocks compressed with zlib without headers
+ *
+ * @dst: Destination for uncompressed data
+ * @dstlen: Size of destination buffer
+ * @src: Source data to decompress
+ * @lenp: On entry, length data at @src. On exit, number of bytes used from @src
+ * @stoponerr: 0 to continue when a decode error is found, 1 to stop
+ * @offset: start offset within the src buffer
+ * @return 0 if OK, -1 on error
+ */
+int zunzip(void *dst, int dstlen, unsigned char *src, unsigned long *lenp,
+ int stoponerr, int offset);
+
+/**
+ * gzwrite progress indicators: defined weak to allow board-specific
+ * overrides:
+ *
+ * gzwrite_progress_init called on startup
+ * gzwrite_progress called during decompress/write loop
+ * gzwrite_progress_finish called at end of loop to
+ * indicate success (retcode=0) or failure
+ */
+void gzwrite_progress_init(u64 expected_size);
+
+void gzwrite_progress(int iteration, u64 bytes_written, u64 total_bytes);
+
+void gzwrite_progress_finish(int retcode, u64 totalwritten, u64 totalsize,
+ u32 expected_crc, u32 calculated_crc);
+
+/**
+ * gzwrite() - decompress and write gzipped image from memory to block device
+ *
+ * @src: compressed image address
+ * @len: compressed image length in bytes
+ * @dev: block device descriptor
+ * @szwritebuf: bytes per write (pad to erase size)
+ * @startoffs: offset in bytes of first write
+ * @szexpected: expected uncompressed length, may be zero to use gzip trailer
+ * for files under 4GiB
+ * @return 0 if OK, -1 on error
+ */
+int gzwrite(unsigned char *src, int len, struct blk_desc *dev, ulong szwritebuf,
+ u64 startoffs, u64 szexpected);
+
+/**
+ * gzip()- Compress data into a buffer using the gzip algorithm
+ *
+ * @dst: Destination buffer for compressed data
+ * @lenp: On entry, space available in destination buffer (in bytes). On exit,
+ * number of bytes used in the buffer
+ * @src: Source data to compress
+ * @srclen: Size of source data
+ * @return 0 if OK, -1 on error
+ */
+int gzip(void *dst, unsigned long *lenp, unsigned char *src, ulong srclen);
+
+/**
+ * zzip() - Compress blocks with zlib
+ *
+ * @dst: Destination for compressed data
+ * @lenp: On entry, length data at @dst. On exit, number of bytes written to
+ * @dst
+ * @src: Source data to compress
+ * @srclen: Size of source data
+ * @stoponerr: 0 to continue when a decode error is found, 1 to stop
+ * @func: Some sort of function that is called to do something. !ADD DOCS HERE!
+ */
+int zzip(void *dst, ulong *lenp, unsigned char *src, ulong srclen,
+ int stoponerr, int (*func)(ulong, ulong));
+
+#endif
diff --git a/include/lcd.h b/include/lcd.h
index cb6b6a4d12..9a4c0da5ba 100644
--- a/include/lcd.h
+++ b/include/lcd.h
@@ -30,6 +30,7 @@ extern struct vidinfo panel_info;
void lcd_ctrl_init(void *lcdbase);
void lcd_enable(void);
void lcd_setcolreg(ushort regno, ushort red, ushort green, ushort blue);
+ulong lcd_setmem(ulong addr);
/**
* Set whether we need to flush the dcache when changing the LCD image. This
diff --git a/include/net.h b/include/net.h
index 7684076af6..a54d5eeac5 100644
--- a/include/net.h
+++ b/include/net.h
@@ -14,6 +14,7 @@
#include <asm/cache.h>
#include <asm/byteorder.h> /* for nton* / ntoh* stuff */
+#include <env.h>
#include <linux/if_ether.h>
#define DEBUG_LL_STATE 0 /* Link local state machine changes */
@@ -874,4 +875,15 @@ int update_tftp(ulong addr, char *interface, char *devstring);
/**********************************************************************/
+/**
+ * eth_parse_enetaddr() - Parse a MAC address
+ *
+ * Convert a string MAC address
+ *
+ * @addr: MAC address in aa:bb:cc:dd:ee:ff format, where each part is a 2-digit
+ * hex value
+ * @enetaddr: Place to put MAC address (6 bytes)
+ */
+void eth_parse_enetaddr(const char *addr, uint8_t *enetaddr);
+
#endif /* __NET_H__ */
diff --git a/include/pcmcia.h b/include/pcmcia.h
deleted file mode 100644
index 89e528efb9..0000000000
--- a/include/pcmcia.h
+++ /dev/null
@@ -1,137 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0+ */
-/*
- * (C) Copyright 2000-2004
- * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
- */
-
-#ifndef _PCMCIA_H
-#define _PCMCIA_H
-
-#include <common.h>
-#include <config.h>
-
-/*
- * Allow configuration to select PCMCIA slot,
- * or try to generate a useful default
- */
-#if defined(CONFIG_CMD_PCMCIA)
-
-#if !defined(CONFIG_PCMCIA_SLOT_A) && !defined(CONFIG_PCMCIA_SLOT_B)
-# error "PCMCIA Slot not configured"
-#endif /* !defined(CONFIG_PCMCIA_SLOT_A) && !defined(CONFIG_PCMCIA_SLOT_B) */
-
-/* Make sure exactly one slot is defined - we support only one for now */
-#if !defined(CONFIG_PCMCIA_SLOT_A) && !defined(CONFIG_PCMCIA_SLOT_B)
-#error Neither CONFIG_PCMCIA_SLOT_A nor CONFIG_PCMCIA_SLOT_B configured
-#endif
-#if defined(CONFIG_PCMCIA_SLOT_A) && defined(CONFIG_PCMCIA_SLOT_B)
-#error Both CONFIG_PCMCIA_SLOT_A and CONFIG_PCMCIA_SLOT_B configured
-#endif
-
-#ifndef PCMCIA_SOCKETS_NO
-#define PCMCIA_SOCKETS_NO 1
-#endif
-#ifndef PCMCIA_MEM_WIN_NO
-#define PCMCIA_MEM_WIN_NO 4
-#endif
-#define PCMCIA_IO_WIN_NO 2
-
-/* define _slot_ to be able to optimize macros */
-#ifdef CONFIG_PCMCIA_SLOT_A
-# define _slot_ 0
-# define PCMCIA_SLOT_MSG "slot A"
-# define PCMCIA_SLOT_x PCMCIA_PSLOT_A
-#else
-# define _slot_ 1
-# define PCMCIA_SLOT_MSG "slot B"
-# define PCMCIA_SLOT_x PCMCIA_PSLOT_B
-#endif
-
-/*
- * This structure is used to address each window in the PCMCIA controller.
- *
- * Keep in mind that we assume that pcmcia_win_t[n+1] is mapped directly
- * after pcmcia_win_t[n]...
- */
-
-typedef struct {
- ulong br;
- ulong or;
-} pcmcia_win_t;
-
-/**********************************************************************/
-
-/*
- * CIS Tupel codes
- */
-#define CISTPL_NULL 0x00
-#define CISTPL_DEVICE 0x01
-#define CISTPL_LONGLINK_CB 0x02
-#define CISTPL_INDIRECT 0x03
-#define CISTPL_CONFIG_CB 0x04
-#define CISTPL_CFTABLE_ENTRY_CB 0x05
-#define CISTPL_LONGLINK_MFC 0x06
-#define CISTPL_BAR 0x07
-#define CISTPL_PWR_MGMNT 0x08
-#define CISTPL_EXTDEVICE 0x09
-#define CISTPL_CHECKSUM 0x10
-#define CISTPL_LONGLINK_A 0x11
-#define CISTPL_LONGLINK_C 0x12
-#define CISTPL_LINKTARGET 0x13
-#define CISTPL_NO_LINK 0x14
-#define CISTPL_VERS_1 0x15
-#define CISTPL_ALTSTR 0x16
-#define CISTPL_DEVICE_A 0x17
-#define CISTPL_JEDEC_C 0x18
-#define CISTPL_JEDEC_A 0x19
-#define CISTPL_CONFIG 0x1a
-#define CISTPL_CFTABLE_ENTRY 0x1b
-#define CISTPL_DEVICE_OC 0x1c
-#define CISTPL_DEVICE_OA 0x1d
-#define CISTPL_DEVICE_GEO 0x1e
-#define CISTPL_DEVICE_GEO_A 0x1f
-#define CISTPL_MANFID 0x20
-#define CISTPL_FUNCID 0x21
-#define CISTPL_FUNCE 0x22
-#define CISTPL_SWIL 0x23
-#define CISTPL_END 0xff
-
-/*
- * CIS Function ID codes
- */
-#define CISTPL_FUNCID_MULTI 0x00
-#define CISTPL_FUNCID_MEMORY 0x01
-#define CISTPL_FUNCID_SERIAL 0x02
-#define CISTPL_FUNCID_PARALLEL 0x03
-#define CISTPL_FUNCID_FIXED 0x04
-#define CISTPL_FUNCID_VIDEO 0x05
-#define CISTPL_FUNCID_NETWORK 0x06
-#define CISTPL_FUNCID_AIMS 0x07
-#define CISTPL_FUNCID_SCSI 0x08
-
-/*
- * Fixed Disk FUNCE codes
- */
-#define CISTPL_IDE_INTERFACE 0x01
-
-#define CISTPL_FUNCE_IDE_IFACE 0x01
-#define CISTPL_FUNCE_IDE_MASTER 0x02
-#define CISTPL_FUNCE_IDE_SLAVE 0x03
-
-/* First feature byte */
-#define CISTPL_IDE_SILICON 0x04
-#define CISTPL_IDE_UNIQUE 0x08
-#define CISTPL_IDE_DUAL 0x10
-
-/* Second feature byte */
-#define CISTPL_IDE_HAS_SLEEP 0x01
-#define CISTPL_IDE_HAS_STANDBY 0x02
-#define CISTPL_IDE_HAS_IDLE 0x04
-#define CISTPL_IDE_LOW_POWER 0x08
-#define CISTPL_IDE_REG_INHIBIT 0x10
-#define CISTPL_IDE_HAS_INDEX 0x20
-#define CISTPL_IDE_IOIS16 0x40
-
-#endif
-
-#endif /* _PCMCIA_H */
diff --git a/include/pcmcia/yenta.h b/include/pcmcia/yenta.h
deleted file mode 100644
index 5cd58a7da3..0000000000
--- a/include/pcmcia/yenta.h
+++ /dev/null
@@ -1,156 +0,0 @@
-/*
- * yenta.h 1.20 2001/08/24 12:15:34
- *
- * The contents of this file are subject to the Mozilla Public License
- * Version 1.1 (the "License"); you may not use this file except in
- * compliance with the License. You may obtain a copy of the License
- * at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS"
- * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
- * the License for the specific language governing rights and
- * limitations under the License.
- *
- * The initial developer of the original code is David A. Hinds
- * <dahinds@users.sourceforge.net>. Portions created by David A. Hinds
- * are Copyright (C) 1999 David A. Hinds. All Rights Reserved.
- *
- * Alternatively, the contents of this file may be used under the
- * terms of the GNU General Public License version 2 (the "GPL"), in
- * which case the provisions of the GPL are applicable instead of the
- * above. If you wish to allow the use of your version of this file
- * only under the terms of the GPL and not to allow others to use
- * your version of this file under the MPL, indicate your decision by
- * deleting the provisions above and replace them with the notice and
- * other provisions required by the GPL. If you do not delete the
- * provisions above, a recipient may use your version of this file
- * under either the MPL or the GPL.
- */
-
-#ifndef _LINUX_YENTA_H
-#define _LINUX_YENTA_H
-
-/* PCI Configuration Registers */
-
-#define PCI_STATUS_CAPLIST 0x10
-#define PCI_CB_CAPABILITY_POINTER 0x14 /* 8 bit */
-#define PCI_CAPABILITY_ID 0x00 /* 8 bit */
-#define PCI_CAPABILITY_PM 0x01
-#define PCI_NEXT_CAPABILITY 0x01 /* 8 bit */
-#define PCI_PM_CAPABILITIES 0x02 /* 16 bit */
-#define PCI_PMCAP_PME_D3COLD 0x8000
-#define PCI_PMCAP_PME_D3HOT 0x4000
-#define PCI_PMCAP_PME_D2 0x2000
-#define PCI_PMCAP_PME_D1 0x1000
-#define PCI_PMCAP_PME_D0 0x0800
-#define PCI_PMCAP_D2_CAP 0x0400
-#define PCI_PMCAP_D1_CAP 0x0200
-#define PCI_PMCAP_DYN_DATA 0x0100
-#define PCI_PMCAP_DSI 0x0020
-#define PCI_PMCAP_AUX_PWR 0x0010
-#define PCI_PMCAP_PMECLK 0x0008
-#define PCI_PMCAP_VERSION_MASK 0x0007
-#define PCI_PM_CONTROL_STATUS 0x04 /* 16 bit */
-#define PCI_PMCS_PME_STATUS 0x8000
-#define PCI_PMCS_DATASCALE_MASK 0x6000
-#define PCI_PMCS_DATASCALE_SHIFT 13
-#define PCI_PMCS_DATASEL_MASK 0x1e00
-#define PCI_PMCS_DATASEL_SHIFT 9
-#define PCI_PMCS_PME_ENABLE 0x0100
-#define PCI_PMCS_PWR_STATE_MASK 0x0003
-#define PCI_PMCS_PWR_STATE_D0 0x0000
-#define PCI_PMCS_PWR_STATE_D1 0x0001
-#define PCI_PMCS_PWR_STATE_D2 0x0002
-#define PCI_PMCS_PWR_STATE_D3 0x0003
-#define PCI_PM_BRIDGE_EXT 0x06 /* 8 bit */
-#define PCI_PM_DATA 0x07 /* 8 bit */
-
-#define CB_PRIMARY_BUS 0x18 /* 8 bit */
-#define CB_CARDBUS_BUS 0x19 /* 8 bit */
-#define CB_SUBORD_BUS 0x1a /* 8 bit */
-#define CB_LATENCY_TIMER 0x1b /* 8 bit */
-
-#define CB_MEM_BASE(m) (0x1c + 8*(m))
-#define CB_MEM_LIMIT(m) (0x20 + 8*(m))
-#define CB_IO_BASE(m) (0x2c + 8*(m))
-#define CB_IO_LIMIT(m) (0x30 + 8*(m))
-
-#define CB_BRIDGE_CONTROL 0x3e /* 16 bit */
-#define CB_BCR_PARITY_ENA 0x0001
-#define CB_BCR_SERR_ENA 0x0002
-#define CB_BCR_ISA_ENA 0x0004
-#define CB_BCR_VGA_ENA 0x0008
-#define CB_BCR_MABORT 0x0020
-#define CB_BCR_CB_RESET 0x0040
-#define CB_BCR_ISA_IRQ 0x0080
-#define CB_BCR_PREFETCH(m) (0x0100 << (m))
-#define CB_BCR_WRITE_POST 0x0400
-
-#define CB_LEGACY_MODE_BASE 0x44
-
-/* Memory mapped registers */
-
-#define CB_SOCKET_EVENT 0x0000
-#define CB_SE_CSTSCHG 0x00000001
-#define CB_SE_CCD 0x00000006
-#define CB_SE_CCD1 0x00000002
-#define CB_SE_CCD2 0x00000004
-#define CB_SE_PWRCYCLE 0x00000008
-
-#define CB_SOCKET_MASK 0x0004
-#define CB_SM_CSTSCHG 0x00000001
-#define CB_SM_CCD 0x00000006
-#define CB_SM_PWRCYCLE 0x00000008
-
-#define CB_SOCKET_STATE 0x0008
-#define CB_SS_CSTSCHG 0x00000001
-#define CB_SS_CCD 0x00000006
-#define CB_SS_CCD1 0x00000002
-#define CB_SS_CCD2 0x00000004
-#define CB_SS_PWRCYCLE 0x00000008
-#define CB_SS_16BIT 0x00000010
-#define CB_SS_32BIT 0x00000020
-#define CB_SS_CINT 0x00000040
-#define CB_SS_BADCARD 0x00000080
-#define CB_SS_DATALOST 0x00000100
-#define CB_SS_BADVCC 0x00000200
-#define CB_SS_5VCARD 0x00000400
-#define CB_SS_3VCARD 0x00000800
-#define CB_SS_XVCARD 0x00001000
-#define CB_SS_YVCARD 0x00002000
-#define CB_SS_VSENSE 0x00003c86
-#define CB_SS_5VSOCKET 0x10000000
-#define CB_SS_3VSOCKET 0x20000000
-#define CB_SS_XVSOCKET 0x40000000
-#define CB_SS_YVSOCKET 0x80000000
-
-#define CB_SOCKET_FORCE 0x000c
-#define CB_SF_CVSTEST 0x00004000
-
-#define CB_SOCKET_CONTROL 0x0010
-#define CB_SC_VPP_MASK 0x00000007
-#define CB_SC_VPP_OFF 0x00000000
-#define CB_SC_VPP_12V 0x00000001
-#define CB_SC_VPP_5V 0x00000002
-#define CB_SC_VPP_3V 0x00000003
-#define CB_SC_VPP_XV 0x00000004
-#define CB_SC_VPP_YV 0x00000005
-#define CB_SC_VCC_MASK 0x00000070
-#define CB_SC_VCC_OFF 0x00000000
-#define CB_SC_VCC_5V 0x00000020
-#define CB_SC_VCC_3V 0x00000030
-#define CB_SC_VCC_XV 0x00000040
-#define CB_SC_VCC_YV 0x00000050
-#define CB_SC_CCLK_STOP 0x00000080
-
-#define CB_SOCKET_POWER 0x0020
-#define CB_SP_CLK_CTRL 0x00000001
-#define CB_SP_CLK_CTRL_ENA 0x00010000
-#define CB_SP_CLK_MODE 0x01000000
-#define CB_SP_ACCESS 0x02000000
-
-/* Address bits 31..24 for memory windows for 16-bit cards,
- accessable only by memory mapping the 16-bit register set */
-#define CB_MEM_PAGE(map) (0x40 + (map))
-
-#endif /* _LINUX_YENTA_H */
diff --git a/include/search.h b/include/search.h
index 5d07b49073..0469a852e0 100644
--- a/include/search.h
+++ b/include/search.h
@@ -14,32 +14,25 @@
#ifndef _SEARCH_H_
#define _SEARCH_H_
+#include <env.h>
#include <stddef.h>
-#define __set_errno(val) do { errno = val; } while (0)
+#define set_errno(val) do { errno = val; } while (0)
-enum env_op {
- env_op_create,
- env_op_delete,
- env_op_overwrite,
+/* enum env_action: action which shall be performed in the call to hsearch */
+enum env_action {
+ ENV_FIND,
+ ENV_ENTER,
};
-/* Action which shall be performed in the call to hsearch. */
-typedef enum {
- FIND,
- ENTER
-} ACTION;
-
-typedef struct entry {
+/** struct env_entry - An entry in the environment hashtable */
+struct env_entry {
const char *key;
char *data;
int (*callback)(const char *name, const char *value, enum env_op op,
int flags);
int flags;
-} ENTRY;
-
-/* Opaque type for internal use. */
-struct _ENTRY;
+};
/*
* Family of hash table handling functions. The functions also
@@ -49,61 +42,59 @@ struct _ENTRY;
/* Data type for reentrant functions. */
struct hsearch_data {
- struct _ENTRY *table;
+ struct env_entry_node *table;
unsigned int size;
unsigned int filled;
/*
* Callback function which will check whether the given change for variable
- * "__item" to "newval" may be applied or not, and possibly apply such change.
+ * "item" to "newval" may be applied or not, and possibly apply such change.
* When (flag & H_FORCE) is set, it shall not print out any error message and
* shall force overwriting of write-once variables.
* Must return 0 for approval, 1 for denial.
*/
- int (*change_ok)(const ENTRY *__item, const char *newval, enum env_op,
- int flag);
+ int (*change_ok)(const struct env_entry *item, const char *newval,
+ enum env_op, int flag);
};
-/* Create a new hash table which will contain at most "__nel" elements. */
-extern int hcreate_r(size_t __nel, struct hsearch_data *__htab);
+/* Create a new hash table which will contain at most "nel" elements. */
+int hcreate_r(size_t nel, struct hsearch_data *htab);
/* Destroy current internal hash table. */
-extern void hdestroy_r(struct hsearch_data *__htab);
+void hdestroy_r(struct hsearch_data *htab);
/*
- * Search for entry matching __item.key in internal hash table. If
- * ACTION is `FIND' return found entry or signal error by returning
- * NULL. If ACTION is `ENTER' replace existing data (if any) with
- * __item.data.
+ * Search for entry matching item.key in internal hash table. If
+ * action is `ENV_FIND' return found entry or signal error by returning
+ * NULL. If action is `ENV_ENTER' replace existing data (if any) with
+ * item.data.
* */
-extern int hsearch_r(ENTRY __item, ACTION __action, ENTRY ** __retval,
- struct hsearch_data *__htab, int __flag);
+int hsearch_r(struct env_entry item, enum env_action action,
+ struct env_entry **retval, struct hsearch_data *htab, int flag);
/*
- * Search for an entry matching "__match". Otherwise, Same semantics
+ * Search for an entry matching "match". Otherwise, Same semantics
* as hsearch_r().
*/
-extern int hmatch_r(const char *__match, int __last_idx, ENTRY ** __retval,
- struct hsearch_data *__htab);
+int hmatch_r(const char *match, int last_idx, struct env_entry **retval,
+ struct hsearch_data *htab);
-/* Search and delete entry matching "__key" in internal hash table. */
-extern int hdelete_r(const char *__key, struct hsearch_data *__htab,
- int __flag);
+/* Search and delete entry matching "key" in internal hash table. */
+int hdelete_r(const char *key, struct hsearch_data *htab, int flag);
-extern ssize_t hexport_r(struct hsearch_data *__htab,
- const char __sep, int __flag, char **__resp, size_t __size,
- int argc, char * const argv[]);
+ssize_t hexport_r(struct hsearch_data *htab, const char sep, int flag,
+ char **resp, size_t size, int argc, char * const argv[]);
/*
* nvars: length of vars array
* vars: array of strings (variable names) to import (nvars == 0 means all)
*/
-extern int himport_r(struct hsearch_data *__htab,
- const char *__env, size_t __size, const char __sep,
- int __flag, int __crlf_is_lf, int nvars,
- char * const vars[]);
+int himport_r(struct hsearch_data *htab, const char *env, size_t size,
+ const char sep, int flag, int crlf_is_lf, int nvars,
+ char * const vars[]);
/* Walk the whole table calling the callback on each element */
-extern int hwalk_r(struct hsearch_data *__htab, int (*callback)(ENTRY *));
+int hwalk_r(struct hsearch_data *htab,
+ int (*callback)(struct env_entry *entry));
/* Flags for himport_r(), hexport_r(), hdelete_r(), and hsearch_r() */
#define H_NOCLEAR (1 << 0) /* do not clear hash table before importing */
diff --git a/include/watchdog.h b/include/watchdog.h
index 3a357de903..a4a4e8e614 100644
--- a/include/watchdog.h
+++ b/include/watchdog.h
@@ -77,7 +77,7 @@ int init_func_watchdog_reset(void);
* Prototypes from $(CPU)/cpu.c.
*/
-#if defined(CONFIG_HW_WATCHDOG) && !defined(__ASSEMBLY__)
+#if (defined(CONFIG_HW_WATCHDOG) || defined(CONFIG_WATCHDOG)) && !defined(__ASSEMBLY__)
void hw_watchdog_init(void);
#endif
diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c
index f75ca1a67c..b9bff894cb 100644
--- a/lib/efi_loader/efi_boottime.c
+++ b/lib/efi_loader/efi_boottime.c
@@ -8,7 +8,6 @@
#include <common.h>
#include <div64.h>
#include <efi_loader.h>
-#include <environment.h>
#include <malloc.h>
#include <linux/libfdt_env.h>
#include <u-boot/crc.h>
diff --git a/lib/efi_loader/efi_console.c b/lib/efi_loader/efi_console.c
index 6c8229da42..d4765afb98 100644
--- a/lib/efi_loader/efi_console.c
+++ b/lib/efi_loader/efi_console.c
@@ -9,6 +9,7 @@
#include <charset.h>
#include <dm/device.h>
#include <efi_loader.h>
+#include <env.h>
#include <stdio_dev.h>
#include <video_console.h>
diff --git a/lib/efi_loader/efi_variable.c b/lib/efi_loader/efi_variable.c
index 889a7f2ba0..6687b69a40 100644
--- a/lib/efi_loader/efi_variable.c
+++ b/lib/efi_loader/efi_variable.c
@@ -5,11 +5,12 @@
* Copyright (c) 2017 Rob Clark
*/
+#include <env.h>
#include <malloc.h>
#include <charset.h>
#include <efi_loader.h>
#include <hexdump.h>
-#include <environment.h>
+#include <env_internal.h>
#include <search.h>
#include <uuid.h>
diff --git a/lib/fdtdec.c b/lib/fdtdec.c
index 3ee786b579..ef5e54875c 100644
--- a/lib/fdtdec.c
+++ b/lib/fdtdec.c
@@ -8,9 +8,11 @@
#include <boot_fit.h>
#include <dm.h>
#include <dm/of_extra.h>
+#include <env.h>
#include <errno.h>
#include <fdtdec.h>
#include <fdt_support.h>
+#include <gzip.h>
#include <mapmem.h>
#include <linux/libfdt.h>
#include <serial.h>
diff --git a/lib/gunzip.c b/lib/gunzip.c
index 15c7b2c932..1d65616c13 100644
--- a/lib/gunzip.c
+++ b/lib/gunzip.c
@@ -5,14 +5,15 @@
*/
#include <common.h>
-#include <watchdog.h>
#include <command.h>
#include <console.h>
+#include <div64.h>
+#include <gzip.h>
#include <image.h>
#include <malloc.h>
#include <memalign.h>
+#include <watchdog.h>
#include <u-boot/zlib.h>
-#include <div64.h>
#define HEADER0 '\x1f'
#define HEADER1 '\x8b'
diff --git a/lib/gzip.c b/lib/gzip.c
index 674d732fe6..c6c0ec880c 100644
--- a/lib/gzip.c
+++ b/lib/gzip.c
@@ -7,6 +7,7 @@
#include <common.h>
#include <watchdog.h>
#include <command.h>
+#include <gzip.h>
#include <image.h>
#include <malloc.h>
#include <memalign.h>
diff --git a/lib/hashtable.c b/lib/hashtable.c
index 0d288d12d9..2caab0a4c6 100644
--- a/lib/hashtable.c
+++ b/lib/hashtable.c
@@ -59,14 +59,14 @@
* which describes the current status.
*/
-typedef struct _ENTRY {
+struct env_entry_node {
int used;
- ENTRY entry;
-} _ENTRY;
+ struct env_entry entry;
+};
-static void _hdelete(const char *key, struct hsearch_data *htab, ENTRY *ep,
- int idx);
+static void _hdelete(const char *key, struct hsearch_data *htab,
+ struct env_entry *ep, int idx);
/*
* hcreate()
@@ -120,7 +120,8 @@ int hcreate_r(size_t nel, struct hsearch_data *htab)
htab->filled = 0;
/* allocate memory and zero out */
- htab->table = (_ENTRY *) calloc(htab->size + 1, sizeof(_ENTRY));
+ htab->table = (struct env_entry_node *)calloc(htab->size + 1,
+ sizeof(struct env_entry_node));
if (htab->table == NULL)
return 0;
@@ -151,7 +152,7 @@ void hdestroy_r(struct hsearch_data *htab)
/* free used memory */
for (i = 1; i <= htab->size; ++i) {
if (htab->table[i].used > 0) {
- ENTRY *ep = &htab->table[i].entry;
+ struct env_entry *ep = &htab->table[i].entry;
free((void *)ep->key);
free(ep->data);
@@ -193,14 +194,14 @@ void hdestroy_r(struct hsearch_data *htab)
* data any more.
* - The standard implementation does not provide a way to update an
* existing entry. This version will create a new entry or update an
- * existing one when both "action == ENTER" and "item.data != NULL".
+ * existing one when both "action == ENV_ENTER" and "item.data != NULL".
* - Instead of returning 1 on success, we return the index into the
* internal hash table, which is also guaranteed to be positive.
* This allows us direct access to the found hash table slot for
* example for functions like hdelete().
*/
-int hmatch_r(const char *match, int last_idx, ENTRY ** retval,
+int hmatch_r(const char *match, int last_idx, struct env_entry **retval,
struct hsearch_data *htab)
{
unsigned int idx;
@@ -222,16 +223,17 @@ int hmatch_r(const char *match, int last_idx, ENTRY ** retval,
/*
* Compare an existing entry with the desired key, and overwrite if the action
- * is ENTER. This is simply a helper function for hsearch_r().
+ * is ENV_ENTER. This is simply a helper function for hsearch_r().
*/
-static inline int _compare_and_overwrite_entry(ENTRY item, ACTION action,
- ENTRY **retval, struct hsearch_data *htab, int flag,
- unsigned int hval, unsigned int idx)
+static inline int _compare_and_overwrite_entry(struct env_entry item,
+ enum env_action action, struct env_entry **retval,
+ struct hsearch_data *htab, int flag, unsigned int hval,
+ unsigned int idx)
{
if (htab->table[idx].used == hval
&& strcmp(item.key, htab->table[idx].entry.key) == 0) {
/* Overwrite existing value? */
- if ((action == ENTER) && (item.data != NULL)) {
+ if (action == ENV_ENTER && item.data) {
/* check for permission */
if (htab->change_ok != NULL && htab->change_ok(
&htab->table[idx].entry, item.data,
@@ -270,8 +272,8 @@ static inline int _compare_and_overwrite_entry(ENTRY item, ACTION action,
return -1;
}
-int hsearch_r(ENTRY item, ACTION action, ENTRY ** retval,
- struct hsearch_data *htab, int flag)
+int hsearch_r(struct env_entry item, enum env_action action,
+ struct env_entry **retval, struct hsearch_data *htab, int flag)
{
unsigned int hval;
unsigned int count;
@@ -352,7 +354,7 @@ int hsearch_r(ENTRY item, ACTION action, ENTRY ** retval,
}
/* An empty bucket has been found. */
- if (action == ENTER) {
+ if (action == ENV_ENTER) {
/*
* If table is full and another entry should be
* entered return with error.
@@ -431,10 +433,10 @@ int hsearch_r(ENTRY item, ACTION action, ENTRY ** retval,
* do that.
*/
-static void _hdelete(const char *key, struct hsearch_data *htab, ENTRY *ep,
- int idx)
+static void _hdelete(const char *key, struct hsearch_data *htab,
+ struct env_entry *ep, int idx)
{
- /* free used ENTRY */
+ /* free used entry */
debug("hdelete: DELETING key \"%s\"\n", key);
free((void *)ep->key);
free(ep->data);
@@ -447,14 +449,14 @@ static void _hdelete(const char *key, struct hsearch_data *htab, ENTRY *ep,
int hdelete_r(const char *key, struct hsearch_data *htab, int flag)
{
- ENTRY e, *ep;
+ struct env_entry e, *ep;
int idx;
debug("hdelete: DELETE key \"%s\"\n", key);
e.key = (char *)key;
- idx = hsearch_r(e, FIND, &ep, htab, 0);
+ idx = hsearch_r(e, ENV_FIND, &ep, htab, 0);
if (idx == 0) {
__set_errno(ESRCH);
return 0; /* not found */
@@ -528,8 +530,8 @@ int hdelete_r(const char *key, struct hsearch_data *htab, int flag)
static int cmpkey(const void *p1, const void *p2)
{
- ENTRY *e1 = *(ENTRY **) p1;
- ENTRY *e2 = *(ENTRY **) p2;
+ struct env_entry *e1 = *(struct env_entry **)p1;
+ struct env_entry *e2 = *(struct env_entry **)p2;
return (strcmp(e1->key, e2->key));
}
@@ -563,8 +565,8 @@ static int match_string(int flag, const char *str, const char *pat, void *priv)
return 0;
}
-static int match_entry(ENTRY *ep, int flag,
- int argc, char * const argv[])
+static int match_entry(struct env_entry *ep, int flag, int argc,
+ char *const argv[])
{
int arg;
void *priv = NULL;
@@ -596,7 +598,7 @@ ssize_t hexport_r(struct hsearch_data *htab, const char sep, int flag,
char **resp, size_t size,
int argc, char * const argv[])
{
- ENTRY *list[htab->size];
+ struct env_entry *list[htab->size];
char *res, *p;
size_t totlen;
int i, n;
@@ -617,7 +619,7 @@ ssize_t hexport_r(struct hsearch_data *htab, const char sep, int flag,
for (i = 1, n = 0, totlen = 0; i <= htab->size; ++i) {
if (htab->table[i].used > 0) {
- ENTRY *ep = &htab->table[i].entry;
+ struct env_entry *ep = &htab->table[i].entry;
int found = match_entry(ep, flag, argc, argv);
if ((argc > 0) && (found == 0))
@@ -657,7 +659,7 @@ ssize_t hexport_r(struct hsearch_data *htab, const char sep, int flag,
#endif
/* Sort list by keys */
- qsort(list, n, sizeof(ENTRY *), cmpkey);
+ qsort(list, n, sizeof(struct env_entry *), cmpkey);
/* Check if the user supplied buffer size is sufficient */
if (size) {
@@ -869,7 +871,7 @@ int himport_r(struct hsearch_data *htab,
}
/* Parse environment; allow for '\0' and 'sep' as separators */
do {
- ENTRY e, *rv;
+ struct env_entry e, *rv;
/* skip leading white space */
while (isblank(*dp))
@@ -929,7 +931,7 @@ int himport_r(struct hsearch_data *htab,
e.key = name;
e.data = value;
- hsearch_r(e, ENTER, &rv, htab, flag);
+ hsearch_r(e, ENV_ENTER, &rv, htab, flag);
if (rv == NULL)
printf("himport_r: can't insert \"%s=%s\" into hash table\n",
name, value);
@@ -976,7 +978,7 @@ end:
* Walk all of the entries in the hash, calling the callback for each one.
* this allows some generic operation to be performed on each element.
*/
-int hwalk_r(struct hsearch_data *htab, int (*callback)(ENTRY *))
+int hwalk_r(struct hsearch_data *htab, int (*callback)(struct env_entry *entry))
{
int i;
int retval;
diff --git a/lib/smbios.c b/lib/smbios.c
index e8ee55c4ae..7b74971f68 100644
--- a/lib/smbios.c
+++ b/lib/smbios.c
@@ -6,6 +6,7 @@
*/
#include <common.h>
+#include <env.h>
#include <mapmem.h>
#include <smbios.h>
#include <tables_csum.h>
diff --git a/lib/uuid.c b/lib/uuid.c
index ca8be2cdca..a48e19c06e 100644
--- a/lib/uuid.c
+++ b/lib/uuid.c
@@ -4,6 +4,7 @@
*/
#include <common.h>
+#include <env.h>
#include <linux/ctype.h>
#include <errno.h>
#include <common.h>
diff --git a/net/bootp.c b/net/bootp.c
index 9a2b512e4a..505489140e 100644
--- a/net/bootp.c
+++ b/net/bootp.c
@@ -10,6 +10,7 @@
#include <common.h>
#include <command.h>
+#include <env.h>
#include <efi_loader.h>
#include <net.h>
#include <net/tftp.h>
diff --git a/net/dns.c b/net/dns.c
index eee8a02f7c..67d761d7c0 100644
--- a/net/dns.c
+++ b/net/dns.c
@@ -24,6 +24,7 @@
#include <common.h>
#include <command.h>
+#include <env.h>
#include <net.h>
#include <asm/unaligned.h>
diff --git a/net/eth-uclass.c b/net/eth-uclass.c
index 031d558625..1d5d2f03b7 100644
--- a/net/eth-uclass.c
+++ b/net/eth-uclass.c
@@ -7,7 +7,7 @@
#include <common.h>
#include <dm.h>
-#include <environment.h>
+#include <env.h>
#include <net.h>
#include <dm/device-internal.h>
#include <dm/uclass-internal.h>
diff --git a/net/eth_common.c b/net/eth_common.c
index 63f9379eec..ed26b1b693 100644
--- a/net/eth_common.c
+++ b/net/eth_common.c
@@ -7,7 +7,7 @@
#include <common.h>
#include <dm.h>
-#include <environment.h>
+#include <env.h>
#include <miiphy.h>
#include <net.h>
#include "eth_internal.h"
@@ -110,7 +110,7 @@ void eth_set_current(void)
static int env_changed_id;
int env_id;
- env_id = get_env_id();
+ env_id = env_get_id();
if ((act == NULL) || (env_changed_id != env_id)) {
act = env_get("ethact");
env_changed_id = env_id;
diff --git a/net/eth_legacy.c b/net/eth_legacy.c
index e250a430f3..850f362d87 100644
--- a/net/eth_legacy.c
+++ b/net/eth_legacy.c
@@ -7,7 +7,7 @@
#include <common.h>
#include <command.h>
-#include <environment.h>
+#include <env.h>
#include <net.h>
#include <phy.h>
#include <linux/errno.h>
diff --git a/net/link_local.c b/net/link_local.c
index 31cdef4083..dd9fcad087 100644
--- a/net/link_local.c
+++ b/net/link_local.c
@@ -12,6 +12,7 @@
*/
#include <common.h>
+#include <env.h>
#include <net.h>
#include "arp.h"
#include "net_rand.h"
diff --git a/net/net.c b/net/net.c
index 58b0417cbe..40511db645 100644
--- a/net/net.c
+++ b/net/net.c
@@ -90,7 +90,8 @@
#include <common.h>
#include <command.h>
#include <console.h>
-#include <environment.h>
+#include <env.h>
+#include <env_internal.h>
#include <errno.h>
#include <net.h>
#include <net/fastboot.h>
@@ -1613,3 +1614,15 @@ ushort env_get_vlan(char *var)
{
return string_to_vlan(env_get(var));
}
+
+void eth_parse_enetaddr(const char *addr, uint8_t *enetaddr)
+{
+ char *end;
+ int i;
+
+ for (i = 0; i < 6; ++i) {
+ enetaddr[i] = addr ? simple_strtoul(addr, &end, 16) : 0;
+ if (addr)
+ addr = (*end) ? end + 1 : end;
+ }
+}
diff --git a/net/tftp.c b/net/tftp.c
index 34488b76c8..5a69bca641 100644
--- a/net/tftp.c
+++ b/net/tftp.c
@@ -9,6 +9,7 @@
#include <common.h>
#include <command.h>
#include <efi_loader.h>
+#include <env.h>
#include <mapmem.h>
#include <net.h>
#include <net/tftp.h>
diff --git a/net/wol.c b/net/wol.c
index 946bd91b47..0a625668a9 100644
--- a/net/wol.c
+++ b/net/wol.c
@@ -5,8 +5,8 @@
#include <common.h>
#include <command.h>
+#include <env.h>
#include <net.h>
-#include <environment.h>
#include "wol.h"
static ulong wol_timeout = WOL_DEFAULT_TIMEOUT;
diff --git a/post/post.c b/post/post.c
index ebb620590e..fb751d9a83 100644
--- a/post/post.c
+++ b/post/post.c
@@ -5,6 +5,7 @@
*/
#include <common.h>
+#include <env.h>
#include <stdio_dev.h>
#include <watchdog.h>
#include <div64.h>
diff --git a/scripts/config_whitelist.txt b/scripts/config_whitelist.txt
index 3a00cd9ede..5de8b81334 100644
--- a/scripts/config_whitelist.txt
+++ b/scripts/config_whitelist.txt
@@ -361,8 +361,6 @@ CONFIG_DRIVER_DM9000
CONFIG_DRIVER_EP93XX_MAC
CONFIG_DRIVER_NE2000
CONFIG_DRIVER_NE2000_BASE
-CONFIG_DRIVER_NE2000_CCR
-CONFIG_DRIVER_NE2000_VAL
CONFIG_DRIVER_SMC911X_BASE
CONFIG_DRIVER_TI_EMAC_USE_RMII
CONFIG_DSP_CLUSTER_START
@@ -1339,9 +1337,6 @@ CONFIG_PCI_SKIP_HOST_BRIDGE
CONFIG_PCI_SYS_BUS
CONFIG_PCI_SYS_PHYS
CONFIG_PCI_SYS_SIZE
-CONFIG_PCMCIA
-CONFIG_PCMCIA_SLOT_A
-CONFIG_PCMCIA_SLOT_B
CONFIG_PCNET
CONFIG_PCNET_79C973
CONFIG_PCNET_79C975
@@ -3682,7 +3677,6 @@ CONFIG_SYS_PCI_TBATR3
CONFIG_SYS_PCI_TBATR4
CONFIG_SYS_PCI_TBATR5
CONFIG_SYS_PCI_VIRT
-CONFIG_SYS_PCMCIA_MEM_SIZE
CONFIG_SYS_PDCNT
CONFIG_SYS_PEHLPAR
CONFIG_SYS_PEPAR
diff --git a/test/compression.c b/test/compression.c
index dc5e94684f..08fef59d0a 100644
--- a/test/compression.c
+++ b/test/compression.c
@@ -6,6 +6,7 @@
#include <common.h>
#include <bootm.h>
#include <command.h>
+#include <gzip.h>
#include <malloc.h>
#include <mapmem.h>
#include <asm/io.h>
diff --git a/test/dm/clk.c b/test/dm/clk.c
index f301ecbb45..676ef217f0 100644
--- a/test/dm/clk.c
+++ b/test/dm/clk.c
@@ -24,6 +24,7 @@ static int dm_test_clk_base(struct unit_test_state *uts)
/* Get the same clk port in 2 different ways and compare */
ut_assertok(clk_get_by_index(dev, 1, &clk_method1));
ut_assertok(clk_get_by_index_nodev(dev_ofnode(dev), 1, &clk_method2));
+ ut_asserteq(clk_is_match(&clk_method1, &clk_method2), true);
ut_asserteq(clk_method1.id, clk_method2.id);
return 0;
diff --git a/test/dm/eth.c b/test/dm/eth.c
index 6e002b8dce..ad5354b4bf 100644
--- a/test/dm/eth.c
+++ b/test/dm/eth.c
@@ -8,6 +8,7 @@
#include <common.h>
#include <dm.h>
+#include <env.h>
#include <fdtdec.h>
#include <malloc.h>
#include <net.h>
diff --git a/test/dm/test-fdt.c b/test/dm/test-fdt.c
index ad8591639d..1fb8b5c248 100644
--- a/test/dm/test-fdt.c
+++ b/test/dm/test-fdt.c
@@ -549,12 +549,14 @@ static int dm_test_fdt_remap_addr_index_flat(struct unit_test_state *uts)
{
struct udevice *dev;
fdt_addr_t addr;
+ fdt_size_t size;
void *paddr;
ut_assertok(uclass_find_device_by_seq(UCLASS_TEST_DUMMY, 0, true, &dev));
- addr = devfdt_get_addr_index(dev, 0);
+ addr = devfdt_get_addr_size_index(dev, 0, &size);
ut_asserteq(0x8000, addr);
+ ut_asserteq(0x1000, size);
paddr = map_physmem(addr, 0, MAP_NOCACHE);
ut_assertnonnull(paddr);
@@ -569,12 +571,14 @@ static int dm_test_fdt_remap_addr_name_flat(struct unit_test_state *uts)
{
struct udevice *dev;
fdt_addr_t addr;
+ fdt_size_t size;
void *paddr;
ut_assertok(uclass_find_device_by_seq(UCLASS_TEST_DUMMY, 0, true, &dev));
- addr = devfdt_get_addr_name(dev, "sandbox-dummy-0");
+ addr = devfdt_get_addr_size_name(dev, "sandbox-dummy-0", &size);
ut_asserteq(0x8000, addr);
+ ut_asserteq(0x1000, size);
paddr = map_physmem(addr, 0, MAP_NOCACHE);
ut_assertnonnull(paddr);
@@ -609,12 +613,14 @@ static int dm_test_fdt_remap_addr_index_live(struct unit_test_state *uts)
{
struct udevice *dev;
fdt_addr_t addr;
+ fdt_size_t size;
void *paddr;
ut_assertok(uclass_find_device_by_seq(UCLASS_TEST_DUMMY, 0, true, &dev));
- addr = dev_read_addr_index(dev, 0);
+ addr = dev_read_addr_size_index(dev, 0, &size);
ut_asserteq(0x8000, addr);
+ ut_asserteq(0x1000, size);
paddr = map_physmem(addr, 0, MAP_NOCACHE);
ut_assertnonnull(paddr);
@@ -629,12 +635,14 @@ static int dm_test_fdt_remap_addr_name_live(struct unit_test_state *uts)
{
struct udevice *dev;
fdt_addr_t addr;
+ fdt_size_t size;
void *paddr;
ut_assertok(uclass_find_device_by_seq(UCLASS_TEST_DUMMY, 0, true, &dev));
- addr = dev_read_addr_name(dev, "sandbox-dummy-0");
+ addr = dev_read_addr_size_name(dev, "sandbox-dummy-0", &size);
ut_asserteq(0x8000, addr);
+ ut_asserteq(0x1000, size);
paddr = map_physmem(addr, 0, MAP_NOCACHE);
ut_assertnonnull(paddr);
diff --git a/test/env/hashtable.c b/test/env/hashtable.c
index 8c87e65457..5242c4cc3e 100644
--- a/test/env/hashtable.c
+++ b/test/env/hashtable.c
@@ -18,8 +18,8 @@ static int htab_fill(struct unit_test_state *uts,
struct hsearch_data *htab, size_t size)
{
size_t i;
- ENTRY item;
- ENTRY *ritem;
+ struct env_entry item;
+ struct env_entry *ritem;
char key[20];
for (i = 0; i < size; i++) {
@@ -28,7 +28,7 @@ static int htab_fill(struct unit_test_state *uts,
item.data = key;
item.flags = 0;
item.key = key;
- ut_asserteq(1, hsearch_r(item, ENTER, &ritem, htab, 0));
+ ut_asserteq(1, hsearch_r(item, ENV_ENTER, &ritem, htab, 0));
}
return 0;
@@ -38,8 +38,8 @@ static int htab_check_fill(struct unit_test_state *uts,
struct hsearch_data *htab, size_t size)
{
size_t i;
- ENTRY item;
- ENTRY *ritem;
+ struct env_entry item;
+ struct env_entry *ritem;
char key[20];
for (i = 0; i < size; i++) {
@@ -48,7 +48,7 @@ static int htab_check_fill(struct unit_test_state *uts,
item.flags = 0;
item.data = key;
item.key = key;
- hsearch_r(item, FIND, &ritem, htab, 0);
+ hsearch_r(item, ENV_FIND, &ritem, htab, 0);
ut_assert(ritem);
ut_asserteq_str(key, ritem->key);
ut_asserteq_str(key, ritem->data);
@@ -61,8 +61,8 @@ static int htab_create_delete(struct unit_test_state *uts,
struct hsearch_data *htab, size_t iterations)
{
size_t i;
- ENTRY item;
- ENTRY *ritem;
+ struct env_entry item;
+ struct env_entry *ritem;
char key[20];
for (i = 0; i < iterations; i++) {
@@ -71,10 +71,10 @@ static int htab_create_delete(struct unit_test_state *uts,
item.flags = 0;
item.data = key;
item.key = key;
- hsearch_r(item, ENTER, &ritem, htab, 0);
+ hsearch_r(item, ENV_ENTER, &ritem, htab, 0);
ritem = NULL;
- hsearch_r(item, FIND, &ritem, htab, 0);
+ hsearch_r(item, ENV_FIND, &ritem, htab, 0);
ut_assert(ritem);
ut_asserteq_str(key, ritem->key);
ut_asserteq_str(key, ritem->data);
diff --git a/tools/env/fw_env.c b/tools/env/fw_env.c
index eef12dd2b7..95c99847a3 100644
--- a/tools/env/fw_env.c
+++ b/tools/env/fw_env.c
@@ -10,6 +10,7 @@
#define _GNU_SOURCE
#include <compiler.h>
+#include <env.h>
#include <errno.h>
#include <env_flags.h>
#include <fcntl.h>
@@ -118,9 +119,12 @@ static struct environment environment = {
static int have_redund_env;
-static unsigned char active_flag = 1;
-/* obsolete_flag must be 0 to efficiently set it on NOR flash without erasing */
-static unsigned char obsolete_flag = 0;
+static unsigned char ENV_REDUND_ACTIVE = 1;
+/*
+ * ENV_REDUND_OBSOLETE must be 0 to efficiently set it on NOR flash without
+ * erasing
+ */
+static unsigned char ENV_REDUND_OBSOLETE;
#define DEFAULT_ENV_INSTANCE_STATIC
#include <env_default.h>
@@ -1141,7 +1145,7 @@ static int flash_flag_obsolete(int dev, int fd, off_t offset)
erase.start = DEVOFFSET(dev);
erase.length = DEVESIZE(dev);
- /* This relies on the fact, that obsolete_flag == 0 */
+ /* This relies on the fact, that ENV_REDUND_OBSOLETE == 0 */
rc = lseek(fd, offset, SEEK_SET);
if (rc < 0) {
fprintf(stderr, "Cannot seek to set the flag on %s\n",
@@ -1149,7 +1153,7 @@ static int flash_flag_obsolete(int dev, int fd, off_t offset)
return rc;
}
ioctl(fd, MEMUNLOCK, &erase);
- rc = write(fd, &obsolete_flag, sizeof(obsolete_flag));
+ rc = write(fd, &ENV_REDUND_OBSOLETE, sizeof(ENV_REDUND_OBSOLETE));
ioctl(fd, MEMLOCK, &erase);
if (rc < 0)
perror("Could not set obsolete flag");
@@ -1168,7 +1172,7 @@ static int flash_write(int fd_current, int fd_target, int dev_target)
(*environment.flags)++;
break;
case FLAG_BOOLEAN:
- *environment.flags = active_flag;
+ *environment.flags = ENV_REDUND_ACTIVE;
break;
default:
fprintf(stderr, "Unimplemented flash scheme %u\n",
@@ -1507,11 +1511,11 @@ int fw_env_open(struct env_opts *opts)
} else {
switch (environment.flag_scheme) {
case FLAG_BOOLEAN:
- if (flag0 == active_flag &&
- flag1 == obsolete_flag) {
+ if (flag0 == ENV_REDUND_ACTIVE &&
+ flag1 == ENV_REDUND_OBSOLETE) {
dev_current = 0;
- } else if (flag0 == obsolete_flag &&
- flag1 == active_flag) {
+ } else if (flag0 == ENV_REDUND_OBSOLETE &&
+ flag1 == ENV_REDUND_ACTIVE) {
dev_current = 1;
} else if (flag0 == flag1) {
dev_current = 0;
diff --git a/tools/env/fw_env.h b/tools/env/fw_env.h
index b250e2f3d7..3d2b457b31 100644
--- a/tools/env/fw_env.h
+++ b/tools/env/fw_env.h
@@ -4,6 +4,7 @@
* Wolfgang Denk, DENX Software Engineering, wd@denx.de.
*/
+#include <env.h>
#include <stdint.h>
/*
diff --git a/tools/env/fw_env_main.c b/tools/env/fw_env_main.c
index 26ba6624cd..1d193bd437 100644
--- a/tools/env/fw_env_main.c
+++ b/tools/env/fw_env_main.c
@@ -26,6 +26,7 @@
* of AES key), eg. '-a aabbccddeeff00112233445566778899'.
*/
+#include <env.h>
#include <fcntl.h>
#include <getopt.h>
#include <stdio.h>
diff --git a/tools/envcrc.c b/tools/envcrc.c
index 505949289f..672ef4d675 100644
--- a/tools/envcrc.c
+++ b/tools/envcrc.c
@@ -59,9 +59,9 @@
#ifdef CONFIG_BUILD_ENVCRC
-# include <environment.h>
+# include <env_internal.h>
extern unsigned int env_size;
-extern env_t environment;
+extern env_t embedded_environment;
#endif /* CONFIG_BUILD_ENVCRC */
extern uint32_t crc32 (uint32_t, const unsigned char *, unsigned int);
@@ -71,7 +71,7 @@ int main (int argc, char **argv)
#ifdef CONFIG_BUILD_ENVCRC
unsigned char pad = 0x00;
uint32_t crc;
- unsigned char *envptr = (unsigned char *)&environment,
+ unsigned char *envptr = (unsigned char *)&embedded_environment,
*dataptr = envptr + ENV_HEADER_SIZE;
unsigned int datasize = ENV_SIZE;
unsigned int eoe;