]> git.ipfire.org Git - people/ms/u-boot.git/commitdiff
Merge git://git.denx.de/u-boot-tegra
authorTom Rini <trini@konsulko.com>
Wed, 16 Aug 2017 22:12:58 +0000 (18:12 -0400)
committerTom Rini <trini@konsulko.com>
Wed, 16 Aug 2017 22:12:58 +0000 (18:12 -0400)
493 files changed:
Kconfig
Makefile
README
api/api.c
arch/arc/lib/bootm.c
arch/arm/Kconfig
arch/arm/cpu/armv7/start.S
arch/arm/cpu/armv7/vf610/generic.c
arch/arm/cpu/armv8/fsl-layerscape/soc.c
arch/arm/dts/Makefile
arch/arm/dts/sun50i-a64-nanopi-a64.dts [new file with mode: 0644]
arch/arm/dts/sun50i-a64-olinuxino.dts [new file with mode: 0644]
arch/arm/dts/sun50i-a64.dtsi
arch/arm/dts/sun7i-a20-olinuxino-lime2-emmc.dts
arch/arm/include/asm/arch-mx6/mx6q_pins.h
arch/arm/include/asm/arch-sunxi/prcm.h
arch/arm/lib/bootm.c
arch/arm/lib/semihosting.c
arch/arm/mach-davinci/misc.c
arch/arm/mach-exynos/Kconfig
arch/arm/mach-imx/mx6/Kconfig
arch/arm/mach-imx/mx6/clock.c
arch/arm/mach-imx/mx6/opos6ul.c
arch/arm/mach-imx/mx6/soc.c
arch/arm/mach-imx/mx7/Kconfig
arch/arm/mach-imx/mx7/soc.c
arch/arm/mach-imx/video.c
arch/arm/mach-integrator/Kconfig
arch/arm/mach-keystone/ddr3.c
arch/arm/mach-keystone/keystone.c
arch/arm/mach-kirkwood/cpu.c
arch/arm/mach-mvebu/Kconfig
arch/arm/mach-omap2/boot-common.c
arch/arm/mach-omap2/utils.c
arch/arm/mach-rockchip/rk3036-board.c
arch/arm/mach-rockchip/rk322x-board.c
arch/arm/mach-rockchip/rk3288-board.c
arch/arm/mach-socfpga/misc_gen5.c
arch/arm/mach-sunxi/Kconfig
arch/arm/mach-sunxi/clock_sun6i.c
arch/arm/mach-tegra/Kconfig
arch/arm/mach-tegra/board2.c
arch/arm/mach-tegra/tegra186/nvtboot_board.c
arch/arm/mach-uniphier/board_late_init.c
arch/arm/mach-uniphier/mmc-first-dev.c
arch/m68k/Kconfig
arch/m68k/lib/bootm.c
arch/microblaze/lib/bootm.c
arch/mips/Kconfig
arch/mips/lib/bootm.c
arch/nds32/lib/bootm.c
arch/nios2/lib/bootm.c
arch/powerpc/Kconfig
arch/powerpc/cpu/mpc83xx/Kconfig
arch/powerpc/cpu/mpc85xx/Kconfig
arch/powerpc/cpu/mpc85xx/cpu_init.c
arch/powerpc/cpu/mpc85xx/fdt.c
arch/powerpc/cpu/mpc85xx/fsl_corenet_serdes.c
arch/powerpc/cpu/mpc85xx/mp.c
arch/powerpc/cpu/mpc86xx/Kconfig
arch/powerpc/lib/bootm.c
arch/sh/Kconfig
arch/sh/cpu/u-boot.lds
arch/sh/lib/bootm.c
arch/sh/lib/zimageboot.c
arch/x86/cpu/baytrail/Kconfig
arch/x86/cpu/broadwell/Kconfig
arch/x86/cpu/coreboot/Kconfig
arch/x86/cpu/ivybridge/Kconfig
arch/x86/cpu/qemu/Kconfig
arch/x86/cpu/quark/Kconfig
arch/x86/cpu/queensbay/Kconfig
arch/x86/lib/zimage.c
arch/xtensa/lib/bootm.c
board/Arcturus/ucp1020/cmd_arc.c
board/Arcturus/ucp1020/spl.c
board/Arcturus/ucp1020/ucp1020.c
board/Barix/ipam390/ipam390.c
board/BuR/brppt1/board.c
board/BuR/brxre1/board.c
board/BuR/common/common.c
board/BuS/eb_cpu5282/eb_cpu5282.c
board/CZ.NIC/turris_omnia/turris_omnia.c
board/CarMediaLab/flea3/flea3.c
board/LaCie/net2big_v2/net2big_v2.c
board/LaCie/netspace_v2/netspace_v2.c
board/Synology/ds414/cmd_syno.c
board/amazon/kc1/kc1.c
board/amlogic/odroid-c2/odroid-c2.c
board/aries/ma5d4evk/ma5d4evk.c
board/aristainetos/aristainetos-v2.c
board/armltd/integrator/integrator.c
board/atmel/sama5d2_xplained/sama5d2_xplained.c
board/atmel/sama5d3xek/sama5d3xek.c
board/bachmann/ot1200/ot1200.c
board/birdland/bav335x/board.c
board/bluegiga/apx4devkit/apx4devkit.c
board/bluewater/gurnard/gurnard.c
board/bosch/shc/board.c
board/boundary/nitrogen6x/nitrogen6x.c
board/broadcom/bcm23550_w1d/bcm23550_w1d.c
board/broadcom/bcm28155_ap/bcm28155_ap.c
board/buffalo/lsxl/lsxl.c
board/cadence/xtfpga/xtfpga.c
board/ccv/xpress/xpress.c
board/compulab/cl-som-am57x/eth.c
board/compulab/cm_fx6/cm_fx6.c
board/compulab/cm_t335/cm_t335.c
board/compulab/cm_t35/cm_t35.c
board/compulab/cm_t3517/cm_t3517.c
board/compulab/cm_t54/cm_t54.c
board/compulab/common/omap3_display.c
board/congatec/cgtqmx6eval/cgtqmx6eval.c
board/cssi/MCR3000/MCR3000.c
board/davinci/da8xxevm/da850evm.c
board/davinci/da8xxevm/omapl138_lcdk.c
board/el/el6x/el6x.c
board/engicam/common/board.c
board/engicam/geam6ul/geam6ul.c
board/engicam/icorem6/icorem6.c
board/engicam/icorem6_rqs/icorem6_rqs.c
board/engicam/isiotmx6ul/isiotmx6ul.c
board/esd/meesc/meesc.c
board/freescale/b4860qds/b4860qds.c
board/freescale/b4860qds/spl.c
board/freescale/bsc9131rdb/bsc9131rdb.c
board/freescale/bsc9132qds/bsc9132qds.c
board/freescale/c29xpcie/c29xpcie.c
board/freescale/c29xpcie/spl.c
board/freescale/common/cmd_esbc_validate.c
board/freescale/common/fsl_chain_of_trust.c
board/freescale/common/sys_eeprom.c
board/freescale/common/vid.c
board/freescale/corenet_ds/corenet_ds.c
board/freescale/ls2080aqds/eth.c
board/freescale/ls2080aqds/ls2080aqds.c
board/freescale/ls2080ardb/ls2080ardb.c
board/freescale/mpc8323erdb/mpc8323erdb.c
board/freescale/mpc837xemds/pci.c
board/freescale/mpc837xerdb/mpc837xerdb.c
board/freescale/mpc8572ds/mpc8572ds.c
board/freescale/mx31ads/u-boot.lds
board/freescale/mx51evk/mx51evk_video.c
board/freescale/mx53loco/mx53loco.c
board/freescale/mx53loco/mx53loco_video.c
board/freescale/mx6sabreauto/mx6sabreauto.c
board/freescale/mx6sabresd/mx6sabresd.c
board/freescale/mx6ul_14x14_evk/mx6ul_14x14_evk.c
board/freescale/mx6ullevk/mx6ullevk.c
board/freescale/p1010rdb/p1010rdb.c
board/freescale/p1010rdb/spl.c
board/freescale/p1022ds/p1022ds.c
board/freescale/p1022ds/spl.c
board/freescale/p1023rdb/p1023rdb.c
board/freescale/p1_p2_rdb_pc/p1_p2_rdb_pc.c
board/freescale/p1_p2_rdb_pc/spl.c
board/freescale/p1_twr/p1_twr.c
board/freescale/p2041rdb/p2041rdb.c
board/freescale/qemu-ppce500/qemu-ppce500.c
board/freescale/t102xqds/spl.c
board/freescale/t102xqds/t102xqds.c
board/freescale/t102xrdb/spl.c
board/freescale/t102xrdb/t102xrdb.c
board/freescale/t1040qds/t1040qds.c
board/freescale/t104xrdb/spl.c
board/freescale/t104xrdb/t104xrdb.c
board/freescale/t208xqds/spl.c
board/freescale/t208xqds/t208xqds.c
board/freescale/t208xrdb/spl.c
board/freescale/t208xrdb/t208xrdb.c
board/freescale/t4qds/spl.c
board/freescale/t4qds/t4240emu.c
board/freescale/t4qds/t4240qds.c
board/freescale/t4rdb/spl.c
board/freescale/t4rdb/t4240rdb.c
board/gateworks/gw_ventana/common.c
board/gateworks/gw_ventana/gw_ventana.c
board/gateworks/gw_ventana/gw_ventana_spl.c
board/gdsys/a38x/keyprogram.c
board/gdsys/mpc8308/hrcon.c
board/gdsys/mpc8308/strider.c
board/gdsys/p1022/controlcenterd-id.c
board/gdsys/p1022/controlcenterd.c
board/grinn/chiliboard/board.c
board/grinn/liteboard/board.c
board/gumstix/pepper/board.c
board/highbank/highbank.c
board/htkw/mcx/mcx.c
board/intel/edison/edison.c
board/isee/igep003x/board.c
board/isee/igep00x0/igep00x0.c
board/keymile/common/common.c
board/keymile/common/ivm.c
board/keymile/km83xx/km83xx.c
board/keymile/km_arm/km_arm.c
board/keymile/kmp204x/kmp204x.c
board/kosagi/novena/novena.c
board/lg/sniper/sniper.c
board/liebherr/mccmon6/mccmon6.c
board/logicpd/imx6/imx6logic.c
board/logicpd/omap3som/omap3logic.c
board/logicpd/zoom1/zoom1.c
board/micronas/vct/vct.c
board/nokia/rx51/rx51.c
board/overo/overo.c
board/phytec/pcm051/board.c
board/phytec/pfla02/Kconfig [new file with mode: 0644]
board/phytec/pfla02/MAINTAINERS [new file with mode: 0644]
board/phytec/pfla02/Makefile [new file with mode: 0644]
board/phytec/pfla02/README [new file with mode: 0644]
board/phytec/pfla02/pfla02.c [new file with mode: 0644]
board/qualcomm/dragonboard410c/dragonboard410c.c
board/raspberrypi/rpi/rpi.c
board/renesas/alt/alt.c
board/renesas/blanche/blanche.c
board/renesas/ecovec/ecovec.c
board/renesas/gose/gose.c
board/renesas/koelsch/koelsch.c
board/renesas/lager/lager.c
board/renesas/porter/porter.c
board/renesas/sh7752evb/sh7752evb.c
board/renesas/sh7753evb/sh7753evb.c
board/renesas/sh7757lcr/sh7757lcr.c
board/renesas/silk/silk.c
board/renesas/stout/stout.c
board/rockchip/kylin_rk3036/kylin_rk3036.c
board/rockchip/tinker_rk3288/tinker-rk3288.c
board/samsung/common/exynos5-dt.c
board/samsung/common/misc.c
board/samsung/odroid/odroid.c
board/samsung/trats/trats.c
board/samsung/universal_c210/universal.c
board/samtec/vining_2000/vining_2000.c
board/samtec/vining_fpga/socfpga.c
board/siemens/common/board.c
board/siemens/common/factoryset.c
board/siemens/common/factoryset.h
board/siemens/draco/board.c
board/siemens/pxm2/board.c
board/siemens/rut/board.c
board/siemens/taurus/taurus.c
board/silica/pengwyn/board.c
board/socrates/socrates.c
board/solidrun/mx6cuboxi/mx6cuboxi.c
board/spear/common/spr_misc.c
board/st/stm32f429-discovery/stm32f429-discovery.c
board/sunxi/MAINTAINERS
board/sunxi/board.c
board/syteco/zmx25/zmx25.c
board/tcl/sl50/board.c
board/technexion/twister/twister.c
board/technologic/ts4800/ts4800.c
board/teejet/mt_ventoux/mt_ventoux.c
board/theobroma-systems/puma_rk3399/puma-rk3399.c
board/ti/am335x/board.c
board/ti/am43xx/board.c
board/ti/am57xx/board.c
board/ti/beagle/beagle.c
board/ti/common/Kconfig
board/ti/common/board_detect.c
board/ti/dra7xx/evm.c
board/ti/evm/evm.c
board/ti/ks2_evm/board.c
board/ti/ks2_evm/board_k2g.c
board/ti/panda/panda.c
board/ti/ti814x/evm.c
board/ti/ti816x/evm.c
board/timll/devkit8000/devkit8000.c
board/toradex/apalis_imx6/apalis_imx6.c
board/toradex/colibri_imx6/colibri_imx6.c
board/toradex/colibri_vf/colibri_vf.c
board/toradex/common/tdx-cfg-block.c
board/toradex/common/tdx-common.c
board/tqc/tqma6/tqma6.c
board/udoo/neo/neo.c
board/udoo/udoo.c
board/varisys/common/sys_eeprom.c
board/varisys/cyrus/cyrus.c
board/vscom/baltos/board.c
board/wandboard/wandboard.c
board/work-microwave/work_92105/work_92105_display.c
board/xes/common/board.c
board/xilinx/zynq/board.c
board/xilinx/zynqmp/zynqmp.c
cmd/bdinfo.c
cmd/bootm.c
cmd/bootmenu.c
cmd/cbfs.c
cmd/cramfs.c
cmd/elf.c
cmd/fdt.c
cmd/fpga.c
cmd/gpt.c
cmd/ini.c
cmd/itest.c
cmd/jffs2.c
cmd/load.c
cmd/log.c
cmd/lzmadec.c
cmd/md5sum.c
cmd/mtdparts.c
cmd/mvebu/bubt.c
cmd/nand.c
cmd/net.c
cmd/nvedit.c
cmd/part.c
cmd/pxe.c
cmd/qfw.c
cmd/reiser.c
cmd/setexpr.c
cmd/source.c
cmd/tpm.c
cmd/trace.c
cmd/unzip.c
cmd/ximg.c
cmd/zfs.c
cmd/zip.c
common/Kconfig
common/Makefile
common/autoboot.c
common/board_f.c
common/board_r.c
common/bootm.c
common/bootm_os.c
common/bootretry.c
common/cli.c
common/cli_hush.c
common/cli_simple.c
common/console.c
common/fb_mmc.c
common/fdt_support.c
common/hash.c
common/hwconfig.c
common/image-android.c
common/image-fdt.c
common/image.c
common/lcd.c
common/main.c
common/spl/Kconfig
common/spl/spl_dfu.c
common/spl/spl_ext.c
common/spl/spl_fat.c
common/spl/spl_net.c
common/splash.c
common/splash_source.c
common/update.c
common/usb_hub.c
common/usb_kbd.c
configs/A20-OLinuXino-Lime2-eMMC_defconfig [new file with mode: 0644]
configs/a64-olinuxino_defconfig [new file with mode: 0644]
configs/boston32r2_defconfig
configs/boston32r2el_defconfig
configs/boston64r2_defconfig
configs/boston64r2el_defconfig
configs/edison_defconfig
configs/malta64_defconfig
configs/malta64el_defconfig
configs/malta_defconfig
configs/maltael_defconfig
configs/microblaze-generic_defconfig
configs/nanopi_a64_defconfig [new file with mode: 0644]
configs/orangepi_pc2_defconfig
configs/orangepi_zero_defconfig
configs/pfla02_defconfig [new file with mode: 0644]
configs/qemu_mips64_defconfig
configs/qemu_mips64el_defconfig
configs/qemu_mips_defconfig
configs/qemu_mipsel_defconfig
configs/r8a7795_ulcb_defconfig
configs/r8a7796_ulcb_defconfig
disk/part.c
disk/part_amiga.c
doc/README.enetaddr
drivers/bootcount/bootcount_env.c
drivers/ddr/fsl/fsl_ddr_gen4.c
drivers/ddr/fsl/interactive.c
drivers/ddr/fsl/options.c
drivers/dfu/dfu.c
drivers/dfu/dfu_mmc.c
drivers/input/i8042.c
drivers/input/input.c
drivers/mtd/cfi_flash.c
drivers/mtd/dataflash.c
drivers/mtd/spi/sf_dataflash.c
drivers/mtd/spi/spi_flash.c
drivers/mtd/spi/spi_flash_ids.c
drivers/net/dc2114x.c
drivers/net/fec_mxc.c
drivers/net/fm/b4860.c
drivers/net/fm/fdt.c
drivers/net/fm/fm.c
drivers/net/fsl-mc/mc.c
drivers/net/fsl_mcdmafec.c
drivers/net/ftgmac100.c
drivers/net/ftmac100.c
drivers/net/lan91c96.c
drivers/net/mcffec.c
drivers/net/ne2000_base.c
drivers/net/netconsole.c
drivers/net/phy/micrel_ksz90x1.c
drivers/net/sandbox-raw.c
drivers/net/sh_eth.c
drivers/pci/fsl_pci_init.c
drivers/pci/pci.c
drivers/pci/pci_common.c
drivers/rtc/m41t60.c
drivers/scsi/scsi.c
drivers/serial/usbtty.c
drivers/usb/gadget/designware_udc.c
drivers/usb/gadget/ether.c
drivers/usb/gadget/f_dfu.c
drivers/usb/gadget/f_fastboot.c
drivers/usb/host/ehci-fsl.c
drivers/video/ati_radeon_fb.c
drivers/video/cfb_console.c
drivers/video/mb862xx.c
drivers/video/mx3fb.c
drivers/video/mxsfb.c
drivers/video/videomodes.c
env/Kconfig [new file with mode: 0644]
env/Makefile [new file with mode: 0644]
env/attr.c [moved from common/env_attr.c with 100% similarity]
env/callback.c [moved from common/env_callback.c with 98% similarity]
env/common.c [moved from common/env_common.c with 89% similarity]
env/dataflash.c [moved from common/env_dataflash.c with 75% similarity]
env/eeprom.c [moved from common/env_eeprom.c with 86% similarity]
env/embedded.c [moved from common/env_embedded.c with 100% similarity]
env/env.c [new file with mode: 0644]
env/ext4.c [moved from common/env_ext4.c with 91% similarity]
env/fat.c [moved from common/env_fat.c with 76% similarity]
env/flags.c [moved from common/env_flags.c with 98% similarity]
env/flash.c [moved from common/env_flash.c with 80% similarity]
env/mmc.c [moved from common/env_mmc.c with 90% similarity]
env/nand.c [moved from common/env_nand.c with 87% similarity]
env/nowhere.c [moved from common/env_nowhere.c with 58% similarity]
env/nvram.c [moved from common/env_nvram.c with 86% similarity]
env/onenand.c [moved from common/env_onenand.c with 89% similarity]
env/remote.c [moved from common/env_remote.c with 73% similarity]
env/sata.c [moved from common/env_sata.c with 84% similarity]
env/sf.c [moved from common/env_sf.c with 87% similarity]
env/ubi.c [moved from common/env_ubi.c with 91% similarity]
fs/fs.c
fs/ubifs/ubifs.c
include/_exports.h
include/asm-generic/global_data.h
include/common.h
include/configs/M5208EVBE.h
include/configs/M5235EVB.h
include/configs/M5249EVB.h
include/configs/M5253DEMO.h
include/configs/M5253EVBE.h
include/configs/M5272C3.h
include/configs/M5275EVB.h
include/configs/M5282EVB.h
include/configs/M53017EVB.h
include/configs/M5329EVB.h
include/configs/M5373EVB.h
include/configs/amcore.h
include/configs/astro_mcf5373l.h
include/configs/cobra5272.h
include/configs/edison.h
include/configs/pfla02.h [new file with mode: 0644]
include/configs/tam3517-common.h
include/configs/ulcb.h
include/configs/wandboard.h
include/dataflash.h
include/environment.h
include/exports.h
include/image.h
include/net.h
include/netdev.h
include/search.h
lib/fdtdec.c
lib/smbios.c
lib/uuid.c
net/arp.c
net/bootp.c
net/dns.c
net/eth-uclass.c
net/eth_common.c
net/eth_internal.h
net/eth_legacy.c
net/link_local.c
net/net.c
net/tftp.c
post/post.c
scripts/Makefile.spl
test/command_ut.c
test/dm/eth.c
tools/Makefile
tools/env/fw_env.c
tools/env/fw_env.h
tools/env/fw_env_main.c

diff --git a/Kconfig b/Kconfig
index 14740b49f1ddbd00530292b13f7d0ad027039949..c48f00ea369595a18bb2c5d955a2a9ad5abc7adf 100644 (file)
--- a/Kconfig
+++ b/Kconfig
@@ -380,6 +380,8 @@ source "disk/Kconfig"
 
 source "dts/Kconfig"
 
+source "env/Kconfig"
+
 source "net/Kconfig"
 
 source "drivers/Kconfig"
index 3d636c5398463094c71e73e77b4703b7435058ac..2fc4616bb67ed1b63b09dbca3d77acb4cf80f734 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -690,6 +690,7 @@ libs-y += drivers/usb/phy/
 libs-y += drivers/usb/ulpi/
 libs-y += cmd/
 libs-y += common/
+libs-y += env/
 libs-$(CONFIG_API) += api/
 libs-$(CONFIG_HAS_POST) += post/
 libs-y += test/
@@ -1464,14 +1465,14 @@ checkarmreloc: u-boot
                false; \
        fi
 
-env: scripts_basic
+environ: scripts_basic
        $(Q)$(MAKE) $(build)=tools/$@
 
 tools-only: scripts_basic $(version_h) $(timestamp_h)
        $(Q)$(MAKE) $(build)=tools
 
 tools-all: export HOST_TOOLS_ALL=y
-tools-all: env tools ;
+tools-all: environ tools ;
 
 cross_tools: export CROSS_BUILD_TOOLS=y
 cross_tools: tools ;
diff --git a/README b/README
index 3fdb89cc79a6d8249374f68c59f8e7466a9c1623..1a7a788c4bf9dd9857cdede7b724faa94a827ada 100644 (file)
--- a/README
+++ b/README
@@ -3286,7 +3286,7 @@ but it can not erase, write this NOR flash by SRIO or PCIE interface.
 
 Please note that the environment is read-only until the monitor
 has been relocated to RAM and a RAM copy of the environment has been
-created; also, when using EEPROM you will have to use getenv_f()
+created; also, when using EEPROM you will have to use env_get_f()
 until then to read environment variables.
 
 The environment is protected by a CRC32 checksum. Before the monitor
index 4fae95d2801db2d1d7e304559630500949d405db..7eee2fc083affa349f393b529c917dd7ea5b76e7 100644 (file)
--- a/api/api.c
+++ b/api/api.c
@@ -458,7 +458,7 @@ static int API_env_get(va_list ap)
        if ((value = (char **)va_arg(ap, uintptr_t)) == NULL)
                return API_EINVAL;
 
-       *value = getenv(name);
+       *value = env_get(name);
 
        return 0;
 }
@@ -481,7 +481,7 @@ static int API_env_set(va_list ap)
        if ((value = (char *)va_arg(ap, uintptr_t)) == NULL)
                return API_EINVAL;
 
-       setenv(name, value);
+       env_set(name, value);
 
        return 0;
 }
@@ -663,7 +663,7 @@ void api_init(void)
                return;
        }
 
-       setenv_hex("api_address", (unsigned long)sig);
+       env_set_hex("api_address", (unsigned long)sig);
        debugf("API sig @ 0x%lX\n", (unsigned long)sig);
        memcpy(sig->magic, API_SIG_MAGIC, 8);
        sig->version = API_SIG_VERSION;
index 57981490467a817c64f1bd75dc77cf4a9c85c6b7..a498ce5b297c69724f9c59bf2b486f1d0414da23 100644 (file)
@@ -85,7 +85,7 @@ static void boot_jump_linux(bootm_headers_t *images, int flag)
                r2 = (unsigned int)images->ft_addr;
        } else {
                r0 = 1;
-               r2 = (unsigned int)getenv("bootargs");
+               r2 = (unsigned int)env_get("bootargs");
        }
 
        smp_set_core_boot_addr((unsigned long)kernel_entry, -1);
index 39b001fd531fb21f9cdbdce838fdb6ec13ac5bfc..da9324b43caeee237e2120191b37ab15aced7132 100644 (file)
@@ -97,6 +97,9 @@ config ARM_ERRATA_833069
 config ARM_ERRATA_833471
        bool
 
+config ARM_ERRATA_845369
+       bool
+
 config ARM_ERRATA_852421
        bool
 
@@ -493,7 +496,6 @@ config ARCH_BCM283X
        select DM_GPIO
        select OF_CONTROL
        imply FAT_WRITE
-       imply ENV_IS_IN_FAT
 
 config TARGET_VEXPRESS_CA15_TC2
        bool "Support vexpress_ca15_tc2"
@@ -1039,7 +1041,6 @@ config ARCH_UNIPHIER
        select SPL_PINCTRL if SPL
        select SUPPORT_SPL
        imply FAT_WRITE
-       imply ENV_IS_IN_MMC
        help
          Support for UniPhier SoC family developed by Socionext Inc.
          (formerly, System LSI Business Division of Panasonic Corporation)
index f06fd28940e7700d9e70779f21c9fa7a6937f38d..7b84a7a0f161207611202c7f44544208c70fed13 100644 (file)
@@ -187,6 +187,12 @@ ENTRY(cpu_init_cp15)
        mcr     p15, 0, r0, c15, c0, 1  @ write diagnostic register
 #endif
 
+#ifdef CONFIG_ARM_ERRATA_845369
+       mrc     p15, 0, r0, c15, c0, 1  @ read diagnostic register
+       orr     r0, r0, #1 << 22        @ set bit #22
+       mcr     p15, 0, r0, c15, c0, 1  @ write diagnostic register
+#endif
+
        mov     r5, lr                  @ Store my Caller
        mrc     p15, 0, r1, c0, c0, 0   @ r1 has Read Main ID Register (MIDR)
        mov     r3, r1, lsr #20         @ get variant field
index ac2d8d1a3f83280011170fafda3032f3f7bc3dae..88f3f4dd163348cf47508520cffec2119afc2638 100644 (file)
@@ -329,7 +329,7 @@ int arch_misc_init(void)
 
        strcpy(soc, "vf");
        strcat(soc, soc_type);
-       setenv("soc", soc);
+       env_set("soc", soc);
 
        return 0;
 }
index aee1ffa7d43eb049b708d287a5e8bd8ecd564834..639e9d2ddc8d643904f22872b42fbd21a66d29ff 100644 (file)
@@ -95,7 +95,7 @@ static void erratum_a008514(void)
 
 static unsigned long get_internval_val_mhz(void)
 {
-       char *interval = getenv(PLATFORM_CYCLE_ENV_VAR);
+       char *interval = env_get(PLATFORM_CYCLE_ENV_VAR);
        /*
         *  interval is the number of platform cycles(MHz) between
         *  wake up events generated by EPU.
index 2cbdb17ca54b7d6604877dbea2681bb602a6cef9..f94c2471b4e88b4275f2ad4231bc3d7ee63aed9e 100644 (file)
@@ -336,6 +336,8 @@ dtb-$(CONFIG_MACH_SUN50I_H5) += \
        sun50i-h5-orangepi-zero-plus2.dtb
 dtb-$(CONFIG_MACH_SUN50I) += \
        sun50i-a64-bananapi-m64.dtb \
+       sun50i-a64-nanopi-a64.dtb \
+       sun50i-a64-olinuxino.dtb \
        sun50i-a64-orangepi-win.dtb \
        sun50i-a64-pine64-plus.dtb \
        sun50i-a64-pine64.dtb
diff --git a/arch/arm/dts/sun50i-a64-nanopi-a64.dts b/arch/arm/dts/sun50i-a64-nanopi-a64.dts
new file mode 100644 (file)
index 0000000..778636c
--- /dev/null
@@ -0,0 +1,115 @@
+/*
+ * Copyright (C) 2017 Jagan Teki <jteki@openedev.com>
+ *
+ * This file is dual-licensed: you can use it either under the terms
+ * of the GPL or the X11 license, at your option. Note that this dual
+ * licensing only applies to this file, and not this project as a
+ * whole.
+ *
+ *  a) This library is free software; you can redistribute it and/or
+ *     modify it under the terms of the GNU General Public License as
+ *     published by the Free Software Foundation; either version 2 of the
+ *     License, or (at your option) any later version.
+ *
+ *     This library is distributed in the hope that it will be useful,
+ *     but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *     GNU General Public License for more details.
+ *
+ * Or, alternatively,
+ *
+ *  b) Permission is hereby granted, free of charge, to any person
+ *     obtaining a copy of this software and associated documentation
+ *     files (the "Software"), to deal in the Software without
+ *     restriction, including without limitation the rights to use,
+ *     copy, modify, merge, publish, distribute, sublicense, and/or
+ *     sell copies of the Software, and to permit persons to whom the
+ *     Software is furnished to do so, subject to the following
+ *     conditions:
+ *
+ *     The above copyright notice and this permission notice shall be
+ *     included in all copies or substantial portions of the Software.
+ *
+ *     THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ *     EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ *     OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ *     NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ *     HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ *     WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ *     FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ *     OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+/dts-v1/;
+
+#include "sun50i-a64.dtsi"
+
+#include <dt-bindings/gpio/gpio.h>
+
+/ {
+       model = "FriendlyARM NanoPi A64";
+       compatible = "friendlyarm,nanopi-a64", "allwinner,sun50i-a64";
+
+       aliases {
+               serial0 = &uart0;
+       };
+
+       chosen {
+               stdout-path = "serial0:115200n8";
+       };
+
+       reg_vcc3v3: vcc3v3 {
+               compatible = "regulator-fixed";
+               regulator-name = "vcc3v3";
+               regulator-min-microvolt = <3300000>;
+               regulator-max-microvolt = <3300000>;
+       };
+};
+
+&ehci0 {
+       status = "okay";
+};
+
+&ehci1 {
+       status = "okay";
+};
+
+/* i2c1 connected with gpio headers like pine64, bananapi */
+&i2c1 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&i2c1_pins>;
+       status = "disabled";
+};
+
+&i2c1_pins {
+       bias-pull-up;
+};
+
+&mmc0 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&mmc0_pins>;
+       vmmc-supply = <&reg_vcc3v3>;
+       cd-gpios = <&pio 5 6 GPIO_ACTIVE_HIGH>;
+       cd-inverted;
+       disable-wp;
+       bus-width = <4>;
+       status = "okay";
+};
+
+&ohci0 {
+       status = "okay";
+};
+
+&ohci1 {
+       status = "okay";
+};
+
+&uart0 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&uart0_pins_a>;
+       status = "okay";
+};
+
+&usbphy {
+       status = "okay";
+};
diff --git a/arch/arm/dts/sun50i-a64-olinuxino.dts b/arch/arm/dts/sun50i-a64-olinuxino.dts
new file mode 100644 (file)
index 0000000..7bd4730
--- /dev/null
@@ -0,0 +1,84 @@
+/*
+ * Copyright (C) 2017 Jagan Teki <jteki@openedev.com>
+ *
+ * This file is dual-licensed: you can use it either under the terms
+ * of the GPL or the X11 license, at your option. Note that this dual
+ * licensing only applies to this file, and not this project as a
+ * whole.
+ *
+ *  a) This library is free software; you can redistribute it and/or
+ *     modify it under the terms of the GNU General Public License as
+ *     published by the Free Software Foundation; either version 2 of the
+ *     License, or (at your option) any later version.
+ *
+ *     This library is distributed in the hope that it will be useful,
+ *     but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *     GNU General Public License for more details.
+ *
+ * Or, alternatively,
+ *
+ *  b) Permission is hereby granted, free of charge, to any person
+ *     obtaining a copy of this software and associated documentation
+ *     files (the "Software"), to deal in the Software without
+ *     restriction, including without limitation the rights to use,
+ *     copy, modify, merge, publish, distribute, sublicense, and/or
+ *     sell copies of the Software, and to permit persons to whom the
+ *     Software is furnished to do so, subject to the following
+ *     conditions:
+ *
+ *     The above copyright notice and this permission notice shall be
+ *     included in all copies or substantial portions of the Software.
+ *
+ *     THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ *     EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ *     OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ *     NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ *     HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ *     WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ *     FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ *     OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+/dts-v1/;
+
+#include "sun50i-a64.dtsi"
+
+#include <dt-bindings/gpio/gpio.h>
+
+/ {
+       model = "Olimex A64-Olinuxino";
+       compatible = "olimex,a64-olinuxino", "allwinner,sun50i-a64";
+
+       aliases {
+               serial0 = &uart0;
+       };
+
+       chosen {
+               stdout-path = "serial0:115200n8";
+       };
+
+       reg_vcc3v3: vcc3v3 {
+               compatible = "regulator-fixed";
+               regulator-name = "vcc3v3";
+               regulator-min-microvolt = <3300000>;
+               regulator-max-microvolt = <3300000>;
+       };
+};
+
+&mmc0 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&mmc0_pins>;
+       vmmc-supply = <&reg_vcc3v3>;
+       cd-gpios = <&pio 5 6 GPIO_ACTIVE_HIGH>;
+       cd-inverted;
+       disable-wp;
+       bus-width = <4>;
+       status = "okay";
+};
+
+&uart0 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&uart0_pins_a>;
+       status = "okay";
+};
index c7f669f5884f910c6e4be44ac1dd09a216cb97f0..65a344d9cea4519b94ef5bac6a2fa9b39e2dca89 100644 (file)
                        #phy-cells = <1>;
                };
 
+               ehci0: usb@01c1a000 {
+                       compatible = "allwinner,sun50i-a64-ehci", "generic-ehci";
+                       reg = <0x01c1a000 0x100>;
+                       interrupts = <GIC_SPI 72 IRQ_TYPE_LEVEL_HIGH>;
+                       clocks = <&ccu CLK_BUS_OHCI0>,
+                                <&ccu CLK_BUS_EHCI0>,
+                                <&ccu CLK_USB_OHCI0>;
+                       resets = <&ccu RST_BUS_OHCI0>,
+                                <&ccu RST_BUS_EHCI0>;
+                       status = "disabled";
+               };
+
+               ohci0: usb@01c1a400 {
+                       compatible = "allwinner,sun50i-a64-ohci", "generic-ohci";
+                       reg = <0x01c1a400 0x100>;
+                       interrupts = <GIC_SPI 73 IRQ_TYPE_LEVEL_HIGH>;
+                       clocks = <&ccu CLK_BUS_OHCI0>,
+                                <&ccu CLK_USB_OHCI0>;
+                       resets = <&ccu RST_BUS_OHCI0>;
+                       status = "disabled";
+               };
+
                ehci1: usb@01c1b000 {
                        compatible = "allwinner,sun50i-a64-ehci", "generic-ehci";
                        reg = <0x01c1b000 0x100>;
index 5ea4915f6d75b93eb06c974ab1b6abd009f7f769..10d307408f237f21d15fdbe2bf84de5b4db40f0a 100644 (file)
@@ -56,7 +56,7 @@
 };
 
 &pio {
-       mmc2_pins_nrst: mmc2@0 {
+       mmc2_pins_nrst: mmc2-rst-pin {
                allwinner,pins = "PC16";
                allwinner,function = "gpio_out";
                allwinner,drive = <SUN4I_PINCTRL_10_MA>;
index a8456a284a1f096ed39cd69095bc18283ef23cd1..41f7240a359c288701c257f76ad6b832c4f92095 100644 (file)
@@ -863,7 +863,7 @@ MX6_PAD_DECL(SD3_DAT4__SD3_DATA4,   0x069C, 0x02B4, 0, 0x0000, 0, 0)
 MX6_PAD_DECL(SD3_DAT4__UART2_TX_DATA,  0x069C, 0x02B4, 1, 0x0000, 0, 0)
 MX6_PAD_DECL(SD3_DAT4__UART2_RX_DATA,  0x069C, 0x02B4, 1, 0x0928, 5, 0)
 MX6_PAD_DECL(SD3_DAT4__GPIO7_IO01,     0x069C, 0x02B4, 5, 0x0000, 0, 0)
-MX6_PAD_DECL(SD3_CMD__SD3_CMD, 0x06A0, 0x02B8, 16, 0x0000, 0, 0)
+MX6_PAD_DECL(SD3_CMD__SD3_CMD,         0x06A0, 0x02B8, 0 | IOMUX_CONFIG_SION, 0x0000, 0, 0)
 MX6_PAD_DECL(SD3_CMD__UART2_CTS_B,     0x06A0, 0x02B8, 1, 0x0000, 0, 0)
 MX6_PAD_DECL(SD3_CMD__UART2_RTS_B,     0x06A0, 0x02B8, 1, 0x0924, 2, 0)
 MX6_PAD_DECL(SD3_CMD__FLEXCAN1_TX,     0x06A0, 0x02B8, 2, 0x0000, 0, 0)
@@ -924,7 +924,7 @@ MX6_PAD_DECL(NANDF_CS3__ESAI_TX1,   0x06D8, 0x02F0, 2, 0x0878, 1, 0)
 MX6_PAD_DECL(NANDF_CS3__EIM_ADDR26,    0x06D8, 0x02F0, 3, 0x0000, 0, 0)
 MX6_PAD_DECL(NANDF_CS3__GPIO6_IO16,    0x06D8, 0x02F0, 5, 0x0000, 0, 0)
 MX6_PAD_DECL(NANDF_CS3__IPU2_SISG1,    0x06D8, 0x02F0, 6, 0x0000, 0, 0)
-MX6_PAD_DECL(SD4_CMD__SD4_CMD, 0x06DC, 0x02F4, 16, 0x0000, 0, 0)
+MX6_PAD_DECL(SD4_CMD__SD4_CMD,         0x06DC, 0x02F4, 0 | IOMUX_CONFIG_SION, 0x0000, 0, 0)
 MX6_PAD_DECL(SD4_CMD__NAND_RE_B,       0x06DC, 0x02F4, 1, 0x0000, 0, 0)
 MX6_PAD_DECL(SD4_CMD__UART3_TX_DATA,   0x06DC, 0x02F4, 2, 0x0000, 0, 0)
 MX6_PAD_DECL(SD4_CMD__UART3_RX_DATA,   0x06DC, 0x02F4, 2, 0x0930, 2, 0)
@@ -1001,7 +1001,7 @@ MX6_PAD_DECL(SD1_DAT3__PWM1_OUT,  0x072C, 0x0344, 3, 0x0000, 0, 0)
 MX6_PAD_DECL(SD1_DAT3__WDOG2_B,        0x072C, 0x0344, 4, 0x0000, 0, 0)
 MX6_PAD_DECL(SD1_DAT3__GPIO1_IO21,     0x072C, 0x0344, 5, 0x0000, 0, 0)
 MX6_PAD_DECL(SD1_DAT3__WDOG2_RESET_B_DEB,      0x072C, 0x0344, 6, 0x0000, 0, 0)
-MX6_PAD_DECL(SD1_CMD__SD1_CMD, 0x0730, 0x0348, 16, 0x0000, 0, 0)
+MX6_PAD_DECL(SD1_CMD__SD1_CMD,         0x0730, 0x0348, 0 | IOMUX_CONFIG_SION, 0x0000, 0, 0)
 MX6_PAD_DECL(SD1_CMD__ECSPI5_MOSI,     0x0730, 0x0348, 1, 0x0830, 0, 0)
 MX6_PAD_DECL(SD1_CMD__PWM4_OUT,        0x0730, 0x0348, 2, 0x0000, 0, 0)
 MX6_PAD_DECL(SD1_CMD__GPT_COMPARE1,    0x0730, 0x0348, 3, 0x0000, 0, 0)
@@ -1022,7 +1022,7 @@ MX6_PAD_DECL(SD2_CLK__ECSPI5_SCLK,        0x073C, 0x0354, 1, 0x0828, 1, 0)
 MX6_PAD_DECL(SD2_CLK__KEY_COL5,        0x073C, 0x0354, 2, 0x08E8, 3, 0)
 MX6_PAD_DECL(SD2_CLK__AUD4_RXFS,       0x073C, 0x0354, 3, 0x07C0, 1, 0)
 MX6_PAD_DECL(SD2_CLK__GPIO1_IO10,      0x073C, 0x0354, 5, 0x0000, 0, 0)
-MX6_PAD_DECL(SD2_CMD__SD2_CMD, 0x0740, 0x0358, 16, 0x0000, 0, 0)
+MX6_PAD_DECL(SD2_CMD__SD2_CMD,         0x0740, 0x0358, 0 | IOMUX_CONFIG_SION, 0x0000, 0, 0)
 MX6_PAD_DECL(SD2_CMD__ECSPI5_MOSI,     0x0740, 0x0358, 1, 0x0830, 1, 0)
 MX6_PAD_DECL(SD2_CMD__KEY_ROW5,        0x0740, 0x0358, 2, 0x08F4, 2, 0)
 MX6_PAD_DECL(SD2_CMD__AUD4_RXC,        0x0740, 0x0358, 3, 0x07BC, 1, 0)
index ae3880b13bdfed19a1a3b0a700ddc76b6b31cfd3..ba4427c925ddc982ff8e7b1db37e1ac668fd5d42 100644 (file)
 #define PRCM_CPU3_PWR_CLAMP(n) (((n) & 0xff) << 0)
 #define PRCM_CPU3_PWR_CLAMP_MASK PRCM_CPU3_PWR_CLAMP(0xff)
 
+#define PRCM_SEC_SWITCH_APB0_CLK_NONSEC (0x1 << 0)
+#define PRCM_SEC_SWITCH_PLL_CFG_NONSEC (0x1 << 1)
+#define PRCM_SEC_SWITCH_PWR_GATE_NONSEC (0x1 << 2)
+
 #ifndef __ASSEMBLY__
 #include <linux/compiler.h>
 
@@ -233,6 +237,8 @@ struct __packed sunxi_prcm_reg {
        u32 dram_pwr;           /* 0x180 */
        u8 res12[0xc];          /* 0x184 */
        u32 dram_tst;           /* 0x190 */
+       u8 res13[0x3c];         /* 0x194 */
+       u32 prcm_sec_switch;    /* 0x1d0 */
 };
 
 void prcm_apb0_enable(u32 flags);
index 704849bd0c7e4dc659ee07c89dc1885be1d845ca..5c62d9c144061aa888730a3dda682042e77a4208 100644 (file)
@@ -216,7 +216,7 @@ static void do_nonsec_virt_switch(void)
 /* Subcommand: PREP */
 static void boot_prep_linux(bootm_headers_t *images)
 {
-       char *commandline = getenv("bootargs");
+       char *commandline = env_get("bootargs");
 
        if (IMAGE_ENABLE_OF_LIBFDT && images->ft_len) {
 #ifdef CONFIG_OF_LIBFDT
@@ -273,7 +273,7 @@ __weak bool armv7_boot_nonsec_default(void)
 #ifdef CONFIG_ARMV7_NONSEC
 bool armv7_boot_nonsec(void)
 {
-       char *s = getenv("bootm_boot_mode");
+       char *s = env_get("bootm_boot_mode");
        bool nonsec = armv7_boot_nonsec_default();
 
        if (s && !strcmp(s, "sec"))
@@ -361,7 +361,7 @@ static void boot_jump_linux(bootm_headers_t *images, int flag)
        ulong addr = (ulong)kernel_entry | 1;
        kernel_entry = (void *)addr;
 #endif
-       s = getenv("machid");
+       s = env_get("machid");
        if (s) {
                if (strict_strtoul(s, 16, &machid) < 0) {
                        debug("strict_strtoul failed!\n");
index 415ac89de9f1fe9d7f20e39d7e3928ed282617ae..bcd16ee5911f78ab44da48c53240351f1688bd16 100644 (file)
@@ -200,7 +200,7 @@ static int do_smhload(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
                /* Optionally save returned end to the environment */
                if (argc == 4) {
                        sprintf(end_str, "0x%08lx", end_addr);
-                       setenv(argv[3], end_str);
+                       env_set(argv[3], end_str);
                }
        } else {
                return CMD_RET_USAGE;
index ec331ba6bb89e16033b751d851c1ebe8e9efd250..461ff778c28bf21a8798dd7f97286bedf8c2e35c 100644 (file)
@@ -90,7 +90,7 @@ void davinci_sync_env_enetaddr(uint8_t *rom_enetaddr)
        uint8_t env_enetaddr[6];
        int ret;
 
-       ret = eth_getenv_enetaddr_by_index("eth", 0, env_enetaddr);
+       ret = eth_env_get_enetaddr_by_index("eth", 0, env_enetaddr);
        if (!ret) {
                /*
                 * There is no MAC address in the environment, so we
@@ -99,7 +99,7 @@ void davinci_sync_env_enetaddr(uint8_t *rom_enetaddr)
                debug("### Setting environment from EEPROM MAC address = "
                        "\"%pM\"\n",
                        env_enetaddr);
-               ret = !eth_setenv_enetaddr("ethaddr", rom_enetaddr);
+               ret = !eth_env_set_enetaddr("ethaddr", rom_enetaddr);
        }
        if (!ret)
                printf("Failed to set mac address from EEPROM: %d\n", ret);
index 8b1389f30f23a204b99e57cabdf94c847a67bbe9..2fb84f9453df9349ac1bf77f5a24c4b017d645ff 100644 (file)
@@ -8,7 +8,6 @@ config ARCH_EXYNOS4
        bool "Exynos4 SoC family"
        select CPU_V7
        select BOARD_EARLY_INIT_F
-       imply ENV_IS_IN_MMC
        help
          Samsung Exynos4 SoC family are based on ARM Cortex-A9 CPU. There
          are multiple SoCs in this family including Exynos4210, Exynos4412,
index 9bae748c674bf5ffc38c04d5b38a8180d2839713..a1aa36bc223b8286029f2ddea743e30516ffced2 100644 (file)
@@ -1,24 +1,32 @@
 if ARCH_MX6
 
+config MX6_SMP
+       select ARM_ERRATA_751472
+       select ARM_ERRATA_761320
+       select ARM_ERRATA_794072
+       select ARM_ERRATA_845369
+       bool
+
 config MX6
+       select ARM_ERRATA_743622 if !MX6UL
        bool
        default y
-       select ARM_ERRATA_743622 if !MX6UL
-       select ARM_ERRATA_751472 if !MX6UL
-       select ARM_ERRATA_761320 if !MX6UL
-       select ARM_ERRATA_794072 if !MX6UL
        imply CMD_FUSE
 
 config MX6D
+       select MX6_SMP
        bool
 
 config MX6DL
+       select MX6_SMP
        bool
 
 config MX6Q
+       select MX6_SMP
        bool
 
 config MX6QDL
+       select MX6_SMP
        bool
 
 config MX6S
@@ -30,7 +38,6 @@ config MX6SL
 config MX6SX
        select ROM_UNIFIED_SECTIONS
        bool
-       imply ENV_IS_IN_MMC
 
 config MX6SLL
        select ROM_UNIFIED_SECTIONS
@@ -332,6 +339,11 @@ config TARGET_PCM058
        select BOARD_LATE_INIT
        select SUPPORT_SPL
 
+config TARGET_PFLA02
+       bool "Phytec PFLA02 (PhyFlex) i.MX6 Quad"
+       select BOARD_LATE_INIT
+       select SUPPORT_SPL
+
 config TARGET_SECOMX6
        bool "secomx6 boards"
 
@@ -429,6 +441,7 @@ source "board/freescale/mx6ul_14x14_evk/Kconfig"
 source "board/freescale/mx6ullevk/Kconfig"
 source "board/grinn/liteboard/Kconfig"
 source "board/phytec/pcm058/Kconfig"
+source "board/phytec/pfla02/Kconfig"
 source "board/gateworks/gw_ventana/Kconfig"
 source "board/kosagi/novena/Kconfig"
 source "board/samtec/vining_2000/Kconfig"
index 1f2739e8645e7806ae4fbaa8b5d614f2e0b20f4e..0e019c42622f8a4c2b7c0094cf0161646ab83c2b 100644 (file)
@@ -19,7 +19,7 @@ enum pll_clocks {
        PLL_USBOTG,     /* OTG USB PLL */
        PLL_ENET,       /* ENET PLL */
        PLL_AUDIO,      /* AUDIO PLL */
-       PLL_VIDEO,      /* AUDIO PLL */
+       PLL_VIDEO,      /* VIDEO PLL */
 };
 
 struct mxc_ccm_reg *imx_ccm = (struct mxc_ccm_reg *)CCM_BASE_ADDR;
index 22b244079b055d36ec10b925fb447a185ac49cdc..f8d7e8ee680c865e984888b0bb38f6696d9a4194 100644 (file)
@@ -132,7 +132,7 @@ int board_late_init(void)
        /* In bootstrap don't use the env vars */
        if (((reg & 0x3000000) >> 24) == 0x1) {
                set_default_env(NULL);
-               setenv("preboot", "");
+               env_set("preboot", "");
        }
 
        return opos6ul_board_late_init();
index af316735ee83917060cc929b1fe01457928c4a5e..9ede1f543527e78186896f378691bc74573f2802 100644 (file)
@@ -114,6 +114,12 @@ u32 get_cpu_rev(void)
 #define OCOTP_CFG3_SPEED_528MHZ 1
 #define OCOTP_CFG3_SPEED_696MHZ 2
 
+/*
+ * For i.MX6ULL
+ */
+#define OCOTP_CFG3_SPEED_792MHZ 2
+#define OCOTP_CFG3_SPEED_900MHZ 3
+
 u32 get_cpu_speed_grade_hz(void)
 {
        struct ocotp_regs *ocotp = (struct ocotp_regs *)OCOTP_BASE_ADDR;
@@ -126,11 +132,22 @@ u32 get_cpu_speed_grade_hz(void)
        val >>= OCOTP_CFG3_SPEED_SHIFT;
        val &= 0x3;
 
-       if (is_mx6ul() || is_mx6ull()) {
+       if (is_mx6ul()) {
                if (val == OCOTP_CFG3_SPEED_528MHZ)
                        return 528000000;
                else if (val == OCOTP_CFG3_SPEED_696MHZ)
-                       return 69600000;
+                       return 696000000;
+               else
+                       return 0;
+       }
+
+       if (is_mx6ull()) {
+               if (val == OCOTP_CFG3_SPEED_528MHZ)
+                       return 528000000;
+               else if (val == OCOTP_CFG3_SPEED_792MHZ)
+                       return 792000000;
+               else if (val == OCOTP_CFG3_SPEED_900MHZ)
+                       return 900000000;
                else
                        return 0;
        }
@@ -234,6 +251,10 @@ static int set_ldo_voltage(enum ldo_reg ldo, u32 mv)
        u32 val, step, old, reg = readl(&anatop->reg_core);
        u8 shift;
 
+       /* No LDO_SOC/PU/ARM */
+       if (is_mx6sll())
+               return 0;
+
        if (mv < 725)
                val = 0x00;     /* Power gated off */
        else if (mv > 1450)
@@ -293,7 +314,7 @@ static void clear_mmdc_ch_mask(void)
        reg = readl(&mxc_ccm->ccdr);
 
        /* Clear MMDC channel mask */
-       if (is_mx6sx() || is_mx6ul() || is_mx6ull() || is_mx6sl())
+       if (is_mx6sx() || is_mx6ul() || is_mx6ull() || is_mx6sl() || is_mx6sll())
                reg &= ~(MXC_CCM_CCDR_MMDC_CH1_HS_MASK);
        else
                reg &= ~(MXC_CCM_CCDR_MMDC_CH1_HS_MASK | MXC_CCM_CCDR_MMDC_CH0_HS_MASK);
@@ -344,20 +365,10 @@ static void init_bandgap(void)
        }
 }
 
-#ifdef CONFIG_MX6SL
-static void set_preclk_from_osc(void)
-{
-       struct mxc_ccm_reg *mxc_ccm = (struct mxc_ccm_reg *)CCM_BASE_ADDR;
-       u32 reg;
-
-       reg = readl(&mxc_ccm->cscmr1);
-       reg |= MXC_CCM_CSCMR1_PER_CLK_SEL_MASK;
-       writel(reg, &mxc_ccm->cscmr1);
-}
-#endif
-
 int arch_cpu_init(void)
 {
+       struct mxc_ccm_reg *ccm = (struct mxc_ccm_reg *)CCM_BASE_ADDR;
+
        init_aips();
 
        /* Need to clear MMDC_CHx_MASK to make warm reset work. */
@@ -421,12 +432,14 @@ int arch_cpu_init(void)
        }
 
        /* Set perclk to source from OSC 24MHz */
-#if defined(CONFIG_MX6SL)
-       set_preclk_from_osc();
-#endif
+       if (is_mx6sl())
+               setbits_le32(&ccm->cscmr1, MXC_CCM_CSCMR1_PER_CLK_SEL_MASK);
 
        imx_set_wdog_powerdown(false); /* Disable PDE bit of WMCR register */
 
+       if (is_mx6sx())
+               setbits_le32(&ccm->cscdr1, MXC_CCM_CSCDR1_UART_CLK_SEL);
+
        init_src();
 
        return 0;
@@ -495,6 +508,10 @@ uint mmc_get_env_part(struct mmc *mmc)
 
 int board_postclk_init(void)
 {
+       /* NO LDO SOC on i.MX6SLL */
+       if (is_mx6sll())
+               return 0;
+
        set_ldo_voltage(LDO_SOC, 1175); /* Set VDDSOC to 1.175V */
 
        return 0;
@@ -576,7 +593,7 @@ void s_init(void)
        u32 mask528;
        u32 reg, periph1, periph2;
 
-       if (is_mx6sx() || is_mx6ul() || is_mx6ull())
+       if (is_mx6sx() || is_mx6ul() || is_mx6ull() || is_mx6sll())
                return;
 
        /* Due to hardware limitation, on MX6Q we need to gate/ungate all PFDs
index 7053697f9bde563a495da3687e27af0fdfc989ed..aea85265ef20a4b72980f0748cf53400255c2445 100644 (file)
@@ -13,7 +13,6 @@ config MX7D
        select ROM_UNIFIED_SECTIONS
        imply CMD_FUSE
        bool
-       imply ENV_IS_IN_MMC
 
 choice
        prompt "MX7 board select"
index 4cf977e20a30ea8dbfbda83f99645561b75c8909..87bf105f385d4c12bee6d038c0ba50e2e588124c 100644 (file)
@@ -31,7 +31,7 @@ U_BOOT_DEVICE(imx7_thermal) = {
 };
 #endif
 
-#ifdef CONFIG_IMX_RDC
+#if CONFIG_IS_ENABLED(IMX_RDC)
 /*
  * In current design, if any peripheral was assigned to both A7 and M4,
  * it will receive ipg_stop or ipg_wait when any of the 2 platforms enter
@@ -245,8 +245,9 @@ int arch_cpu_init(void)
        mxs_dma_init();
 #endif
 
-       if (IS_ENABLED(CONFIG_IMX_RDC))
-               isolate_resource();
+#if CONFIG_IS_ENABLED(IMX_RDC)
+       isolate_resource();
+#endif
 
        return 0;
 }
@@ -256,9 +257,9 @@ int arch_misc_init(void)
 {
 #ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG
        if (is_mx7d())
-               setenv("soc", "imx7d");
+               env_set("soc", "imx7d");
        else
-               setenv("soc", "imx7s");
+               env_set("soc", "imx7s");
 #endif
 
        return 0;
index 55242f0eaabaedad4a8dce5ef4cec0e996eb7f74..c670c5dfc9c23e9459caec50704315e52829d5ca 100644 (file)
@@ -10,7 +10,7 @@ int board_video_skip(void)
 {
        int i;
        int ret;
-       char const *panel = getenv("panel");
+       char const *panel = env_get("panel");
 
        if (!panel) {
                for (i = 0; i < display_count; i++) {
index 5146e51f9cab1452a1e03e8a9652434fe02d9377..d506ee5b39cda6eb051c396259b0800df6f986ac 100644 (file)
@@ -11,13 +11,11 @@ config ARCH_INTEGRATOR_AP
 config ARCH_INTEGRATOR_CP
        bool "Support Integrator/CP platform"
        select ARCH_CINTEGRATOR
-       imply ENV_IS_IN_FLASH
 
 endchoice
 
 config ARCH_CINTEGRATOR
        bool
-       imply ENV_IS_IN_FLASH
 
 choice
        prompt "Integrator core module select"
index 4cad6a2d81c33a508f1623be9f847d81ff2874f9..b2f5414a5c6c31cf59f8445579ecb22c183af013 100644 (file)
@@ -331,7 +331,7 @@ void ddr3_check_ecc_int(u32 base)
        int ecc_test = 0;
        u32 value = __raw_readl(base + KS2_DDR3_ECC_INT_STATUS_OFFSET);
 
-       env = getenv("ecc_test");
+       env = env_get("ecc_test");
        if (env)
                ecc_test = simple_strtol(env, NULL, 0);
 
index beb8a767c44a7bcd0dc13f8c54393d391f37c77e..fcabfbd5c3907c8a92da76bd632beac918e7d515 100644 (file)
@@ -46,7 +46,7 @@ int misc_init_r(void)
        char *env;
        long ks2_debug = 0;
 
-       env = getenv("ks2_debug");
+       env = env_get("ks2_debug");
 
        if (env)
                ks2_debug = simple_strtol(env, NULL, 0);
index 4c9d3fde47f58af4915676505bd0cb80d2cd1f45..db2ff0311cfd0dac58cd3d7c7d353ea7c483a1f1 100644 (file)
@@ -129,7 +129,7 @@ int kw_config_adr_windows(void)
 static void kw_sysrst_action(void)
 {
        int ret;
-       char *s = getenv("sysrstcmd");
+       char *s = env_get("sysrstcmd");
 
        if (!s) {
                debug("Error.. %s failed, check sysrstcmd\n",
@@ -153,7 +153,7 @@ static void kw_sysrst_check(void)
        /*
         * no action if sysrstdelay environment variable is not defined
         */
-       s = getenv("sysrstdelay");
+       s = env_get("sysrstdelay");
        if (s == NULL)
                return;
 
index 1b12b330608e8f4aeb3710ecf08f67843e68df3d..01d700bf2e3058d3e2fd2758040ba5133502f1e3 100644 (file)
@@ -32,7 +32,6 @@ config ARMADA_38X
 config ARMADA_XP
        bool
        select ARMADA_32BIT
-       imply ENV_IS_IN_SPI_FLASH
 
 # ARMv8 SoCs...
 config ARMADA_3700
index 700e6c2f7985e77053cecd98c797eb17d7d59c9f..26245aa1694e47283c2acdeac8e322ed06fe1b76 100644 (file)
@@ -10,6 +10,7 @@
 
 #include <common.h>
 #include <ahci.h>
+#include <environment.h>
 #include <spl.h>
 #include <asm/omap_common.h>
 #include <asm/arch/omap.h>
@@ -240,8 +241,8 @@ void arch_preboot_os(void)
 int fb_set_reboot_flag(void)
 {
        printf("Setting reboot to fastboot flag ...\n");
-       setenv("dofastboot", "1");
-       saveenv();
+       env_set("dofastboot", "1");
+       env_save();
        return 0;
 }
 #endif
index 1946641eb902af291e357c0a7fc3c1c3208fefdd..0b0bf1837c9cb89ac074356f9c3e081b858a63ff 100644 (file)
@@ -40,7 +40,7 @@ static void omap_set_fastboot_cpu(void)
                printf("Warning: fastboot.cpu: unknown CPU rev: %u\n", cpu_rev);
        }
 
-       setenv("fastboot.cpu", cpu);
+       env_set("fastboot.cpu", cpu);
 }
 
 static void omap_set_fastboot_secure(void)
@@ -63,18 +63,18 @@ static void omap_set_fastboot_secure(void)
                printf("Warning: fastboot.secure: unknown CPU sec: %u\n", dev);
        }
 
-       setenv("fastboot.secure", secure);
+       env_set("fastboot.secure", secure);
 }
 
 static void omap_set_fastboot_board_rev(void)
 {
        const char *board_rev;
 
-       board_rev = getenv("board_rev");
+       board_rev = env_get("board_rev");
        if (board_rev == NULL)
                printf("Warning: fastboot.board_rev: unknown board revision\n");
 
-       setenv("fastboot.board_rev", board_rev);
+       env_set("fastboot.board_rev", board_rev);
 }
 
 #ifdef CONFIG_FASTBOOT_FLASH_MMC_DEV
@@ -118,7 +118,7 @@ static void omap_set_fastboot_userdata_size(void)
                sprintf(buf, "%u", sz_kb);
        }
 
-       setenv("fastboot.userdata_size", buf);
+       env_set("fastboot.userdata_size", buf);
 }
 #else
 static inline void omap_set_fastboot_userdata_size(void)
@@ -169,11 +169,11 @@ void omap_die_id_serial(void)
 
        omap_die_id((unsigned int *)&die_id);
 
-       if (!getenv("serial#")) {
+       if (!env_get("serial#")) {
                snprintf(serial_string, sizeof(serial_string),
                        "%08x%08x", die_id[0], die_id[3]);
 
-               setenv("serial#", serial_string);
+               env_set("serial#", serial_string);
        }
 }
 
@@ -182,7 +182,7 @@ void omap_die_id_get_board_serial(struct tag_serialnr *serialnr)
        char *serial_string;
        unsigned long long serial;
 
-       serial_string = getenv("serial#");
+       serial_string = env_get("serial#");
 
        if (serial_string) {
                serial = simple_strtoull(serial_string, NULL, 16);
@@ -202,7 +202,7 @@ void omap_die_id_usbethaddr(void)
 
        omap_die_id((unsigned int *)&die_id);
 
-       if (!getenv("usbethaddr")) {
+       if (!env_get("usbethaddr")) {
                /*
                 * Create a fake MAC address from the processor ID code.
                 * First byte is 0x02 to signify locally administered.
@@ -214,7 +214,7 @@ void omap_die_id_usbethaddr(void)
                mac[4] = die_id[0] & 0xff;
                mac[5] = (die_id[0] >> 8) & 0xff;
 
-               eth_setenv_enetaddr("usbethaddr", mac);
+               eth_env_set_enetaddr("usbethaddr", mac);
        }
 }
 
index 26ea23b01400686a76a7dbf0ae23340f99ae4742..a3457f391449a9f943675a8c296ac6f3d9b0d0a3 100644 (file)
@@ -34,11 +34,11 @@ static void setup_boot_mode(void)
        switch (boot_mode) {
        case BOOT_FASTBOOT:
                printf("enter fastboot!\n");
-               setenv("preboot", "setenv preboot; fastboot usb0");
+               env_set("preboot", "setenv preboot; fastboot usb0");
                break;
        case BOOT_UMS:
                printf("enter UMS!\n");
-               setenv("preboot", "setenv preboot; ums mmc 0");
+               env_set("preboot", "setenv preboot; ums mmc 0");
                break;
        }
 }
index b6543a5108216bfd692d0348e665046a6b83a491..1e79c19309656cc76ba7b708975f4887cb117b19 100644 (file)
@@ -30,11 +30,11 @@ static void setup_boot_mode(void)
        switch (boot_mode) {
        case BOOT_FASTBOOT:
                printf("enter fastboot!\n");
-               setenv("preboot", "setenv preboot; fastboot usb0");
+               env_set("preboot", "setenv preboot; fastboot usb0");
                break;
        case BOOT_UMS:
                printf("enter UMS!\n");
-               setenv("preboot", "setenv preboot; ums mmc 0");
+               env_set("preboot", "setenv preboot; ums mmc 0");
                break;
        }
 }
index d5f568c7932fe0501153361796a0e081ad1fd31e..74c6cc14a140e51b9cd78fe61c9754485b27b9c3 100644 (file)
@@ -37,11 +37,11 @@ static void setup_boot_mode(void)
        switch (boot_mode) {
        case BOOT_FASTBOOT:
                printf("enter fastboot!\n");
-               setenv("preboot", "setenv preboot; fastboot usb0");
+               env_set("preboot", "setenv preboot; fastboot usb0");
                break;
        case BOOT_UMS:
                printf("enter UMS!\n");
-               setenv("preboot", "setenv preboot; if mmc dev 0;"
+               env_set("preboot", "setenv preboot; if mmc dev 0;"
                       "then ums mmc 0; else ums mmc 1;fi");
                break;
        }
index 49b26b3570f9ea418833b8582098c261cba668d1..2f1da740fbe0ffe53fdf70e270ad000b8772cab8 100644 (file)
@@ -219,9 +219,9 @@ int arch_misc_init(void)
 {
        const u32 bsel = readl(&sysmgr_regs->bootinfo) & 0x7;
        const int fpga_id = socfpga_fpga_id(0);
-       setenv("bootmode", bsel_str[bsel].mode);
+       env_set("bootmode", bsel_str[bsel].mode);
        if (fpga_id >= 0)
-               setenv("fpgatype", socfpga_fpga_model[fpga_id].var);
+               env_set("fpgatype", socfpga_fpga_model[fpga_id].var);
        return socfpga_eth_reset();
 }
 #endif
index 386befb4e7b893ee8920973f31395f853c24b55d..2cd7bae078b896c0dec41d750b7f34153b23ad56 100644 (file)
@@ -62,7 +62,6 @@ config MACH_SUNXI_H3_H5
        select SUNXI_DRAM_DW_32BIT
        select SUNXI_GEN_SUN6I
        select SUPPORT_SPL
-       imply ENV_IS_IN_MMC
 
 choice
        prompt "Sunxi SoC Variant"
@@ -74,7 +73,6 @@ config MACH_SUN4I
        select ARM_CORTEX_CPU_IS_UP
        select SUNXI_GEN_SUN4I
        select SUPPORT_SPL
-       imply ENV_IS_IN_MMC
 
 config MACH_SUN5I
        bool "sun5i (Allwinner A13)"
@@ -92,7 +90,6 @@ config MACH_SUN6I
        select SUNXI_GEN_SUN6I
        select SUPPORT_SPL
        select ARMV7_BOOT_SEC_DEFAULT if OLD_SUNXI_KERNEL_COMPAT
-       imply ENV_IS_IN_MMC
 
 config MACH_SUN7I
        bool "sun7i (Allwinner A20)"
@@ -103,7 +100,6 @@ config MACH_SUN7I
        select SUNXI_GEN_SUN4I
        select SUPPORT_SPL
        select ARMV7_BOOT_SEC_DEFAULT if OLD_SUNXI_KERNEL_COMPAT
-       imply ENV_IS_IN_MMC
 
 config MACH_SUN8I_A23
        bool "sun8i (Allwinner A23)"
@@ -114,7 +110,6 @@ config MACH_SUN8I_A23
        select SUNXI_GEN_SUN6I
        select SUPPORT_SPL
        select ARMV7_BOOT_SEC_DEFAULT if OLD_SUNXI_KERNEL_COMPAT
-       imply ENV_IS_IN_MMC
 
 config MACH_SUN8I_A33
        bool "sun8i (Allwinner A33)"
@@ -140,7 +135,6 @@ config MACH_SUN8I_H3
        select ARCH_SUPPORT_PSCI
        select MACH_SUNXI_H3_H5
        select ARMV7_BOOT_SEC_DEFAULT if OLD_SUNXI_KERNEL_COMPAT
-       imply ENV_IS_IN_MMC
 
 config MACH_SUN8I_R40
        bool "sun8i (Allwinner R40)"
index ec5b026ef56a18d803fd8a62219da22721a5d83d..870ff5b1e0983dd2e72a02a7194792cf27b71ed0 100644 (file)
@@ -66,11 +66,17 @@ void clock_init_sec(void)
 #ifdef CONFIG_MACH_SUNXI_H3_H5
        struct sunxi_ccm_reg * const ccm =
                (struct sunxi_ccm_reg *)SUNXI_CCM_BASE;
+       struct sunxi_prcm_reg * const prcm =
+               (struct sunxi_prcm_reg *)SUNXI_PRCM_BASE;
 
        setbits_le32(&ccm->ccu_sec_switch,
                     CCM_SEC_SWITCH_MBUS_NONSEC |
                     CCM_SEC_SWITCH_BUS_NONSEC |
                     CCM_SEC_SWITCH_PLL_NONSEC);
+       setbits_le32(&prcm->prcm_sec_switch,
+                    PRCM_SEC_SWITCH_APB0_CLK_NONSEC |
+                    PRCM_SEC_SWITCH_PLL_CFG_NONSEC |
+                    PRCM_SEC_SWITCH_PWR_GATE_NONSEC);
 #endif
 }
 
index 58085dc0a36b8f5eec3fe276db78f23eaa3a5dd1..51e50907d27a25177ebc9e6bbbcd9306e0a346c0 100644 (file)
@@ -60,7 +60,6 @@ config TEGRA_ARMV8_COMMON
        bool "Tegra 64-bit common options"
        select ARM64
        select TEGRA_COMMON
-       imply ENV_IS_IN_MMC
 
 choice
        prompt "Tegra SoC select"
@@ -78,7 +77,6 @@ config TEGRA30
        select ARM_ERRATA_743622
        select ARM_ERRATA_751472
        select TEGRA_ARMV7_COMMON
-       imply ENV_IS_IN_MMC
 
 config TEGRA114
        bool "Tegra114 family"
@@ -87,7 +85,6 @@ config TEGRA114
 config TEGRA124
        bool "Tegra124 family"
        select TEGRA_ARMV7_COMMON
-       imply ENV_IS_IN_MMC
        imply REGMAP
        imply SYSCON
 
index bd137969f07b20b386e08a3c8a06115aac132661..0426b7a95a963c547b22ecffa9b30c73671023fc 100644 (file)
@@ -214,9 +214,9 @@ int board_late_init(void)
 #if defined(CONFIG_TEGRA_SUPPORT_NON_SECURE)
        if (tegra_cpu_is_non_secure()) {
                printf("CPU is in NS mode\n");
-               setenv("cpu_ns_mode", "1");
+               env_set("cpu_ns_mode", "1");
        } else {
-               setenv("cpu_ns_mode", "");
+               env_set("cpu_ns_mode", "");
        }
 #endif
        start_cpu_fan();
index feb935f0d9085618537aa7013a5d6595b415d098..b94eb424aaa2bbc9d8e46dbfd86dfa5cde3290f0 100644 (file)
@@ -15,7 +15,7 @@ static int set_fdt_addr(void)
 {
        int ret;
 
-       ret = setenv_hex("fdt_addr", nvtboot_boot_x0);
+       ret = env_set_hex("fdt_addr", nvtboot_boot_x0);
        if (ret) {
                printf("Failed to set fdt_addr to point at DTB: %d\n", ret);
                return ret;
@@ -35,7 +35,7 @@ static int set_ethaddr_from_nvtboot(void)
        const u32 *prop;
 
        /* Already a valid address in the environment? If so, keep it */
-       if (getenv("ethaddr"))
+       if (env_get("ethaddr"))
                return 0;
 
        node = fdt_path_offset(nvtboot_blob, "/chosen");
@@ -49,7 +49,7 @@ static int set_ethaddr_from_nvtboot(void)
                return -ENOENT;
        }
 
-       ret = setenv("ethaddr", (void *)prop);
+       ret = env_set("ethaddr", (void *)prop);
        if (ret) {
                printf("Failed to set ethaddr from nvtboot DTB: %d\n", ret);
                return ret;
index 4bfa10b374ad8b2306f052d1ee75fb5f8e4dfe1a..b9a2cbe14865454f7939d774a8177ed2ca3e0211 100644 (file)
@@ -37,7 +37,7 @@ static int uniphier_set_fdt_file(void)
        char dtb_name[256];
        int buf_len = sizeof(dtb_name);
 
-       if (getenv("fdt_file"))
+       if (env_get("fdt_file"))
                return 0;       /* do nothing if it is already set */
 
        compat = fdt_stringlist_get(gd->fdt_blob, 0, "compatible", 0, NULL);
@@ -55,7 +55,7 @@ static int uniphier_set_fdt_file(void)
 
        strncat(dtb_name, ".dtb", buf_len);
 
-       return setenv("fdt_file", dtb_name);
+       return env_set("fdt_file", dtb_name);
 }
 
 int board_late_init(void)
@@ -65,20 +65,20 @@ int board_late_init(void)
        switch (uniphier_boot_device_raw()) {
        case BOOT_DEVICE_MMC1:
                printf("eMMC Boot");
-               setenv("bootmode", "emmcboot");
+               env_set("bootmode", "emmcboot");
                break;
        case BOOT_DEVICE_NAND:
                printf("NAND Boot");
-               setenv("bootmode", "nandboot");
+               env_set("bootmode", "nandboot");
                nand_denali_wp_disable();
                break;
        case BOOT_DEVICE_NOR:
                printf("NOR Boot");
-               setenv("bootmode", "norboot");
+               env_set("bootmode", "norboot");
                break;
        case BOOT_DEVICE_USB:
                printf("USB Boot");
-               setenv("bootmode", "usbboot");
+               env_set("bootmode", "usbboot");
                break;
        default:
                printf("Unknown");
index 8c45229a8953f77459cba4cf58111b135eba3365..acc859a6c3f917ce7abaaafaac13208e644ebfca 100644 (file)
@@ -35,7 +35,7 @@ static int do_mmcsetn(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
        if (dev < 0)
                return CMD_RET_FAILURE;
 
-       setenv_ulong("mmc_first_dev", dev);
+       env_set_ulong("mmc_first_dev", dev);
        return CMD_RET_SUCCESS;
 }
 
index 88e7d6a7b67d669d9c1685b7011de728f076e7ce..26509b73c64773ae5716a744b8b9e39631e2a89a 100644 (file)
@@ -10,7 +10,6 @@ config MCF520x
 
 config MCF52x2
        bool
-       imply ENV_IS_IN_FLASH
 
 config MCF523x
        bool
@@ -23,7 +22,6 @@ config MCF5301x
 
 config MCF532x
        bool
-       imply ENV_IS_IN_FLASH
 
 config MCF537x
        bool
@@ -39,7 +37,6 @@ config MCF5227x
 
 config MCF547x_8x
        bool
-       imply ENV_IS_IN_FLASH
 
 # processor type
 config M5208
@@ -73,7 +70,6 @@ config M5275
 config M5282
        bool
        select MCF52x2
-       imply ENV_IS_IN_FLASH
 
 config M5307
        bool
@@ -111,12 +107,10 @@ config M52277
 config M547x
        bool
        select MCF547x_8x
-       imply ENV_IS_IN_FLASH
 
 config M548x
        bool
        select MCF547x_8x
-       imply ENV_IS_IN_FLASH
 
 choice
        prompt "Target select"
@@ -197,12 +191,10 @@ config TARGET_M54455EVB
 config TARGET_M5475EVB
        bool "Support M5475EVB"
        select M547x
-       imply ENV_IS_IN_FLASH
 
 config TARGET_M5485EVB
        bool "Support M5485EVB"
        select M548x
-       imply ENV_IS_IN_FLASH
 
 config TARGET_AMCORE
        bool "Support AMCORE"
index fa9c4930814e470a058419ded5878386c246bd6b..c976904fa9ca5d198a06278af9da82a0e90cb4eb 100644 (file)
@@ -113,7 +113,8 @@ static void set_clocks_in_mhz (bd_t *kbd)
 {
        char *s;
 
-       if ((s = getenv("clocks_in_mhz")) != NULL) {
+       s = env_get("clocks_in_mhz");
+       if (s) {
                /* convert all clock information to MHz */
                kbd->bi_intfreq /= 1000000L;
                kbd->bi_busfreq /= 1000000L;
index 2732203b93e7f30489aa97b3d31f401ad28ee045..0a286e82c2be8d6e45b559a51cb389b3251f5644 100644 (file)
@@ -27,7 +27,7 @@ int do_bootm_linux(int flag, int argc, char * const argv[],
 {
        /* First parameter is mapped to $r5 for kernel boot args */
        void    (*thekernel) (char *, ulong, ulong);
-       char    *commandline = getenv("bootargs");
+       char    *commandline = env_get("bootargs");
        ulong   rd_data_start, rd_data_end;
 
        /*
index b53206bf8ee78fb655c093e93a3ea9fc2ace8a26..d07b92d1b442b86be928b28ee08b0cb1fbfe23c4 100644 (file)
@@ -21,7 +21,6 @@ config TARGET_QEMU_MIPS
        select SUPPORTS_CPU_MIPS64_R1
        select SUPPORTS_CPU_MIPS64_R2
        select ROM_EXCEPTION_VECTORS
-       imply ENV_IS_IN_FLASH
 
 config TARGET_MALTA
        bool "Support malta"
@@ -43,7 +42,6 @@ config TARGET_MALTA
        select SWAP_IO_SPACE
        select MIPS_L1_CACHE_SHIFT_6
        select ROM_EXCEPTION_VECTORS
-       imply ENV_IS_IN_FLASH
 
 config TARGET_VCT
        bool "Support vct"
@@ -85,7 +83,6 @@ config ARCH_BMIPS
        select CPU
        select RAM
        select SYSRESET
-       imply ENV_IS_NOWHERE
 
 config MACH_PIC32
        bool "Support Microchip PIC32"
@@ -110,7 +107,6 @@ config TARGET_BOSTON
        select SUPPORTS_CPU_MIPS64_R2
        select SUPPORTS_CPU_MIPS64_R6
        select ROM_EXCEPTION_VECTORS
-       imply ENV_IS_IN_FLASH
 
 config TARGET_XILFPGA
        bool "Support Imagination Xilfpga"
@@ -200,7 +196,6 @@ config CPU_MIPS64_R2
        bool "MIPS64 Release 2"
        depends on SUPPORTS_CPU_MIPS64_R2
        select 64BIT
-       imply ENV_IS_IN_FLASH
        help
          Choose this option to build a kernel for release 2 through 5 of the
          MIPS64 architecture.
index 2b6790524c80a03268a86ccab8a8a6b6bdcc3b34..5a9a2811ffb5b86e0bb410025c1b6276a93d4c3e 100644 (file)
@@ -80,7 +80,7 @@ static void linux_cmdline_legacy(bootm_headers_t *images)
 
        linux_cmdline_init();
 
-       bootargs = getenv("bootargs");
+       bootargs = env_get("bootargs");
        if (!bootargs)
                return;
 
@@ -202,11 +202,11 @@ static void linux_env_legacy(bootm_headers_t *images)
        sprintf(env_buf, "0x%X", (uint) (gd->bd->bi_flashsize));
        linux_env_set("flash_size", env_buf);
 
-       cp = getenv("ethaddr");
+       cp = env_get("ethaddr");
        if (cp)
                linux_env_set("ethaddr", cp);
 
-       cp = getenv("eth1addr");
+       cp = env_get("eth1addr");
        if (cp)
                linux_env_set("eth1addr", cp);
 
index 21aadf284f11843d74b104ac4f0f0e074fe2dcf9..e834329e0b68db16f3f9ae726d5a0816162b5c5b 100644 (file)
@@ -50,7 +50,7 @@ int do_bootm_linux(int flag, int argc, char *argv[], bootm_headers_t *images)
        void    (*theKernel)(int zero, int arch, uint params);
 
 #ifdef CONFIG_CMDLINE_TAG
-       char *commandline = getenv("bootargs");
+       char *commandline = env_get("bootargs");
 #endif
 
        /*
@@ -64,7 +64,7 @@ int do_bootm_linux(int flag, int argc, char *argv[], bootm_headers_t *images)
 
        theKernel = (void (*)(int, int, uint))images->ep;
 
-       s = getenv("machid");
+       s = env_get("machid");
        if (s) {
                machid = simple_strtoul(s, NULL, 16);
                printf("Using machid 0x%x from environment\n", machid);
index 4e5c269193d9d32ee7dc83650a6d7a88e47aedb6..00ade2c57319a5f34e450f93329e9e44fff80b94 100644 (file)
@@ -12,7 +12,7 @@
 int do_bootm_linux(int flag, int argc, char * const argv[], bootm_headers_t *images)
 {
        void (*kernel)(int, int, int, char *) = (void *)images->ep;
-       char *commandline = getenv("bootargs");
+       char *commandline = env_get("bootargs");
        ulong initrd_start = images->rd_start;
        ulong initrd_end = images->rd_end;
        char *of_flat_tree = NULL;
index 7ac5cbfca6b66957417282276763d223f63ef646..e4b3043fa2263c05e8c5ec711d3c7988e989d055 100644 (file)
@@ -28,7 +28,6 @@ config MPC86xx
        bool "MPC86xx"
        select SYS_FSL_DDR
        select SYS_FSL_DDR_BE
-       imply ENV_IS_IN_FLASH
        imply CMD_REGINFO
 
 config 8xx
index c66d6616a4264c473ad95fd3173438ee2e1b68d9..a3779734c1abc5e41d252d8ccee2b2374a558f11 100644 (file)
@@ -13,7 +13,6 @@ config TARGET_MPC8308_P1M
 
 config TARGET_SBC8349
        bool "Support sbc8349"
-       imply ENV_IS_IN_FLASH
 
 config TARGET_VE8313
        bool "Support ve8313"
@@ -40,7 +39,6 @@ config TARGET_MPC8323ERDB
 config TARGET_MPC832XEMDS
        bool "Support MPC832XEMDS"
        select BOARD_EARLY_INIT_F
-       imply ENV_IS_IN_FLASH
 
 config TARGET_MPC8349EMDS
        bool "Support MPC8349EMDS"
@@ -52,7 +50,6 @@ config TARGET_MPC8349EMDS
 config TARGET_MPC8349ITX
        bool "Support MPC8349ITX"
        imply CMD_IRQ
-       imply ENV_IS_IN_FLASH
 
 config TARGET_MPC837XEMDS
        bool "Support MPC837XEMDS"
@@ -77,13 +74,11 @@ config TARGET_SUVD3
        bool "Support suvd3"
        imply CMD_CRAMFS
        imply FS_CRAMFS
-       imply ENV_IS_IN_FLASH
 
 config TARGET_TUXX1
        bool "Support tuxx1"
        imply CMD_CRAMFS
        imply FS_CRAMFS
-       imply ENV_IS_IN_FLASH
 
 config TARGET_TQM834X
        bool "Support TQM834x"
@@ -95,7 +90,6 @@ config TARGET_HRCON
 config TARGET_STRIDER
        bool "Support strider"
        select SYS_FSL_ERRATUM_ESDHC111
-       imply ENV_IS_IN_FLASH
        imply CMD_PCA953X
 
 endchoice
index ccdf103624ccad44161d4a0c3fdc101d3c8dc4e5..92187d371be39f0dfbb16ace7577cc3352f1c8cc 100644 (file)
@@ -19,7 +19,6 @@ choice
 config TARGET_SBC8548
        bool "Support sbc8548"
        select ARCH_MPC8548
-       imply ENV_IS_IN_FLASH
 
 config TARGET_SOCRATES
        bool "Support socrates"
@@ -105,7 +104,6 @@ config TARGET_MPC8544DS
 config TARGET_MPC8548CDS
        bool "Support MPC8548CDS"
        select ARCH_MPC8548
-       imply ENV_IS_IN_FLASH
 
 config TARGET_MPC8555CDS
        bool "Support MPC8555CDS"
@@ -565,7 +563,6 @@ config ARCH_MPC8548
        select SYS_FSL_SEC_BE
        select SYS_FSL_SEC_COMPAT_2
        select SYS_PPC_E500_USE_DEBUG_TLB
-       imply ENV_IS_IN_FLASH
        imply CMD_REGINFO
 
 config ARCH_MPC8555
@@ -616,7 +613,6 @@ config ARCH_MPC8572
        select SYS_PPC_E500_USE_DEBUG_TLB
        select FSL_ELBC
        imply CMD_NAND
-       imply ENV_IS_IN_FLASH
 
 config ARCH_P1010
        bool
index a3076d8d71005a16d0d166d9c8c9ea55b78c0d83..ea46e498534910efa09ce80536ccda890a9a15fb 100644 (file)
@@ -256,7 +256,7 @@ static void enable_tdm_law(void)
         * is not setup properly yet. Search for tdm entry in
         * hwconfig.
         */
-       ret = getenv_f("hwconfig", buffer, sizeof(buffer));
+       ret = env_get_f("hwconfig", buffer, sizeof(buffer));
        if (ret > 0) {
                tdm_hwconfig_enabled = hwconfig_f("tdm", buffer);
                /* If tdm is defined in hwconfig, set law for tdm workaround */
@@ -280,7 +280,7 @@ void enable_cpc(void)
        cpc_corenet_t *cpc = (cpc_corenet_t *)CONFIG_SYS_FSL_CPC_ADDR;
 
        /* Extract hwconfig from environment */
-       ret = getenv_f("hwconfig", buffer, sizeof(buffer));
+       ret = env_get_f("hwconfig", buffer, sizeof(buffer));
        if (ret > 0) {
                /*
                 * If "en_cpc" is not defined in hwconfig then by default all
@@ -754,7 +754,7 @@ int cpu_init_r(void)
        char *buf = NULL;
        int n, res;
 
-       n = getenv_f("hwconfig", buffer, sizeof(buffer));
+       n = env_get_f("hwconfig", buffer, sizeof(buffer));
        if (n > 0)
                buf = buffer;
 
@@ -794,7 +794,7 @@ int cpu_init_r(void)
 #endif
 
 #if defined(CONFIG_PPC_SPINTABLE_COMPATIBLE) && defined(CONFIG_MP)
-       spin = getenv("spin_table_compat");
+       spin = env_get("spin_table_compat");
        if (spin && (*spin == 'n'))
                spin_table_compat = 0;
        else
@@ -845,7 +845,7 @@ int cpu_init_r(void)
 #ifdef CONFIG_SYS_SRIO
        srio_init();
 #ifdef CONFIG_SRIO_PCIE_BOOT_MASTER
-       char *s = getenv("bootmaster");
+       char *s = env_get("bootmaster");
        if (s) {
                if (!strcmp(s, "SRIO1")) {
                        srio_boot_master(1);
index caa0bf9bdc1d889876f4b9a61ac99675c2b0b4b4..297dc4af4808111755dc5a1d70a53704efcccd98 100644 (file)
@@ -92,7 +92,7 @@ void ft_fixup_cpu(void *blob, u64 memory_limit)
         * Extract hwconfig from environment.
         * Search for tdm entry in hwconfig.
         */
-       ret = getenv_f("hwconfig", buffer, sizeof(buffer));
+       ret = env_get_f("hwconfig", buffer, sizeof(buffer));
        if (ret > 0)
                tdm_hwconfig_enabled = hwconfig_f("tdm", buffer);
 
@@ -580,7 +580,7 @@ static void fdt_fixup_l2_switch(void *blob)
                return;
 
        /* Get MAC address for the l2switch from "l2switchaddr"*/
-       if (!eth_getenv_enetaddr("l2switchaddr", l2swaddr)) {
+       if (!eth_env_get_enetaddr("l2switchaddr", l2swaddr)) {
                printf("Warning: MAC address for l2switch not found\n");
                memset(l2swaddr, 0, sizeof(l2swaddr));
        }
index 1bc0c64cfc30ebcce129bd0c14d5ee5c0497acb7..79d6544a09805da4267016058300278e519ce503 100644 (file)
@@ -514,7 +514,7 @@ void fsl_serdes_init(void)
         * Extract hwconfig from environment since we have not properly setup
         * the environment but need it for ddr config params
         */
-       if (getenv_f("hwconfig", buffer, sizeof(buffer)) > 0)
+       if (env_get_f("hwconfig", buffer, sizeof(buffer)) > 0)
                buf = buffer;
 #endif
        if (serdes_prtcl_map & (1 << NONE))
index 0addf8493c2577bbd6d07e66c383f2eb3e3f422c..2ea9f5c7be0fe4c4869776d0920c051046394b33 100644 (file)
@@ -31,7 +31,7 @@ u32 get_my_id()
 int hold_cores_in_reset(int verbose)
 {
        /* Default to no, overridden by 'y', 'yes', 'Y', 'Yes', or '1' */
-       if (getenv_yesno("mp_holdoff") == 1) {
+       if (env_get_yesno("mp_holdoff") == 1) {
                if (verbose) {
                        puts("Secondary cores are being held in reset.\n");
                        puts("See 'mp_holdoff' environment variable\n");
index fe56efdf55b1b59623e6fc672de9fa90d5422752..2cc180da38972bca7ba7e4890188f8a92b1b5a85 100644 (file)
@@ -40,7 +40,6 @@ config ARCH_MPC8641
        select FSL_LAW
        select SYS_FSL_HAS_DDR1
        select SYS_FSL_HAS_DDR2
-       imply ENV_IS_IN_FLASH
 
 config FSL_LAW
        bool
index 0e204027af21491b258010030cee9a688135ec47..b9ae24dc98b6bc334060fe429586d33eeb5c0678 100644 (file)
@@ -86,7 +86,7 @@ static void boot_jump_linux(bootm_headers_t *images)
                debug ("   Booting using OF flat tree...\n");
                WATCHDOG_RESET ();
                (*kernel) ((bd_t *)of_flat_tree, 0, 0, EPAPR_MAGIC,
-                          getenv_bootm_mapsize(), 0, 0);
+                          env_get_bootm_mapsize(), 0, 0);
                /* does not return */
        } else
 #endif
@@ -121,8 +121,8 @@ void arch_lmb_reserve(struct lmb *lmb)
        phys_size_t bootm_size;
        ulong size, sp, bootmap_base;
 
-       bootmap_base = getenv_bootm_low();
-       bootm_size = getenv_bootm_size();
+       bootmap_base = env_get_bootm_low();
+       bootm_size = env_get_bootm_size();
 
 #ifdef DEBUG
        if (((u64)bootmap_base + bootm_size) >
@@ -275,7 +275,8 @@ static void set_clocks_in_mhz (bd_t *kbd)
 {
        char    *s;
 
-       if ((s = getenv ("clocks_in_mhz")) != NULL) {
+       s = env_get("clocks_in_mhz");
+       if (s) {
                /* convert all clock information to MHz */
                kbd->bi_intfreq /= 1000000L;
                kbd->bi_busfreq /= 1000000L;
@@ -339,6 +340,6 @@ void boot_jump_vxworks(bootm_headers_t *images)
 
        ((void (*)(void *, ulong, ulong, ulong,
                ulong, ulong, ulong))images->ep)(images->ft_addr,
-               0, 0, EPAPR_MAGIC, getenv_bootm_mapsize(), 0, 0);
+               0, 0, EPAPR_MAGIC, env_get_bootm_mapsize(), 0, 0);
 }
 #endif
index fa32df02fc4af3e3d5fda6b0b3e17684b2d99a26..d20761e66cad03e988df35f6ae4512adba77ecd9 100644 (file)
@@ -3,16 +3,13 @@ menu "SuperH architecture"
 
 config CPU_SH2
        bool
-       imply ENV_IS_IN_FLASH
 
 config CPU_SH2A
        bool
        select CPU_SH2
-       imply ENV_IS_IN_FLASH
 
 config CPU_SH3
        bool
-       imply ENV_IS_IN_FLASH
 
 config CPU_SH4
        bool
index bbf9ff485f3ae0b2c8c85c77d957b173e3f34894..7fc91bc4aaaa746a1e8c137a060b818109c3914b 100644 (file)
@@ -33,9 +33,9 @@ SECTIONS
                KEEP(CONFIG_BOARDDIR/lowlevel_init.o    (.text .spiboot1.text))
                KEEP(*(.spiboot2.text))
                . = ALIGN(8192);
-               common/env_embedded.o   (.ppcenv)
+               env/embedded.o  (.ppcenv)
                . = ALIGN(8192);
-               common/env_embedded.o   (.ppcenvr)
+               env/embedded.o  (.ppcenvr)
                . = ALIGN(8192);
                *(.text)
                . = ALIGN(4);
index 8a0010be23797d4ac075e0b5818d7d7e11e3e284..09fbd5e5df8ddae7e0e6797069a7732d829b346f 100644 (file)
@@ -61,7 +61,7 @@ int do_bootm_linux(int flag, int argc, char * const argv[], bootm_headers_t *ima
        char *cmdline = (char *)param + COMMAND_LINE;
        /* PAGE_SIZE */
        unsigned long size = images->ep - (unsigned long)param;
-       char *bootargs = getenv("bootargs");
+       char *bootargs = env_get("bootargs");
 
        /*
         * allow the PREP bootm subcommand, it is required for bootm to work
index 3fea5f5b532108c124123ba32f996118991b5d51..cd4abba10aa3e9f364e12330b45e3006a2eba394 100644 (file)
@@ -42,7 +42,7 @@ int do_sh_zimageboot (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 
        /* Linux kernel command line */
        cmdline = (char *)param + COMMAND_LINE;
-       bootargs = getenv("bootargs");
+       bootargs = env_get("bootargs");
 
        /* Clear zero page */
        /* cppcheck-suppress nullPointer */
index 9374c121f930730021fdb1f9491f7993ec1ea57e..75dbbc27f120c6d5f703a63b5bb28ecd4cbbd5f7 100644 (file)
@@ -10,7 +10,6 @@ config INTEL_BAYTRAIL
        select ARCH_MISC_INIT if !EFI
        imply HAVE_INTEL_ME if !EFI
        imply ENABLE_MRC_CACHE
-       imply ENV_IS_IN_SPI_FLASH
        imply AHCI_PCI
        imply ICH_SPI
        imply INTEL_ICH6_GPIO
index b421f18202bd4d6058c24bc7cbbdf4fad0541707..bc2dba2bd7c816629880dbbed40d9180c890eb99 100644 (file)
@@ -9,7 +9,6 @@ config INTEL_BROADWELL
        select ARCH_EARLY_INIT_R
        imply HAVE_INTEL_ME
        imply ENABLE_MRC_CACHE
-       imply ENV_IS_IN_SPI_FLASH
        imply AHCI_PCI
        imply ICH_SPI
        imply INTEL_BROADWELL_GPIO
index d4e0587fc585c5c2a7c99fb4b31aca82b31e49f3..60eb45f9d0ab00f9f49fed8bbc47a5c05b27a2c3 100644 (file)
@@ -3,7 +3,6 @@ if TARGET_COREBOOT
 config SYS_COREBOOT
        bool
        default y
-       imply ENV_IS_NOWHERE
        imply AHCI_PCI
        imply E1000
        imply ICH_SPI
index 00f99d6b110db422a2cbd43f80461ed4fedd88ca..c214ea0efe0931485a9a128b2833b0237b740523 100644 (file)
@@ -10,7 +10,6 @@ config NORTHBRIDGE_INTEL_IVYBRIDGE
        select CACHE_MRC_BIN if HAVE_MRC
        imply HAVE_INTEL_ME
        imply ENABLE_MRC_CACHE
-       imply ENV_IS_IN_SPI_FLASH
        imply AHCI_PCI
        imply ICH_SPI
        imply INTEL_ICH6_GPIO
index fdf5ae338ec11c81a07e2da369ca9f9a6974040c..da378128fecf8c51aedd23ec644e58b5f5f17dbb 100644 (file)
@@ -7,7 +7,6 @@
 config QEMU
        bool
        select ARCH_EARLY_INIT_R
-       imply ENV_IS_NOWHERE
        imply AHCI_PCI
        imply E1000
        imply SYS_NS16550
index 7ec46e95ef79e0a16b9c70ee5c8f74fa04a0651c..0ed724813d9e1d9af65c84f8faa4814e47de6912 100644 (file)
@@ -10,7 +10,6 @@ config INTEL_QUARK
        select ARCH_EARLY_INIT_R
        select ARCH_MISC_INIT
        imply ENABLE_MRC_CACHE
-       imply ENV_IS_IN_SPI_FLASH
        imply ETH_DESIGNWARE
        imply ICH_SPI
        imply INTEL_ICH6_GPIO
index d1b04c952a099a123b6557cb35139678694583f9..835de85268dd4c1612b481b4050a26e3bcfc1622 100644 (file)
@@ -9,7 +9,6 @@ config INTEL_QUEENSBAY
        select HAVE_FSP
        select HAVE_CMC
        select ARCH_EARLY_INIT_R
-       imply ENV_IS_IN_SPI_FLASH
        imply AHCI_PCI
        imply ICH_SPI
        imply INTEL_ICH6_GPIO
index aafbeb01f907ea4d49a9f343085b6d3e9f491d1b..00172dc7c130180fbd5062a791975f9419c23adb 100644 (file)
@@ -48,15 +48,15 @@ static void build_command_line(char *command_line, int auto_boot)
 
        command_line[0] = '\0';
 
-       env_command_line =  getenv("bootargs");
+       env_command_line =  env_get("bootargs");
 
        /* set console= argument if we use a serial console */
        if (!strstr(env_command_line, "console=")) {
-               if (!strcmp(getenv("stdout"), "serial")) {
+               if (!strcmp(env_get("stdout"), "serial")) {
 
                        /* We seem to use serial console */
                        sprintf(command_line, "console=ttyS0,%s ",
-                               getenv("baudrate"));
+                               env_get("baudrate"));
                }
        }
 
@@ -285,7 +285,7 @@ int do_zboot(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
                /* argv[1] holds the address of the bzImage */
                s = argv[1];
        } else {
-               s = getenv("fileaddr");
+               s = env_get("fileaddr");
        }
 
        if (s)
index 1604bb95368879e319dd01cbf937faf63d2ea9b9..16961acba5dd1e0f9b541e536e79425b3292ca7b 100644 (file)
@@ -136,7 +136,7 @@ int do_bootm_linux(int flag, int argc, char *argv[], bootm_headers_t *images)
 {
        struct bp_tag *params, *params_start;
        ulong initrd_start, initrd_end;
-       char *commandline = getenv("bootargs");
+       char *commandline = env_get("bootargs");
 
        if (!(flag & (BOOTM_STATE_OS_GO | BOOTM_STATE_OS_FAKE_GO)))
                return 0;
index fa6b4853f9b063ce2d042f8618928d127f330a84..0d3ac88fffea84975cd98428f75999f534ad7207 100644 (file)
@@ -138,7 +138,7 @@ int get_arc_info(void)
                        printf("\t<not found>\n");
                } else {
                        printf("\t%s\n", smac[3]);
-                       setenv("SERIAL", smac[3]);
+                       env_set("SERIAL", smac[3]);
                }
        }
 
@@ -149,10 +149,10 @@ int get_arc_info(void)
        if (smac[2][0] == 0xFF) {
                printf("\t<not found>\n");
        } else {
-               char *ret = getenv("ethaddr");
+               char *ret = env_get("ethaddr");
 
                if (strcmp(ret, __stringify(CONFIG_ETHADDR)) == 0) {
-                       setenv("ethaddr", smac[2]);
+                       env_set("ethaddr", smac[2]);
                        printf("\t%s (factory)\n", smac[2]);
                } else {
                        printf("\t%s\n", ret);
@@ -160,8 +160,8 @@ int get_arc_info(void)
        }
 
        if (strcmp(smac[1], "00:00:00:00:00:00") == 0) {
-               setenv("eth1addr", smac[2]);
-               setenv("eth2addr", smac[2]);
+               env_set("eth1addr", smac[2]);
+               env_set("eth2addr", smac[2]);
                return 0;
        }
 
@@ -169,10 +169,10 @@ int get_arc_info(void)
        if (smac[1][0] == 0xFF) {
                printf("\t<not found>\n");
        } else {
-               char *ret = getenv("eth1addr");
+               char *ret = env_get("eth1addr");
 
                if (strcmp(ret, __stringify(CONFIG_ETH1ADDR)) == 0) {
-                       setenv("eth1addr", smac[1]);
+                       env_set("eth1addr", smac[1]);
                        printf("\t%s (factory)\n", smac[1]);
                } else {
                        printf("\t%s\n", ret);
@@ -180,7 +180,7 @@ int get_arc_info(void)
        }
 
        if (strcmp(smac[0], "00:00:00:00:00:00") == 0) {
-               setenv("eth2addr", smac[1]);
+               env_set("eth2addr", smac[1]);
                return 0;
        }
 
@@ -188,10 +188,10 @@ int get_arc_info(void)
        if (smac[0][0] == 0xFF) {
                printf("\t<not found>\n");
        } else {
-               char *ret = getenv("eth2addr");
+               char *ret = env_get("eth2addr");
 
                if (strcmp(ret, __stringify(CONFIG_ETH2ADDR)) == 0) {
-                       setenv("eth2addr", smac[0]);
+                       env_set("eth2addr", smac[0]);
                        printf("\t%s (factory)\n", smac[0]);
                } else {
                        printf("\t%s\n", ret);
index cd484fc44b3aeaf05a26950e1acba1920b3e496d..b5e7a5db060dc80e9926b66a2482d6608af284e7 100644 (file)
@@ -10,6 +10,7 @@
 
 #include <common.h>
 #include <console.h>
+#include <environment.h>
 #include <ns16550.h>
 #include <malloc.h>
 #include <mmc.h>
@@ -99,7 +100,7 @@ void board_init_r(gd_t *gd, ulong dest_addr)
        nand_spl_load_image(CONFIG_ENV_OFFSET, CONFIG_ENV_SIZE,
                            (uchar *)CONFIG_ENV_ADDR);
        gd->env_addr = (ulong)(CONFIG_ENV_ADDR);
-       gd->env_valid = 1;
+       gd->env_valid = ENV_VALID;
 #else
        env_relocate();
 #endif
index 0d086e87fa30db1f8864efdcaa4c1b0b8ffb01c7..3f786a20148b59feb939fd9403cab2cf6faf8f24 100644 (file)
@@ -64,7 +64,7 @@ void board_gpio_init(void)
 
        for (i = 0; i < GPIO_MAX_NUM; i++) {
                sprintf(envname, "GPIO%d", i);
-               val = getenv(envname);
+               val = env_get(envname);
                if (val) {
                        char direction = toupper(val[0]);
                        char level = toupper(val[1]);
@@ -82,7 +82,7 @@ void board_gpio_init(void)
                }
        }
 
-       val = getenv("PCIE_OFF");
+       val = env_get("PCIE_OFF");
        if (val) {
                gpio_direction_input(GPIO_PCIE1_EN);
                gpio_direction_input(GPIO_PCIE2_EN);
@@ -91,7 +91,7 @@ void board_gpio_init(void)
                gpio_direction_output(GPIO_PCIE2_EN, 1);
        }
 
-       val = getenv("SDHC_CDWP_OFF");
+       val = env_get("SDHC_CDWP_OFF");
        if (!val) {
                ccsr_gur_t *gur = (void *)(CONFIG_SYS_MPC85xx_GUTS_ADDR);
 
@@ -214,7 +214,7 @@ int last_stage_init(void)
        else
                printf("NCT72(0x%x): ready\n", id2);
 
-       kval = getenv("kernelargs");
+       kval = env_get("kernelargs");
 
        mmc = find_mmc_device(0);
        if (mmc)
@@ -230,21 +230,21 @@ int last_stage_init(void)
                                strcat(newkernelargs, mmckargs);
                                strcat(newkernelargs, " ");
                                strcat(newkernelargs, &tmp[n]);
-                               setenv("kernelargs", newkernelargs);
+                               env_set("kernelargs", newkernelargs);
                        } else {
-                               setenv("kernelargs", mmckargs);
+                               env_set("kernelargs", mmckargs);
                        }
                }
        get_arc_info();
 
        if (kval) {
-               sval = getenv("SERIAL");
+               sval = env_get("SERIAL");
                if (sval) {
                        strcpy(newkernelargs, "SN=");
                        strcat(newkernelargs, sval);
                        strcat(newkernelargs, " ");
                        strcat(newkernelargs, kval);
-                       setenv("kernelargs", newkernelargs);
+                       env_set("kernelargs", newkernelargs);
                }
        } else {
                printf("Error reading kernelargs env variable!\n");
@@ -307,8 +307,8 @@ int ft_board_setup(void *blob, bd_t *bd)
 
        ft_cpu_setup(blob, bd);
 
-       base = getenv_bootm_low();
-       size = getenv_bootm_size();
+       base = env_get_bootm_low();
+       size = env_get_bootm_size();
 
        fdt_fixup_memory(blob, (u64)base, (u64)size);
 
index 3a584021ac71dc5225c33f75defa481638fdbff9..d203429738e3b84f345111c3933bcb04f6e57730 100644 (file)
@@ -157,7 +157,7 @@ u32 get_board_rev(void)
        u32 maxcpuclk = CONFIG_DA850_EVM_MAX_CPU_CLK;
        u32 rev = 0;
 
-       s = getenv("maxcpuclk");
+       s = env_get("maxcpuclk");
        if (s)
                maxcpuclk = simple_strtoul(s, NULL, 10);
 
index a22722122bd680f8657391e6f46e56fad9c0fb3e..6083479f2b07006fac21a2294a5cccd5cb720787 100644 (file)
@@ -167,7 +167,7 @@ int board_late_init(void)
                lcd_position_cursor(1, 8);
                lcd_puts(
                "switching to network-console ...       ");
-               setenv("bootcmd", "run netconsole");
+               env_set("bootcmd", "run netconsole");
        }
        return 0;
 }
index f4bfa410cc60ec7b21b8ae763db86ed909f54fa8..ca08f3cd90808e30572e0eb5f091c32123ffd407 100644 (file)
@@ -203,7 +203,7 @@ int board_late_init(void)
                                lcd_position_cursor(1, 8);
                                lcd_puts(
                                "switching to network-console ...       ");
-                               setenv("bootcmd", "run netconsole");
+                               env_set("bootcmd", "run netconsole");
                                cnt = 4;
                                break;
                        } else if (!gpio_get_value(ESC_KEY) &&
@@ -211,7 +211,7 @@ int board_late_init(void)
                                lcd_position_cursor(1, 8);
                                lcd_puts(
                                "starting u-boot script from USB ...    ");
-                               setenv("bootcmd", "run usbscript");
+                               env_set("bootcmd", "run usbscript");
                                cnt = 4;
                                break;
                        } else if ((!gpio_get_value(ESC_KEY) &&
@@ -221,7 +221,7 @@ int board_late_init(void)
                                lcd_position_cursor(1, 8);
                                lcd_puts(
                                "starting script from network ...      ");
-                               setenv("bootcmd", "run netscript");
+                               env_set("bootcmd", "run netscript");
                                cnt = 4;
                                break;
                        } else if (!gpio_get_value(ESC_KEY)) {
@@ -232,19 +232,19 @@ int board_late_init(void)
                lcd_position_cursor(1, 8);
                lcd_puts(
                "starting vxworks from network ...      ");
-               setenv("bootcmd", "run netboot");
+               env_set("bootcmd", "run netboot");
                cnt = 4;
        } else if (scratchreg == 0xCD) {
                lcd_position_cursor(1, 8);
                lcd_puts(
                "starting script from network ...      ");
-               setenv("bootcmd", "run netscript");
+               env_set("bootcmd", "run netscript");
                cnt = 4;
        } else if (scratchreg == 0xCE) {
                lcd_position_cursor(1, 8);
                lcd_puts(
                "starting AR from eMMC ...             ");
-               setenv("bootcmd", "run mmcboot");
+               env_set("bootcmd", "run mmcboot");
                cnt = 4;
        }
 
@@ -252,7 +252,7 @@ int board_late_init(void)
        switch (cnt) {
        case 0:
                lcd_puts("entering BOOT-mode.                    ");
-               setenv("bootcmd", "run defaultAR");
+               env_set("bootcmd", "run defaultAR");
                buf = 0x0000;
                break;
        case 1:
@@ -282,10 +282,10 @@ int board_late_init(void)
        snprintf(othbootargs, sizeof(othbootargs),
                 "u=vxWorksFTP pw=vxWorks o=0x%08x;0x%08x;0x%08x;0x%08x",
                 (unsigned int) gd->fb_base-0x20,
-                (u32)getenv_ulong("vx_memtop", 16, gd->fb_base-0x20),
-                (u32)getenv_ulong("vx_romfsbase", 16, 0),
-                (u32)getenv_ulong("vx_romfssize", 16, 0));
-       setenv("othbootargs", othbootargs);
+                (u32)env_get_ulong("vx_memtop", 16, gd->fb_base-0x20),
+                (u32)env_get_ulong("vx_romfsbase", 16, 0),
+                (u32)env_get_ulong("vx_romfssize", 16, 0));
+       env_set("othbootargs", othbootargs);
        /*
         * reset VBAR registers to its reset location, VxWorks 6.9.3.2 does
         * expect that vectors are there, original u-boot moves them to _start
index c3a56db76a69aab37a6ad26aa9dcdd4e22566fb7..c1cd0100239333993a1e8ff2ab58e2937e39e8a2 100644 (file)
@@ -58,9 +58,9 @@ void lcdbacklight(int on)
        unsigned int bright = FDTPROP(PATHINF, "brightdef");
        unsigned int pwmfrq = FDTPROP(PATHINF, "brightfdim");
 #else
-       unsigned int driver = getenv_ulong("ds1_bright_drv", 16, 0UL);
-       unsigned int bright = getenv_ulong("ds1_bright_def", 10, 50);
-       unsigned int pwmfrq = getenv_ulong("ds1_pwmfreq", 10, ~0UL);
+       unsigned int driver = env_get_ulong("ds1_bright_drv", 16, 0UL);
+       unsigned int bright = env_get_ulong("ds1_bright_def", 10, 50);
+       unsigned int pwmfrq = env_get_ulong("ds1_pwmfreq", 10, ~0UL);
 #endif
        unsigned int tmp;
        struct gptimer *timerhw;
@@ -184,22 +184,22 @@ int load_lcdtiming(struct am335x_lcdpanel *panel)
                puts("no 'factory-settings / rotation' in dtb!\n");
        }
        snprintf(buf, sizeof(buf), "fbcon=rotate:%d", panel_info.vl_rot);
-       setenv("optargs_rot", buf);
+       env_set("optargs_rot", buf);
 #else
-       pnltmp.hactive = getenv_ulong("ds1_hactive", 10, ~0UL);
-       pnltmp.vactive = getenv_ulong("ds1_vactive", 10, ~0UL);
-       pnltmp.bpp = getenv_ulong("ds1_bpp", 10, ~0UL);
-       pnltmp.hfp = getenv_ulong("ds1_hfp", 10, ~0UL);
-       pnltmp.hbp = getenv_ulong("ds1_hbp", 10, ~0UL);
-       pnltmp.hsw = getenv_ulong("ds1_hsw", 10, ~0UL);
-       pnltmp.vfp = getenv_ulong("ds1_vfp", 10, ~0UL);
-       pnltmp.vbp = getenv_ulong("ds1_vbp", 10, ~0UL);
-       pnltmp.vsw = getenv_ulong("ds1_vsw", 10, ~0UL);
-       pnltmp.pxl_clk_div = getenv_ulong("ds1_pxlclkdiv", 10, ~0UL);
-       pnltmp.pol = getenv_ulong("ds1_pol", 16, ~0UL);
-       pnltmp.pup_delay = getenv_ulong("ds1_pupdelay", 10, ~0UL);
-       pnltmp.pon_delay = getenv_ulong("ds1_tondelay", 10, ~0UL);
-       panel_info.vl_rot = getenv_ulong("ds1_rotation", 10, 0);
+       pnltmp.hactive = env_get_ulong("ds1_hactive", 10, ~0UL);
+       pnltmp.vactive = env_get_ulong("ds1_vactive", 10, ~0UL);
+       pnltmp.bpp = env_get_ulong("ds1_bpp", 10, ~0UL);
+       pnltmp.hfp = env_get_ulong("ds1_hfp", 10, ~0UL);
+       pnltmp.hbp = env_get_ulong("ds1_hbp", 10, ~0UL);
+       pnltmp.hsw = env_get_ulong("ds1_hsw", 10, ~0UL);
+       pnltmp.vfp = env_get_ulong("ds1_vfp", 10, ~0UL);
+       pnltmp.vbp = env_get_ulong("ds1_vbp", 10, ~0UL);
+       pnltmp.vsw = env_get_ulong("ds1_vsw", 10, ~0UL);
+       pnltmp.pxl_clk_div = env_get_ulong("ds1_pxlclkdiv", 10, ~0UL);
+       pnltmp.pol = env_get_ulong("ds1_pol", 16, ~0UL);
+       pnltmp.pup_delay = env_get_ulong("ds1_pupdelay", 10, ~0UL);
+       pnltmp.pon_delay = env_get_ulong("ds1_tondelay", 10, ~0UL);
+       panel_info.vl_rot = env_get_ulong("ds1_rotation", 10, 0);
 #endif
        if (
           ~0UL == (pnltmp.hactive) ||
@@ -251,7 +251,7 @@ static int load_devicetree(void)
 {
        int rc;
        loff_t dtbsize;
-       u32 dtbaddr = getenv_ulong("dtbaddr", 16, 0UL);
+       u32 dtbaddr = env_get_ulong("dtbaddr", 16, 0UL);
 
        if (dtbaddr == 0) {
                printf("%s: don't have a valid <dtbaddr> in env!\n", __func__);
@@ -263,9 +263,9 @@ static int load_devicetree(void)
                                (size_t *)&dtbsize,
                                NULL, 0x20000, (u_char *)dtbaddr);
 #else
-       char *dtbname = getenv("dtb");
-       char *dtbdev = getenv("dtbdev");
-       char *dtbpart = getenv("dtbpart");
+       char *dtbname = env_get("dtb");
+       char *dtbdev = env_get("dtbdev");
+       char *dtbpart = env_get("dtbpart");
        if (!dtbdev || !dtbpart || !dtbname) {
                printf("%s: <dtbdev>/<dtbpart>/<dtb> missing.\n", __func__);
                return -1;
@@ -375,7 +375,7 @@ int ft_board_setup(void *blob, bd_t *bd)
         * if no simplefb is requested through environment, we don't set up
         * one, instead we turn off backlight.
         */
-       if (getenv_ulong("simplefb", 10, 0) == 0) {
+       if (env_get_ulong("simplefb", 10, 0) == 0) {
                lcdbacklight(0);
                return 0;
        }
@@ -405,11 +405,11 @@ static void br_summaryscreen_printenv(char *prefix,
                                       char *name, char *altname,
                                       char *suffix)
 {
-       char *envval = getenv(name);
+       char *envval = env_get(name);
        if (0 != envval) {
                lcd_printf("%s %s %s", prefix, envval, suffix);
        } else if (0 != altname) {
-               envval = getenv(altname);
+               envval = env_get(altname);
                if (0 != envval)
                        lcd_printf("%s %s %s", prefix, envval, suffix);
        } else {
@@ -447,7 +447,7 @@ void lcdpower(int on)
        }
        pin = FDTPROP(PATHINF, "pwrpin");
 #else
-       pin = getenv_ulong("ds1_pwr", 16, ~0UL);
+       pin = env_get_ulong("ds1_pwr", 16, ~0UL);
 #endif
        if (pin == ~0UL) {
                puts("no pwrpin in dtb/env, cannot powerup display!\n");
@@ -657,7 +657,7 @@ int board_eth_init(bd_t *bis)
        mac_addr[4] = mac_lo & 0xFF;
        mac_addr[5] = (mac_lo & 0xFF00) >> 8;
 
-       if (!getenv("ethaddr")) {
+       if (!env_get("ethaddr")) {
                #if !defined(CONFIG_SPL_BUILD) && defined(CONFIG_USE_FDT)
                printf("<ethaddr> not set. trying DTB ... ");
                mac = dtbmacaddr(0);
@@ -670,7 +670,7 @@ int board_eth_init(bd_t *bis)
 
                if (mac) {
                        printf("using: %pM on ", mac);
-                       eth_setenv_enetaddr("ethaddr", (const u8 *)mac);
+                       eth_env_set_enetaddr("ethaddr", (const u8 *)mac);
                }
        }
        writel(MII_MODE_ENABLE, &cdev->miisel);
index a00a83a4a545a2c9d7385b46368e79448669caab..d23b9f3a4f32e263df6e27e52fee744586cbd0a2 100644 (file)
@@ -139,7 +139,7 @@ void hw_watchdog_init(void)
        int enable;
 
        enable = 1;
-       s = getenv("watchdog");
+       s = env_get("watchdog");
        if (s != NULL)
                if ((strncmp(s, "off", 3) == 0) || (strncmp(s, "0", 1) == 0))
                        enable = 0;
@@ -191,13 +191,13 @@ int drv_video_init(void)
        unsigned long splash;
 #endif
        printf("Init Video as ");
-       s = getenv("displaywidth");
+       s = env_get("displaywidth");
        if (s != NULL)
                display_width = simple_strtoul(s, NULL, 10);
        else
                display_width = 256;
 
-       s = getenv("displayheight");
+       s = env_get("displayheight");
        if (s != NULL)
                display_height = simple_strtoul(s, NULL, 10);
        else
@@ -211,7 +211,7 @@ int drv_video_init(void)
        vcxk_init(display_width, display_height);
 
 #ifdef CONFIG_SPLASH_SCREEN
-       s = getenv("splashimage");
+       s = env_get("splashimage");
        if (s != NULL) {
                splash = simple_strtoul(s, NULL, 16);
                vcxk_acknowledge_wait();
index a4275091d21573c42ee7b605d3a33b29a7b609e7..af66837909defadcd00210b61fdde698cdc59802 100644 (file)
@@ -285,7 +285,7 @@ static int set_regdomain(void)
                puts("EEPROM regdomain read failed.\n");
 
        printf("Regdomain set to %s\n", rd);
-       return setenv("regdomain", rd);
+       return env_set("regdomain", rd);
 }
 #endif
 
@@ -515,17 +515,17 @@ int misc_init_r(void)
        mac[5] = mac1[3];
 
        if (is_valid_ethaddr(mac))
-               eth_setenv_enetaddr("ethaddr", mac);
+               eth_env_set_enetaddr("ethaddr", mac);
 
        increment_mac(mac);
 
        if (is_valid_ethaddr(mac))
-               eth_setenv_enetaddr("eth1addr", mac);
+               eth_env_set_enetaddr("eth1addr", mac);
 
        increment_mac(mac);
 
        if (is_valid_ethaddr(mac))
-               eth_setenv_enetaddr("eth2addr", mac);
+               eth_env_set_enetaddr("eth2addr", mac);
 
 out:
 #endif
index 3cd4dc95fe32c111f507ca42c5c09eca3b8830a3..5e75eb0b6438e8d11e26b00925632ec890c1423a 100644 (file)
@@ -211,7 +211,7 @@ int ft_board_setup(void *blob, bd_t *bd)
                { "mxc_nand", MTD_DEV_TYPE_NAND, }, /* NAND flash */
        };
 
-       if (getenv("fdt_noauto")) {
+       if (env_get("fdt_noauto")) {
                puts("   Skiping ft_board_setup (fdt_noauto defined)\n");
                return 0;
        }
index 2e6e9ef916676e4370f68d98bcf05ce0a4063385..f639a37d4da01416dc26f6ad63198c1716c14345 100644 (file)
@@ -221,10 +221,10 @@ int misc_init_r(void)
 {
        init_fan();
 #if defined(CONFIG_CMD_I2C) && defined(CONFIG_SYS_I2C_EEPROM_ADDR)
-       if (!getenv("ethaddr")) {
+       if (!env_get("ethaddr")) {
                uchar mac[6];
                if (lacie_read_mac_address(mac) == 0)
-                       eth_setenv_enetaddr("ethaddr", mac);
+                       eth_env_set_enetaddr("ethaddr", mac);
        }
 #endif
        init_leds();
index 16d694716f78c7901aa14e52a8e53e3309b4ed0a..52f36644a3ea7c6dc8d18cb8eff3df61a02b7fda 100644 (file)
@@ -83,10 +83,10 @@ int board_init(void)
 int misc_init_r(void)
 {
 #if defined(CONFIG_CMD_I2C) && defined(CONFIG_SYS_I2C_EEPROM_ADDR)
-       if (!getenv("ethaddr")) {
+       if (!env_get("ethaddr")) {
                uchar mac[6];
                if (lacie_read_mac_address(mac) == 0)
-                       eth_setenv_enetaddr("ethaddr", mac);
+                       eth_env_set_enetaddr("ethaddr", mac);
        }
 #endif
        return 0;
index 20544e29c45325985f8a4e396891213ded37d533..6313882a5285dd68e1b57a8b911a27c08dadb6c5 100644 (file)
@@ -81,7 +81,7 @@ static int do_syno_populate(int argc, char * const argv[])
                         ethaddr[0], ethaddr[1], ethaddr[2],
                         ethaddr[3], ethaddr[4], ethaddr[5]);
                printf("parsed %s = %s\n", var, val);
-               setenv(var, val);
+               env_set(var, val);
        }
        if (!strncmp(buf + 32, SYNO_SN_TAG, strlen(SYNO_SN_TAG))) {
                char *snp, *csump;
@@ -111,7 +111,7 @@ static int do_syno_populate(int argc, char * const argv[])
                        goto out_unmap;
                }
                printf("parsed SN = %s\n", snp);
-               setenv("SN", snp);
+               env_set("SN", snp);
        } else {        /* old style format */
                unsigned char csum = 0;
 
@@ -125,7 +125,7 @@ static int do_syno_populate(int argc, char * const argv[])
                }
                bufp[n] = '\0';
                printf("parsed SN = %s\n", buf + 32);
-               setenv("SN", buf + 32);
+               env_set("SN", buf + 32);
        }
 out_unmap:
        unmap_physmem(buf, len);
index 13a9c6a0fe10e5b314ca98a0e09a125e98238afc..eead98b24eb39aabf732f096fba3a44987007292 100644 (file)
@@ -118,8 +118,8 @@ int misc_init_r(void)
        }
 
        if (reboot_mode[0] > 0 && isascii(reboot_mode[0])) {
-               if (!getenv("reboot-mode"))
-                       setenv("reboot-mode", (char *)reboot_mode);
+               if (!env_get("reboot-mode"))
+                       env_set("reboot-mode", (char *)reboot_mode);
        }
 
        omap_reboot_mode_clear();
index b29f56d5ebc0b0ac4539ad7425ce05ca3901e072..eac04d8178d2806cd28dacae40bf5f0bb68f1db4 100644 (file)
@@ -44,18 +44,18 @@ int misc_init_r(void)
        mdelay(10);
        setbits_le32(GXBB_GPIO_OUT(3), BIT(14));
 
-       if (!eth_getenv_enetaddr("ethaddr", mac_addr)) {
+       if (!eth_env_get_enetaddr("ethaddr", mac_addr)) {
                len = meson_sm_read_efuse(EFUSE_MAC_OFFSET,
                                          mac_addr, EFUSE_MAC_SIZE);
                if (len == EFUSE_MAC_SIZE && is_valid_ethaddr(mac_addr))
-                       eth_setenv_enetaddr("ethaddr", mac_addr);
+                       eth_env_set_enetaddr("ethaddr", mac_addr);
        }
 
-       if (!getenv("serial#")) {
+       if (!env_get("serial#")) {
                len = meson_sm_read_efuse(EFUSE_SN_OFFSET, serial,
                        EFUSE_SN_SIZE);
                if (len == EFUSE_SN_SIZE) 
-                       setenv("serial#", serial);
+                       env_set("serial#", serial);
        }
 
        return 0;
index b9294fc881bec328e6fd2ecacbc40ef9001bdf85..956c297e72de6c4e9244ff9556d0c429f800195f 100644 (file)
@@ -325,7 +325,7 @@ int board_init(void)
 
 int board_late_init(void)
 {
-       setenv("bootmode", boot_mode_sf ? "sf" : "emmc");
+       env_set("bootmode", boot_mode_sf ? "sf" : "emmc");
        return 0;
 }
 
index 6abc2159bbc59bc34bc52482a225a41cba1e5f6e..698715ca20698af270a8b599ebea59e95583b9fd 100644 (file)
@@ -651,7 +651,7 @@ int board_late_init(void)
 {
        char *my_bootdelay;
        char bootmode = 0;
-       char const *panel = getenv("panel");
+       char const *panel = env_get("panel");
 
        /*
         * Check the boot-source. If booting from NOR Flash,
@@ -668,11 +668,11 @@ int board_late_init(void)
        bootmode |= (gpio_get_value(IMX_GPIO_NR(7, 1)) ? 1 : 0) << 2;
 
        if (bootmode == 7) {
-               my_bootdelay = getenv("nor_bootdelay");
+               my_bootdelay = env_get("nor_bootdelay");
                if (my_bootdelay != NULL)
-                       setenv("bootdelay", my_bootdelay);
+                       env_set("bootdelay", my_bootdelay);
                else
-                       setenv("bootdelay", "-2");
+                       env_set("bootdelay", "-2");
        }
 
        /* if we have the lg panel, we can initialze it now */
index c3bafd453ebea8956631550bfbd2d8389a4dccd4..858f74e5cf0bcb137ece5bb3152ac9864e1e4c56 100644 (file)
@@ -116,7 +116,7 @@ extern void cm_remap(void);
 
 int misc_init_r (void)
 {
-       setenv("verify", "n");
+       env_set("verify", "n");
        return (0);
 }
 
index 48f45b35ce5705c677288fe264113f87d15b0613..3f0860c555a5d464eb44a1d164450d1900ff1e0f 100644 (file)
@@ -169,7 +169,7 @@ static int set_ethaddr_from_eeprom(void)
        const char *ETHADDR_NAME = "ethaddr";
        struct udevice *bus, *dev;
 
-       if (getenv(ETHADDR_NAME))
+       if (env_get(ETHADDR_NAME))
                return 0;
 
        if (uclass_get_device_by_seq(UCLASS_I2C, 1, &bus)) {
@@ -192,7 +192,7 @@ static int set_ethaddr_from_eeprom(void)
                return -1;
        }
 
-       return eth_setenv_enetaddr(ETHADDR_NAME, ethaddr);
+       return eth_env_set_enetaddr(ETHADDR_NAME, ethaddr);
 }
 #else
 static int set_ethaddr_from_eeprom(void)
index c1f2769f1c556d788b2acf58824f9279747c3c09..88bcd876c9562e4f17ab8e77ef8096f68e50282d 100644 (file)
@@ -267,7 +267,7 @@ int board_late_init(void)
                *p = tolower(*p);
 
        strcat(name, "ek.dtb");
-       setenv("dtb_name", name);
+       env_set("dtb_name", name);
 #endif
        return 0;
 }
index 1ad4ef93cfc7e5f2d11a7f1116b62a52b576d8b7..df10d6a0d0406c1b36a764979832da11ae1952b3 100644 (file)
@@ -312,9 +312,9 @@ int board_eth_init(bd_t *bis)
 
        /* depending on the phy address we can detect our board version */
        if (phydev->addr == 0)
-               setenv("boardver", "");
+               env_set("boardver", "");
        else
-               setenv("boardver", "mr");
+               env_set("boardver", "mr");
 
        printf("using phy at %d\n", phydev->addr);
        ret = fec_probe(bis, -1, base, bus, phydev);
index 67aca3cc43253722fd96e955c0d3d7e217a6e511..f284568ec92098a3380c056df495ecffb1a5b08a 100644 (file)
@@ -162,8 +162,8 @@ int spl_start_uboot(void)
 
 #ifdef CONFIG_SPL_ENV_SUPPORT
        env_init();
-       env_relocate_spec();
-       if (getenv_yesno("boot_os") != 1)
+       env_load();
+       if (env_get_yesno("boot_os") != 1)
                return 1;
 #endif
 
@@ -301,8 +301,8 @@ int board_init(void)
 int board_late_init(void)
 {
 #ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG
-       setenv("board_name", "BAV335xB");
-       setenv("board_rev", "B"); /* Fix me, but why bother.. */
+       env_set("board_name", "BAV335xB");
+       env_set("board_rev", "B"); /* Fix me, but why bother.. */
 #endif
        return 0;
 }
@@ -392,11 +392,11 @@ int board_eth_init(bd_t *bis)
 #if (defined(CONFIG_DRIVER_TI_CPSW) && !defined(CONFIG_SPL_BUILD)) || \
        (defined(CONFIG_SPL_ETH_SUPPORT) && defined(CONFIG_SPL_BUILD))
 
-       if (!getenv("ethaddr")) {
+       if (!env_get("ethaddr")) {
                printf("<ethaddr> not set. Validating first E-fuse MAC\n");
 
                if (is_valid_ethaddr(mac_addr))
-                       eth_setenv_enetaddr("ethaddr", mac_addr);
+                       eth_env_set_enetaddr("ethaddr", mac_addr);
        }
 
 #ifdef CONFIG_DRIVER_TI_CPSW
index 2215c29c9c625c1ffddb4508b86ddc8b740eff37..25e5c3d80cd989b9f64adb383933393178ba1103 100644 (file)
@@ -133,8 +133,8 @@ void get_board_serial(struct tag_serialnr *serialnr)
 #ifdef CONFIG_REVISION_TAG
 u32 get_board_rev(void)
 {
-       if (getenv("revision#") != NULL)
-               return simple_strtoul(getenv("revision#"), NULL, 10);
+       if (env_get("revision#") != NULL)
+               return simple_strtoul(env_get("revision#"), NULL, 10);
        return 0;
 }
 #endif
index e82c6918414088fbc53691f09eedf05ea1ee1295..8733a9af163b1489eb3a0d1f4e0f03aee1a911d3 100644 (file)
@@ -341,7 +341,7 @@ int board_init(void)
        at91_set_A_periph(AT91_PIN_PE6, 1);     /* power up */
 
        /* Select the second timing index for board rev 2 */
-       rev_str = getenv("board_rev");
+       rev_str = env_get("board_rev");
        if (rev_str && !strncmp(rev_str, "2", 1)) {
                struct udevice *dev;
 
@@ -368,7 +368,7 @@ int board_late_init(void)
         * Set MAC address so we do not need to init Ethernet before Linux
         * boot
         */
-       env_str = getenv("ethaddr");
+       env_str = env_get("ethaddr");
        if (env_str) {
                struct at91_emac *emac = (struct at91_emac *)ATMEL_BASE_EMAC;
                /* Parse MAC address */
@@ -385,7 +385,7 @@ int board_late_init(void)
                       &emac->sa2l);
                writel((env_enetaddr[4] | env_enetaddr[5] << 8), &emac->sa2h);
 
-               printf("MAC:   %s\n", getenv("ethaddr"));
+               printf("MAC:   %s\n", env_get("ethaddr"));
        } else {
                /* Not set in environment */
                printf("MAC:   not set\n");
index 38577f30f15ab91a9dd68f59343cca8f711e4958..999ed95c31d95a804fc57f8222be81d1938c1e59 100644 (file)
@@ -251,7 +251,7 @@ static void check_button_status(void)
 
        if (value == 0) {
                printf("front button activated !\n");
-               setenv("harakiri", "1");
+               env_set("harakiri", "1");
        }
 }
 
@@ -460,7 +460,7 @@ int board_late_init(void)
 #ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG
        if (shc_eeprom_valid)
                if (is_valid_ethaddr(header.mac_addr))
-                       eth_setenv_enetaddr("ethaddr", header.mac_addr);
+                       eth_env_set_enetaddr("ethaddr", header.mac_addr);
 #endif
 
        return 0;
@@ -545,11 +545,11 @@ int board_eth_init(bd_t *bis)
 
 #if (defined(CONFIG_DRIVER_TI_CPSW) && !defined(CONFIG_SPL_BUILD)) || \
        (defined(CONFIG_SPL_ETH_SUPPORT) && defined(CONFIG_SPL_BUILD))
-       if (!getenv("ethaddr")) {
+       if (!env_get("ethaddr")) {
                printf("<ethaddr> not set. Validating first E-fuse MAC\n");
 
                if (is_valid_ethaddr(mac_addr))
-                       eth_setenv_enetaddr("ethaddr", mac_addr);
+                       eth_env_set_enetaddr("ethaddr", mac_addr);
        }
 
        writel(MII_MODE_ENABLE, &cdev->miisel);
@@ -565,7 +565,7 @@ int board_eth_init(bd_t *bis)
 #if defined(CONFIG_USB_ETHER) && \
        (!defined(CONFIG_SPL_BUILD) || defined(CONFIG_SPL_USBETH_SUPPORT))
        if (is_valid_ethaddr(mac_addr))
-               eth_setenv_enetaddr("usbnet_devaddr", mac_addr);
+               eth_env_set_enetaddr("usbnet_devaddr", mac_addr);
 
        rv = usb_eth_initialize(bis);
        if (rv < 0)
index 17fd6f56eafb3fdebd3410a679b1f1a09eef97d1..3b92b64f6a40bcd8a3fefa85d9ba87659e8a92b8 100644 (file)
@@ -749,7 +749,7 @@ size_t display_count = ARRAY_SIZE(displays);
 
 int board_cfb_skip(void)
 {
-       return NULL != getenv("novideo");
+       return NULL != env_get("novideo");
 }
 
 static void setup_display(void)
@@ -954,7 +954,7 @@ static int do_kbd(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 {
        char envvalue[ARRAY_SIZE(buttons)+1];
        int numpressed = read_keys(envvalue);
-       setenv("keybd", envvalue);
+       env_set("keybd", envvalue);
        return numpressed == 0;
 }
 
@@ -974,7 +974,7 @@ static void preboot_keys(void)
        char keypress[ARRAY_SIZE(buttons)+1];
        numpressed = read_keys(keypress);
        if (numpressed) {
-               char *kbd_magic_keys = getenv("magic_keys");
+               char *kbd_magic_keys = env_get("magic_keys");
                char *suffix;
                /*
                 * loop over all magic keys
@@ -983,7 +983,7 @@ static void preboot_keys(void)
                        char *keys;
                        char magic[sizeof(kbd_magic_prefix) + 1];
                        sprintf(magic, "%s%c", kbd_magic_prefix, *suffix);
-                       keys = getenv(magic);
+                       keys = env_get(magic);
                        if (keys) {
                                if (!strcmp(keys, keypress))
                                        break;
@@ -993,9 +993,9 @@ static void preboot_keys(void)
                        char cmd_name[sizeof(kbd_command_prefix) + 1];
                        char *cmd;
                        sprintf(cmd_name, "%s%c", kbd_command_prefix, *suffix);
-                       cmd = getenv(cmd_name);
+                       cmd = env_get(cmd_name);
                        if (cmd) {
-                               setenv("preboot", cmd);
+                               env_set("preboot", cmd);
                                return;
                        }
                }
@@ -1021,6 +1021,6 @@ int misc_init_r(void)
 #ifdef CONFIG_CMD_BMODE
        add_board_boot_modes(board_boot_modes);
 #endif
-       setenv_hex("reset_cause", get_imx_reset_cause());
+       env_set_hex("reset_cause", get_imx_reset_cause());
        return 0;
 }
index 5f4c634362abef66b8fd293e8b046314934e77d6..0267582186a64df83435e95547e2e0895b2f269e 100644 (file)
@@ -103,7 +103,7 @@ int board_usb_init(int index, enum usb_init_type init)
 int g_dnl_bind_fixup(struct usb_device_descriptor *dev, const char *name)
 {
        debug("%s\n", __func__);
-       if (!getenv("serial#"))
+       if (!env_get("serial#"))
                g_dnl_set_serialnumber(CONFIG_USB_SERIALNO);
        return 0;
 }
index f5b94f6430fe80f049aa8228a171a2bff9c6ca27..8f48ccbf1c5f814adb6abeb391324f7527141c04 100644 (file)
@@ -110,7 +110,7 @@ int board_usb_init(int index, enum usb_init_type init)
 int g_dnl_bind_fixup(struct usb_device_descriptor *dev, const char *name)
 {
        debug("%s\n", __func__);
-       if (!getenv("serial#"))
+       if (!env_get("serial#"))
                g_dnl_set_serialnumber(CONFIG_USB_SERIALNO);
        return 0;
 }
index 0f3734587a5d83cac741592437f7b81f858b6ebf..2d01ac25d85e13684f92a88ebe6e7fbc215a59cc 100644 (file)
@@ -203,7 +203,7 @@ void check_enetaddr(void)
 {
        uchar enetaddr[6];
 
-       if (!eth_getenv_enetaddr("ethaddr", enetaddr)) {
+       if (!eth_env_get_enetaddr("ethaddr", enetaddr)) {
                /* signal unset/invalid ethaddr to user */
                set_led(LED_INFO_BLINKING);
        }
@@ -228,7 +228,7 @@ static void erase_environment(void)
 static void rescue_mode(void)
 {
        printf("Entering rescue mode..\n");
-       setenv("bootsource", "rescue");
+       env_set("bootsource", "rescue");
 }
 
 static void check_push_button(void)
index 0265e9bb360b74d9422eecd833585f02d4440349..f81fa95c18ae9b9e8b4ea43e8ac1f359ba3b045d 100644 (file)
@@ -86,14 +86,14 @@ int misc_init_r(void)
         * Default MAC address comes from CONFIG_ETHADDR + DIP switches 1-6.
         */
 
-       char *s = getenv("ethaddr");
+       char *s = env_get("ethaddr");
        if (s == 0) {
                unsigned int x;
                char s[] = __stringify(CONFIG_ETHBASE);
                x = (*(volatile u32 *)CONFIG_SYS_FPGAREG_DIPSW)
                        & FPGAREG_MAC_MASK;
                sprintf(&s[15], "%02x", x);
-               setenv("ethaddr", s);
+               env_set("ethaddr", s);
        }
 #endif /* CONFIG_CMD_NET */
 
index 542e534270e02389805a0f9433bf5183881b2834..b65646588a9d229a0e4ec275129b9739b72f93bf 100644 (file)
@@ -318,7 +318,7 @@ static const struct boot_mode board_boot_modes[] = {
 int board_late_init(void)
 {
        add_board_boot_modes(board_boot_modes);
-       setenv("board_name", "xpress");
+       env_set("board_name", "xpress");
 
        return 0;
 }
index 0c4bf91c130d8162840ad8d186461ae92f4b2f5c..b615fb9e7ee830b7b75a390aa4e244b1291eba68 100644 (file)
@@ -95,7 +95,7 @@ static int cl_som_am57x_handle_mac_address(char *env_name, uint port_num)
        int ret;
        uint8_t enetaddr[6];
 
-       ret = eth_getenv_enetaddr(env_name, enetaddr);
+       ret = eth_env_get_enetaddr(env_name, enetaddr);
        if (ret)
                return 0;
 
@@ -107,7 +107,7 @@ static int cl_som_am57x_handle_mac_address(char *env_name, uint port_num)
        if (!is_valid_ethaddr(enetaddr))
                return -1;
 
-       ret = eth_setenv_enetaddr(env_name, enetaddr);
+       ret = eth_env_set_enetaddr(env_name, enetaddr);
        if (ret)
                printf("cl-som-am57x: Failed to set Eth port %d MAC address\n",
                       port_num);
@@ -181,7 +181,7 @@ int board_eth_init(bd_t *bis)
        gpio_set_value(CL_SOM_AM57X_GPIO_PHY1_RST, 1);
        mdelay(20);
 
-       cpsw_phy_envval = getenv("cpsw_phy");
+       cpsw_phy_envval = env_get("cpsw_phy");
        if (cpsw_phy_envval != NULL)
                cpsw_act_phy = simple_strtoul(cpsw_phy_envval, NULL, 0);
 
index c59884a8c319489b1ab3bb33d2de64ed0fd28fc7..a1da2780aa444b5799d002dee8773ff76ccaffa1 100644 (file)
@@ -114,10 +114,10 @@ int board_video_skip(void)
 {
        int ret;
        struct display_info_t *preset;
-       char const *panel = getenv("displaytype");
+       char const *panel = env_get("displaytype");
 
        if (!panel) /* Also accept panel for backward compatibility */
-               panel = getenv("panel");
+               panel = env_get("panel");
 
        if (!panel)
                return -ENOENT;
@@ -470,7 +470,7 @@ static int handle_mac_address(char *env_var, uint eeprom_bus)
        unsigned char enetaddr[6];
        int rc;
 
-       rc = eth_getenv_enetaddr(env_var, enetaddr);
+       rc = eth_env_get_enetaddr(env_var, enetaddr);
        if (rc)
                return 0;
 
@@ -481,7 +481,7 @@ static int handle_mac_address(char *env_var, uint eeprom_bus)
        if (!is_valid_ethaddr(enetaddr))
                return -1;
 
-       return eth_setenv_enetaddr(env_var, enetaddr);
+       return eth_env_set_enetaddr(env_var, enetaddr);
 }
 
 #define SB_FX6_I2C_EEPROM_BUS  0
@@ -605,13 +605,13 @@ int ft_board_setup(void *blob, bd_t *bd)
        fdt_shrink_to_minimum(blob, 0); /* Make room for new properties */
 
        /* MAC addr */
-       if (eth_getenv_enetaddr("ethaddr", enetaddr)) {
+       if (eth_env_get_enetaddr("ethaddr", enetaddr)) {
                fdt_find_and_setprop(blob,
                                     "/soc/aips-bus@02100000/ethernet@02188000",
                                     "local-mac-address", enetaddr, 6, 1);
        }
 
-       if (eth_getenv_enetaddr("eth1addr", enetaddr)) {
+       if (eth_env_get_enetaddr("eth1addr", enetaddr)) {
                fdt_find_and_setprop(blob, "/eth@pcie", "local-mac-address",
                                     enetaddr, 6, 1);
        }
index c4506b910e3cb6ee9809b071918f7d795c7a9aaf..6f6ba49af578a4450ab4c4f7eb13d3bd6807f20c 100644 (file)
@@ -106,7 +106,7 @@ static int handle_mac_address(void)
        uchar enetaddr[6];
        int rv;
 
-       rv = eth_getenv_enetaddr("ethaddr", enetaddr);
+       rv = eth_env_get_enetaddr("ethaddr", enetaddr);
        if (rv)
                return 0;
 
@@ -117,7 +117,7 @@ static int handle_mac_address(void)
        if (!is_valid_ethaddr(enetaddr))
                return -1;
 
-       return eth_setenv_enetaddr("ethaddr", enetaddr);
+       return eth_env_set_enetaddr("ethaddr", enetaddr);
 }
 
 #define AR8051_PHY_DEBUG_ADDR_REG      0x1d
index da6709889ad4ba5ffbfeb9b46e4f879102a02ae7..be938eb2cf50b30eca232591efa418f9d1fee501 100644 (file)
@@ -434,7 +434,7 @@ static int handle_mac_address(void)
        unsigned char enetaddr[6];
        int rc;
 
-       rc = eth_getenv_enetaddr("ethaddr", enetaddr);
+       rc = eth_env_get_enetaddr("ethaddr", enetaddr);
        if (rc)
                return 0;
 
@@ -445,7 +445,7 @@ static int handle_mac_address(void)
        if (!is_valid_ethaddr(enetaddr))
                return -1;
 
-       return eth_setenv_enetaddr("ethaddr", enetaddr);
+       return eth_env_set_enetaddr("ethaddr", enetaddr);
 }
 
 /*
index 38eb641bc42464d4e82ac1f9c5f09b833c1a565c..0ff49dcdccc4ff8c8c76745cda4a1580fd7a2e01 100644 (file)
@@ -168,7 +168,7 @@ static int cm_t3517_handle_mac_address(void)
        unsigned char enetaddr[6];
        int ret;
 
-       ret = eth_getenv_enetaddr("ethaddr", enetaddr);
+       ret = eth_env_get_enetaddr("ethaddr", enetaddr);
        if (ret)
                return 0;
 
@@ -182,7 +182,7 @@ static int cm_t3517_handle_mac_address(void)
        if (!is_valid_ethaddr(enetaddr))
                return -1;
 
-       return eth_setenv_enetaddr("ethaddr", enetaddr);
+       return eth_env_set_enetaddr("ethaddr", enetaddr);
 }
 
 #define SB_T35_ETH_RST_GPIO 164
index 6437718415362a3ae0ad6c9531160f5d52fb5300..31730a4d1ca1f1782b3c8c87245af3beb8793045 100644 (file)
@@ -126,7 +126,7 @@ int ft_board_setup(void *blob, bd_t *bd)
        uint8_t enetaddr[6];
 
        /* MAC addr */
-       if (eth_getenv_enetaddr("usbethaddr", enetaddr)) {
+       if (eth_env_get_enetaddr("usbethaddr", enetaddr)) {
                fdt_find_and_setprop(blob, "/smsc95xx@0", "mac-address",
                                     enetaddr, 6, 1);
        }
@@ -161,7 +161,7 @@ static int handle_mac_address(void)
        uint8_t enetaddr[6];
        int ret;
 
-       ret = eth_getenv_enetaddr("usbethaddr", enetaddr);
+       ret = eth_env_get_enetaddr("usbethaddr", enetaddr);
        if (ret)
                return 0;
 
@@ -172,7 +172,7 @@ static int handle_mac_address(void)
        if (!is_valid_ethaddr(enetaddr))
                return -1;
 
-       return eth_setenv_enetaddr("usbethaddr", enetaddr);
+       return eth_env_set_enetaddr("usbethaddr", enetaddr);
 }
 
 int board_eth_init(bd_t *bis)
index 61707f5b900e2f0278773592c72ce83bb3e6fb52..ed2077e3617904c32f1d49cc09a52292df5015a9 100644 (file)
@@ -400,7 +400,7 @@ void lcd_ctrl_init(void *lcdbase)
 {
        struct prcm *prcm = (struct prcm *)PRCM_BASE;
        char *custom_lcd;
-       char *displaytype = getenv("displaytype");
+       char *displaytype = env_get("displaytype");
 
        if (displaytype == NULL)
                return;
@@ -408,7 +408,7 @@ void lcd_ctrl_init(void *lcdbase)
        lcd_def = env_parse_displaytype(displaytype);
        /* If we did not recognize the preset, check if it's an env variable */
        if (lcd_def == NONE) {
-               custom_lcd = getenv(displaytype);
+               custom_lcd = env_get(displaytype);
                if (custom_lcd == NULL || parse_customlcd(custom_lcd) < 0)
                        return;
        }
index 5cb97b4778721c258720ab4c397cb18e139c7bb7..8cd0090887a82ef2f1be2ecea52ff7bfda426e4f 100644 (file)
@@ -235,7 +235,7 @@ int power_init_board(void)
                return 0;
 
        /* set level of MIPI if specified */
-       lv_mipi = getenv("lv_mipi");
+       lv_mipi = env_get("lv_mipi");
        if (lv_mipi)
                return 0;
 
@@ -583,7 +583,7 @@ int board_video_skip(void)
 {
        int i;
        int ret;
-       char const *panel = getenv("panel");
+       char const *panel = env_get("panel");
        if (!panel) {
                for (i = 0; i < ARRAY_SIZE(displays); i++) {
                        struct display_info_t const *dev = displays + i;
@@ -755,9 +755,9 @@ int board_late_init(void)
 {
 #ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG
        if (is_mx6dq())
-               setenv("board_rev", "MX6Q");
+               env_set("board_rev", "MX6Q");
        else
-               setenv("board_rev", "MX6DL");
+               env_set("board_rev", "MX6DL");
 #endif
 
        return 0;
index 43c4cb77bb137cc3ca64f6f2cc3f5e629babb896..c92888180496d09fef7e7e5135fd934963fef439 100644 (file)
@@ -123,7 +123,7 @@ int misc_init_r(void)
 
        /* if BTN_ACQ_AL is pressed then bootdelay is changed to 60 second */
        if ((in_be16(&iop->iop_pcdat) & 0x0004) == 0)
-               setenv("bootdelay", "60");
+               env_set("bootdelay", "60");
 
        return 0;
 }
index 11ea52f24048d743a0e09fe58e08e7635f329c65..c2d2e8e882919eff7b1b02eab765eee12b9d878a 100644 (file)
@@ -131,7 +131,7 @@ int misc_init_r(void)
        uchar env_enetaddr[6];
        int enetaddr_found;
 
-       enetaddr_found = eth_getenv_enetaddr("ethaddr", env_enetaddr);
+       enetaddr_found = eth_env_get_enetaddr("ethaddr", env_enetaddr);
 
 #ifdef CONFIG_MAC_ADDR_IN_SPIFLASH
        int spi_mac_read;
@@ -147,7 +147,7 @@ int misc_init_r(void)
        if (!enetaddr_found) {
                if (!spi_mac_read) {
                        if (is_valid_ethaddr(buff)) {
-                               if (eth_setenv_enetaddr("ethaddr", buff)) {
+                               if (eth_env_set_enetaddr("ethaddr", buff)) {
                                        printf("Warning: Failed to "
                                        "set MAC address from SPI flash\n");
                                }
@@ -292,7 +292,7 @@ u32 get_board_rev(void)
        u32 maxcpuclk = CONFIG_DA850_EVM_MAX_CPU_CLK;
        u32 rev = 0;
 
-       s = getenv("maxcpuclk");
+       s = env_get("maxcpuclk");
        if (s)
                maxcpuclk = simple_strtoul(s, NULL, 10);
 
index 52bb7363a7e279903242ca33c49699ee8380336f..565020760d5591a7511b47a6bcc3a5fa57dfa103 100644 (file)
@@ -293,7 +293,7 @@ static void dspwake(void)
        if ((REG(CHIP_REV_ID_REG) & 0x3f) == 0x10)
                return;
 
-       if (!strcmp(getenv("dspwake"), "no"))
+       if (!strcmp(env_get("dspwake"), "no"))
                return;
 
        *resetvect++ = 0x1E000; /* DSP Idle */
@@ -323,7 +323,7 @@ int misc_init_r(void)
        uint8_t tmp[20], addr[10];
 
 
-       if (getenv("ethaddr") == NULL) {
+       if (env_get("ethaddr") == NULL) {
                /* Read Ethernet MAC address from EEPROM */
                if (dvevm_read_mac_address(addr)) {
                        /* Set Ethernet MAC address from EEPROM */
@@ -337,7 +337,7 @@ int misc_init_r(void)
                                addr[0], addr[1], addr[2], addr[3], addr[4],
                                addr[5]);
 
-                       setenv("ethaddr", (char *)tmp);
+                       env_set("ethaddr", (char *)tmp);
                } else {
                        printf("Invalid MAC address read.\n");
                }
index cbe355a600a3eb21add00e3f3490305701fed01d..6b98b5c3ebda90c4788d57ef939c3d70930a09f7 100644 (file)
@@ -466,7 +466,7 @@ int board_late_init(void)
        add_board_boot_modes(board_boot_modes);
 #endif
 
-       setenv("board_name", BOARD_NAME);
+       env_set("board_name", BOARD_NAME);
        return 0;
 }
 
index e3bb5698f63c316e2930bd9723de182c4634575a..c7ec55ff825af8cdcc81f9a70898cb64d4930981 100644 (file)
@@ -21,11 +21,11 @@ static void mmc_late_init(void)
        char mmcblk[32];
        u32 dev_no = mmc_get_env_dev();
 
-       setenv_ulong("mmcdev", dev_no);
+       env_set_ulong("mmcdev", dev_no);
 
        /* Set mmcblk env */
        sprintf(mmcblk, "/dev/mmcblk%dp2 rootwait rw", dev_no);
-       setenv("mmcroot", mmcblk);
+       env_set("mmcroot", mmcblk);
 
        sprintf(cmd, "mmc dev %d", dev_no);
        run_command(cmd, 0);
@@ -43,20 +43,20 @@ int board_late_init(void)
 #ifdef CONFIG_ENV_IS_IN_MMC
                mmc_late_init();
 #endif
-               setenv("modeboot", "mmcboot");
+               env_set("modeboot", "mmcboot");
                break;
        case IMX6_BMODE_NAND:
-               setenv("modeboot", "nandboot");
+               env_set("modeboot", "nandboot");
                break;
        default:
-               setenv("modeboot", "");
+               env_set("modeboot", "");
                break;
        }
 
        if (is_mx6ul())
-               setenv("console", "ttymxc0");
+               env_set("console", "ttymxc0");
        else
-               setenv("console", "ttymxc3");
+               env_set("console", "ttymxc3");
 
        setenv_fdt_file();
 
index bc36fc77ee5b5ab3ba9c0637b7edbb22dd18e6c3..ffd383a0eecac0b57df8dbb7094974c81aebd269 100644 (file)
@@ -93,7 +93,7 @@ void setup_gpmi_nand(void)
 void setenv_fdt_file(void)
 {
        if (is_mx6ul())
-               setenv("fdt_file", "imx6ul-geam-kit.dtb");
+               env_set("fdt_file", "imx6ul-geam-kit.dtb");
 }
 
 #ifdef CONFIG_SPL_BUILD
index 5b2ed066b49ae85bc3be5d6b8a0479b19b1f87fb..3d4f713c3e2b80783e1ee7ee5cc328390225043a 100644 (file)
@@ -195,9 +195,9 @@ void setup_display(void)
 void setenv_fdt_file(void)
 {
        if (is_mx6dq())
-               setenv("fdt_file", "imx6q-icore.dtb");
+               env_set("fdt_file", "imx6q-icore.dtb");
        else if(is_mx6dl() || is_mx6solo())
-               setenv("fdt_file", "imx6dl-icore.dtb");
+               env_set("fdt_file", "imx6dl-icore.dtb");
 }
 
 #ifdef CONFIG_SPL_BUILD
index 10a947173032e510ccb9da8a3dcfee1938e2777c..2a321dca50eacd96dd9c84ef216b480c206caf50 100644 (file)
@@ -35,9 +35,9 @@ int board_mmc_get_env_dev(int devno)
 void setenv_fdt_file(void)
 {
        if (is_mx6dq())
-               setenv("fdt_file", "imx6q-icore-rqs.dtb");
+               env_set("fdt_file", "imx6q-icore-rqs.dtb");
        else if(is_mx6dl() || is_mx6solo())
-               setenv("fdt_file", "imx6dl-icore-rqs.dtb");
+               env_set("fdt_file", "imx6dl-icore-rqs.dtb");
 }
 
 #ifdef CONFIG_SPL_BUILD
index 4dcc9ea11baa3b34c68287f8a5d6f94d4f9a834f..fbf17242f87ef60972372720e3d480cee3cf388d 100644 (file)
@@ -102,9 +102,9 @@ void setenv_fdt_file(void)
 {
        if (is_mx6ul()) {
 #ifdef CONFIG_ENV_IS_IN_MMC
-               setenv("fdt_file", "imx6ul-isiot-emmc.dtb");
+               env_set("fdt_file", "imx6ul-isiot-emmc.dtb");
 #else
-               setenv("fdt_file", "imx6ul-isiot-nand.dtb");
+               env_set("fdt_file", "imx6ul-isiot-nand.dtb");
 #endif
        }
 }
index 93a02ab0eedeb18382106dc3b98c8b3463cae416..0c5900a15a425cf28180a227a3a2c9cb46505fb0 100644 (file)
@@ -181,7 +181,7 @@ int checkboard(void)
                puts("Board: EtherCAN/2 Gateway");
                break;
        }
-       if (getenv_f("serial#", str, sizeof(str)) > 0) {
+       if (env_get_f("serial#", str, sizeof(str)) > 0) {
                puts(", serial# ");
                puts(str);
        }
@@ -198,7 +198,7 @@ void get_board_serial(struct tag_serialnr *serialnr)
 {
        char *str;
 
-       char *serial = getenv("serial#");
+       char *serial = env_get("serial#");
        if (serial) {
                str = strchr(serial, '_');
                if (str && (strlen(str) >= 4)) {
@@ -231,7 +231,8 @@ int misc_init_r(void)
         * In some cases this this needs to be set to 4.
         * Check the user has set environment mdiv to 4 to change the divisor.
         */
-       if ((str = getenv("mdiv")) && (strcmp(str, "4") == 0)) {
+       str = env_get("mdiv");
+       if (str && (strcmp(str, "4") == 0)) {
                writel((readl(&pmc->mckr) & ~AT91_PMC_MDIV) |
                        AT91SAM9_PMC_MDIV_4, &pmc->mckr);
                at91_clock_init(CONFIG_SYS_AT91_MAIN_CLOCK);
index 83a70153e875491bd9577a94693f08d749422b71..5d872fdfd9b99b2c23adf75ae0f61a21a5172ea2 100644 (file)
@@ -195,7 +195,7 @@ static int adjust_vdd(ulong vdd_override)
              vid, vdd_target/10);
 
        /* check override variable for overriding VDD */
-       vdd_string = getenv("b4qds_vdd_mv");
+       vdd_string = env_get("b4qds_vdd_mv");
        if (vdd_override == 0 && vdd_string &&
            !strict_strtoul(vdd_string, 10, &vdd_string_override))
                vdd_override = vdd_string_override;
@@ -542,7 +542,7 @@ int configure_vsc3316_3308(void)
                         * Extract hwconfig from environment since environment
                         * is not setup properly yet
                         */
-                       getenv_f("hwconfig", buffer, sizeof(buffer));
+                       env_get_f("hwconfig", buffer, sizeof(buffer));
                        buf = buffer;
 
                        if (hwconfig_subarg_cmp_f("fsl_b4860_serdes2",
@@ -1197,8 +1197,8 @@ int ft_board_setup(void *blob, bd_t *bd)
 
        ft_cpu_setup(blob, bd);
 
-       base = getenv_bootm_low();
-       size = getenv_bootm_size();
+       base = env_get_bootm_low();
+       size = env_get_bootm_size();
 
        fdt_fixup_memory(blob, (u64)base, (u64)size);
 
index 60d7f0d48a83d513ee23802d73c9d8ed02ad5b5f..b1824b07a2176e5a7dd94174ad03ff7e2b626c21 100644 (file)
@@ -5,6 +5,7 @@
 
 #include <common.h>
 #include <console.h>
+#include <environment.h>
 #include <asm/spl.h>
 #include <malloc.h>
 #include <ns16550.h>
@@ -101,7 +102,7 @@ void board_init_r(gd_t *gd, ulong dest_addr)
        nand_spl_load_image(CONFIG_ENV_OFFSET, CONFIG_ENV_SIZE,
                            (uchar *)CONFIG_ENV_ADDR);
        gd->env_addr  = (ulong)(CONFIG_ENV_ADDR);
-       gd->env_valid = 1;
+       gd->env_valid = ENV_VALID;
 #endif
 
        i2c_init_all();
index fb8bb39d87e303ceb041046db54002c3ed35fe09..c642e88a097b05770c92808c785674a0000e184b 100644 (file)
@@ -65,8 +65,8 @@ int ft_board_setup(void *blob, bd_t *bd)
 
        ft_cpu_setup(blob, bd);
 
-       base = getenv_bootm_low();
-       size = getenv_bootm_size();
+       base = env_get_bootm_low();
+       size = env_get_bootm_size();
 
        fdt_fixup_memory(blob, (u64)base, (u64)size);
 #ifdef CONFIG_FDT_FIXUP_PARTITIONS
index a7772c4bf4c29eecad2b996706d37719560977ae..ed0b453e54b922faaee09d54c17f553632c28937 100644 (file)
@@ -370,8 +370,8 @@ int ft_board_setup(void *blob, bd_t *bd)
 
        ft_cpu_setup(blob, bd);
 
-       base = getenv_bootm_low();
-       size = getenv_bootm_size();
+       base = env_get_bootm_low();
+       size = env_get_bootm_size();
 
        #if defined(CONFIG_PCI)
        FT_FSL_PCI_SETUP;
index 45f463f01f38134ca38e0793f3b83170b95e1f5f..23901a4f96adc555bc965347029d97d5e4f0fa6f 100644 (file)
@@ -138,8 +138,8 @@ int ft_board_setup(void *blob, bd_t *bd)
 
        ft_cpu_setup(blob, bd);
 
-       base = getenv_bootm_low();
-       size = getenv_bootm_size();
+       base = env_get_bootm_low();
+       size = env_get_bootm_size();
 
 #if defined(CONFIG_PCI)
        FT_FSL_PCI_SETUP;
index 94093f11a88092663cc3e894e3487591c440dbcc..28541a72cb1808685d6d2a71890092a7d0ab16dd 100644 (file)
@@ -5,6 +5,7 @@
 
 #include <common.h>
 #include <console.h>
+#include <environment.h>
 #include <ns16550.h>
 #include <malloc.h>
 #include <mmc.h>
@@ -63,7 +64,7 @@ void board_init_r(gd_t *gd, ulong dest_addr)
        nand_spl_load_image(CONFIG_ENV_OFFSET, CONFIG_ENV_SIZE,
                            (uchar *)CONFIG_ENV_ADDR);
        gd->env_addr  = (ulong)(CONFIG_ENV_ADDR);
-       gd->env_valid = 1;
+       gd->env_valid = ENV_VALID;
 
        i2c_init_all();
 
index cefe3cc531741687a229599d5e7c73d1177f3fd4..b3e5f019b87b2094a72880517f827ad4dd126893 100644 (file)
@@ -52,7 +52,7 @@ static int do_esbc_validate(cmd_tbl_t *cmdtp, int flag, int argc,
         * to continue U-Boot
         */
        sprintf(buf, "%lx", img_addr);
-       setenv("img_addr", buf);
+       env_set("img_addr", buf);
 
        if (ret)
                return 1;
index dfe5d204d4a3e3ed1184f961cdd82a432c9d1776..6e750b08bcd6e6a4fa34b4f0cf614da449891fe0 100644 (file)
@@ -80,12 +80,12 @@ int fsl_setenv_chain_of_trust(void)
         * bootdelay = 0 (To disable Boot Prompt)
         * bootcmd = CONFIG_CHAIN_BOOT_CMD (Validate and execute Boot script)
         */
-       setenv("bootdelay", "0");
+       env_set("bootdelay", "0");
 
 #ifdef CONFIG_ARM
-       setenv("secureboot", "y");
+       env_set("secureboot", "y");
 #else
-       setenv("bootcmd", CONFIG_CHAIN_BOOT_CMD);
+       env_set("bootcmd", CONFIG_CHAIN_BOOT_CMD);
 #endif
 
        return 0;
index 29aa778dbeca4524788d982b517f74ce1d160b66..152ad84672a48607b98fdffebec6839bde910e3d 100644 (file)
@@ -478,8 +478,8 @@ int mac_read_from_eeprom(void)
                        /* Only initialize environment variables that are blank
                         * (i.e. have not yet been set)
                         */
-                       if (!getenv(enetvar))
-                               setenv(enetvar, ethaddr);
+                       if (!env_get(enetvar))
+                               env_set(enetvar, ethaddr);
                }
        }
 
index 9b65c13b1ab5a7f4c95004c8d59c8ae9e87dc97b..d6d1bfc861677948ab79586c24ac273433962d08 100644 (file)
@@ -376,7 +376,7 @@ int adjust_vdd(ulong vdd_override)
        vdd_target = vdd[vid];
 
        /* check override variable for overriding VDD */
-       vdd_string = getenv(CONFIG_VID_FLS_ENV);
+       vdd_string = env_get(CONFIG_VID_FLS_ENV);
        if (vdd_override == 0 && vdd_string &&
            !strict_strtoul(vdd_string, 10, &vdd_string_override))
                vdd_override = vdd_string_override;
@@ -560,7 +560,7 @@ int adjust_vdd(ulong vdd_override)
        vdd_target = vdd[vid];
 
        /* check override variable for overriding VDD */
-       vdd_string = getenv(CONFIG_VID_FLS_ENV);
+       vdd_string = env_get(CONFIG_VID_FLS_ENV);
        if (vdd_override == 0 && vdd_string &&
            !strict_strtoul(vdd_string, 10, &vdd_string_override))
                vdd_override = vdd_string_override;
index 93e1258295617b815605d1a97d043f39283ce3bf..132650c938744c62e3e13c842d84a936cb70691e 100644 (file)
@@ -191,8 +191,8 @@ int ft_board_setup(void *blob, bd_t *bd)
 
        ft_cpu_setup(blob, bd);
 
-       base = getenv_bootm_low();
-       size = getenv_bootm_size();
+       base = env_get_bootm_low();
+       size = env_get_bootm_size();
 
        fdt_fixup_memory(blob, (u64)base, (u64)size);
 
index defcac52634fac2be3f595b935673df1b17560f5..aca29bc3613e8d6404b2d9b5e11efb261b25bf25 100644 (file)
@@ -449,7 +449,7 @@ static void initialize_dpmac_to_slot(void)
                >> FSL_CHASSIS3_RCWSR28_SRDS2_PRTCL_SHIFT;
 
        char *env_hwconfig;
-       env_hwconfig = getenv("hwconfig");
+       env_hwconfig = env_get("hwconfig");
 
        switch (serdes1_prtcl) {
        case 0x07:
@@ -603,7 +603,7 @@ void ls2080a_handle_phy_interface_sgmii(int dpmac_id)
                >> FSL_CHASSIS3_RCWSR28_SRDS2_PRTCL_SHIFT;
 
        int *riser_phy_addr;
-       char *env_hwconfig = getenv("hwconfig");
+       char *env_hwconfig = env_get("hwconfig");
 
        if (hwconfig_f("xqsgmii", env_hwconfig))
                riser_phy_addr = &xqsgii_riser_phy_addr[0];
@@ -849,7 +849,7 @@ int board_eth_init(bd_t *bis)
        unsigned int i;
        char *env_hwconfig;
 
-       env_hwconfig = getenv("hwconfig");
+       env_hwconfig = env_get("hwconfig");
 
        initialize_dpmac_to_slot();
 
index f36fb9810bd2d7a365fd540a24a3560a63a73f90..83773d0af5dd1b07f832eba250bf12575836fa2f 100644 (file)
@@ -204,7 +204,7 @@ int board_init(void)
 
        val = in_le32(dcfg_ccsr + DCFG_RCWSR13 / 4);
 
-       env_hwconfig = getenv("hwconfig");
+       env_hwconfig = env_get("hwconfig");
 
        if (hwconfig_f("dspi", env_hwconfig) &&
            DCFG_RCWSR13_DSPI == (val & (u32)(0xf << 8)))
index d7122b3dfcafccbd987deceb8c62009d840ee669..07ba0266d57cc64fe761dd488de05b56ea753f49 100644 (file)
@@ -250,7 +250,7 @@ int misc_init_r(void)
 
        val = in_le32(dcfg_ccsr + DCFG_RCWSR13 / 4);
 
-       env_hwconfig = getenv("hwconfig");
+       env_hwconfig = env_get("hwconfig");
 
        if (hwconfig_f("dspi", env_hwconfig) &&
            DCFG_RCWSR13_DSPI == (val & (u32)(0xf << 8)))
index f30a1510ee406c1537d2368e4fbff30089777f08..b715d8363ea2dd1fc82adc5ea7e46108a3fe0bd3 100644 (file)
@@ -216,7 +216,7 @@ int mac_read_from_eeprom(void)
                                                buf[i * 6 + 4], buf[i * 6 + 5]);
                                        sprintf((char *)enetvar,
                                                i ? "eth%daddr" : "ethaddr", i);
-                                       setenv((char *)enetvar, str);
+                                       env_set((char *)enetvar, str);
                                }
                        }
                }
index 39c40e5cc95fdcc61905df799cb821b6424588dc..e5d3dfd4545ec87ab9b88f7dc517fbb8a9ad1253 100644 (file)
@@ -67,7 +67,7 @@ static struct pci_region pcie_regions_1[] = {
 
 static int is_pex_x2(void)
 {
-       const char *pex_x2 = getenv("pex_x2");
+       const char *pex_x2 = env_get("pex_x2");
 
        if (pex_x2 && !strcmp(pex_x2, "yes"))
                return 1;
index 319f0479e2c246e454f5c260463ec20916569c19..9a0ab7f2ad2af93d58fc80ab5f7aaa2317b88e00 100644 (file)
@@ -173,7 +173,7 @@ int board_mmc_init(bd_t *bd)
        char buffer[HWCONFIG_BUFFER_SIZE] = {0};
        int esdhc_hwconfig_enabled = 0;
 
-       if (getenv_f("hwconfig", buffer, sizeof(buffer)) > 0)
+       if (env_get_f("hwconfig", buffer, sizeof(buffer)) > 0)
                esdhc_hwconfig_enabled = hwconfig_f("esdhc", buffer);
 
        if (esdhc_hwconfig_enabled == 0)
index ed6836a93027b8035d119d85db692f1e77403778..93d54f5c4aa2dcabb8ec0b8dee09906798335e29 100644 (file)
@@ -239,8 +239,8 @@ int ft_board_setup(void *blob, bd_t *bd)
 
        ft_cpu_setup(blob, bd);
 
-       base = getenv_bootm_low();
-       size = getenv_bootm_size();
+       base = env_get_bootm_low();
+       size = env_get_bootm_size();
 
        fdt_fixup_memory(blob, (u64)base, (u64)size);
 
index 8a4a8a2f078f8a7ddcada9572c58bf00abf22a6d..71a63f188e772c13ded711ff5b428f067be4f21c 100644 (file)
@@ -30,7 +30,7 @@ SECTIONS
          drivers/mtd/built-in.o                (.text*)
 
          . = DEFINED(env_offset) ? env_offset : .;
-         common/env_embedded.o(.text*)
+         env/embedded.o(.text*)
 
          *(.text*)
        }
index 86ec7508dbbb27390c7fca4763043e39456266b4..cc2c855b88f9428a17ea21067162acd5ae7df5c1 100644 (file)
@@ -76,7 +76,7 @@ void setup_iomux_lcd(void)
 int board_video_skip(void)
 {
        int ret;
-       char const *e = getenv("panel");
+       char const *e = env_get("panel");
 
        if (e) {
                if (strcmp(e, "claa") == 0) {
index 27d606f3105bcfe5085a7560864a41b25298c65f..ea3660368603bbc0cf1be49a4564db8ab00a8bc3 100644 (file)
@@ -246,7 +246,7 @@ static int power_init(void)
                if (!p)
                        return -ENODEV;
 
-               setenv("fdt_file", "imx53-qsb.dtb");
+               env_set("fdt_file", "imx53-qsb.dtb");
 
                /* Set VDDA to 1.25V */
                val = DA9052_BUCKCORE_BCOREEN | DA_BUCKCORE_VBCORE_1_250V;
@@ -289,7 +289,7 @@ static int power_init(void)
                if (!p)
                        return -ENODEV;
 
-               setenv("fdt_file", "imx53-qsrb.dtb");
+               env_set("fdt_file", "imx53-qsrb.dtb");
 
                /* Set VDDGP to 1.25V for 1GHz on SW1 */
                pmic_reg_read(p, REG_SW_0, &val);
index bc5e8a9d3e0f63de4f983086550a4a2b483d5199..5fb0f0438761174cc1a357b2f983b2a8a312dbde 100644 (file)
@@ -92,7 +92,7 @@ void setup_iomux_lcd(void)
 int board_video_skip(void)
 {
        int ret;
-       char const *e = getenv("panel");
+       char const *e = env_get("panel");
 
        if (e) {
                if (strcmp(e, "seiko") == 0) {
index a5703a35b16381fc16abff2ca97d7b1f5b8db957..f8f77f616cf1ae887ea7726a14d7f4840ee5405b 100644 (file)
@@ -687,14 +687,14 @@ int board_late_init(void)
 #endif
 
 #ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG
-       setenv("board_name", "SABREAUTO");
+       env_set("board_name", "SABREAUTO");
 
        if (is_mx6dqp())
-               setenv("board_rev", "MX6QP");
+               env_set("board_rev", "MX6QP");
        else if (is_mx6dq())
-               setenv("board_rev", "MX6Q");
+               env_set("board_rev", "MX6Q");
        else if (is_mx6sdl())
-               setenv("board_rev", "MX6DL");
+               env_set("board_rev", "MX6DL");
 #endif
 
        return 0;
@@ -806,8 +806,8 @@ static void gpr_init(void)
        writel(0xF00000CF, &iomux->gpr[4]);
        if (is_mx6dqp()) {
                /* set IPU AXI-id1 Qos=0x1 AXI-id0/2/3 Qos=0x7 */
-               writel(0x007F007F, &iomux->gpr[6]);
-               writel(0x007F007F, &iomux->gpr[7]);
+               writel(0x77177717, &iomux->gpr[6]);
+               writel(0x77177717, &iomux->gpr[7]);
        } else {
                /* set IPU AXI-id0 Qos=0xf(bypass) AXI-id1 Qos=0x7 */
                writel(0x007F007F, &iomux->gpr[6]);
index e4160420fa8b393d792c05b1433f39cb331dee1e..9a562b3424da0d7754e9a0dfcf807c83b2e9fbb7 100644 (file)
@@ -700,14 +700,14 @@ int board_late_init(void)
 #endif
 
 #ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG
-       setenv("board_name", "SABRESD");
+       env_set("board_name", "SABRESD");
 
        if (is_mx6dqp())
-               setenv("board_rev", "MX6QP");
+               env_set("board_rev", "MX6QP");
        else if (is_mx6dq())
-               setenv("board_rev", "MX6Q");
+               env_set("board_rev", "MX6Q");
        else if (is_mx6sdl())
-               setenv("board_rev", "MX6DL");
+               env_set("board_rev", "MX6DL");
 #endif
 
        return 0;
@@ -755,8 +755,8 @@ static void gpr_init(void)
        writel(0xF00000CF, &iomux->gpr[4]);
        if (is_mx6dqp()) {
                /* set IPU AXI-id1 Qos=0x1 AXI-id0/2/3 Qos=0x7 */
-               writel(0x007F007F, &iomux->gpr[6]);
-               writel(0x007F007F, &iomux->gpr[7]);
+               writel(0x77177717, &iomux->gpr[6]);
+               writel(0x77177717, &iomux->gpr[7]);
        } else {
                /* set IPU AXI-id0 Qos=0xf(bypass) AXI-id1 Qos=0x7 */
                writel(0x007F007F, &iomux->gpr[6]);
index a30c379e4ddd5a9e895844bf8d28bf867f050be1..cf7a069c56ecd89fde0da339469fda1b9813e4db 100644 (file)
@@ -674,12 +674,12 @@ int board_late_init(void)
 #endif
 
 #ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG
-       setenv("board_name", "EVK");
+       env_set("board_name", "EVK");
 
        if (is_mx6ul_9x9_evk())
-               setenv("board_rev", "9X9");
+               env_set("board_rev", "9X9");
        else
-               setenv("board_rev", "14X14");
+               env_set("board_rev", "14X14");
 #endif
 
        return 0;
index 66b08f823e3fabcae29f4814317495fa24e8ef1c..cebcec738fc074b1221bc9f53c41b0b31848849c 100644 (file)
@@ -84,8 +84,8 @@ int board_late_init(void)
 #endif
 
 #ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG
-       setenv("board_name", "EVK");
-       setenv("board_rev", "14X14");
+       env_set("board_name", "EVK");
+       env_set("board_rev", "14X14");
 #endif
 
        return 0;
index 65bb575a9643836b613047e8375d65adf21ed214..aa04e993c460124a23dc858960dc563e761d2e26 100644 (file)
@@ -453,8 +453,8 @@ int ft_board_setup(void *blob, bd_t *bd)
 
        ft_cpu_setup(blob, bd);
 
-       base = getenv_bootm_low();
-       size = getenv_bootm_size();
+       base = env_get_bootm_low();
+       size = env_get_bootm_size();
 
 #if defined(CONFIG_PCI)
        FT_FSL_PCI_SETUP;
index 2cebc2c00218f41ef5e7a91d954abf3467d79d44..001308874e41fefc104220574296cce1112f6f3d 100644 (file)
@@ -5,6 +5,7 @@
 
 #include <common.h>
 #include <console.h>
+#include <environment.h>
 #include <ns16550.h>
 #include <malloc.h>
 #include <mmc.h>
@@ -87,7 +88,7 @@ void board_init_r(gd_t *gd, ulong dest_addr)
        nand_spl_load_image(CONFIG_ENV_OFFSET, CONFIG_ENV_SIZE,
                            (uchar *)CONFIG_ENV_ADDR);
                            gd->env_addr  = (ulong)(CONFIG_ENV_ADDR);
-       gd->env_valid = 1;
+       gd->env_valid = ENV_VALID;
 #else
        env_relocate();
 #endif
index 345feac0b2941ece20fe5f491cff95b2034a8d85..bf493262d07442a2a8a14bba918e160670b97021 100644 (file)
@@ -339,8 +339,8 @@ int ft_board_setup(void *blob, bd_t *bd)
 
        ft_cpu_setup(blob, bd);
 
-       base = getenv_bootm_low();
-       size = getenv_bootm_size();
+       base = env_get_bootm_low();
+       size = env_get_bootm_size();
 
        fdt_fixup_memory(blob, (u64)base, (u64)size);
 
index a117dc3a2c6eda0c048921a65e7ee7794b15e166..94b357d446812b50673cb50333d9b8132c0514b6 100644 (file)
@@ -6,6 +6,7 @@
 
 #include <common.h>
 #include <console.h>
+#include <environment.h>
 #include <ns16550.h>
 #include <malloc.h>
 #include <mmc.h>
@@ -100,7 +101,7 @@ void board_init_r(gd_t *gd, ulong dest_addr)
                            (uchar *)CONFIG_ENV_ADDR);
 
        gd->env_addr  = (ulong)(CONFIG_ENV_ADDR);
-       gd->env_valid = 1;
+       gd->env_valid = ENV_VALID;
 #else
        env_relocate();
 #endif
index 04517226033d4d254583ee6a90e01620dfc8b457..ccda82412536020736cf47fe7a5ad4daa486db26 100644 (file)
@@ -137,8 +137,8 @@ int ft_board_setup(void *blob, bd_t *bd)
 
        ft_cpu_setup(blob, bd);
 
-       base = getenv_bootm_low();
-       size = getenv_bootm_size();
+       base = env_get_bootm_low();
+       size = env_get_bootm_size();
 
        fdt_fixup_memory(blob, (u64)base, (u64)size);
 
index 51217c58e5782ef5630fcbcd9701dff04fa4d05c..31c8ed9ae17e3ce1188ef20d81d37419cb49b487 100644 (file)
@@ -350,7 +350,8 @@ int board_eth_init(bd_t *bis)
 
 #ifdef CONFIG_VSC7385_ENET
        /* If a VSC7385 microcode image is present, then upload it. */
-       if ((tmp = getenv("vscfw_addr")) != NULL) {
+       tmp = env_get("vscfw_addr");
+       if (tmp) {
                vscfw_addr = simple_strtoul(tmp, NULL, 16);
                printf("uploading VSC7385 microcode from %x\n", vscfw_addr);
                if (vsc7385_upload_firmware((void *) vscfw_addr,
@@ -438,8 +439,8 @@ int ft_board_setup(void *blob, bd_t *bd)
 
        ft_cpu_setup(blob, bd);
 
-       base = getenv_bootm_low();
-       size = getenv_bootm_size();
+       base = env_get_bootm_low();
+       size = env_get_bootm_size();
 
        fdt_fixup_memory(blob, (u64)base, (u64)size);
 
index ca7ba5754e25b309e9ae73a54d268c2642c28ee2..c1d4c36b0642c6b2de87a3390934ca8229d8932b 100644 (file)
@@ -6,6 +6,7 @@
 
 #include <common.h>
 #include <console.h>
+#include <environment.h>
 #include <ns16550.h>
 #include <malloc.h>
 #include <mmc.h>
@@ -92,7 +93,7 @@ void board_init_r(gd_t *gd, ulong dest_addr)
        nand_spl_load_image(CONFIG_ENV_OFFSET, CONFIG_ENV_SIZE,
                            (uchar *)CONFIG_ENV_ADDR);
        gd->env_addr  = (ulong)(CONFIG_ENV_ADDR);
-       gd->env_valid = 1;
+       gd->env_valid = ENV_VALID;
 #else
        env_relocate();
 #endif
index f54a6ff8dc7260a9b7847c715d81155aa1db1a80..02c89998cb4d23c18152c2e3033c3c1b90f4967e 100644 (file)
@@ -268,8 +268,8 @@ int ft_board_setup(void *blob, bd_t *bd)
 
        ft_cpu_setup(blob, bd);
 
-       base = getenv_bootm_low();
-       size = getenv_bootm_size();
+       base = env_get_bootm_low();
+       size = env_get_bootm_size();
 
        fdt_fixup_memory(blob, (u64)base, (u64)size);
 
index 21fb66f184a4c0e65eac2c577fbd9d1211dc9f8d..78ee74770c3f377e9b8ba9aad6267709ef024efd 100644 (file)
@@ -219,8 +219,8 @@ int ft_board_setup(void *blob, bd_t *bd)
 
        ft_cpu_setup(blob, bd);
 
-       base = getenv_bootm_low();
-       size = getenv_bootm_size();
+       base = env_get_bootm_low();
+       size = env_get_bootm_size();
 
        fdt_fixup_memory(blob, (u64)base, (u64)size);
 
index 0c65ec72d209602314380208143701514d851424..cf5023c505b238bfc5deca0ca753901b3e71f96b 100644 (file)
@@ -211,10 +211,10 @@ int last_stage_init(void)
        /* -kernel boot */
        prop = fdt_getprop(fdt, chosen, "qemu,boot-kernel", &len);
        if (prop && (len >= 8))
-               setenv_hex("qemu_kernel_addr", *prop);
+               env_set_hex("qemu_kernel_addr", *prop);
 
        /* Give the user a variable for the host fdt */
-       setenv_hex("fdt_addr_r", (ulong)fdt);
+       env_set_hex("fdt_addr_r", (ulong)fdt);
 
        return 0;
 }
index b987ecea1d23e0552b81f279c2fa1b84495c2c7a..3aa19e6715ba29e178e51fe33517c6b88fd9163c 100644 (file)
@@ -5,6 +5,7 @@
 
 #include <common.h>
 #include <console.h>
+#include <environment.h>
 #include <malloc.h>
 #include <ns16550.h>
 #include <nand.h>
@@ -138,7 +139,7 @@ void board_init_r(gd_t *gd, ulong dest_addr)
 #endif
 
        gd->env_addr  = (ulong)(CONFIG_ENV_ADDR);
-       gd->env_valid = 1;
+       gd->env_valid = ENV_VALID;
 
        i2c_init_all();
 
index 1b2f6b248754284aac94b319fc866ed8a6591f98..20374baf48c136c0949a928f81d425c5fbac10a1 100644 (file)
@@ -363,8 +363,8 @@ int ft_board_setup(void *blob, bd_t *bd)
 
        ft_cpu_setup(blob, bd);
 
-       base = getenv_bootm_low();
-       size = getenv_bootm_size();
+       base = env_get_bootm_low();
+       size = env_get_bootm_size();
 
        fdt_fixup_memory(blob, (u64)base, (u64)size);
 
index dc6d9eeef626a785f23c14ab23fafdb5acbfcd4c..ca1e49ffa7b4ce9a73326c4a8036c73a0e979b91 100644 (file)
@@ -5,6 +5,7 @@
 
 #include <common.h>
 #include <console.h>
+#include <environment.h>
 #include <malloc.h>
 #include <ns16550.h>
 #include <nand.h>
@@ -125,7 +126,7 @@ void board_init_r(gd_t *gd, ulong dest_addr)
 #endif
 
        gd->env_addr  = (ulong)(CONFIG_ENV_ADDR);
-       gd->env_valid = 1;
+       gd->env_valid = ENV_VALID;
 
        i2c_init_all();
 
index f370f72baa6a7ed0173534c82338d2ea5848f805..8885a546fa3a5a6dfd79853f8d85e4ee3c37896c 100644 (file)
@@ -186,8 +186,8 @@ int ft_board_setup(void *blob, bd_t *bd)
 
        ft_cpu_setup(blob, bd);
 
-       base = getenv_bootm_low();
-       size = getenv_bootm_size();
+       base = env_get_bootm_low();
+       size = env_get_bootm_size();
 
        fdt_fixup_memory(blob, (u64)base, (u64)size);
 
index 5466fbf5f661bd136bf7b1a925fd9cf3a17493ab..a36997b48cb43cf98578d79e321d6239ba9bd57f 100644 (file)
@@ -245,8 +245,8 @@ int ft_board_setup(void *blob, bd_t *bd)
 
        ft_cpu_setup(blob, bd);
 
-       base = getenv_bootm_low();
-       size = getenv_bootm_size();
+       base = env_get_bootm_low();
+       size = env_get_bootm_size();
 
        fdt_fixup_memory(blob, (u64)base, (u64)size);
 
index 2e43307b2d471c09c30310e31f5b3dcdc26397b7..4fb9323873982979a713bd5a1d2293a50aa23874 100644 (file)
@@ -5,6 +5,7 @@
 
 #include <common.h>
 #include <console.h>
+#include <environment.h>
 #include <malloc.h>
 #include <ns16550.h>
 #include <nand.h>
@@ -119,7 +120,7 @@ void board_init_r(gd_t *gd, ulong dest_addr)
                               (uchar *)CONFIG_ENV_ADDR);
 #endif
        gd->env_addr  = (ulong)(CONFIG_ENV_ADDR);
-       gd->env_valid = 1;
+       gd->env_valid = ENV_VALID;
 
        i2c_init_all();
 
index d4c3d4dcb420680d8a462c14063a169a6334cbfb..2818cdf2745fd9ae427387d177e061c534d47a01 100644 (file)
@@ -132,8 +132,8 @@ int ft_board_setup(void *blob, bd_t *bd)
 
        ft_cpu_setup(blob, bd);
 
-       base = getenv_bootm_low();
-       size = getenv_bootm_size();
+       base = env_get_bootm_low();
+       size = env_get_bootm_size();
 
        fdt_fixup_memory(blob, (u64)base, (u64)size);
 
index d7d716b690a23c833ab07522f2d6480015a038b3..36961dc9b05302bdac0a3153af2a688090b02f99 100644 (file)
@@ -5,6 +5,7 @@
 
 #include <common.h>
 #include <console.h>
+#include <environment.h>
 #include <malloc.h>
 #include <ns16550.h>
 #include <nand.h>
@@ -124,7 +125,7 @@ void board_init_r(gd_t *gd, ulong dest_addr)
 #endif
 
        gd->env_addr  = (ulong)(CONFIG_ENV_ADDR);
-       gd->env_valid = 1;
+       gd->env_valid = ENV_VALID;
 
        i2c_init_all();
 
index 26093ea9d265a23fc9a8a8c0edbc00a53950b084..ed3d3f4b71d07147f89c00bd03fd2f2d0e3d3c9e 100644 (file)
@@ -451,8 +451,8 @@ int ft_board_setup(void *blob, bd_t *bd)
 
        ft_cpu_setup(blob, bd);
 
-       base = getenv_bootm_low();
-       size = getenv_bootm_size();
+       base = env_get_bootm_low();
+       size = env_get_bootm_size();
 
        fdt_fixup_memory(blob, (u64)base, (u64)size);
 
index b43140148b18c554cdef10e39fe05095acbd79d2..f0cc34d788e196a33a6092099d19335323b8db0a 100644 (file)
@@ -5,6 +5,7 @@
 
 #include <common.h>
 #include <console.h>
+#include <environment.h>
 #include <malloc.h>
 #include <ns16550.h>
 #include <nand.h>
@@ -94,7 +95,7 @@ void board_init_r(gd_t *gd, ulong dest_addr)
 #endif
 
        gd->env_addr  = (ulong)(CONFIG_ENV_ADDR);
-       gd->env_valid = 1;
+       gd->env_valid = ENV_VALID;
 
        i2c_init_all();
 
index 1ab05ec9fd4300c2dabf87ad8b1452fa26d59fe9..619495e6abcdf61ac1a546fac8680fed69b42f09 100644 (file)
@@ -118,8 +118,8 @@ int ft_board_setup(void *blob, bd_t *bd)
 
        ft_cpu_setup(blob, bd);
 
-       base = getenv_bootm_low();
-       size = getenv_bootm_size();
+       base = env_get_bootm_low();
+       size = env_get_bootm_size();
 
        fdt_fixup_memory(blob, (u64)base, (u64)size);
 
index 9ecdaedda333844a9fa01483260cf4ac025bc8cd..750f1554939be95c8604745e7d4f2c0c750bdbee 100644 (file)
@@ -5,6 +5,7 @@
 
 #include <common.h>
 #include <console.h>
+#include <environment.h>
 #include <asm/spl.h>
 #include <malloc.h>
 #include <ns16550.h>
@@ -129,7 +130,7 @@ void board_init_r(gd_t *gd, ulong dest_addr)
 #endif
 
        gd->env_addr  = (ulong)(CONFIG_ENV_ADDR);
-       gd->env_valid = 1;
+       gd->env_valid = ENV_VALID;
 
        i2c_init_all();
 
index 35ad19e045b163130ed37363d97dc9a7d78fb76e..7136acafeae180f71323e08e96d44e638b5775b3 100644 (file)
@@ -70,8 +70,8 @@ int ft_board_setup(void *blob, bd_t *bd)
 
        ft_cpu_setup(blob, bd);
 
-       base = getenv_bootm_low();
-       size = getenv_bootm_size();
+       base = env_get_bootm_low();
+       size = env_get_bootm_size();
 
        fdt_fixup_memory(blob, (u64)base, (u64)size);
 
index 8f9e7e82550dfd340803a8fe9faa8f41e37751d1..7b71b541fda29609f5a7dbb85646f54ad4b5aa94 100644 (file)
@@ -265,7 +265,7 @@ static int adjust_vdd(ulong vdd_override)
        vdd_target = vdd[vid];
 
        /* check override variable for overriding VDD */
-       vdd_string = getenv("t4240qds_vdd_mv");
+       vdd_string = env_get("t4240qds_vdd_mv");
        if (vdd_override == 0 && vdd_string &&
            !strict_strtoul(vdd_string, 10, &vdd_string_override))
                vdd_override = vdd_string_override;
@@ -684,8 +684,8 @@ int ft_board_setup(void *blob, bd_t *bd)
 
        ft_cpu_setup(blob, bd);
 
-       base = getenv_bootm_low();
-       size = getenv_bootm_size();
+       base = env_get_bootm_low();
+       size = env_get_bootm_size();
 
        fdt_fixup_memory(blob, (u64)base, (u64)size);
 
index 5feab1cfcd60951780962337ca0edb5cd641ec91..932954e93df3ee6c1e65e11c5ca9442fe5ab0a64 100644 (file)
@@ -8,6 +8,7 @@
 
 #include <common.h>
 #include <console.h>
+#include <environment.h>
 #include <asm/spl.h>
 #include <malloc.h>
 #include <ns16550.h>
@@ -87,7 +88,7 @@ void board_init_r(gd_t *gd, ulong dest_addr)
                           (uchar *)CONFIG_ENV_ADDR);
 
        gd->env_addr  = (ulong)(CONFIG_ENV_ADDR);
-       gd->env_valid = 1;
+       gd->env_valid = ENV_VALID;
 
        i2c_init_all();
 
index bdd6f4ef49a74dd6d47d0ef26c11a84809377a37..f511706b9f8047b538f1d2640e075ba2220bdf82 100644 (file)
@@ -97,8 +97,8 @@ int ft_board_setup(void *blob, bd_t *bd)
 
        ft_cpu_setup(blob, bd);
 
-       base = getenv_bootm_low();
-       size = getenv_bootm_size();
+       base = env_get_bootm_low();
+       size = env_get_bootm_size();
 
        fdt_fixup_memory(blob, (u64)base, (u64)size);
 
index 46404b4d59f6f3bc8a13fa998e6211bda2a03390..e9865b4adbfd4a8a7785241e3f67eab198c91d31 100644 (file)
@@ -1160,7 +1160,7 @@ void setup_board_gpio(int board, struct ventana_board_info *info)
        char arg[10];
        size_t len;
        int i;
-       int quiet = simple_strtol(getenv("quiet"), NULL, 10);
+       int quiet = simple_strtol(env_get("quiet"), NULL, 10);
 
        if (board >= GW_UNKNOWN)
                return;
index 89848c8f075d46b29a40b9484c4aba9ebea791c3..4ddc7e1fa218613c023360c886b1fcda91b5c0fe 100644 (file)
@@ -298,11 +298,11 @@ int board_eth_init(bd_t *bis)
 #endif
 
        /* default to the first detected enet dev */
-       if (!getenv("ethprime")) {
+       if (!env_get("ethprime")) {
                struct eth_device *dev = eth_get_dev_by_index(0);
                if (dev) {
-                       setenv("ethprime", dev->name);
-                       printf("set ethprime to %s\n", getenv("ethprime"));
+                       env_set("ethprime", dev->name);
+                       printf("set ethprime to %s\n", env_get("ethprime"));
                }
        }
 
@@ -579,7 +579,7 @@ void board_pci_fixup_dev(struct pci_controller *hose, pci_dev_t dev,
  */
 void get_board_serial(struct tag_serialnr *serialnr)
 {
-       char *serial = getenv("serial#");
+       char *serial = env_get("serial#");
 
        if (serial) {
                serialnr->high = 0;
@@ -658,11 +658,11 @@ int checkboard(void)
        int quiet; /* Quiet or minimal output mode */
 
        quiet = 0;
-       p = getenv("quiet");
+       p = env_get("quiet");
        if (p)
                quiet = simple_strtol(p, NULL, 10);
        else
-               setenv("quiet", "0");
+               env_set("quiet", "0");
 
        puts("\nGateworks Corporation Copyright 2014\n");
        if (info->model[0]) {
@@ -737,26 +737,26 @@ int misc_init_r(void)
                else if (is_cpu_type(MXC_CPU_MX6DL) ||
                         is_cpu_type(MXC_CPU_MX6SOLO))
                        cputype = "imx6dl";
-               setenv("soctype", cputype);
+               env_set("soctype", cputype);
                if (8 << (ventana_info.nand_flash_size-1) >= 2048)
-                       setenv("flash_layout", "large");
+                       env_set("flash_layout", "large");
                else
-                       setenv("flash_layout", "normal");
+                       env_set("flash_layout", "normal");
                memset(str, 0, sizeof(str));
                for (i = 0; i < (sizeof(str)-1) && info->model[i]; i++)
                        str[i] = tolower(info->model[i]);
-               setenv("model", str);
-               if (!getenv("fdt_file")) {
+               env_set("model", str);
+               if (!env_get("fdt_file")) {
                        sprintf(fdt, "%s-%s.dtb", cputype, str);
-                       setenv("fdt_file", fdt);
+                       env_set("fdt_file", fdt);
                }
                p = strchr(str, '-');
                if (p) {
                        *p++ = 0;
 
-                       setenv("model_base", str);
+                       env_set("model_base", str);
                        sprintf(fdt, "%s-%s.dtb", cputype, str);
-                       setenv("fdt_file1", fdt);
+                       env_set("fdt_file1", fdt);
                        if (board_type != GW551x &&
                            board_type != GW552x &&
                            board_type != GW553x &&
@@ -765,30 +765,30 @@ int misc_init_r(void)
                        str[5] = 'x';
                        str[6] = 0;
                        sprintf(fdt, "%s-%s.dtb", cputype, str);
-                       setenv("fdt_file2", fdt);
+                       env_set("fdt_file2", fdt);
                }
 
                /* initialize env from EEPROM */
                if (test_bit(EECONFIG_ETH0, info->config) &&
-                   !getenv("ethaddr")) {
-                       eth_setenv_enetaddr("ethaddr", info->mac0);
+                   !env_get("ethaddr")) {
+                       eth_env_set_enetaddr("ethaddr", info->mac0);
                }
                if (test_bit(EECONFIG_ETH1, info->config) &&
-                   !getenv("eth1addr")) {
-                       eth_setenv_enetaddr("eth1addr", info->mac1);
+                   !env_get("eth1addr")) {
+                       eth_env_set_enetaddr("eth1addr", info->mac1);
                }
 
                /* board serial-number */
                sprintf(str, "%6d", info->serial);
-               setenv("serial#", str);
+               env_set("serial#", str);
 
                /* memory MB */
                sprintf(str, "%d", (int) (gd->ram_size >> 20));
-               setenv("mem_mb", str);
+               env_set("mem_mb", str);
        }
 
        /* Set a non-initialized hwconfig based on board configuration */
-       if (!strcmp(getenv("hwconfig"), "_UNKNOWN_")) {
+       if (!strcmp(env_get("hwconfig"), "_UNKNOWN_")) {
                buf[0] = 0;
                if (gpio_cfg[board_type].rs232_en)
                        strcat(buf, "rs232;");
@@ -798,7 +798,7 @@ int misc_init_r(void)
                        if (strlen(buf) + strlen(buf1) < sizeof(buf))
                                strcat(buf, buf1);
                }
-               setenv("hwconfig", buf);
+               env_set("hwconfig", buf);
        }
 
        /* setup baseboard specific GPIO based on board and env */
@@ -1035,7 +1035,7 @@ int fdt_fixup_sky2(void *blob, int np, struct pci_dev *dev)
        int j;
 
        sprintf(mac, "eth1addr");
-       tmp = getenv(mac);
+       tmp = env_get(mac);
        if (tmp) {
                for (j = 0; j < 6; j++) {
                        mac_addr[j] = tmp ?
@@ -1118,8 +1118,8 @@ int ft_board_setup(void *blob, bd_t *bd)
                { "sst,w25q256",          MTD_DEV_TYPE_NOR, },  /* SPI flash */
                { "fsl,imx6q-gpmi-nand",  MTD_DEV_TYPE_NAND, }, /* NAND flash */
        };
-       const char *model = getenv("model");
-       const char *display = getenv("display");
+       const char *model = env_get("model");
+       const char *display = env_get("display");
        int i;
        char rev = 0;
 
@@ -1131,7 +1131,7 @@ int ft_board_setup(void *blob, bd_t *bd)
                }
        }
 
-       if (getenv("fdt_noauto")) {
+       if (env_get("fdt_noauto")) {
                puts("   Skiping ft_board_setup (fdt_noauto defined)\n");
                return 0;
        }
@@ -1152,15 +1152,15 @@ int ft_board_setup(void *blob, bd_t *bd)
        printf("   Adjusting FDT per EEPROM for %s...\n", model);
 
        /* board serial number */
-       fdt_setprop(blob, 0, "system-serial", getenv("serial#"),
-                   strlen(getenv("serial#")) + 1);
+       fdt_setprop(blob, 0, "system-serial", env_get("serial#"),
+                   strlen(env_get("serial#")) + 1);
 
        /* board (model contains model from device-tree) */
        fdt_setprop(blob, 0, "board", info->model,
                    strlen((const char *)info->model) + 1);
 
        /* set desired digital video capture format */
-       ft_sethdmiinfmt(blob, getenv("hdmiinfmt"));
+       ft_sethdmiinfmt(blob, env_get("hdmiinfmt"));
 
        /*
         * Board model specific fixups
@@ -1315,7 +1315,7 @@ int ft_board_setup(void *blob, bd_t *bd)
        }
 
 #if defined(CONFIG_CMD_PCI)
-       if (!getenv("nopcifixup"))
+       if (!env_get("nopcifixup"))
                ft_board_pci_fixup(blob, bd);
 #endif
 
@@ -1324,7 +1324,7 @@ int ft_board_setup(void *blob, bd_t *bd)
         *  remove nodes by alias path if EEPROM config tells us the
         *  peripheral is not loaded on the board.
         */
-       if (getenv("fdt_noconfig")) {
+       if (env_get("fdt_noconfig")) {
                puts("   Skiping periperhal config (fdt_noconfig defined)\n");
                return 0;
        }
index 69a638d71d8ca7904314a36cb50208b7fee1a2fc..9524da7daf392166f55b9d7f5b49d526e858ccb9 100644 (file)
@@ -690,9 +690,9 @@ int spl_start_uboot(void)
        debug("%s\n", __func__);
 #ifdef CONFIG_SPL_ENV_SUPPORT
        env_init();
-       env_relocate_spec();
-       debug("boot_os=%s\n", getenv("boot_os"));
-       if (getenv_yesno("boot_os") == 1)
+       env_load();
+       debug("boot_os=%s\n", env_get("boot_os"));
+       if (env_get_yesno("boot_os") == 1)
                ret = 0;
 #else
        /* use i2c-0:0x50:0x00 for falcon boot mode (0=linux, else uboot) */
index a4a6f1cca5ed38998e0f750b22ef9ac335abdee3..d75e08b39f5b58adf8c754783085910d0401b4b7 100644 (file)
@@ -129,12 +129,12 @@ int load_and_run_keyprog(void)
        char *hexprog;
        struct key_program *prog;
 
-       cmd = getenv("loadkeyprogram");
+       cmd = env_get("loadkeyprogram");
 
        if (!cmd || run_command(cmd, 0))
                return 1;
 
-       hexprog = getenv("keyprogram");
+       hexprog = env_get("keyprogram");
 
        if (decode_hexstr(hexprog, &binprog))
                return 1;
index c6566e9196ca17d3d6700161ca8ece90c1f2ac08..7e485074ce027bc9165c87e731e9700f70e04476 100644 (file)
@@ -103,7 +103,7 @@ int fpga_get_reg(u32 fpga, u16 *reg, off_t regoff, u16 *data)
 
 int checkboard(void)
 {
-       char *s = getenv("serial#");
+       char *s = env_get("serial#");
        bool hw_type_cat = pca9698_get_value(0x20, 20);
 
        puts("Board: ");
index 34e9d1956e2e5462c3f563f015631cc2c0a0cabf..fec691515d4597016c4bbfa5d4f7748e371b3238 100644 (file)
@@ -106,7 +106,7 @@ int fpga_get_reg(u32 fpga, u16 *reg, off_t regoff, u16 *data)
 
 int checkboard(void)
 {
-       char *s = getenv("serial#");
+       char *s = env_get("serial#");
        bool hw_type_cat = pca9698_get_value(0x20, 18);
 
        puts("Board: ");
index 95f11fb69f36dd5d01d713205bb7444c53285fe4..1813a58e60bf62e7ce805df9be76bb1097c9f633 100644 (file)
@@ -217,7 +217,7 @@ static u8 *get_2nd_stage_bl_location(ulong target_addr)
 {
        ulong addr;
 #ifdef CCDM_SECOND_STAGE
-       addr = getenv_ulong("loadaddr", 16, CONFIG_LOADADDR);
+       addr = env_get_ulong("loadaddr", 16, CONFIG_LOADADDR);
 #else
        addr = target_addr;
 #endif
@@ -235,7 +235,7 @@ static u8 *get_image_location(void)
 {
        ulong addr;
        /* TODO use other area? */
-       addr = getenv_ulong("loadaddr", 16, CONFIG_LOADADDR);
+       addr = env_get_ulong("loadaddr", 16, CONFIG_LOADADDR);
        return (u8 *)(addr);
 }
 #endif
@@ -1043,13 +1043,13 @@ static int second_stage_init(void)
                goto failure;
 
        /* run "prepboot" from env to get "mmcdev" set */
-       cptr = getenv("prepboot");
+       cptr = env_get("prepboot");
        if (cptr && !run_command(cptr, 0))
-               mmcdev = getenv("mmcdev");
+               mmcdev = env_get("mmcdev");
        if (!mmcdev)
                goto failure;
 
-       cptr = getenv("ramdiskimage");
+       cptr = env_get("ramdiskimage");
        if (cptr)
                image_path = cptr;
 
index 01064dcfde10a8e131726ebb145155e2c8c1e2fc..9fb814d8c7c0de99fc4de43bcab5e20073f81778 100644 (file)
@@ -223,7 +223,7 @@ void hw_watchdog_reset(void)
 #ifdef CONFIG_TRAILBLAZER
 int do_bootd(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 {
-       return run_command(getenv("bootcmd"), flag);
+       return run_command(env_get("bootcmd"), flag);
 }
 
 int board_early_init_r(void)
@@ -335,8 +335,8 @@ int ft_board_setup(void *blob, bd_t *bd)
 
        ft_cpu_setup(blob, bd);
 
-       base = getenv_bootm_low();
-       size = getenv_bootm_size();
+       base = env_get_bootm_low();
+       size = env_get_bootm_size();
 
        fdt_fixup_memory(blob, (u64)base, (u64)size);
 
index e3f82b0a80d5a17da07c26898f106a19e887c1e8..2f5974a246aa0f30c8227147da5ba3436796a13e 100644 (file)
@@ -126,11 +126,11 @@ int board_late_init(void)
        mac_addr[4] = mac_lo & 0xFF;
        mac_addr[5] = (mac_lo & 0xFF00) >> 8;
 
-       if (!getenv("ethaddr")) {
+       if (!env_get("ethaddr")) {
                printf("<ethaddr> not set. Validating first E-fuse MAC\n");
 
                if (is_valid_ethaddr(mac_addr))
-                       eth_setenv_enetaddr("ethaddr", mac_addr);
+                       eth_env_set_enetaddr("ethaddr", mac_addr);
        }
 
        mac_lo = readl(&cdev->macid1l);
@@ -142,9 +142,9 @@ int board_late_init(void)
        mac_addr[4] = mac_lo & 0xFF;
        mac_addr[5] = (mac_lo & 0xFF00) >> 8;
 
-       if (!getenv("eth1addr")) {
+       if (!env_get("eth1addr")) {
                if (is_valid_ethaddr(mac_addr))
-                       eth_setenv_enetaddr("eth1addr", mac_addr);
+                       eth_env_set_enetaddr("eth1addr", mac_addr);
        }
 #endif
 
index 817e22fd455518d4ed2af1e550457aa4e20b2378..941e7ea2c8ed8019b33dfb4bcc74b1c515e75372 100644 (file)
@@ -149,7 +149,7 @@ int board_mmc_init(bd_t *bis)
 
 static int check_mmc_autodetect(void)
 {
-       char *autodetect_str = getenv("mmcautodetect");
+       char *autodetect_str = env_get("mmcautodetect");
 
        if ((autodetect_str != NULL) &&
            (strcmp(autodetect_str, "yes") == 0)) {
@@ -168,12 +168,12 @@ void board_late_mmc_init(void)
        if (!check_mmc_autodetect())
                return;
 
-       setenv_ulong("mmcdev", dev_no);
+       env_set_ulong("mmcdev", dev_no);
 
        /* Set mmcblk env */
        sprintf(mmcblk, "/dev/mmcblk%dp2 rootwait rw",
                dev_no);
-       setenv("mmcroot", mmcblk);
+       env_set("mmcroot", mmcblk);
 
        sprintf(cmd, "mmc dev %d", dev_no);
        run_command(cmd, 0);
index d76c28bd3cc3ff0a24f78c025ec2a0977704e4e5..bfc5fd1c46393a93ca33ff0d02b2bee8e9889aa9 100644 (file)
@@ -239,7 +239,7 @@ int board_eth_init(bd_t *bis)
        uint32_t mac_hi, mac_lo;
        const char *devname;
 
-       if (!eth_getenv_enetaddr("ethaddr", mac_addr)) {
+       if (!eth_env_get_enetaddr("ethaddr", mac_addr)) {
                /* try reading mac address from efuse */
                mac_lo = readl(&cdev->macid0l);
                mac_hi = readl(&cdev->macid0h);
@@ -250,7 +250,7 @@ int board_eth_init(bd_t *bis)
                mac_addr[4] = mac_lo & 0xFF;
                mac_addr[5] = (mac_lo & 0xFF00) >> 8;
                if (is_valid_ethaddr(mac_addr))
-                       eth_setenv_enetaddr("ethaddr", mac_addr);
+                       eth_env_set_enetaddr("ethaddr", mac_addr);
        }
 
        writel((RGMII_MODE_ENABLE | RGMII_INT_DELAY), &cdev->miisel);
index 1af220786795cb74770bc0843dc35c603a8428c5..f7c05ab08fa23d427b83f5509e9c081af6ddb56d 100644 (file)
@@ -80,11 +80,11 @@ int misc_init_r(void)
 
        boot_choice = readl(HB_SREG_A9_BOOT_SRC_STAT) & 0xff;
        sprintf(envbuffer, "bootcmd%d", boot_choice);
-       if (getenv(envbuffer)) {
+       if (env_get(envbuffer)) {
                sprintf(envbuffer, "run bootcmd%d", boot_choice);
-               setenv("bootcmd", envbuffer);
+               env_set("bootcmd", envbuffer);
        } else
-               setenv("bootcmd", "");
+               env_set("bootcmd", "");
 
        return 0;
 }
index 1deb2bdd8b7b8e26439a1ecc606362dbd35fe0b7..0a02e44046d08b4b060d9c6985cdb8aa00eae41a 100644 (file)
@@ -83,7 +83,7 @@ int board_late_init(void)
        if (gpio_get_value(HOT_WATER_BUTTON))
                return 0;
 
-       setenv("bootcmd", "run swupdate");
+       env_set("bootcmd", "run swupdate");
 
        return 0;
 }
index a1a7d4d7c8940aaa293412f1563ae942c1f93dc5..4b1e6d0f471f6f7d7fdeb14cb24dd97cc989eee5 100644 (file)
@@ -5,6 +5,7 @@
  */
 #include <common.h>
 #include <dwc3-uboot.h>
+#include <environment.h>
 #include <mmc.h>
 #include <u-boot/md5.h>
 #include <usb.h>
@@ -63,14 +64,14 @@ static void assign_serial(void)
 
        snprintf(usb0addr, sizeof(usb0addr), "02:00:86:%02x:%02x:%02x",
                 ssn[13], ssn[14], ssn[15]);
-       setenv("usb0addr", usb0addr);
+       env_set("usb0addr", usb0addr);
 
        for (i = 0; i < 16; i++)
                snprintf(&serial[2 * i], 3, "%02x", ssn[i]);
-       setenv("serial#", serial);
+       env_set("serial#", serial);
 
 #if defined(CONFIG_CMD_SAVEENV) && !defined(CONFIG_ENV_IS_NOWHERE)
-       saveenv();
+       env_save();
 #endif
 }
 
@@ -85,19 +86,19 @@ static void assign_hardware_id(void)
                printf("Can't retrieve hardware revision\n");
 
        snprintf(hardware_id, sizeof(hardware_id), "%02X", v.hardware_id);
-       setenv("hardware_id", hardware_id);
+       env_set("hardware_id", hardware_id);
 
 #if defined(CONFIG_CMD_SAVEENV) && !defined(CONFIG_ENV_IS_NOWHERE)
-       saveenv();
+       env_save();
 #endif
 }
 
 int board_late_init(void)
 {
-       if (!getenv("serial#"))
+       if (!env_get("serial#"))
                assign_serial();
 
-       if (!getenv("hardware_id"))
+       if (!env_get("hardware_id"))
                assign_hardware_id();
 
        return 0;
index e33170d65f9d102262207f47c733b5593c6cfa31..d33dc960a5af913f977b80c665757287e10a1456 100644 (file)
@@ -194,13 +194,13 @@ int board_late_init(void)
 #ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG
        switch (get_board_revision()) {
                case 0:
-                       setenv("board_name", "igep0034-lite");
+                       env_set("board_name", "igep0034-lite");
                        break;
                case 1:
-                       setenv("board_name", "igep0034");
+                       env_set("board_name", "igep0034");
                        break;
                default:
-                       setenv("board_name", "igep0033");
+                       env_set("board_name", "igep0033");
                        break;
        }
 #endif
@@ -264,7 +264,7 @@ int board_eth_init(bd_t *bis)
        uint8_t mac_addr[6];
        uint32_t mac_hi, mac_lo;
 
-       if (!eth_getenv_enetaddr("ethaddr", mac_addr)) {
+       if (!eth_env_get_enetaddr("ethaddr", mac_addr)) {
                /* try reading mac address from efuse */
                mac_lo = readl(&cdev->macid0l);
                mac_hi = readl(&cdev->macid0h);
@@ -275,7 +275,7 @@ int board_eth_init(bd_t *bis)
                mac_addr[4] = mac_lo & 0xFF;
                mac_addr[5] = (mac_lo & 0xFF00) >> 8;
                if (is_valid_ethaddr(mac_addr))
-                       eth_setenv_enetaddr("ethaddr", mac_addr);
+                       eth_env_set_enetaddr("ethaddr", mac_addr);
        }
 
        writel((GMII1_SEL_RMII | RMII1_IO_CLK_EN),
index 843d35eb2d0ff18c9394e6f297f8ee42b5c923fa..a7a75601dd3ee959849221b45f6678f5021d3201 100644 (file)
@@ -251,10 +251,10 @@ void set_fdt(void)
 {
        switch (gd->bd->bi_arch_number) {
        case MACH_TYPE_IGEP0020:
-               setenv("fdtfile", "omap3-igep0020.dtb");
+               env_set("fdtfile", "omap3-igep0020.dtb");
                break;
        case MACH_TYPE_IGEP0030:
-               setenv("fdtfile", "omap3-igep0030.dtb");
+               env_set("fdtfile", "omap3-igep0030.dtb");
                break;
        }
 }
index 408079c9a14976386137159f563b0dc3e334f811..6cd281218ee124a9cef8e912b2fc768595ca1ddd 100644 (file)
@@ -51,24 +51,24 @@ int set_km_env(void)
        pnvramaddr = gd->ram_size - CONFIG_KM_RESERVED_PRAM - CONFIG_KM_PHRAM
                        - CONFIG_KM_PNVRAM;
        sprintf((char *)buf, "0x%x", pnvramaddr);
-       setenv("pnvramaddr", (char *)buf);
+       env_set("pnvramaddr", (char *)buf);
 
        /* try to read rootfssize (ram image) from environment */
-       p = getenv("rootfssize");
+       p = env_get("rootfssize");
        if (p != NULL)
                strict_strtoul(p, 16, &rootfssize);
        pram = (rootfssize + CONFIG_KM_RESERVED_PRAM + CONFIG_KM_PHRAM +
                CONFIG_KM_PNVRAM) / 0x400;
        sprintf((char *)buf, "0x%x", pram);
-       setenv("pram", (char *)buf);
+       env_set("pram", (char *)buf);
 
        varaddr = gd->ram_size - CONFIG_KM_RESERVED_PRAM - CONFIG_KM_PHRAM;
        sprintf((char *)buf, "0x%x", varaddr);
-       setenv("varaddr", (char *)buf);
+       env_set("varaddr", (char *)buf);
 
        kernelmem = gd->ram_size - 0x400 * pram;
        sprintf((char *)buf, "0x%x", kernelmem);
-       setenv("kernelmem", (char *)buf);
+       env_set("kernelmem", (char *)buf);
 
        return 0;
 }
@@ -169,7 +169,7 @@ static int do_setboardid(cmd_tbl_t *cmdtp, int flag, int argc,
                return 1;
        }
        strcpy((char *)buf, p);
-       setenv("boardid", (char *)buf);
+       env_set("boardid", (char *)buf);
        printf("set boardid=%s\n", buf);
 
        p = get_local_var("IVM_HWKey");
@@ -178,7 +178,7 @@ static int do_setboardid(cmd_tbl_t *cmdtp, int flag, int argc,
                return 1;
        }
        strcpy((char *)buf, p);
-       setenv("hwkey", (char *)buf);
+       env_set("hwkey", (char *)buf);
        printf("set hwkey=%s\n", buf);
        printf("Execute manually saveenv for persistent storage.\n");
 
@@ -236,10 +236,10 @@ static int do_checkboardidhwk(cmd_tbl_t *cmdtp, int flag, int argc,
        }
 
        /* now try to read values from environment if available */
-       p = getenv("boardid");
+       p = env_get("boardid");
        if (p != NULL)
                rc = strict_strtoul(p, 16, &envbid);
-       p = getenv("hwkey");
+       p = env_get("hwkey");
        if (p != NULL)
                rc = strict_strtoul(p, 16, &envhwkey);
 
@@ -253,7 +253,7 @@ static int do_checkboardidhwk(cmd_tbl_t *cmdtp, int flag, int argc,
                 * BoardId/HWkey not available in the environment, so try the
                 * environment variable for BoardId/HWkey list
                 */
-               char *bidhwklist = getenv("boardIdListHex");
+               char *bidhwklist = env_get("boardIdListHex");
 
                if (bidhwklist) {
                        int found = 0;
@@ -311,9 +311,9 @@ static int do_checkboardidhwk(cmd_tbl_t *cmdtp, int flag, int argc,
                                        envbid   = bid;
                                        envhwkey = hwkey;
                                        sprintf(buf, "%lx", bid);
-                                       setenv("boardid", buf);
+                                       env_set("boardid", buf);
                                        sprintf(buf, "%lx", hwkey);
-                                       setenv("hwkey", buf);
+                                       env_set("hwkey", buf);
                                }
                        } /* end while( ! found ) */
                }
@@ -355,7 +355,7 @@ static int do_checktestboot(cmd_tbl_t *cmdtp, int flag, int argc,
 #if defined(CONFIG_POST)
        testpin = post_hotkeys_pressed();
 #endif
-       s = getenv("test_bank");
+       s = env_get("test_bank");
        /* when test_bank is not set, act as if testpin is not asserted */
        testboot = (testpin != 0) && (s);
        if (verbose) {
index e9e518cf7257165d0e647d340ff6a865639d2ee1..f1321d9899f84e63dc05faf91ad6d03523c5d792 100644 (file)
@@ -261,7 +261,7 @@ int ivm_analyze_eeprom(unsigned char *buf, int len)
 
        GET_STRING("IVM_Symbol", IVM_POS_SYMBOL_ONLY, 8)
        GET_STRING("IVM_DeviceName", IVM_POS_SHORT_TEXT, 64)
-       tmp = (unsigned char *) getenv("IVM_DeviceName");
+       tmp = (unsigned char *)env_get("IVM_DeviceName");
        if (tmp) {
                int     len = strlen((char *)tmp);
                int     i = 0;
@@ -310,11 +310,11 @@ static int ivm_populate_env(unsigned char *buf, int len)
 #ifndef CONFIG_KMTEGR1
        /* if an offset is defined, add it */
        process_mac(valbuf, page2, CONFIG_PIGGY_MAC_ADRESS_OFFSET, true);
-       setenv((char *)"ethaddr", (char *)valbuf);
+       env_set((char *)"ethaddr", (char *)valbuf);
 #ifdef CONFIG_KMVECT1
 /* KMVECT1 has two ethernet interfaces */
        process_mac(valbuf, page2, 1, true);
-       setenv((char *)"eth1addr", (char *)valbuf);
+       env_set((char *)"eth1addr", (char *)valbuf);
 #endif
 #else
 /* KMTEGR1 has a special setup. eth0 has no connection to the outside and
@@ -322,9 +322,9 @@ static int ivm_populate_env(unsigned char *buf, int len)
  * gets the official MAC address from the IVM
  */
        process_mac(valbuf, page2, CONFIG_PIGGY_MAC_ADRESS_OFFSET, false);
-       setenv((char *)"ethaddr", (char *)valbuf);
+       env_set((char *)"ethaddr", (char *)valbuf);
        process_mac(valbuf, page2, CONFIG_PIGGY_MAC_ADRESS_OFFSET, true);
-       setenv((char *)"eth1addr", (char *)valbuf);
+       env_set((char *)"eth1addr", (char *)valbuf);
 #endif
 
        return 0;
index 8020c379fdb1947705b9c1ec1435c66d0fb552f3..5e07faa818aa6c34b68b37e475f46188bd4bb39b 100644 (file)
@@ -263,11 +263,11 @@ int last_stage_init(void)
        mv88e_sw_reset(name, CONFIG_KM_MVEXTSW_ADDR);
 
        if (piggy_present()) {
-               setenv("ethact", "UEC2");
-               setenv("netdev", "eth1");
+               env_set("ethact", "UEC2");
+               env_set("netdev", "eth1");
                puts("using PIGGY for network boot\n");
        } else {
-               setenv("netdev", "eth0");
+               env_set("netdev", "eth0");
                puts("using frontport for network boot\n");
        }
 #endif
@@ -280,7 +280,7 @@ int last_stage_init(void)
        if (dip_switch != 0) {
                /* start bootloader */
                puts("DIP:   Enabled\n");
-               setenv("actual_bank", "0");
+               env_set("actual_bank", "0");
        }
 #endif
        set_km_env();
index 85785ffc02b1d5d8fdab31972fe03e4bf5097393..af1ebc4101e885a5aa2bf14d7a117920542755fa 100644 (file)
@@ -193,7 +193,7 @@ static void set_bootcount_addr(void)
        unsigned int bootcountaddr;
        bootcountaddr = gd->ram_size - BOOTCOUNT_ADDR;
        sprintf((char *)buf, "0x%x", bootcountaddr);
-       setenv("bootcountaddr", (char *)buf);
+       env_set("bootcountaddr", (char *)buf);
 }
 
 int misc_init_r(void)
@@ -201,7 +201,7 @@ int misc_init_r(void)
 #if defined(CONFIG_KM_MGCOGE3UN)
        char *wait_for_ne;
        u8 dip_switch = kw_gpio_get_value(KM_FLASH_ERASE_ENABLE);
-       wait_for_ne = getenv("waitforne");
+       wait_for_ne = env_get("waitforne");
 
        if ((wait_for_ne != NULL) && (dip_switch == 0)) {
                if (strcmp(wait_for_ne, "true") == 0) {
@@ -299,7 +299,7 @@ int board_late_init(void)
        if (dip_switch != 0) {
                /* start bootloader */
                puts("DIP:   Enabled\n");
-               setenv("actual_bank", "0");
+               env_set("actual_bank", "0");
        }
 #endif
 
index abb20196c55c1bef68088ba70fe7a9cf7ef1a933..8c9d6b167d4744dd62520973510f445676a78b00 100644 (file)
@@ -222,7 +222,7 @@ int last_stage_init(void)
        if (dip_switch != 0) {
                /* start bootloader */
                puts("DIP:   Enabled\n");
-               setenv("actual_bank", "0");
+               env_set("actual_bank", "0");
        }
 #endif
        set_km_env();
@@ -239,7 +239,7 @@ void fdt_fixup_fman_mac_addresses(void *blob)
        unsigned char mac_addr[6];
 
        /* get the mac addr from env */
-       tmp = getenv("ethaddr");
+       tmp = env_get("ethaddr");
        if (!tmp) {
                printf("ethaddr env variable not defined\n");
                return;
@@ -271,8 +271,8 @@ int ft_board_setup(void *blob, bd_t *bd)
 
        ft_cpu_setup(blob, bd);
 
-       base = getenv_bootm_low();
-       size = getenv_bootm_size();
+       base = env_get_bootm_low();
+       size = env_get_bootm_size();
 
        fdt_fixup_memory(blob, (u64)base, (u64)size);
 
index 980cd6288ca8286a520e299d96a653d18a015a19..f0ace03009e79d9b8d550d242dc1d16739f0c0c8 100644 (file)
@@ -240,7 +240,7 @@ int misc_init_r(void)
        int ret;
 
        /* If 'ethaddr' is already set, do nothing. */
-       if (getenv("ethaddr"))
+       if (env_get("ethaddr"))
                return 0;
 
        /* EEPROM is at bus 2. */
@@ -264,7 +264,7 @@ int misc_init_r(void)
        }
 
        /* Set ethernet address from EEPROM. */
-       eth_setenv_enetaddr("ethaddr", data.mac);
+       eth_env_set_enetaddr("ethaddr", data.mac);
 
        return ret;
 }
index f924645dc0788cd5fadf9cef090a7384aa0a5d36..a299f761f96e0606d89a26d8c3d6843937ebfcde 100644 (file)
@@ -133,8 +133,8 @@ int misc_init_r(void)
        }
 
        if (reboot_mode[0] > 0 && isascii(reboot_mode[0])) {
-               if (!getenv("reboot-mode"))
-                       setenv("reboot-mode", (char *)reboot_mode);
+               if (!env_get("reboot-mode"))
+                       env_set("reboot-mode", (char *)reboot_mode);
        }
 
        omap_reboot_mode_clear();
index e265e2a73291f5b0643d6c403569a852aad52495..4f7e018deabbf0cf86105b90b97535218c2d2830 100644 (file)
@@ -367,7 +367,7 @@ int board_init(void)
 
 int board_late_init(void)
 {
-       setenv("board_name", "mccmon6");
+       env_set("board_name", "mccmon6");
 
        return 0;
 }
@@ -467,7 +467,7 @@ int spl_start_uboot(void)
                return 1;
 
        env_init();
-       ret = getenv_f("boot_os", s, sizeof(s));
+       ret = env_get_f("boot_os", s, sizeof(s));
        if ((ret != -1) && (strcmp(s, "no") == 0))
                return 1;
 
@@ -481,7 +481,7 @@ int spl_start_uboot(void)
         * recovery_status = <any value> -> start SWUpdate
         *
         */
-       ret = getenv_f("recovery_status", s, sizeof(s));
+       ret = env_get_f("recovery_status", s, sizeof(s));
        if (ret != -1)
                return 1;
 
index 0a7d4124a62830f4aa07ae58221a16c7c977a34e..78fc5466b692522afc41666bba6ce9b86a3c84ad 100644 (file)
@@ -173,11 +173,11 @@ int board_init(void)
 
 int board_late_init(void)
 {
-       setenv("board_name", "imx6logic");
+       env_set("board_name", "imx6logic");
 
        if (is_mx6dq()) {
-               setenv("board_rev", "MX6DQ");
-               setenv("fdt_file", "imx6q-logicpd.dtb");
+               env_set("board_rev", "MX6DQ");
+               env_set("fdt_file", "imx6q-logicpd.dtb");
        }
 
        return 0;
index f8b9f687fb1b8c46dd58113a196dcac40bc8b6cb..fe3f9e664f982e7c51bcbe0c4ab5ab56eec95c77 100644 (file)
@@ -219,8 +219,8 @@ int board_late_init(void)
                        gd->bd->bi_arch_number = board->machine_id;
 
                /* If the user has not set fdtimage, set the default */
-               if (!getenv("fdtimage"))
-                       setenv("fdtimage", board->fdtfile);
+               if (!env_get("fdtimage"))
+                       env_set("fdtimage", board->fdtfile);
        }
 
        /* restore hsusb0_data5 pin as hsusb0_data5 */
index e91f874a2b909c87f74b38f79385925e08c358a0..e6c2526ea1520bc1f328de172fcf92f056b649a0 100644 (file)
@@ -130,10 +130,10 @@ int board_eth_init(bd_t *bis)
        uchar eth_addr[6];
 
        rc = smc911x_initialize(0, CONFIG_SMC911X_BASE);
-       if (!eth_getenv_enetaddr(STR_ENV_ETHADDR, eth_addr)) {
+       if (!eth_env_get_enetaddr(STR_ENV_ETHADDR, eth_addr)) {
                dev = eth_get_dev_by_index(0);
                if (dev) {
-                       eth_setenv_enetaddr(STR_ENV_ETHADDR, dev->enetaddr);
+                       eth_env_set_enetaddr(STR_ENV_ETHADDR, dev->enetaddr);
                } else {
                        printf("zoom1: Couldn't get eth device\n");
                        rc = -1;
index 8bf8d5f4e813fe0693267d296fbe9bd45454108c..510746d35cb1829ef602ceacfad41f9e9c043441 100644 (file)
@@ -72,7 +72,7 @@ int dram_init(void)
 int checkboard(void)
 {
        char buf[64];
-       int i = getenv_f("serial#", buf, sizeof(buf));
+       int i = env_get_f("serial#", buf, sizeof(buf));
        u32 config0 = read_c0_prid();
 
        if ((config0 & 0xff0000) == PRID_COMP_LEGACY
index 6a4427a42e2b91dd08839dd8a34dd6fc7d541415..7764288811718d02cd0d27cda108a26e75a5588f 100644 (file)
@@ -234,18 +234,18 @@ void setup_board_tags(struct tag **in_params)
        params->u.core.rootdev = 0x0;
 
        /* append omap atag only if env setup_omap_atag is set to 1 */
-       str = getenv("setup_omap_atag");
+       str = env_get("setup_omap_atag");
        if (!str || str[0] != '1')
                return;
 
-       str = getenv("setup_console_atag");
+       str = env_get("setup_console_atag");
        if (str && str[0] == '1')
                setup_console_atag = 1;
        else
                setup_console_atag = 0;
 
-       setup_boot_reason_atag = getenv("setup_boot_reason_atag");
-       setup_boot_mode_atag = getenv("setup_boot_mode_atag");
+       setup_boot_reason_atag = env_get("setup_boot_reason_atag");
+       setup_boot_mode_atag = env_get("setup_boot_mode_atag");
 
        params = *in_params;
        t = (struct tag_omap *)&params->u;
@@ -413,7 +413,7 @@ int misc_init_r(void)
 
        /* set env variable attkernaddr for relocated kernel */
        sprintf(buf, "%#x", KERNEL_ADDRESS);
-       setenv("attkernaddr", buf);
+       env_set("attkernaddr", buf);
 
        /* initialize omap tags */
        init_omap_tags();
index adf33cfd37e328558f122306592b5bbd24598ef5..140e34d4dd6147e5e9f8aaeaebc897b69e76bfc5 100644 (file)
@@ -172,47 +172,47 @@ int misc_init_r(void)
                        expansion_config.revision,
                        expansion_config.fab_revision);
                MUX_GUMSTIX();
-               setenv("defaultdisplay", "dvi");
-               setenv("expansionname", "summit");
+               env_set("defaultdisplay", "dvi");
+               env_set("expansionname", "summit");
                break;
        case GUMSTIX_TOBI:
                printf("Recognized Tobi expansion board (rev %d %s)\n",
                        expansion_config.revision,
                        expansion_config.fab_revision);
                MUX_GUMSTIX();
-               setenv("defaultdisplay", "dvi");
-               setenv("expansionname", "tobi");
+               env_set("defaultdisplay", "dvi");
+               env_set("expansionname", "tobi");
                break;
        case GUMSTIX_TOBI_DUO:
                printf("Recognized Tobi Duo expansion board (rev %d %s)\n",
                        expansion_config.revision,
                        expansion_config.fab_revision);
                MUX_GUMSTIX();
-               setenv("expansionname", "tobiduo");
+               env_set("expansionname", "tobiduo");
                break;
        case GUMSTIX_PALO35:
                printf("Recognized Palo35 expansion board (rev %d %s)\n",
                        expansion_config.revision,
                        expansion_config.fab_revision);
                MUX_GUMSTIX();
-               setenv("defaultdisplay", "lcd35");
-               setenv("expansionname", "palo35");
+               env_set("defaultdisplay", "lcd35");
+               env_set("expansionname", "palo35");
                break;
        case GUMSTIX_PALO43:
                printf("Recognized Palo43 expansion board (rev %d %s)\n",
                        expansion_config.revision,
                        expansion_config.fab_revision);
                MUX_GUMSTIX();
-               setenv("defaultdisplay", "lcd43");
-               setenv("expansionname", "palo43");
+               env_set("defaultdisplay", "lcd43");
+               env_set("expansionname", "palo43");
                break;
        case GUMSTIX_CHESTNUT43:
                printf("Recognized Chestnut43 expansion board (rev %d %s)\n",
                        expansion_config.revision,
                        expansion_config.fab_revision);
                MUX_GUMSTIX();
-               setenv("defaultdisplay", "lcd43");
-               setenv("expansionname", "chestnut43");
+               env_set("defaultdisplay", "lcd43");
+               env_set("expansionname", "chestnut43");
                break;
        case GUMSTIX_PINTO:
                printf("Recognized Pinto expansion board (rev %d %s)\n",
@@ -225,8 +225,8 @@ int misc_init_r(void)
                        expansion_config.revision,
                        expansion_config.fab_revision);
                MUX_GUMSTIX();
-               setenv("defaultdisplay", "lcd43");
-               setenv("expansionname", "gallop43");
+               env_set("defaultdisplay", "lcd43");
+               env_set("expansionname", "gallop43");
                break;
        case GUMSTIX_ALTO35:
                printf("Recognized Alto35 expansion board (rev %d %s)\n",
@@ -234,8 +234,8 @@ int misc_init_r(void)
                        expansion_config.fab_revision);
                MUX_GUMSTIX();
                MUX_ALTO35();
-               setenv("defaultdisplay", "lcd35");
-               setenv("expansionname", "alto35");
+               env_set("defaultdisplay", "lcd35");
+               env_set("expansionname", "alto35");
                break;
        case GUMSTIX_STAGECOACH:
                printf("Recognized Stagecoach expansion board (rev %d %s)\n",
@@ -261,8 +261,8 @@ int misc_init_r(void)
                        expansion_config.fab_revision);
                MUX_GUMSTIX();
                MUX_ARBOR43C();
-               setenv("defaultdisplay", "lcd43");
-               setenv("expansionname", "arbor43c");
+               env_set("defaultdisplay", "lcd43");
+               env_set("expansionname", "arbor43c");
                break;
        case ETTUS_USRP_E:
                printf("Recognized Ettus Research USRP-E (rev %d %s)\n",
@@ -270,13 +270,13 @@ int misc_init_r(void)
                        expansion_config.fab_revision);
                MUX_GUMSTIX();
                MUX_USRP_E();
-               setenv("defaultdisplay", "dvi");
+               env_set("defaultdisplay", "dvi");
                break;
        case GUMSTIX_NO_EEPROM:
        case GUMSTIX_EMPTY_EEPROM:
                puts("No or empty EEPROM on expansion board\n");
                MUX_GUMSTIX();
-               setenv("expansionname", "tobi");
+               env_set("expansionname", "tobi");
                break;
        default:
                printf("Unrecognized expansion board 0x%08x\n", expansion_id);
@@ -284,14 +284,14 @@ int misc_init_r(void)
        }
 
        if (expansion_config.content == 1)
-               setenv(expansion_config.env_var, expansion_config.env_setting);
+               env_set(expansion_config.env_var, expansion_config.env_setting);
 
        omap_die_id_display();
 
        if (get_cpu_family() == CPU_OMAP34XX)
-               setenv("boardname", "overo");
+               env_set("boardname", "overo");
        else
-               setenv("boardname", "overo-storm");
+               env_set("boardname", "overo-storm");
 
        return 0;
 }
index 4f3853ac4262ac347740369be63d1e550e46845a..52ad5b64de7d58aceafc79037e5881cd70652997 100644 (file)
@@ -216,7 +216,7 @@ int board_eth_init(bd_t *bis)
        uint8_t mac_addr[6];
        uint32_t mac_hi, mac_lo;
 
-       if (!eth_getenv_enetaddr("ethaddr", mac_addr)) {
+       if (!eth_env_get_enetaddr("ethaddr", mac_addr)) {
                printf("<ethaddr> not set. Reading from E-fuse\n");
                /* try reading mac address from efuse */
                mac_lo = readl(&cdev->macid0l);
@@ -229,7 +229,7 @@ int board_eth_init(bd_t *bis)
                mac_addr[5] = (mac_lo & 0xFF00) >> 8;
 
                if (is_valid_ethaddr(mac_addr))
-                       eth_setenv_enetaddr("ethaddr", mac_addr);
+                       eth_env_set_enetaddr("ethaddr", mac_addr);
                else
                        goto try_usbether;
        }
diff --git a/board/phytec/pfla02/Kconfig b/board/phytec/pfla02/Kconfig
new file mode 100644 (file)
index 0000000..142a122
--- /dev/null
@@ -0,0 +1,12 @@
+if TARGET_PFLA02
+
+config SYS_BOARD
+       default "pfla02"
+
+config SYS_VENDOR
+       default "phytec"
+
+config SYS_CONFIG_NAME
+       default "pfla02"
+
+endif
diff --git a/board/phytec/pfla02/MAINTAINERS b/board/phytec/pfla02/MAINTAINERS
new file mode 100644 (file)
index 0000000..4b069a9
--- /dev/null
@@ -0,0 +1,6 @@
+PHYTEC PHYFLEX
+M:     Stefano Babic <sbabic@denx.de>
+S:     Maintained
+F:     board/phytec/pfla02/
+F:     include/configs/pfla02.h
+F:     configs/pfla02_defconfig
diff --git a/board/phytec/pfla02/Makefile b/board/phytec/pfla02/Makefile
new file mode 100644 (file)
index 0000000..25af9a0
--- /dev/null
@@ -0,0 +1,9 @@
+#
+# Copyright (C) 2007, Guennadi Liakhovetski <lg@denx.de>
+#
+# (C) Copyright 2011 Freescale Semiconductor, Inc.
+#
+# SPDX-License-Identifier:     GPL-2.0+
+#
+
+obj-y  := pfla02.o
diff --git a/board/phytec/pfla02/README b/board/phytec/pfla02/README
new file mode 100644 (file)
index 0000000..0f46ab8
--- /dev/null
@@ -0,0 +1,24 @@
+Board information
+-----------------
+
+The evaluation board "pbab01" is thought to be used
+together with the SOM.
+
+More information on the board can be found on manufacturer's
+website:
+
+http://www.phytec.de/produkt/system-on-modules/phyflex-imx-6/
+
+Building U-Boot
+-------------------------------
+
+$ make pfla02_defconfig
+$ make
+
+This generates the artifacts SPL and u-boot.img.
+The SOM can boot from NAND or from SD-Card, having the SPI-NOR
+as second option.
+The dip switch "SW3" on the board let choose the boot device.
+
+SW3_1(on), SW3_2(on), SW3_3(off):      Boot first from SD, then try SPI
+SW3_1(off), SW3_2(on), SW3_3(off):     Boot from SPI
diff --git a/board/phytec/pfla02/pfla02.c b/board/phytec/pfla02/pfla02.c
new file mode 100644 (file)
index 0000000..8d2ce63
--- /dev/null
@@ -0,0 +1,698 @@
+/*
+ * Copyright (C) 2017 Stefano Babic <sbabic@denx.de>
+ *
+ * SPDX-License-Identifier:    GPL-2.0+
+ */
+
+#include <common.h>
+#include <asm/io.h>
+#include <asm/arch/clock.h>
+#include <asm/arch/imx-regs.h>
+#include <asm/arch/iomux.h>
+#include <asm/arch/crm_regs.h>
+#include <asm/arch/iomux.h>
+#include <asm/arch/mx6-pins.h>
+#include <asm/mach-imx/iomux-v3.h>
+#include <asm/mach-imx/boot_mode.h>
+#include <asm/mach-imx/mxc_i2c.h>
+#include <asm/mach-imx/spi.h>
+#include <linux/errno.h>
+#include <asm/gpio.h>
+#include <mmc.h>
+#include <i2c.h>
+#include <fsl_esdhc.h>
+#include <nand.h>
+#include <miiphy.h>
+#include <netdev.h>
+#include <asm/arch/sys_proto.h>
+#include <asm/sections.h>
+
+DECLARE_GLOBAL_DATA_PTR;
+
+#define UART_PAD_CTRL  (PAD_CTL_PUS_100K_UP |                  \
+       PAD_CTL_SPEED_MED | PAD_CTL_DSE_40ohm |                 \
+       PAD_CTL_SRE_FAST  | PAD_CTL_HYS)
+
+#define USDHC_PAD_CTRL (PAD_CTL_PUS_47K_UP |                   \
+       PAD_CTL_SPEED_LOW | PAD_CTL_DSE_80ohm |                 \
+       PAD_CTL_SRE_FAST  | PAD_CTL_HYS)
+
+#define ENET_PAD_CTRL  (PAD_CTL_PUS_100K_UP |                  \
+       PAD_CTL_SPEED_MED | PAD_CTL_DSE_40ohm | PAD_CTL_HYS)
+
+#define SPI_PAD_CTRL (PAD_CTL_HYS | PAD_CTL_SPEED_MED | \
+                     PAD_CTL_DSE_40ohm | PAD_CTL_SRE_FAST)
+
+#define I2C_PAD_CTRL  (PAD_CTL_PUS_100K_UP |                   \
+       PAD_CTL_SPEED_MED | PAD_CTL_DSE_40ohm | PAD_CTL_HYS |   \
+       PAD_CTL_ODE | PAD_CTL_SRE_FAST)
+
+#define I2C_PAD MUX_PAD_CTRL(I2C_PAD_CTRL)
+
+#define ASRC_PAD_CTRL (PAD_CTL_HYS | PAD_CTL_PUS_100K_UP  |    \
+                     PAD_CTL_DSE_40ohm | PAD_CTL_SRE_FAST)
+
+#define NAND_PAD_CTRL (PAD_CTL_PUS_100K_UP | PAD_CTL_SPEED_MED | \
+              PAD_CTL_DSE_40ohm | PAD_CTL_SRE_FAST)
+
+#define ENET_PHY_RESET_GPIO IMX_GPIO_NR(1, 14)
+#define USDHC2_CD_GPIO IMX_GPIO_NR(1, 4)
+#define GREEN_LED      IMX_GPIO_NR(2, 31)
+#define RED_LED                IMX_GPIO_NR(1, 30)
+#define IMX6Q_DRIVE_STRENGTH   0x30
+
+int dram_init(void)
+{
+       gd->ram_size = imx_ddr_size();
+       return 0;
+}
+
+static iomux_v3_cfg_t const uart4_pads[] = {
+       IOMUX_PADS(PAD_KEY_COL0__UART4_TX_DATA | MUX_PAD_CTRL(UART_PAD_CTRL)),
+       IOMUX_PADS(PAD_KEY_ROW0__UART4_RX_DATA | MUX_PAD_CTRL(UART_PAD_CTRL)),
+};
+
+static iomux_v3_cfg_t const enet_pads[] = {
+       IOMUX_PADS(PAD_ENET_MDIO__ENET_MDIO     | MUX_PAD_CTRL(ENET_PAD_CTRL)),
+       IOMUX_PADS(PAD_ENET_MDC__ENET_MDC       | MUX_PAD_CTRL(ENET_PAD_CTRL)),
+       IOMUX_PADS(PAD_RGMII_TXC__RGMII_TXC     | MUX_PAD_CTRL(ENET_PAD_CTRL)),
+       IOMUX_PADS(PAD_RGMII_TD0__RGMII_TD0     | MUX_PAD_CTRL(ENET_PAD_CTRL)),
+       IOMUX_PADS(PAD_RGMII_TD1__RGMII_TD1     | MUX_PAD_CTRL(ENET_PAD_CTRL)),
+       IOMUX_PADS(PAD_RGMII_TD2__RGMII_TD2     | MUX_PAD_CTRL(ENET_PAD_CTRL)),
+       IOMUX_PADS(PAD_RGMII_TD3__RGMII_TD3     | MUX_PAD_CTRL(ENET_PAD_CTRL)),
+       IOMUX_PADS(PAD_RGMII_TX_CTL__RGMII_TX_CTL |
+                       MUX_PAD_CTRL(ENET_PAD_CTRL)),
+       IOMUX_PADS(PAD_ENET_REF_CLK__ENET_TX_CLK |
+                       MUX_PAD_CTRL(ENET_PAD_CTRL)),
+       IOMUX_PADS(PAD_RGMII_RXC__RGMII_RXC     | MUX_PAD_CTRL(ENET_PAD_CTRL)),
+       IOMUX_PADS(PAD_RGMII_RD0__RGMII_RD0     | MUX_PAD_CTRL(ENET_PAD_CTRL)),
+       IOMUX_PADS(PAD_RGMII_RD1__RGMII_RD1     | MUX_PAD_CTRL(ENET_PAD_CTRL)),
+       IOMUX_PADS(PAD_RGMII_RD2__RGMII_RD2     | MUX_PAD_CTRL(ENET_PAD_CTRL)),
+       IOMUX_PADS(PAD_RGMII_RD3__RGMII_RD3     | MUX_PAD_CTRL(ENET_PAD_CTRL)),
+       IOMUX_PADS(PAD_RGMII_RX_CTL__RGMII_RX_CTL |
+                       MUX_PAD_CTRL(ENET_PAD_CTRL)),
+       IOMUX_PADS(PAD_SD2_DAT1__GPIO1_IO14     | MUX_PAD_CTRL(NO_PAD_CTRL)),
+};
+
+static iomux_v3_cfg_t const ecspi3_pads[] = {
+       IOMUX_PADS(PAD_DISP0_DAT0__ECSPI3_SCLK | MUX_PAD_CTRL(SPI_PAD_CTRL)),
+       IOMUX_PADS(PAD_DISP0_DAT1__ECSPI3_MOSI | MUX_PAD_CTRL(SPI_PAD_CTRL)),
+       IOMUX_PADS(PAD_DISP0_DAT2__ECSPI3_MISO | MUX_PAD_CTRL(SPI_PAD_CTRL)),
+       IOMUX_PADS(PAD_DISP0_DAT3__GPIO4_IO24  | MUX_PAD_CTRL(NO_PAD_CTRL)),
+};
+
+static iomux_v3_cfg_t const gpios_pads[] = {
+       IOMUX_PADS(PAD_SD4_DAT3__GPIO2_IO11 | MUX_PAD_CTRL(NO_PAD_CTRL)),
+       IOMUX_PADS(PAD_SD4_DAT4__GPIO2_IO12 | MUX_PAD_CTRL(NO_PAD_CTRL)),
+       IOMUX_PADS(PAD_SD4_DAT5__GPIO2_IO13 | MUX_PAD_CTRL(NO_PAD_CTRL)),
+       IOMUX_PADS(PAD_SD4_DAT6__GPIO2_IO14 | MUX_PAD_CTRL(NO_PAD_CTRL)),
+       IOMUX_PADS(PAD_SD4_DAT7__GPIO2_IO15 | MUX_PAD_CTRL(NO_PAD_CTRL)),
+       IOMUX_PADS(PAD_EIM_EB3__GPIO2_IO31 | MUX_PAD_CTRL(NO_PAD_CTRL)),
+       IOMUX_PADS(PAD_ENET_TXD0__GPIO1_IO30 | MUX_PAD_CTRL(NO_PAD_CTRL)),
+       IOMUX_PADS(PAD_SD4_DAT3__GPIO2_IO11 | MUX_PAD_CTRL(NO_PAD_CTRL)),
+};
+
+#ifdef CONFIG_CMD_NAND
+/* NAND */
+static iomux_v3_cfg_t const nfc_pads[] = {
+       IOMUX_PADS(PAD_NANDF_CLE__NAND_CLE      | MUX_PAD_CTRL(NAND_PAD_CTRL)),
+       IOMUX_PADS(PAD_NANDF_ALE__NAND_ALE      | MUX_PAD_CTRL(NAND_PAD_CTRL)),
+       IOMUX_PADS(PAD_NANDF_WP_B__NAND_WP_B    | MUX_PAD_CTRL(NAND_PAD_CTRL)),
+       IOMUX_PADS(PAD_NANDF_RB0__NAND_READY_B  | MUX_PAD_CTRL(NAND_PAD_CTRL)),
+       IOMUX_PADS(PAD_NANDF_CS0__NAND_CE0_B    | MUX_PAD_CTRL(NAND_PAD_CTRL)),
+       IOMUX_PADS(PAD_NANDF_CS1__NAND_CE1_B    | MUX_PAD_CTRL(NAND_PAD_CTRL)),
+       IOMUX_PADS(PAD_NANDF_CS2__NAND_CE2_B    | MUX_PAD_CTRL(NAND_PAD_CTRL)),
+       IOMUX_PADS(PAD_NANDF_CS3__NAND_CE3_B    | MUX_PAD_CTRL(NAND_PAD_CTRL)),
+       IOMUX_PADS(PAD_SD4_CMD__NAND_RE_B       | MUX_PAD_CTRL(NAND_PAD_CTRL)),
+       IOMUX_PADS(PAD_SD4_CLK__NAND_WE_B       | MUX_PAD_CTRL(NAND_PAD_CTRL)),
+       IOMUX_PADS(PAD_NANDF_D0__NAND_DATA00    | MUX_PAD_CTRL(NAND_PAD_CTRL)),
+       IOMUX_PADS(PAD_NANDF_D1__NAND_DATA01    | MUX_PAD_CTRL(NAND_PAD_CTRL)),
+       IOMUX_PADS(PAD_NANDF_D2__NAND_DATA02    | MUX_PAD_CTRL(NAND_PAD_CTRL)),
+       IOMUX_PADS(PAD_NANDF_D3__NAND_DATA03    | MUX_PAD_CTRL(NAND_PAD_CTRL)),
+       IOMUX_PADS(PAD_NANDF_D4__NAND_DATA04    | MUX_PAD_CTRL(NAND_PAD_CTRL)),
+       IOMUX_PADS(PAD_NANDF_D5__NAND_DATA05    | MUX_PAD_CTRL(NAND_PAD_CTRL)),
+       IOMUX_PADS(PAD_NANDF_D6__NAND_DATA06    | MUX_PAD_CTRL(NAND_PAD_CTRL)),
+       IOMUX_PADS(PAD_NANDF_D7__NAND_DATA07    | MUX_PAD_CTRL(NAND_PAD_CTRL)),
+       IOMUX_PADS(PAD_SD4_DAT0__NAND_DQS       | MUX_PAD_CTRL(NAND_PAD_CTRL)),
+};
+#endif
+
+static struct i2c_pads_info i2c_pad_info = {
+       .scl = {
+               .i2c_mode = MX6Q_PAD_EIM_D21__I2C1_SCL | I2C_PAD,
+               .gpio_mode = MX6Q_PAD_EIM_D21__GPIO3_IO21 | I2C_PAD,
+               .gp = IMX_GPIO_NR(3, 21)
+       },
+       .sda = {
+               .i2c_mode = MX6Q_PAD_EIM_D28__I2C1_SDA | I2C_PAD,
+               .gpio_mode = MX6Q_PAD_EIM_D28__GPIO3_IO28 | I2C_PAD,
+               .gp = IMX_GPIO_NR(3, 28)
+       }
+};
+
+static struct fsl_esdhc_cfg usdhc_cfg[] = {
+       {USDHC3_BASE_ADDR,
+       .max_bus_width = 4},
+       {.esdhc_base = USDHC2_BASE_ADDR,
+       .max_bus_width = 4},
+};
+
+#if !defined(CONFIG_SPL_BUILD)
+static iomux_v3_cfg_t const usdhc2_pads[] = {
+       IOMUX_PADS(PAD_SD2_CLK__SD2_CLK | MUX_PAD_CTRL(USDHC_PAD_CTRL)),
+       IOMUX_PADS(PAD_SD2_CMD__SD2_CMD | MUX_PAD_CTRL(USDHC_PAD_CTRL)),
+       IOMUX_PADS(PAD_SD2_DAT0__SD2_DATA0      | MUX_PAD_CTRL(USDHC_PAD_CTRL)),
+       IOMUX_PADS(PAD_SD2_DAT1__SD2_DATA1      | MUX_PAD_CTRL(USDHC_PAD_CTRL)),
+       IOMUX_PADS(PAD_SD2_DAT2__SD2_DATA2      | MUX_PAD_CTRL(USDHC_PAD_CTRL)),
+       IOMUX_PADS(PAD_SD2_DAT3__SD2_DATA3      | MUX_PAD_CTRL(USDHC_PAD_CTRL)),
+       IOMUX_PADS(PAD_EIM_BCLK__GPIO6_IO31     | MUX_PAD_CTRL(NO_PAD_CTRL)),
+       IOMUX_PADS(PAD_GPIO_4__GPIO1_IO04       | MUX_PAD_CTRL(NO_PAD_CTRL)),
+};
+#endif
+
+static iomux_v3_cfg_t const usdhc3_pads[] = {
+       IOMUX_PADS(PAD_SD3_CLK__SD3_CLK | MUX_PAD_CTRL(USDHC_PAD_CTRL)),
+       IOMUX_PADS(PAD_SD3_CMD__SD3_CMD | MUX_PAD_CTRL(USDHC_PAD_CTRL)),
+       IOMUX_PADS(PAD_SD3_DAT0__SD3_DATA0      | MUX_PAD_CTRL(USDHC_PAD_CTRL)),
+       IOMUX_PADS(PAD_SD3_DAT1__SD3_DATA1      | MUX_PAD_CTRL(USDHC_PAD_CTRL)),
+       IOMUX_PADS(PAD_SD3_DAT2__SD3_DATA2      | MUX_PAD_CTRL(USDHC_PAD_CTRL)),
+       IOMUX_PADS(PAD_SD3_DAT3__SD3_DATA3      | MUX_PAD_CTRL(USDHC_PAD_CTRL)),
+       IOMUX_PADS(PAD_SD3_DAT4__SD3_DATA4      | MUX_PAD_CTRL(USDHC_PAD_CTRL)),
+       IOMUX_PADS(PAD_SD3_DAT5__SD3_DATA5      | MUX_PAD_CTRL(USDHC_PAD_CTRL)),
+       IOMUX_PADS(PAD_SD3_DAT6__SD3_DATA6      | MUX_PAD_CTRL(USDHC_PAD_CTRL)),
+       IOMUX_PADS(PAD_SD3_DAT7__SD3_DATA7      | MUX_PAD_CTRL(USDHC_PAD_CTRL)),
+};
+
+int board_mmc_get_env_dev(int devno)
+{
+       return devno - 1;
+}
+
+int board_mmc_getcd(struct mmc *mmc)
+{
+       struct fsl_esdhc_cfg *cfg = (struct fsl_esdhc_cfg *)mmc->priv;
+       int ret = 0;
+
+       switch (cfg->esdhc_base) {
+       case USDHC2_BASE_ADDR:
+               ret = !gpio_get_value(USDHC2_CD_GPIO);
+               ret = 1;
+               break;
+       case USDHC3_BASE_ADDR:
+               ret = 1;
+               break;
+       }
+
+       return ret;
+}
+
+#ifndef CONFIG_SPL_BUILD
+int board_mmc_init(bd_t *bis)
+{
+       int ret;
+       int i;
+
+       for (i = 0; i < CONFIG_SYS_FSL_USDHC_NUM; i++) {
+               switch (i) {
+               case 0:
+                       SETUP_IOMUX_PADS(usdhc3_pads);
+                       usdhc_cfg[0].sdhc_clk = mxc_get_clock(MXC_ESDHC3_CLK);
+                       break;
+               case 1:
+                       SETUP_IOMUX_PADS(usdhc2_pads);
+                       gpio_direction_input(USDHC2_CD_GPIO);
+                       usdhc_cfg[1].sdhc_clk = mxc_get_clock(MXC_ESDHC2_CLK);
+                       break;
+               default:
+                       printf("Warning: you configured more USDHC controllers"
+                              "(%d) then supported by the board (%d)\n",
+                              i + 1, CONFIG_SYS_FSL_USDHC_NUM);
+                       return -EINVAL;
+               }
+
+               ret = fsl_esdhc_initialize(bis, &usdhc_cfg[i]);
+               if (ret)
+                       return ret;
+       }
+
+       return 0;
+}
+#endif
+
+static void setup_iomux_uart(void)
+{
+       SETUP_IOMUX_PADS(uart4_pads);
+}
+
+static void setup_iomux_enet(void)
+{
+       SETUP_IOMUX_PADS(enet_pads);
+
+       gpio_direction_output(ENET_PHY_RESET_GPIO, 0);
+       mdelay(10);
+       gpio_set_value(ENET_PHY_RESET_GPIO, 1);
+       mdelay(30);
+}
+
+static void setup_spi(void)
+{
+       gpio_request(IMX_GPIO_NR(4, 24), "spi_cs0");
+       gpio_direction_output(IMX_GPIO_NR(4, 24), 1);
+
+       SETUP_IOMUX_PADS(ecspi3_pads);
+
+       enable_spi_clk(true, 2);
+}
+
+static void setup_gpios(void)
+{
+       SETUP_IOMUX_PADS(gpios_pads);
+}
+
+#ifdef CONFIG_CMD_NAND
+static void setup_gpmi_nand(void)
+{
+       struct mxc_ccm_reg *mxc_ccm = (struct mxc_ccm_reg *)CCM_BASE_ADDR;
+
+       /* config gpmi nand iomux */
+       SETUP_IOMUX_PADS(nfc_pads);
+
+       /* gate ENFC_CLK_ROOT clock first,before clk source switch */
+       clrbits_le32(&mxc_ccm->CCGR2, MXC_CCM_CCGR2_IOMUX_IPT_CLK_IO_MASK);
+
+       /* config gpmi and bch clock to 100 MHz */
+       clrsetbits_le32(&mxc_ccm->cs2cdr,
+                       MXC_CCM_CS2CDR_ENFC_CLK_PODF_MASK |
+                       MXC_CCM_CS2CDR_ENFC_CLK_PRED_MASK |
+                       MXC_CCM_CS2CDR_ENFC_CLK_SEL_MASK,
+                       MXC_CCM_CS2CDR_ENFC_CLK_PODF(0) |
+                       MXC_CCM_CS2CDR_ENFC_CLK_PRED(3) |
+                       MXC_CCM_CS2CDR_ENFC_CLK_SEL(3));
+
+       /* enable ENFC_CLK_ROOT clock */
+       setbits_le32(&mxc_ccm->CCGR2, MXC_CCM_CCGR2_IOMUX_IPT_CLK_IO_MASK);
+
+       /* enable gpmi and bch clock gating */
+       setbits_le32(&mxc_ccm->CCGR4,
+                    MXC_CCM_CCGR4_RAWNAND_U_BCH_INPUT_APB_MASK |
+                    MXC_CCM_CCGR4_RAWNAND_U_GPMI_BCH_INPUT_BCH_MASK |
+                    MXC_CCM_CCGR4_RAWNAND_U_GPMI_BCH_INPUT_GPMI_IO_MASK |
+                    MXC_CCM_CCGR4_RAWNAND_U_GPMI_INPUT_APB_MASK |
+                    MXC_CCM_CCGR4_PL301_MX6QPER1_BCH_OFFSET);
+
+       /* enable apbh clock gating */
+       setbits_le32(&mxc_ccm->CCGR0, MXC_CCM_CCGR0_APBHDMA_MASK);
+}
+#endif
+
+/*
+ * Board revision is coded in 4 GPIOs
+ */
+u32 get_board_rev(void)
+{
+       u32 rev;
+       int i;
+
+       for (i = 0, rev = 0; i < 4; i++)
+               rev |= (gpio_get_value(IMX_GPIO_NR(2, 12 + i)) << i);
+
+       return 16 - rev;
+}
+
+int board_spi_cs_gpio(unsigned bus, unsigned cs)
+{
+       if (bus != 2 || (cs != 0))
+               return -EINVAL;
+
+       return IMX_GPIO_NR(4, 24);
+}
+
+int board_eth_init(bd_t *bis)
+{
+       setup_iomux_enet();
+
+       return cpu_eth_init(bis);
+}
+
+int board_early_init_f(void)
+{
+       setup_iomux_uart();
+
+       return 0;
+}
+
+int board_init(void)
+{
+       /* address of boot parameters */
+       gd->bd->bi_boot_params = PHYS_SDRAM + 0x100;
+
+#ifdef CONFIG_SYS_I2C_MXC
+       setup_i2c(0, CONFIG_SYS_I2C_SPEED, 0x7f, &i2c_pad_info);
+#endif
+
+#ifdef CONFIG_MXC_SPI
+       setup_spi();
+#endif
+
+       setup_gpios();
+
+#ifdef CONFIG_CMD_NAND
+       setup_gpmi_nand();
+#endif
+       return 0;
+}
+
+
+#ifdef CONFIG_CMD_BMODE
+/*
+ * BOOT_CFG1, BOOT_CFG2, BOOT_CFG3, BOOT_CFG4
+ * see Table 8-11 and Table 5-9
+ *  BOOT_CFG1[7] = 1 (boot from NAND)
+ *  BOOT_CFG1[5] = 0 - raw NAND
+ *  BOOT_CFG1[4] = 0 - default pad settings
+ *  BOOT_CFG1[3:2] = 00 - devices = 1
+ *  BOOT_CFG1[1:0] = 00 - Row Address Cycles = 3
+ *  BOOT_CFG2[4:3] = 00 - Boot Search Count = 2
+ *  BOOT_CFG2[2:1] = 01 - Pages In Block = 64
+ *  BOOT_CFG2[0] = 0 - Reset time 12ms
+ */
+static const struct boot_mode board_boot_modes[] = {
+       /* NAND: 64pages per block, 3 row addr cycles, 2 copies of FCB/DBBT */
+       {"nand", MAKE_CFGVAL(0x80, 0x02, 0x00, 0x00)},
+       {"mmc0",  MAKE_CFGVAL(0x40, 0x20, 0x00, 0x00)},
+       {NULL, 0},
+};
+#endif
+
+int board_late_init(void)
+{
+       char buf[10];
+#ifdef CONFIG_CMD_BMODE
+       add_board_boot_modes(board_boot_modes);
+#endif
+
+       snprintf(buf, sizeof(buf), "%d", get_board_rev());
+       env_set("board_rev", buf);
+
+       return 0;
+}
+
+#ifdef CONFIG_SPL_BUILD
+#include <asm/arch/mx6-ddr.h>
+#include <spl.h>
+#include <libfdt.h>
+
+#define MX6_PHYFLEX_ERR006282  IMX_GPIO_NR(2, 11)
+static void phyflex_err006282_workaround(void)
+{
+       /*
+        * Boards beginning with 1362.2 have the SD4_DAT3 pin connected
+        * to the CMIC. If this pin isn't toggled within 10s the boards
+        * reset. The pin is unconnected on older boards, so we do not
+        * need a check for older boards before applying this fixup.
+        */
+
+       gpio_direction_output(MX6_PHYFLEX_ERR006282, 0);
+       mdelay(2);
+       gpio_direction_output(MX6_PHYFLEX_ERR006282, 1);
+       mdelay(2);
+       gpio_set_value(MX6_PHYFLEX_ERR006282, 0);
+
+       gpio_direction_input(MX6_PHYFLEX_ERR006282);
+}
+
+static const struct mx6dq_iomux_ddr_regs mx6_ddr_ioregs = {
+       .dram_sdclk_0 = 0x00000030,
+       .dram_sdclk_1 = 0x00000030,
+       .dram_cas = 0x00000030,
+       .dram_ras = 0x00000030,
+       .dram_reset = 0x00000030,
+       .dram_sdcke0 = 0x00003000,
+       .dram_sdcke1 = 0x00003000,
+       .dram_sdba2 = 0x00000030,
+       .dram_sdodt0 = 0x00000030,
+       .dram_sdodt1 = 0x00000030,
+
+       .dram_sdqs0 = 0x00000028,
+       .dram_sdqs1 = 0x00000028,
+       .dram_sdqs2 = 0x00000028,
+       .dram_sdqs3 = 0x00000028,
+       .dram_sdqs4 = 0x00000028,
+       .dram_sdqs5 = 0x00000028,
+       .dram_sdqs6 = 0x00000028,
+       .dram_sdqs7 = 0x00000028,
+       .dram_dqm0 = 0x00000028,
+       .dram_dqm1 = 0x00000028,
+       .dram_dqm2 = 0x00000028,
+       .dram_dqm3 = 0x00000028,
+       .dram_dqm4 = 0x00000028,
+       .dram_dqm5 = 0x00000028,
+       .dram_dqm6 = 0x00000028,
+       .dram_dqm7 = 0x00000028,
+};
+
+static const struct mx6dq_iomux_grp_regs mx6_grp_ioregs = {
+       .grp_ddr_type =  0x000C0000,
+       .grp_ddrmode_ctl =  0x00020000,
+       .grp_ddrpke =  0x00000000,
+       .grp_addds = IMX6Q_DRIVE_STRENGTH,
+       .grp_ctlds = IMX6Q_DRIVE_STRENGTH,
+       .grp_ddrmode =  0x00020000,
+       .grp_b0ds = 0x00000028,
+       .grp_b1ds = 0x00000028,
+       .grp_b2ds = 0x00000028,
+       .grp_b3ds = 0x00000028,
+       .grp_b4ds = 0x00000028,
+       .grp_b5ds = 0x00000028,
+       .grp_b6ds = 0x00000028,
+       .grp_b7ds = 0x00000028,
+};
+
+static const struct mx6_mmdc_calibration mx6_mmcd_calib = {
+       .p0_mpwldectrl0 =  0x00110011,
+       .p0_mpwldectrl1 =  0x00240024,
+       .p1_mpwldectrl0 =  0x00260038,
+       .p1_mpwldectrl1 =  0x002C0038,
+       .p0_mpdgctrl0 =  0x03400350,
+       .p0_mpdgctrl1 =  0x03440340,
+       .p1_mpdgctrl0 =  0x034C0354,
+       .p1_mpdgctrl1 =  0x035C033C,
+       .p0_mprddlctl =  0x322A2A2A,
+       .p1_mprddlctl =  0x302C2834,
+       .p0_mpwrdlctl =  0x34303834,
+       .p1_mpwrdlctl =  0x422A3E36,
+};
+
+/* Index in RAM Chip array */
+enum {
+       RAM_1GB,
+       RAM_2GB,
+       RAM_4GB
+};
+
+static struct mx6_ddr3_cfg mt41k_xx[] = {
+/* MT41K64M16JT-125 (1Gb density) */
+       {
+       .mem_speed = 1600,
+       .density = 1,
+       .width = 16,
+       .banks = 8,
+       .rowaddr = 13,
+       .coladdr = 10,
+       .pagesz = 2,
+       .trcd = 1375,
+       .trcmin = 4875,
+       .trasmin = 3500,
+       .SRT       = 1,
+       },
+
+/* MT41K256M16JT-125 (2Gb density) */
+       {
+       .mem_speed = 1600,
+       .density = 2,
+       .width = 16,
+       .banks = 8,
+       .rowaddr = 14,
+       .coladdr = 10,
+       .pagesz = 2,
+       .trcd = 1375,
+       .trcmin = 4875,
+       .trasmin = 3500,
+       .SRT       = 1,
+       },
+
+/* MT41K256M16JT-125 (4Gb density) */
+       {
+       .mem_speed = 1600,
+       .density = 4,
+       .width = 16,
+       .banks = 8,
+       .rowaddr = 15,
+       .coladdr = 10,
+       .pagesz = 2,
+       .trcd = 1375,
+       .trcmin = 4875,
+       .trasmin = 3500,
+       .SRT       = 1,
+       }
+};
+
+static void ccgr_init(void)
+{
+       struct mxc_ccm_reg *ccm = (struct mxc_ccm_reg *)CCM_BASE_ADDR;
+
+       writel(0x00C03F3F, &ccm->CCGR0);
+       writel(0x0030FC03, &ccm->CCGR1);
+       writel(0x0FFFC000, &ccm->CCGR2);
+       writel(0x3FF00000, &ccm->CCGR3);
+       writel(0x00FFF300, &ccm->CCGR4);
+       writel(0x0F0000C3, &ccm->CCGR5);
+       writel(0x000003FF, &ccm->CCGR6);
+}
+
+static void gpr_init(void)
+{
+       struct iomuxc *iomux = (struct iomuxc *)IOMUXC_BASE_ADDR;
+
+       /* enable AXI cache for VDOA/VPU/IPU */
+       writel(0xF00000CF, &iomux->gpr[4]);
+       /* set IPU AXI-id0 Qos=0xf(bypass) AXI-id1 Qos=0x7 */
+       writel(0x007F007F, &iomux->gpr[6]);
+       writel(0x007F007F, &iomux->gpr[7]);
+}
+
+static void spl_dram_init(struct mx6_ddr3_cfg *mem_ddr)
+{
+       struct mx6_ddr_sysinfo sysinfo = {
+               /* width of data bus:0=16,1=32,2=64 */
+               .dsize = 2,
+               /* config for full 4GB range so that get_mem_size() works */
+               .cs_density = 32, /* 32Gb per CS */
+               /* single chip select */
+               .ncs = 2,
+               .cs1_mirror = 0,
+               .rtt_wr = 1 /*DDR3_RTT_60_OHM*/,        /* RTT_Wr = RZQ/4 */
+               .rtt_nom = 1 /*DDR3_RTT_60_OHM*/,       /* RTT_Nom = RZQ/4 */
+               .walat = 1,     /* Write additional latency */
+               .ralat = 5,     /* Read additional latency */
+               .mif3_mode = 3, /* Command prediction working mode */
+               .bi_on = 1,     /* Bank interleaving enabled */
+               .sde_to_rst = 0x10,     /* 14 cycles, 200us (JEDEC default) */
+               .rst_to_cke = 0x23,     /* 33 cycles, 500us (JEDEC default) */
+               .ddr_type = DDR_TYPE_DDR3,
+               .refsel = 1,    /* Refresh cycles at 32KHz */
+               .refr = 7,      /* 8 refresh commands per refresh cycle */
+       };
+
+       mx6dq_dram_iocfg(64, &mx6_ddr_ioregs, &mx6_grp_ioregs);
+       mx6_dram_cfg(&sysinfo, &mx6_mmcd_calib, mem_ddr);
+}
+
+int board_mmc_init(bd_t *bis)
+{
+       if (spl_boot_device() == BOOT_DEVICE_SPI)
+               printf("MMC SEtup, Boot SPI");
+
+       SETUP_IOMUX_PADS(usdhc3_pads);
+       usdhc_cfg[0].esdhc_base = USDHC3_BASE_ADDR;
+       usdhc_cfg[0].sdhc_clk = mxc_get_clock(MXC_ESDHC3_CLK);
+       usdhc_cfg[0].max_bus_width = 4;
+       gd->arch.sdhc_clk = usdhc_cfg[0].sdhc_clk;
+
+       return fsl_esdhc_initialize(bis, &usdhc_cfg[0]);
+}
+
+
+void board_boot_order(u32 *spl_boot_list)
+{
+       spl_boot_list[0] = spl_boot_device();
+       printf("Boot device %x\n", spl_boot_list[0]);
+       switch (spl_boot_list[0]) {
+       case BOOT_DEVICE_SPI:
+               spl_boot_list[1] = BOOT_DEVICE_UART;
+               break;
+       case BOOT_DEVICE_MMC1:
+               spl_boot_list[1] = BOOT_DEVICE_SPI;
+               spl_boot_list[2] = BOOT_DEVICE_UART;
+               break;
+       default:
+               printf("Boot device %x\n", spl_boot_list[0]);
+       }
+}
+
+/*
+ * This is used because get_ram_size() does not
+ * take care of cache, resulting a wrong size
+ * pfla02 has just 1, 2 or 4 GB option
+ * Function checks for mirrors in the first CS
+ */
+#define RAM_TEST_PATTERN       0xaa5555aa
+static unsigned int pfla02_detect_ramsize(void)
+{
+       u32 *p, *p1;
+       unsigned int offset = 512 * 1024 * 1024;
+       int i;
+
+       for (i = 0; i < 2; i++) {
+               p = (u32 *)PHYS_SDRAM;
+               p1 = (u32 *)(PHYS_SDRAM + (i + 1) * offset);
+
+               *p1 = 0;
+               *p = RAM_TEST_PATTERN;
+
+               /*
+                *  This is required to detect mirroring
+                *  else we read back values from cache
+                */
+               flush_dcache_all();
+
+               if (*p == *p1)
+                       return i;
+       }
+       return RAM_4GB;
+}
+
+void board_init_f(ulong dummy)
+{
+       unsigned int ramchip;
+#ifdef CONFIG_CMD_NAND
+       /* Enable NAND */
+       setup_gpmi_nand();
+#endif
+
+       /* setup clock gating */
+       ccgr_init();
+
+       /* setup AIPS and disable watchdog */
+       arch_cpu_init();
+
+       /* setup AXI */
+       gpr_init();
+
+       board_early_init_f();
+
+       /* setup GP timer */
+       timer_init();
+
+       /* UART clocks enabled and gd valid - init serial console */
+       preloader_console_init();
+
+       setup_spi();
+
+       setup_gpios();
+
+       /* DDR initialization */
+       spl_dram_init(&mt41k_xx[RAM_4GB]);
+       ramchip = pfla02_detect_ramsize();
+       if (ramchip != RAM_4GB)
+               spl_dram_init(&mt41k_xx[ramchip]);
+
+       /* Clear the BSS. */
+       memset(__bss_start, 0, __bss_end - __bss_start);
+
+       phyflex_err006282_workaround();
+
+       /* load/boot image from boot device */
+       board_init_r(NULL, 0);
+}
+#endif
index 37d0b85e0eacb7f6417d8b0b83965bbac8c89e3e..848e27848b743a3d7c31b43966b127e5064a2b4b 100644 (file)
@@ -128,7 +128,7 @@ int misc_init_r(void)
        }
 
        if (dm_gpio_get_value(&resin)) {
-               setenv("bootdelay", "-1");
+               env_set("bootdelay", "-1");
                printf("Power button pressed - dropping to console.\n");
        }
 
index d3c6ba580f5cadf7e1b387a2d580424c5dcde138..530f1496171b406875b2d31d6c08f30aeadf306b 100644 (file)
@@ -247,11 +247,11 @@ static void set_fdtfile(void)
 {
        const char *fdtfile;
 
-       if (getenv("fdtfile"))
+       if (env_get("fdtfile"))
                return;
 
        fdtfile = model->fdtfile;
-       setenv("fdtfile", fdtfile);
+       env_set("fdtfile", fdtfile);
 }
 
 /*
@@ -260,13 +260,13 @@ static void set_fdtfile(void)
  */
 static void set_fdt_addr(void)
 {
-       if (getenv("fdt_addr"))
+       if (env_get("fdt_addr"))
                return;
 
        if (fdt_magic(fw_dtb_pointer) != FDT_MAGIC)
                return;
 
-       setenv_hex("fdt_addr", fw_dtb_pointer);
+       env_set_hex("fdt_addr", fw_dtb_pointer);
 }
 
 /*
@@ -287,7 +287,7 @@ static void set_usbethaddr(void)
        if (!model->has_onboard_eth)
                return;
 
-       if (getenv("usbethaddr"))
+       if (env_get("usbethaddr"))
                return;
 
        BCM2835_MBOX_INIT_HDR(msg);
@@ -300,10 +300,10 @@ static void set_usbethaddr(void)
                return;
        }
 
-       eth_setenv_enetaddr("usbethaddr", msg->get_mac_address.body.resp.mac);
+       eth_env_set_enetaddr("usbethaddr", msg->get_mac_address.body.resp.mac);
 
-       if (!getenv("ethaddr"))
-               setenv("ethaddr", getenv("usbethaddr"));
+       if (!env_get("ethaddr"))
+               env_set("ethaddr", env_get("usbethaddr"));
 
        return;
 }
@@ -314,13 +314,13 @@ static void set_board_info(void)
        char s[11];
 
        snprintf(s, sizeof(s), "0x%X", revision);
-       setenv("board_revision", s);
+       env_set("board_revision", s);
        snprintf(s, sizeof(s), "%d", rev_scheme);
-       setenv("board_rev_scheme", s);
+       env_set("board_rev_scheme", s);
        /* Can't rename this to board_rev_type since it's an ABI for scripts */
        snprintf(s, sizeof(s), "0x%X", rev_type);
-       setenv("board_rev", s);
-       setenv("board_name", model->name);
+       env_set("board_rev", s);
+       env_set("board_name", model->name);
 }
 #endif /* CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG */
 
@@ -330,7 +330,7 @@ static void set_serial_number(void)
        int ret;
        char serial_string[17] = { 0 };
 
-       if (getenv("serial#"))
+       if (env_get("serial#"))
                return;
 
        BCM2835_MBOX_INIT_HDR(msg);
@@ -345,7 +345,7 @@ static void set_serial_number(void)
 
        snprintf(serial_string, sizeof(serial_string), "%016" PRIx64,
                 msg->get_board_serial.body.resp.serial);
-       setenv("serial#", serial_string);
+       env_set("serial#", serial_string);
 }
 
 int misc_init_r(void)
index b35b6a3ad1ac1f2572dd420d2e3f6e536e34c118..0bf8160f1fa2bcb8725de9e3a651ff2c42a694b8 100644 (file)
@@ -143,7 +143,7 @@ int board_eth_init(bd_t *bis)
        unsigned char enetaddr[6];
 
        ret = sh_eth_initialize(bis);
-       if (!eth_getenv_enetaddr("ethaddr", enetaddr))
+       if (!eth_env_get_enetaddr("ethaddr", enetaddr))
                return ret;
 
        /* Set Mac address */
index 5156eafeb4040d6e7102711729dccd7f3cc6fa5c..574dcda01bd1f05b45281133676012a4117c4fab 100644 (file)
@@ -418,10 +418,10 @@ int board_eth_init(bd_t *bis)
 
        rc = smc911x_initialize(0, CONFIG_SMC911X_BASE);
 
-       if (!eth_getenv_enetaddr(STR_ENV_ETHADDR, eth_addr)) {
+       if (!eth_env_get_enetaddr(STR_ENV_ETHADDR, eth_addr)) {
                dev = eth_get_dev_by_index(0);
                if (dev) {
-                       eth_setenv_enetaddr(STR_ENV_ETHADDR, dev->enetaddr);
+                       eth_env_set_enetaddr(STR_ENV_ETHADDR, dev->enetaddr);
                } else {
                        printf("blanche: Couldn't get eth device\n");
                        rc = -1;
index 28b557a5b08ad76a4a81bbd4bf3277c01bbf7f0f..e4bb440d2455d8eb306d9a55208fc96a1bd785a4 100644 (file)
@@ -55,7 +55,7 @@ int board_late_init(void)
        /* Set MAC address */
        sprintf(env_mac, "%02X:%02X:%02X:%02X:%02X:%02X",
                mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
-       setenv("ethaddr", env_mac);
+       env_set("ethaddr", env_mac);
 
        debug_led(0x0F);
 
index 359f95e264fb9a1b8f2eeb242c5b9f0e179a38e0..54e126985b5d1b6f999f128d6c794fe4b7602e64 100644 (file)
@@ -126,7 +126,7 @@ int board_eth_init(bd_t *bis)
 
 #ifdef CONFIG_SH_ETHER
        ret = sh_eth_initialize(bis);
-       if (!eth_getenv_enetaddr("ethaddr", enetaddr))
+       if (!eth_env_get_enetaddr("ethaddr", enetaddr))
                return ret;
 
        /* Set Mac address */
index dd62145ac9b2277b3ea550103fa199f06e7d755d..8fa648e40a94fcf2ee758c0de4587225eb98df71 100644 (file)
@@ -131,7 +131,7 @@ int board_eth_init(bd_t *bis)
        unsigned char enetaddr[6];
 
        ret = sh_eth_initialize(bis);
-       if (!eth_getenv_enetaddr("ethaddr", enetaddr))
+       if (!eth_env_get_enetaddr("ethaddr", enetaddr))
                return ret;
 
        /* Set Mac address */
index 2ada81600660bbc685f8368c7fdfb99c2fb3974f..562be04760febfa2d622019c9a45ae6013b7a00a 100644 (file)
@@ -136,7 +136,7 @@ int board_eth_init(bd_t *bis)
        unsigned char enetaddr[6];
 
        ret = sh_eth_initialize(bis);
-       if (!eth_getenv_enetaddr("ethaddr", enetaddr))
+       if (!eth_env_get_enetaddr("ethaddr", enetaddr))
                return ret;
 
        /* Set Mac address */
index 926a657511715acd1a78dd6fd909d70932e5b46b..5b1a16790647b9eec345f68ed2e31c77a41d19c2 100644 (file)
@@ -126,7 +126,7 @@ int board_eth_init(bd_t *bis)
        unsigned char enetaddr[6];
 
        ret = sh_eth_initialize(bis);
-       if (!eth_getenv_enetaddr("ethaddr", enetaddr))
+       if (!eth_env_get_enetaddr("ethaddr", enetaddr))
                return ret;
 
        /* Set Mac address */
index 525d9797242ddeac2ab7e1663b668d76f7aa2510..4a76fb73ee963bb9d8b8d0742a7d0f8fe4b6cb75 100644 (file)
@@ -221,10 +221,10 @@ static void init_ethernet_mac(void)
        for (i = 0; i < SH7752EVB_ETHERNET_NUM_CH; i++) {
                get_sh_eth_mac(i, mac_string, buf);
                if (i == 0)
-                       setenv("ethaddr", mac_string);
+                       env_set("ethaddr", mac_string);
                else {
                        sprintf(env_string, "eth%daddr", i);
-                       setenv(env_string, mac_string);
+                       env_set(env_string, mac_string);
                }
                set_mac_to_sh_giga_eth_register(i, mac_string);
        }
index 3d1eedaa5f520562799f963a659061e6fa7be01a..ca9e1447438334f66531dc2a1bdbc6c6794d8cae 100644 (file)
@@ -237,10 +237,10 @@ static void init_ethernet_mac(void)
        for (i = 0; i < SH7753EVB_ETHERNET_NUM_CH; i++) {
                get_sh_eth_mac(i, mac_string, buf);
                if (i == 0)
-                       setenv("ethaddr", mac_string);
+                       env_set("ethaddr", mac_string);
                else {
                        sprintf(env_string, "eth%daddr", i);
-                       setenv(env_string, mac_string);
+                       env_set(env_string, mac_string);
                }
                set_mac_to_sh_giga_eth_register(i, mac_string);
        }
index 0a04a9d39dcbb9c21d8e7ea5559365c360eed6a3..3f970fc401bfe1773f7553812778a5108beb0af0 100644 (file)
@@ -278,10 +278,10 @@ static void init_ethernet_mac(void)
        for (i = 0; i < SH7757LCR_ETHERNET_NUM_CH; i++) {
                get_sh_eth_mac(i, mac_string, buf);
                if (i == 0)
-                       setenv("ethaddr", mac_string);
+                       env_set("ethaddr", mac_string);
                else {
                        sprintf(env_string, "eth%daddr", i);
-                       setenv(env_string, mac_string);
+                       env_set(env_string, mac_string);
                }
 
                set_mac_to_sh_eth_register(i, mac_string);
@@ -291,7 +291,7 @@ static void init_ethernet_mac(void)
        for (i = 0; i < SH7757LCR_GIGA_ETHERNET_NUM_CH; i++) {
                get_sh_eth_mac(i + SH7757LCR_ETHERNET_NUM_CH, mac_string, buf);
                sprintf(env_string, "eth%daddr", i + SH7757LCR_ETHERNET_NUM_CH);
-               setenv(env_string, mac_string);
+               env_set(env_string, mac_string);
 
                set_mac_to_sh_giga_eth_register(i, mac_string);
        }
index e13a38f5ea9a2749a47f3fe23282ab61ec3fdc83..a8de402d20433977daf2b4572ad46bbcd41802ab 100644 (file)
@@ -135,7 +135,7 @@ int board_eth_init(bd_t *bis)
        unsigned char enetaddr[6];
 
        ret = sh_eth_initialize(bis);
-       if (!eth_getenv_enetaddr("ethaddr", enetaddr))
+       if (!eth_env_get_enetaddr("ethaddr", enetaddr))
                return ret;
 
        /* Set Mac address */
index fe8dd3d952f86c2c3d2f4506db8169d435c92d36..d68114827354f37a0f84eb773d6cb8351e5a50ca 100644 (file)
@@ -137,7 +137,7 @@ int board_eth_init(bd_t *bis)
        unsigned char enetaddr[6];
 
        ret = sh_eth_initialize(bis);
-       if (!eth_getenv_enetaddr("ethaddr", enetaddr))
+       if (!eth_env_get_enetaddr("ethaddr", enetaddr))
                return ret;
 
        /* Set Mac address */
index 7e2edf4a566a3f3dd4a7b6d275cb65551982e3ca..91349948740bcbe01c5096dad653fa8faeffeddc 100644 (file)
@@ -44,7 +44,7 @@ int rk_board_late_init(void)
 {
        if (fastboot_key_pressed()) {
                printf("enter fastboot!\n");
-               setenv("preboot", "setenv preboot; fastboot usb0");
+               env_set("preboot", "setenv preboot; fastboot usb0");
        }
 
        return 0;
index c2872e7330a42d48ac624de8accdc95985c07b44..790a9215156e628592c5b24d9bd243126fcb3b27 100644 (file)
@@ -29,7 +29,7 @@ int rk_board_late_init(void)
                return 0;
 
        if (is_valid_ethaddr(ethaddr))
-               eth_setenv_enetaddr("ethaddr", ethaddr);
+               eth_env_set_enetaddr("ethaddr", ethaddr);
 
        return 0;
 }
index 44f412db5d82cdc36dc6c3c978a49993e4e4892c..ae2a6e6bfa637a82d8aa80b2de3b6b56edf97cdf 100644 (file)
@@ -179,7 +179,7 @@ char *get_dfu_alt_system(char *interface, char *devstr)
        if (board_is_odroidxu4())
                return info;
 
-       return getenv("dfu_alt_system");
+       return env_get("dfu_alt_system");
 }
 
 char *get_dfu_alt_boot(char *interface, char *devstr)
index b18eed2facbc83d2f9e046dea0f684674978959b..4157349d028b0c0eb488c1e6d364b3b36acfc742 100644 (file)
@@ -51,7 +51,7 @@ void set_dfu_alt_info(char *interface, char *devstr)
 
        alt_setting = get_dfu_alt_boot(interface, devstr);
        if (alt_setting) {
-               setenv("dfu_alt_boot", alt_setting);
+               env_set("dfu_alt_boot", alt_setting);
                offset = snprintf(buf, buf_size, "%s", alt_setting);
        }
 
@@ -71,7 +71,7 @@ void set_dfu_alt_info(char *interface, char *devstr)
                status = "done\n";
        }
 
-       setenv("dfu_alt_info", alt_info);
+       env_set("dfu_alt_info", alt_info);
        puts(status);
 }
 #endif
@@ -83,14 +83,14 @@ void set_board_info(void)
 
        snprintf(info, ARRAY_SIZE(info), "%u.%u", (s5p_cpu_rev & 0xf0) >> 4,
                 s5p_cpu_rev & 0xf);
-       setenv("soc_rev", info);
+       env_set("soc_rev", info);
 
        snprintf(info, ARRAY_SIZE(info), "%x", s5p_cpu_id);
-       setenv("soc_id", info);
+       env_set("soc_id", info);
 
 #ifdef CONFIG_REVISION_TAG
        snprintf(info, ARRAY_SIZE(info), "%x", get_board_rev());
-       setenv("board_rev", info);
+       env_set("board_rev", info);
 #endif
 #ifdef CONFIG_OF_LIBFDT
        const char *bdtype = "";
@@ -102,11 +102,11 @@ void set_board_info(void)
                bdtype = "";
 
        sprintf(info, "%s%s", bdname, bdtype);
-       setenv("boardname", info);
+       env_set("boardname", info);
 #endif
        snprintf(info, ARRAY_SIZE(info),  "%s%x-%s%s.dtb",
                 CONFIG_SYS_SOC, s5p_cpu_id, bdname, bdtype);
-       setenv("fdtfile", info);
+       env_set("fdtfile", info);
 #endif
 }
 #endif /* CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG */
index b4cb33240e18dbf431f04d4e0e40bdb6a115580c..e40a2f6e3a6909663ad45d57ebe4f69ebb5841f4 100644 (file)
@@ -66,7 +66,7 @@ const char *get_board_type(void)
 #ifdef CONFIG_SET_DFU_ALT_INFO
 char *get_dfu_alt_system(char *interface, char *devstr)
 {
-       return getenv("dfu_alt_system");
+       return env_get("dfu_alt_system");
 }
 
 char *get_dfu_alt_boot(char *interface, char *devstr)
index 00059a13174af9968da5afa3bbe8138512b42361..f0913383b97b1d76d3171433d7518d76f474fc48 100644 (file)
@@ -469,7 +469,7 @@ void exynos_lcd_misc_init(vidinfo_t *vid)
 #endif
 #ifdef CONFIG_S6E8AX0
        s6e8ax0_init();
-       setenv("lcdinfo", "lcd=s6e8ax0");
+       env_set("lcdinfo", "lcd=s6e8ax0");
 #endif
 }
 #endif
index cc6eaf7ad0fe33e9b1b5b8bdde64d0d1250db77c..549ac8b48aeb27b86d1a72fd55a8870ff3f96770 100644 (file)
@@ -397,6 +397,6 @@ void exynos_lcd_misc_init(vidinfo_t *vid)
        vid->pclk_name = 1;     /* MPLL */
        vid->sclk_div = 1;
 
-       setenv("lcdinfo", "lcd=ld9040");
+       env_set("lcdinfo", "lcd=ld9040");
 }
 #endif
index 5c8b4367767bb127c525290b510c2408a8592426..af1a3e75cb508c672c6d5d478948c94943327ffc 100644 (file)
@@ -131,8 +131,8 @@ int board_eth_init(bd_t *bis)
 
        /* just to get secound mac address */
        imx_get_mac_from_fuse(1, eth1addr);
-       if (!getenv("eth1addr") && is_valid_ethaddr(eth1addr))
-               eth_setenv_enetaddr("eth1addr", eth1addr);
+       if (!env_get("eth1addr") && is_valid_ethaddr(eth1addr))
+               eth_env_set_enetaddr("eth1addr", eth1addr);
 
        imx_iomux_v3_setup_multiple_pads(fec1_pads, ARRAY_SIZE(fec1_pads));
 
@@ -413,11 +413,11 @@ static int set_pin_state(void)
                return ret;
 
        if (val >= VAL_UPPER)
-               setenv("pin_state", "connected");
+               env_set("pin_state", "connected");
        else if (val < VAL_UPPER && val > VAL_LOWER)
-               setenv("pin_state", "open");
+               env_set("pin_state", "open");
        else
-               setenv("pin_state", "button");
+               env_set("pin_state", "button");
 
        return ret;
 }
index f888ecbbc19602601f2084f22d95dbaf510583fd..229b12f308c92597bb56ed4e387a280a206baf61 100644 (file)
@@ -69,31 +69,31 @@ int misc_init_r(void)
        /* Check EEPROM signature. */
        if (!(data[0] == 0xa5 && data[1] == 0x5a)) {
                puts("Invalid I2C EEPROM signature.\n");
-               setenv("unit_serial", "invalid");
-               setenv("unit_ident", "VINing-xxxx-STD");
-               setenv("hostname", "vining-invalid");
+               env_set("unit_serial", "invalid");
+               env_set("unit_ident", "VINing-xxxx-STD");
+               env_set("hostname", "vining-invalid");
                return 0;
        }
 
        /* If 'unit_serial' is already set, do nothing. */
-       if (!getenv("unit_serial")) {
+       if (!env_get("unit_serial")) {
                /* This field is Big Endian ! */
                serial = (data[0x54] << 24) | (data[0x55] << 16) |
                         (data[0x56] << 8) | (data[0x57] << 0);
                memset(str, 0, sizeof(str));
                sprintf(str, "%07i", serial);
-               setenv("unit_serial", str);
+               env_set("unit_serial", str);
        }
 
-       if (!getenv("unit_ident")) {
+       if (!env_get("unit_ident")) {
                memset(str, 0, sizeof(str));
                memcpy(str, &data[0x2e], 18);
-               setenv("unit_ident", str);
+               env_set("unit_ident", str);
        }
 
        /* Set ethernet address from EEPROM. */
-       if (!getenv("ethaddr") && is_valid_ethaddr(&data[0x62]))
-               eth_setenv_enetaddr("ethaddr", &data[0x62]);
+       if (!env_get("ethaddr") && is_valid_ethaddr(&data[0x62]))
+               eth_env_set_enetaddr("ethaddr", &data[0x62]);
 
        return 0;
 }
index b9672274117d38574ca988e61504cfa94b920577..65fa6af2d444eafb330a8c56018e821786b15840 100644 (file)
@@ -121,7 +121,7 @@ unsigned char get_button_state(char * const envname, unsigned char def)
        char *ptr_env;
 
        /* If button is not found we take default */
-       ptr_env = getenv(envname);
+       ptr_env = env_get(envname);
        if (NULL == ptr_env) {
                gpio = def;
        } else {
@@ -199,7 +199,7 @@ void set_env_gpios(unsigned char state)
                strcat(str_tmp, num);
 
                /* If env var is not found we stop */
-               ptr_env = getenv(str_tmp);
+               ptr_env = env_get(str_tmp);
                if (NULL == ptr_env)
                        break;
 
index 6c869ed2b035a0e9f840e1f6f960fe0e6ac824e5..b4f027af2862ae5af37263d0bfb92d3833de26f2 100644 (file)
@@ -266,7 +266,7 @@ err:
 
 static struct ctrl_dev *cdev = (struct ctrl_dev *)CTRL_DEVICE_BASE;
 
-static int factoryset_mac_setenv(void)
+static int factoryset_mac_env_set(void)
 {
        uint8_t mac_addr[6];
 
@@ -292,15 +292,15 @@ static int factoryset_mac_setenv(void)
                }
        }
 
-       eth_setenv_enetaddr("ethaddr", mac_addr);
+       eth_env_set_enetaddr("ethaddr", mac_addr);
        return 0;
 }
 
-int factoryset_setenv(void)
+int factoryset_env_set(void)
 {
        int ret = 0;
 
-       if (factoryset_mac_setenv() < 0)
+       if (factoryset_mac_env_set() < 0)
                ret = -1;
 
        return ret;
index 3f23d5ebf4126fd1eb1f711e45d473bac3d15e71..8602627d2e18fa52f935516bdab366e6c07a78f0 100644 (file)
@@ -25,7 +25,7 @@ struct factorysetcontainer {
 };
 
 int factoryset_read_eeprom(int i2c_addr);
-int factoryset_setenv(void);
+int factoryset_env_set(void);
 extern struct factorysetcontainer factory_dat;
 
 #endif /* __FACTORYSET_H */
index d8869a09dd007072d9eff554caa20f3acf69529c..c705b5ab0f6f63ff9f9c9a0eb085a9335fc67f76 100644 (file)
@@ -272,13 +272,13 @@ int board_late_init(void)
 #ifdef CONFIG_FACTORYSET
        /* Set ASN in environment*/
        if (factory_dat.asn[0] != 0) {
-               setenv("dtb_name", (char *)factory_dat.asn);
+               env_set("dtb_name", (char *)factory_dat.asn);
        } else {
                /* dtb suffix gets added in load script */
-               setenv("dtb_name", "am335x-draco");
+               env_set("dtb_name", "am335x-draco");
        }
 #else
-       setenv("dtb_name", "am335x-draco");
+       env_set("dtb_name", "am335x-draco");
 #endif
 
        return 0;
@@ -330,7 +330,7 @@ int board_eth_init(bd_t *bis)
        int n = 0;
        int rv;
 
-       factoryset_setenv();
+       factoryset_env_set();
 
        /* Set rgmii mode and enable rmii clock to be sourced from chip */
        writel((RMII_MODE_ENABLE | RMII_CHIPCKL_ENABLE), &cdev->miisel);
index 750f33889742d86cd84f2f71a9b54ebf21c2d91f..8bbb03561b18f980f1e9cceceefcf21352013287 100644 (file)
@@ -225,7 +225,7 @@ int board_eth_init(bd_t *bis)
        if (!is_valid_ethaddr(factory_dat.mac))
                printf("Error: no valid mac address\n");
        else
-               eth_setenv_enetaddr("ethaddr", factory_dat.mac);
+               eth_env_set_enetaddr("ethaddr", factory_dat.mac);
 #endif /* #ifdef CONFIG_FACTORYSET */
 
        /* Set rgmii mode and enable rmii clock to be sourced from chip */
@@ -446,12 +446,12 @@ int board_late_init(void)
                        factory_dat.pxm50 = 0;
                sprintf(tmp, "%s_%s", factory_dat.asn,
                        factory_dat.comp_version);
-               ret = setenv("boardid", tmp);
+               ret = env_set("boardid", tmp);
                if (ret)
                        printf("error setting board id\n");
        } else {
                factory_dat.pxm50 = 1;
-               ret = setenv("boardid", "PXM50_1.0");
+               ret = env_set("boardid", "PXM50_1.0");
                if (ret)
                        printf("error setting board id\n");
        }
index b3c666c054f1060fccc61edfd5679d2801cdbc00..2a97414bafa508d4a59137d35ef04426676b3521 100644 (file)
@@ -182,7 +182,7 @@ int board_eth_init(bd_t *bis)
        int rv;
 
 #ifndef CONFIG_SPL_BUILD
-       factoryset_setenv();
+       factoryset_env_set();
 #endif
 
        /* Set rgmii mode and enable rmii clock to be sourced from chip */
@@ -482,7 +482,7 @@ int board_late_init(void)
        else
                strcpy(tmp, "QMX7.E38_4.0");
 
-       ret = setenv("boardid", tmp);
+       ret = env_set("boardid", tmp);
        if (ret)
                printf("error setting board id\n");
 
index 4aa8d6486904cf37c0006414acb630cb52beefc2..8390bdd5f812f60004a0262b0b1ee67dfc29b3fb 100644 (file)
@@ -15,6 +15,7 @@
 #include <command.h>
 #include <common.h>
 #include <dm.h>
+#include <environment.h>
 #include <asm/io.h>
 #include <asm/arch/at91sam9260_matrix.h>
 #include <asm/arch/at91sam9_smc.h>
@@ -376,36 +377,36 @@ static int upgrade_failure_fallback(void)
        char *kern_size;
        char *kern_size_fb;
 
-       partitionset_active = getenv("partitionset_active");
+       partitionset_active = env_get("partitionset_active");
        if (partitionset_active) {
                if (partitionset_active[0] == 'A')
-                       setenv("partitionset_active", "B");
+                       env_set("partitionset_active", "B");
                else
-                       setenv("partitionset_active", "A");
+                       env_set("partitionset_active", "A");
        } else {
                printf("partitionset_active missing.\n");
                return -ENOENT;
        }
 
-       rootfs = getenv("rootfs");
-       rootfs_fallback = getenv("rootfs_fallback");
-       setenv("rootfs", rootfs_fallback);
-       setenv("rootfs_fallback", rootfs);
+       rootfs = env_get("rootfs");
+       rootfs_fallback = env_get("rootfs_fallback");
+       env_set("rootfs", rootfs_fallback);
+       env_set("rootfs_fallback", rootfs);
 
-       kern_size = getenv("kernel_size");
-       kern_size_fb = getenv("kernel_size_fallback");
-       setenv("kernel_size", kern_size_fb);
-       setenv("kernel_size_fallback", kern_size);
+       kern_size = env_get("kernel_size");
+       kern_size_fb = env_get("kernel_size_fallback");
+       env_set("kernel_size", kern_size_fb);
+       env_set("kernel_size_fallback", kern_size);
 
-       kern_off = getenv("kernel_Off");
-       kern_off_fb = getenv("kernel_Off_fallback");
-       setenv("kernel_Off", kern_off_fb);
-       setenv("kernel_Off_fallback", kern_off);
+       kern_off = env_get("kernel_Off");
+       kern_off_fb = env_get("kernel_Off_fallback");
+       env_set("kernel_Off", kern_off_fb);
+       env_set("kernel_Off_fallback", kern_off);
 
-       setenv("bootargs", '\0');
-       setenv("upgrade_available", '\0');
-       setenv("boot_retries", '\0');
-       saveenv();
+       env_set("bootargs", '\0');
+       env_set("upgrade_available", '\0');
+       env_set("boot_retries", '\0');
+       env_save();
 
        return 0;
 }
@@ -417,14 +418,14 @@ static int do_upgrade_available(cmd_tbl_t *cmdtp, int flag, int argc,
        unsigned long boot_retry = 0;
        char boot_buf[10];
 
-       upgrade_available = simple_strtoul(getenv("upgrade_available"), NULL,
+       upgrade_available = simple_strtoul(env_get("upgrade_available"), NULL,
                                           10);
        if (upgrade_available) {
-               boot_retry = simple_strtoul(getenv("boot_retries"), NULL, 10);
+               boot_retry = simple_strtoul(env_get("boot_retries"), NULL, 10);
                boot_retry++;
                sprintf(boot_buf, "%lx", boot_retry);
-               setenv("boot_retries", boot_buf);
-               saveenv();
+               env_set("boot_retries", boot_buf);
+               env_save();
 
                /*
                 * Here the boot_retries count is checked, and if the
index 1f5a5868cb8a6dd94e92d7a7aee4a722640b8d2e..0429e6f0c7f792a810971cec560c568ba46b56c7 100644 (file)
@@ -171,7 +171,7 @@ int board_eth_init(bd_t *bis)
        uint8_t mac_addr[6];
        uint32_t mac_hi, mac_lo;
 
-       if (!eth_getenv_enetaddr("ethaddr", mac_addr)) {
+       if (!eth_env_get_enetaddr("ethaddr", mac_addr)) {
                printf("<ethaddr> not set. Reading from E-fuse\n");
                /* try reading mac address from efuse */
                mac_lo = readl(&cdev->macid0l);
@@ -184,7 +184,7 @@ int board_eth_init(bd_t *bis)
                mac_addr[5] = (mac_lo & 0xFF00) >> 8;
 
                if (is_valid_ethaddr(mac_addr))
-                       eth_setenv_enetaddr("ethaddr", mac_addr);
+                       eth_env_set_enetaddr("ethaddr", mac_addr);
                else
                        return n;
        }
index fb691c22d961862001f7a895793d10d74101d947..004f37009ae1940dcda657dafda5d5237a37d4b4 100644 (file)
@@ -38,7 +38,7 @@ int checkboard (void)
        volatile ccsr_gur_t *gur = (void *)(CONFIG_SYS_MPC85xx_GUTS_ADDR);
        char buf[64];
        int f;
-       int i = getenv_f("serial#", buf, sizeof(buf));
+       int i = env_get_f("serial#", buf, sizeof(buf));
 #ifdef CONFIG_PCI
        char *src;
 #endif
@@ -409,7 +409,7 @@ void board_backlight_switch (int flag)
                printf ("hwmon IC init failed\n");
 
        if (flag) {
-               param = getenv("brightness");
+               param = env_get("brightness");
                rc = param ? simple_strtol(param, NULL, 10) : -1;
                if (rc < 0)
                        rc = DEFAULT_BRIGHTNESS;
index 1ccdfa8e056064cc7446cd85a8920d3468f043ed..7e59fb259e118fd99400261453088d0ab7231da4 100644 (file)
@@ -376,14 +376,14 @@ int board_late_init(void)
 {
 #ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG
        if (is_hummingboard())
-               setenv("board_name", "HUMMINGBOARD");
+               env_set("board_name", "HUMMINGBOARD");
        else
-               setenv("board_name", "CUBOXI");
+               env_set("board_name", "CUBOXI");
 
        if (is_mx6dq())
-               setenv("board_rev", "MX6Q");
+               env_set("board_rev", "MX6Q");
        else
-               setenv("board_rev", "MX6DL");
+               env_set("board_rev", "MX6DL");
 #endif
 
        return 0;
index d6a84dba60eb346c94830ac67378da78c27f9009..a02304f49ee0b4c27e8f57a8dc3fec42bdada873 100644 (file)
@@ -53,15 +53,15 @@ int misc_init_r(void)
 #if defined(CONFIG_CMD_NET)
        uchar mac_id[6];
 
-       if (!eth_getenv_enetaddr("ethaddr", mac_id) && !i2c_read_mac(mac_id))
-               eth_setenv_enetaddr("ethaddr", mac_id);
+       if (!eth_env_get_enetaddr("ethaddr", mac_id) && !i2c_read_mac(mac_id))
+               eth_env_set_enetaddr("ethaddr", mac_id);
 #endif
-       setenv("verify", "n");
+       env_set("verify", "n");
 
 #if defined(CONFIG_SPEAR_USBTTY)
-       setenv("stdin", "usbtty");
-       setenv("stdout", "usbtty");
-       setenv("stderr", "usbtty");
+       env_set("stdin", "usbtty");
+       env_set("stdout", "usbtty");
+       env_set("stderr", "usbtty");
 
 #ifndef CONFIG_SYS_NO_DCACHE
        dcache_enable();
index 8c8abf6a0670cfca1b6ee5d5826c5bd121c6e08c..d6763c306f830350ce599cbd4f28036c4e609601 100644 (file)
@@ -314,13 +314,13 @@ int misc_init_r(void)
        char serialno[25];
        uint32_t u_id_low, u_id_mid, u_id_high;
 
-       if (!getenv("serial#")) {
+       if (!env_get("serial#")) {
                u_id_low  = readl(&STM32_U_ID->u_id_low);
                u_id_mid  = readl(&STM32_U_ID->u_id_mid);
                u_id_high = readl(&STM32_U_ID->u_id_high);
                sprintf(serialno, "%08x%08x%08x",
                        u_id_high, u_id_mid, u_id_low);
-               setenv("serial#", serialno);
+               env_set("serial#", serialno);
        }
 
        return 0;
index e9f3e350d02ce1b95350434a8567c3fe45b5ed37..ff6eea24a5e75255d24d131d1cf2355904d906b3 100644 (file)
@@ -88,11 +88,21 @@ M:  Iain Paton <ipaton0@gmail.com>
 S:     Maintained
 F:     configs/A20-OLinuXino-Lime2_defconfig
 
+A20-OLINUXINO-LIME2-EMMC BOARD
+M:     Olliver Schinagl <oliver@schinagl.nl>
+S:     Maintained
+F:     configs/A20-OLinuXino-Lime2-eMMC_defconfig
+
 A33-OLINUXINO BOARD
 M:     Stefan Mavrodiev <stefan.mavrodiev@gmail.com>
 S:     Maintained
 F:     configs/A33-OLinuXino_defconfig
 
+A64-OLINUXINO BOARD
+M:     Jagan Teki <jagan@amarulasolutions.com>
+S:     Maintained
+F:     configs/a64-olinuxino_defconfig
+
 A80 OPTIMUS BOARD
 M:     Chen-Yu Tsai <wens@csie.org>
 S:     Maintained
@@ -267,6 +277,11 @@ M: Jelle van der Waa <jelle@vdwaa.nl>
 S:     Maintained
 F:     configs/nanopi_neo_air_defconfig
 
+NANOPI-A64 BOARD
+M:     Jagan Teki <jagan@amarulasolutions.com>
+S:     Maintained
+F:     configs/nanopi_a64_defconfig
+
 NINTENDO NES CLASSIC EDITION BOARD
 M:     FUKAUMI Naoki <naobsd@gmail.com>
 S:     Maintained
index 800f412b383ddf9ac90972e50a684c534d40fea4..70e01437c4f4efb9b6f4c1417be7133151983ac4 100644 (file)
@@ -602,7 +602,7 @@ void get_board_serial(struct tag_serialnr *serialnr)
        char *serial_string;
        unsigned long long serial;
 
-       serial_string = getenv("serial#");
+       serial_string = env_get("serial#");
 
        if (serial_string) {
                serial = simple_strtoull(serial_string, NULL, 16);
@@ -646,7 +646,7 @@ static void parse_spl_header(const uint32_t spl_addr)
                return;
        }
        /* otherwise assume .scr format (mkimage-type script) */
-       setenv_hex("fel_scriptaddr", spl->fel_script_address);
+       env_set_hex("fel_scriptaddr", spl->fel_script_address);
 }
 
 /*
@@ -694,7 +694,7 @@ static void setup_environment(const void *fdt)
                        else
                                sprintf(ethaddr, "eth%daddr", i);
 
-                       if (getenv(ethaddr))
+                       if (env_get(ethaddr))
                                continue;
 
                        /* Non OUI / registered MAC address */
@@ -705,14 +705,14 @@ static void setup_environment(const void *fdt)
                        mac_addr[4] = (sid[3] >>  8) & 0xff;
                        mac_addr[5] = (sid[3] >>  0) & 0xff;
 
-                       eth_setenv_enetaddr(ethaddr, mac_addr);
+                       eth_env_set_enetaddr(ethaddr, mac_addr);
                }
 
-               if (!getenv("serial#")) {
+               if (!env_get("serial#")) {
                        snprintf(serial_string, sizeof(serial_string),
                                "%08x%08x", sid[0], sid[3]);
 
-                       setenv("serial#", serial_string);
+                       env_set("serial#", serial_string);
                }
        }
 }
@@ -721,11 +721,11 @@ int misc_init_r(void)
 {
        __maybe_unused int ret;
 
-       setenv("fel_booted", NULL);
-       setenv("fel_scriptaddr", NULL);
+       env_set("fel_booted", NULL);
+       env_set("fel_scriptaddr", NULL);
        /* determine if we are running in FEL mode */
        if (!is_boot0_magic(SPL_ADDR + 4)) { /* eGON.BT0 */
-               setenv("fel_booted", "1");
+               env_set("fel_booted", "1");
                parse_spl_header(SPL_ADDR);
        }
 
index bdbf02a06769cfcd89d7318f7f02d8484f970a5f..85fda13188d640285cb416ab13bfdc45a0668930 100644 (file)
@@ -146,7 +146,7 @@ int board_late_init(void)
        udelay(5000);
 #endif
 
-       e = getenv("gs_base_board");
+       e = env_get("gs_base_board");
        if (e != NULL) {
                if (strcmp(e, "G283") == 0) {
                        int key = gpio_get_value(IMX_GPIO_NR(2, 29));
@@ -156,9 +156,9 @@ int board_late_init(void)
                                gpio_set_value(IMX_GPIO_NR(1, 29), 0);
                                gpio_set_value(IMX_GPIO_NR(4, 21), 0);
 
-                               setenv("preboot", "run gs_slow_boot");
+                               env_set("preboot", "run gs_slow_boot");
                        } else
-                               setenv("preboot", "run gs_fast_boot");
+                               env_set("preboot", "run gs_fast_boot");
                }
        }
 
index e89ee35d306a47893578c1b244f956fcc69d58a5..f79bb9dcdd5f76235b4697aa9ce13f429c9af84c 100644 (file)
@@ -76,8 +76,8 @@ int spl_start_uboot(void)
 
 #ifdef CONFIG_SPL_ENV_SUPPORT
        env_init();
-       env_relocate_spec();
-       if (getenv_yesno("boot_os") != 1)
+       env_load();
+       if (env_get_yesno("boot_os") != 1)
                return 1;
 #endif
 
@@ -322,11 +322,11 @@ int board_eth_init(bd_t *bis)
 
 #if (defined(CONFIG_DRIVER_TI_CPSW) && !defined(CONFIG_SPL_BUILD)) || \
        (defined(CONFIG_SPL_ETH_SUPPORT) && defined(CONFIG_SPL_BUILD))
-       if (!getenv("ethaddr")) {
+       if (!env_get("ethaddr")) {
                printf("<ethaddr> not set. Validating first E-fuse MAC\n");
 
                if (is_valid_ethaddr(mac_addr))
-                       eth_setenv_enetaddr("ethaddr", mac_addr);
+                       eth_env_set_enetaddr("ethaddr", mac_addr);
        }
 
 #ifdef CONFIG_DRIVER_TI_CPSW
@@ -340,9 +340,9 @@ int board_eth_init(bd_t *bis)
        mac_addr[4] = mac_lo & 0xFF;
        mac_addr[5] = (mac_lo & 0xFF00) >> 8;
 
-       if (!getenv("eth1addr")) {
+       if (!env_get("eth1addr")) {
                if (is_valid_ethaddr(mac_addr))
-                       eth_setenv_enetaddr("eth1addr", mac_addr);
+                       eth_env_set_enetaddr("eth1addr", mac_addr);
        }
 
 
@@ -373,7 +373,7 @@ int board_eth_init(bd_t *bis)
 #if defined(CONFIG_USB_ETHER) && \
        (!defined(CONFIG_SPL_BUILD) || defined(CONFIG_SPL_USBETH_SUPPORT))
        if (is_valid_ether_addr(mac_addr))
-               eth_setenv_enetaddr("usbnet_devaddr", mac_addr);
+               eth_env_set_enetaddr("usbnet_devaddr", mac_addr);
 
        rv = usb_eth_initialize(bis);
        if (rv < 0)
index 25aeebc8d0e9543bf08c6443c83fdc58b6cb1064..8c38f14cded0b45ace3e575e5d58327361a6e4f5 100644 (file)
@@ -94,7 +94,7 @@ int misc_init_r(void)
 
        omap_die_id_display();
 
-       eth_addr = getenv("ethaddr");
+       eth_addr = env_get("ethaddr");
        if (eth_addr)
                return 0;
 
index 94251c6d918bf1d89e2a71fb469eb0b5ebf20d61..8fe26a75e82076c985df9273fec8074469c4acfd 100644 (file)
@@ -178,7 +178,7 @@ static int fec_get_mac_from_register(uint32_t base_addr)
                ethaddr[i] = (reg_mac[i / 4] >> ((i % 4) * 8)) & 0xFF;
 
        if (is_valid_ethaddr(ethaddr)) {
-               eth_setenv_enetaddr("ethaddr", ethaddr);
+               eth_env_set_enetaddr("ethaddr", ethaddr);
                return 0;
        }
 
index 6e73ae114a65903a5c8772537d356399bb245598..9eaae50f27a0be3ab9a5c0cc3878a4e825089975 100644 (file)
@@ -261,7 +261,7 @@ int misc_init_r(void)
 
        if (ret)
                return 0;
-       eth_addr = getenv("ethaddr");
+       eth_addr = env_get("ethaddr");
        if (!eth_addr)
                TAM3517_READ_MAC_FROM_EEPROM(&info);
 
@@ -311,7 +311,7 @@ int board_video_init(void)
 
        fb = (void *)0x88000000;
 
-       s = getenv("panel");
+       s = env_get("panel");
        if (s) {
                index = simple_strtoul(s, NULL, 10);
                if (index < ARRAY_SIZE(lcd_cfg))
index 9347329eac8820aef75d128503b7b08f7cf60b9b..c6f8eed0c98821ab10941cfecc02ae994986bdae 100644 (file)
@@ -63,13 +63,13 @@ static void setup_macaddr(void)
 {
 #if CONFIG_IS_ENABLED(CMD_NET)
        int ret;
-       const char *cpuid = getenv("cpuid#");
+       const char *cpuid = env_get("cpuid#");
        u8 hash[SHA256_SUM_LEN];
        int size = sizeof(hash);
        u8 mac_addr[6];
 
        /* Only generate a MAC address, if none is set in the environment */
-       if (getenv("ethaddr"))
+       if (env_get("ethaddr"))
                return;
 
        if (!cpuid) {
@@ -89,7 +89,7 @@ static void setup_macaddr(void)
        /* Make this a valid MAC address and set it */
        mac_addr[0] &= 0xfe;  /* clear multicast bit */
        mac_addr[0] |= 0x02;  /* set local assignment bit (IEEE802) */
-       eth_setenv_enetaddr("ethaddr", mac_addr);
+       eth_env_set_enetaddr("ethaddr", mac_addr);
 #endif
 
        return;
@@ -144,8 +144,8 @@ static void setup_serial(void)
        serialno |= (u64)crc32_no_comp(serialno, high, 8) << 32;
        snprintf(serialno_str, sizeof(serialno_str), "%llx", serialno);
 
-       setenv("cpuid#", cpuid_str);
-       setenv("serial#", serialno_str);
+       env_set("cpuid#", cpuid_str);
+       env_set("serial#", serialno_str);
 #endif
 
        return;
@@ -165,7 +165,7 @@ void get_board_serial(struct tag_serialnr *serialnr)
        char *serial_string;
        u64 serial = 0;
 
-       serial_string = getenv("serial#");
+       serial_string = env_get("serial#");
 
        if (serial_string)
                serial = simple_strtoull(serial_string, NULL, 16);
index 0a16529b5f810d0a3dff9b0798454f414b5b3ba4..1a52bffc002294fbdeee04e509565cef33c183d1 100644 (file)
@@ -249,8 +249,8 @@ int spl_start_uboot(void)
 
 #ifdef CONFIG_SPL_ENV_SUPPORT
        env_init();
-       env_relocate_spec();
-       if (getenv_yesno("boot_os") != 1)
+       env_load();
+       if (env_get_yesno("boot_os") != 1)
                return 1;
 #endif
 
@@ -731,7 +731,7 @@ int board_late_init(void)
         * on HS devices.
         */
        if (get_device_type() == HS_DEVICE)
-               setenv("boot_fit", "1");
+               env_set("boot_fit", "1");
 #endif
 
 #if !defined(CONFIG_SPL_BUILD)
@@ -745,11 +745,11 @@ int board_late_init(void)
        mac_addr[4] = mac_lo & 0xFF;
        mac_addr[5] = (mac_lo & 0xFF00) >> 8;
 
-       if (!getenv("ethaddr")) {
+       if (!env_get("ethaddr")) {
                printf("<ethaddr> not set. Validating first E-fuse MAC\n");
 
                if (is_valid_ethaddr(mac_addr))
-                       eth_setenv_enetaddr("ethaddr", mac_addr);
+                       eth_env_set_enetaddr("ethaddr", mac_addr);
        }
 
        mac_lo = readl(&cdev->macid1l);
@@ -761,9 +761,9 @@ int board_late_init(void)
        mac_addr[4] = mac_lo & 0xFF;
        mac_addr[5] = (mac_lo & 0xFF00) >> 8;
 
-       if (!getenv("eth1addr")) {
+       if (!env_get("eth1addr")) {
                if (is_valid_ethaddr(mac_addr))
-                       eth_setenv_enetaddr("eth1addr", mac_addr);
+                       eth_env_set_enetaddr("eth1addr", mac_addr);
        }
 #endif
 
@@ -908,7 +908,7 @@ int board_eth_init(bd_t *bis)
 #if defined(CONFIG_USB_ETHER) && \
        (!defined(CONFIG_SPL_BUILD) || defined(CONFIG_SPL_USBETH_SUPPORT))
        if (is_valid_ethaddr(mac_addr))
-               eth_setenv_enetaddr("usbnet_devaddr", mac_addr);
+               eth_env_set_enetaddr("usbnet_devaddr", mac_addr);
 
        rv = usb_eth_initialize(bis);
        if (rv < 0)
index 933596d59c8276738ddb80b94da13126f388be23..2c417e75459c7741123bddc6d4f493bb4990f776 100644 (file)
@@ -626,7 +626,7 @@ int board_late_init(void)
         * on HS devices.
         */
        if (get_device_type() == HS_DEVICE)
-               setenv("boot_fit", "1");
+               env_set("boot_fit", "1");
 #endif
        return 0;
 }
@@ -791,10 +791,10 @@ int board_eth_init(bd_t *bis)
        mac_addr[4] = mac_lo & 0xFF;
        mac_addr[5] = (mac_lo & 0xFF00) >> 8;
 
-       if (!getenv("ethaddr")) {
+       if (!env_get("ethaddr")) {
                puts("<ethaddr> not set. Validating first E-fuse MAC\n");
                if (is_valid_ethaddr(mac_addr))
-                       eth_setenv_enetaddr("ethaddr", mac_addr);
+                       eth_env_set_enetaddr("ethaddr", mac_addr);
        }
 
        mac_lo = readl(&cdev->macid1l);
@@ -806,9 +806,9 @@ int board_eth_init(bd_t *bis)
        mac_addr[4] = mac_lo & 0xFF;
        mac_addr[5] = (mac_lo & 0xFF00) >> 8;
 
-       if (!getenv("eth1addr")) {
+       if (!env_get("eth1addr")) {
                if (is_valid_ethaddr(mac_addr))
-                       eth_setenv_enetaddr("eth1addr", mac_addr);
+                       eth_env_set_enetaddr("eth1addr", mac_addr);
        }
 
        if (board_is_eposevm()) {
index 00a31a97fd6dce4ae98d704638c7f4df271b2ef4..7e7056cf71c5012150a1328a0cd8defee3fd6871 100644 (file)
@@ -592,7 +592,7 @@ void am57x_idk_lcd_detect(void)
                /* we will let default be "no lcd" */
        }
 out:
-       setenv("idk_lcd", idk_lcd);
+       env_set("idk_lcd", idk_lcd);
        return;
 }
 
@@ -612,7 +612,7 @@ int board_late_init(void)
         * on HS devices.
         */
        if (get_device_type() == HS_DEVICE)
-               setenv("boot_fit", "1");
+               env_set("boot_fit", "1");
 
        /*
         * Set the GPIO7 Pad to POWERHOLD. This has higher priority
@@ -742,8 +742,8 @@ int spl_start_uboot(void)
 
 #ifdef CONFIG_SPL_ENV_SUPPORT
        env_init();
-       env_relocate_spec();
-       if (getenv_yesno("boot_os") != 1)
+       env_load();
+       if (env_get_yesno("boot_os") != 1)
                return 1;
 #endif
 
@@ -933,11 +933,11 @@ int board_eth_init(bd_t *bis)
        mac_addr[4] = (mac_lo & 0xFF00) >> 8;
        mac_addr[5] = mac_lo & 0xFF;
 
-       if (!getenv("ethaddr")) {
+       if (!env_get("ethaddr")) {
                printf("<ethaddr> not set. Validating first E-fuse MAC\n");
 
                if (is_valid_ethaddr(mac_addr))
-                       eth_setenv_enetaddr("ethaddr", mac_addr);
+                       eth_env_set_enetaddr("ethaddr", mac_addr);
        }
 
        mac_lo = readl((*ctrl)->control_core_mac_id_1_lo);
@@ -949,9 +949,9 @@ int board_eth_init(bd_t *bis)
        mac_addr[4] = (mac_lo & 0xFF00) >> 8;
        mac_addr[5] = mac_lo & 0xFF;
 
-       if (!getenv("eth1addr")) {
+       if (!env_get("eth1addr")) {
                if (is_valid_ethaddr(mac_addr))
-                       eth_setenv_enetaddr("eth1addr", mac_addr);
+                       eth_env_set_enetaddr("eth1addr", mac_addr);
        }
 
        ctrl_val = readl((*ctrl)->control_core_control_io1) & (~0x33);
@@ -986,9 +986,9 @@ int board_eth_init(bd_t *bis)
                        for (i = 0; i < num_macs; i++) {
                                u64_to_mac(mac1 + i, mac_addr);
                                if (is_valid_ethaddr(mac_addr)) {
-                                       eth_setenv_enetaddr_by_index("eth",
-                                                                    i + 2,
-                                                                    mac_addr);
+                                       eth_env_set_enetaddr_by_index("eth",
+                                                                     i + 2,
+                                                                     mac_addr);
                                }
                        }
                }
index 887b577b6adf940f709c36a037e38f22c17dae66..2f62fbec69e92ed47d56820ddb45744e8e238b48 100644 (file)
@@ -341,16 +341,16 @@ int misc_init_r(void)
        switch (get_board_revision()) {
        case REVISION_AXBX:
                printf("Beagle Rev Ax/Bx\n");
-               setenv("beaglerev", "AxBx");
+               env_set("beaglerev", "AxBx");
                break;
        case REVISION_CX:
                printf("Beagle Rev C1/C2/C3\n");
-               setenv("beaglerev", "Cx");
+               env_set("beaglerev", "Cx");
                MUX_BEAGLE_C();
                break;
        case REVISION_C4:
                printf("Beagle Rev C4\n");
-               setenv("beaglerev", "C4");
+               env_set("beaglerev", "C4");
                MUX_BEAGLE_C();
                /* Set VAUX2 to 1.8V for EHCI PHY */
                twl4030_pmrecv_vsel_cfg(TWL4030_PM_RECEIVER_VAUX2_DEDICATED,
@@ -360,7 +360,7 @@ int misc_init_r(void)
                break;
        case REVISION_XM_AB:
                printf("Beagle xM Rev A/B\n");
-               setenv("beaglerev", "xMAB");
+               env_set("beaglerev", "xMAB");
                MUX_BEAGLE_XM();
                /* Set VAUX2 to 1.8V for EHCI PHY */
                twl4030_pmrecv_vsel_cfg(TWL4030_PM_RECEIVER_VAUX2_DEDICATED,
@@ -371,7 +371,7 @@ int misc_init_r(void)
                break;
        case REVISION_XM_C:
                printf("Beagle xM Rev C\n");
-               setenv("beaglerev", "xMC");
+               env_set("beaglerev", "xMC");
                MUX_BEAGLE_XM();
                /* Set VAUX2 to 1.8V for EHCI PHY */
                twl4030_pmrecv_vsel_cfg(TWL4030_PM_RECEIVER_VAUX2_DEDICATED,
@@ -397,14 +397,14 @@ int misc_init_r(void)
                        expansion_config.revision,
                        expansion_config.fab_revision);
                MUX_TINCANTOOLS_ZIPPY();
-               setenv("buddy", "zippy");
+               env_set("buddy", "zippy");
                break;
        case TINCANTOOLS_ZIPPY2:
                printf("Recognized Tincantools Zippy2 board (rev %d %s)\n",
                        expansion_config.revision,
                        expansion_config.fab_revision);
                MUX_TINCANTOOLS_ZIPPY();
-               setenv("buddy", "zippy2");
+               env_set("buddy", "zippy2");
                break;
        case TINCANTOOLS_TRAINER:
                printf("Recognized Tincantools Trainer board (rev %d %s)\n",
@@ -412,37 +412,37 @@ int misc_init_r(void)
                        expansion_config.fab_revision);
                MUX_TINCANTOOLS_ZIPPY();
                MUX_TINCANTOOLS_TRAINER();
-               setenv("buddy", "trainer");
+               env_set("buddy", "trainer");
                break;
        case TINCANTOOLS_SHOWDOG:
                printf("Recognized Tincantools Showdow board (rev %d %s)\n",
                        expansion_config.revision,
                        expansion_config.fab_revision);
                /* Place holder for DSS2 definition for showdog lcd */
-               setenv("defaultdisplay", "showdoglcd");
-               setenv("buddy", "showdog");
+               env_set("defaultdisplay", "showdoglcd");
+               env_set("buddy", "showdog");
                break;
        case KBADC_BEAGLEFPGA:
                printf("Recognized KBADC Beagle FPGA board\n");
                MUX_KBADC_BEAGLEFPGA();
-               setenv("buddy", "beaglefpga");
+               env_set("buddy", "beaglefpga");
                break;
        case LW_BEAGLETOUCH:
                printf("Recognized Liquidware BeagleTouch board\n");
-               setenv("buddy", "beagletouch");
+               env_set("buddy", "beagletouch");
                break;
        case BRAINMUX_LCDOG:
                printf("Recognized Brainmux LCDog board\n");
-               setenv("buddy", "lcdog");
+               env_set("buddy", "lcdog");
                break;
        case BRAINMUX_LCDOGTOUCH:
                printf("Recognized Brainmux LCDog Touch board\n");
-               setenv("buddy", "lcdogtouch");
+               env_set("buddy", "lcdogtouch");
                break;
        case BBTOYS_WIFI:
                printf("Recognized BeagleBoardToys WiFi board\n");
                MUX_BBTOYS_WIFI()
-               setenv("buddy", "bbtoys-wifi");
+               env_set("buddy", "bbtoys-wifi");
                break;
        case BBTOYS_VGA:
                printf("Recognized BeagleBoardToys VGA board\n");
@@ -459,20 +459,20 @@ int misc_init_r(void)
        case LSR_COM6L_ADPT:
                printf("Recognized LSR COM6L Adapter Board\n");
                MUX_BBTOYS_WIFI()
-               setenv("buddy", "lsr-com6l-adpt");
+               env_set("buddy", "lsr-com6l-adpt");
                break;
        case BEAGLE_NO_EEPROM:
                printf("No EEPROM on expansion board\n");
-               setenv("buddy", "none");
+               env_set("buddy", "none");
                break;
        default:
                printf("Unrecognized expansion board: %x\n",
                        expansion_config.device_vendor);
-               setenv("buddy", "unknown");
+               env_set("buddy", "unknown");
        }
 
        if (expansion_config.content == 1)
-               setenv(expansion_config.env_var, expansion_config.env_setting);
+               env_set(expansion_config.env_var, expansion_config.env_setting);
 
        twl4030_power_init();
        switch (get_board_revision()) {
index c81baa12becccfa4e1e8984bebd0262a28bed53c..c21eb8c2d2e39c9d17c8ec3616a1faa8c0fbf413 100644 (file)
@@ -42,4 +42,3 @@ config TI_COMMON_CMD_OPTIONS
        imply CMD_SPI
        imply CMD_TIME
        imply CMD_USB if USB
-       imply ENV_IS_IN_FAT if MMC_OMAP_HS
index 1da5ace9236d7d8d17e0d2c67d99ad9ad7a8ef5f..6f07ec331af0bdc7c63feeb210f3661c045b8c02 100644 (file)
@@ -379,21 +379,21 @@ void __maybe_unused set_board_info_env(char *name)
        struct ti_common_eeprom *ep = TI_EEPROM_DATA;
 
        if (name)
-               setenv("board_name", name);
+               env_set("board_name", name);
        else if (ep->name)
-               setenv("board_name", ep->name);
+               env_set("board_name", ep->name);
        else
-               setenv("board_name", unknown);
+               env_set("board_name", unknown);
 
        if (ep->version)
-               setenv("board_rev", ep->version);
+               env_set("board_rev", ep->version);
        else
-               setenv("board_rev", unknown);
+               env_set("board_rev", unknown);
 
        if (ep->serial)
-               setenv("board_serial", ep->serial);
+               env_set("board_serial", ep->serial);
        else
-               setenv("board_serial", unknown);
+               env_set("board_serial", unknown);
 }
 
 static u64 mac_to_u64(u8 mac[6])
@@ -451,8 +451,8 @@ void board_ti_set_ethaddr(int index)
                for (i = 0; i < num_macs; i++) {
                        u64_to_mac(mac1 + i, mac_addr);
                        if (is_valid_ethaddr(mac_addr)) {
-                               eth_setenv_enetaddr_by_index("eth", i + index,
-                                                            mac_addr);
+                               eth_env_set_enetaddr_by_index("eth", i + index,
+                                                             mac_addr);
                        }
                }
        }
index 7d36f03fa1ec98c99a42ea28cb0458c9747bef79..93d3d0b54ebab0c9b6cd63fa1cf0674528f939d8 100644 (file)
@@ -558,7 +558,7 @@ int board_late_init(void)
         * on HS devices.
         */
        if (get_device_type() == HS_DEVICE)
-               setenv("boot_fit", "1");
+               env_set("boot_fit", "1");
 
        omap_die_id_serial();
        omap_set_fastboot_vars();
@@ -825,8 +825,8 @@ int spl_start_uboot(void)
 
 #ifdef CONFIG_SPL_ENV_SUPPORT
        env_init();
-       env_relocate_spec();
-       if (getenv_yesno("boot_os") != 1)
+       env_load();
+       if (env_get_yesno("boot_os") != 1)
                return 1;
 #endif
 
@@ -893,11 +893,11 @@ int board_eth_init(bd_t *bis)
        mac_addr[4] = (mac_lo & 0xFF00) >> 8;
        mac_addr[5] = mac_lo & 0xFF;
 
-       if (!getenv("ethaddr")) {
+       if (!env_get("ethaddr")) {
                printf("<ethaddr> not set. Validating first E-fuse MAC\n");
 
                if (is_valid_ethaddr(mac_addr))
-                       eth_setenv_enetaddr("ethaddr", mac_addr);
+                       eth_env_set_enetaddr("ethaddr", mac_addr);
        }
 
        mac_lo = readl((*ctrl)->control_core_mac_id_1_lo);
@@ -909,9 +909,9 @@ int board_eth_init(bd_t *bis)
        mac_addr[4] = (mac_lo & 0xFF00) >> 8;
        mac_addr[5] = mac_lo & 0xFF;
 
-       if (!getenv("eth1addr")) {
+       if (!env_get("eth1addr")) {
                if (is_valid_ethaddr(mac_addr))
-                       eth_setenv_enetaddr("eth1addr", mac_addr);
+                       eth_env_set_enetaddr("eth1addr", mac_addr);
        }
 
        ctrl_val = readl((*ctrl)->control_core_control_io1) & (~0x33);
index 6f75bd16f869712e6a02c7a8f2fc2148cd71033a..6bf57f9269b4977bd0683fe0842b0f73faadced0 100644 (file)
@@ -297,10 +297,10 @@ int board_eth_init(bd_t *bis)
 
        rc = smc911x_initialize(0, CONFIG_SMC911X_BASE);
 
-       if (!eth_getenv_enetaddr(STR_ENV_ETHADDR, eth_addr)) {
+       if (!eth_env_get_enetaddr(STR_ENV_ETHADDR, eth_addr)) {
                dev = eth_get_dev_by_index(0);
                if (dev) {
-                       eth_setenv_enetaddr(STR_ENV_ETHADDR, dev->enetaddr);
+                       eth_env_set_enetaddr(STR_ENV_ETHADDR, dev->enetaddr);
                } else {
                        printf("omap3evm: Couldn't get eth device\n");
                        rc = -1;
index c61baeeb8cf5d76093160db0408caf48120a71fe..ae86dfbe0aabeeed1ed4a66d2125e8427b028259 100644 (file)
@@ -74,7 +74,7 @@ int get_eth_env_param(char *env_name)
        char *env;
        int res = -1;
 
-       env = getenv(env_name);
+       env = env_get(env_name);
        if (env)
                res = simple_strtol(env, NULL, 0);
 
@@ -151,9 +151,9 @@ int ft_board_setup(void *blob, bd_t *bd)
        u32 ddr3a_size;
        int unitrd_fixup = 0;
 
-       env = getenv("mem_lpae");
+       env = env_get("mem_lpae");
        lpae = env && simple_strtol(env, NULL, 0);
-       env = getenv("uinitrd_fixup");
+       env = env_get("uinitrd_fixup");
        unitrd_fixup = env && simple_strtol(env, NULL, 0);
 
        ddr3a_size = 0;
@@ -180,13 +180,13 @@ int ft_board_setup(void *blob, bd_t *bd)
        }
 
        /* reserve memory at start of bank */
-       env = getenv("mem_reserve_head");
+       env = env_get("mem_reserve_head");
        if (env) {
                start[0] += ustrtoul(env, &endp, 0);
                size[0] -= ustrtoul(env, &endp, 0);
        }
 
-       env = getenv("mem_reserve");
+       env = env_get("mem_reserve");
        if (env)
                size[0] -= ustrtoul(env, &endp, 0);
 
@@ -251,7 +251,7 @@ void ft_board_setup_ex(void *blob, bd_t *bd)
        char *env;
        u64 *reserve_start;
 
-       env = getenv("mem_lpae");
+       env = env_get("mem_lpae");
        lpae = env && simple_strtol(env, NULL, 0);
 
        if (lpae) {
index 21605762ef51a59dc1bfdad80397c529e66d5cf5..15f0f54af633c61cc6877aa4432dcfbfaa88ce38 100644 (file)
@@ -310,9 +310,9 @@ int board_late_init(void)
 
 #ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG
        if (board_is_k2g_gp())
-               setenv("board_name", "66AK2GGP\0");
+               env_set("board_name", "66AK2GGP\0");
        else if (board_is_k2g_ice())
-               setenv("board_name", "66AK2GIC\0");
+               env_set("board_name", "66AK2GIC\0");
 #endif
        return 0;
 }
index 6ffb53c4c618d55cd4a602e75f5e4f1f8dd14642..c59e58a82a55ea28a672ca6da216b9c09fedb7d1 100644 (file)
@@ -103,7 +103,7 @@ int get_board_revision(void)
                board_id4 = gpio_get_value(PANDA_ES_BOARD_ID_4_GPIO);
 
 #ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG
-               setenv("board_name", "panda-es");
+               env_set("board_name", "panda-es");
 #endif
                board_id = ((board_id4 << 4) | (board_id3 << 3) |
                        (board_id2 << 2) | (board_id1 << 1) | (board_id0));
@@ -117,7 +117,7 @@ int get_board_revision(void)
 
 #ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG
                if ((board_id >= 0x3) && (processor_rev == OMAP4430_ES2_3))
-                       setenv("board_name", "panda-a4");
+                       env_set("board_name", "panda-a4");
 #endif
        }
 
index 055a29d9c649ac23dd0e33b8d250ac765fb460b4..cdde6a8ca338d2bc45481dbaf904858daf8a6e62 100644 (file)
@@ -166,7 +166,7 @@ int board_eth_init(bd_t *bis)
        uint8_t mac_addr[6];
        uint32_t mac_hi, mac_lo;
 
-       if (!eth_getenv_enetaddr("ethaddr", mac_addr)) {
+       if (!eth_env_get_enetaddr("ethaddr", mac_addr)) {
                printf("<ethaddr> not set. Reading from E-fuse\n");
                /* try reading mac address from efuse */
                mac_lo = readl(&cdev->macid0l);
@@ -179,7 +179,7 @@ int board_eth_init(bd_t *bis)
                mac_addr[5] = (mac_lo & 0xFF00) >> 8;
 
                if (is_valid_ethaddr(mac_addr))
-                       eth_setenv_enetaddr("ethaddr", mac_addr);
+                       eth_env_set_enetaddr("ethaddr", mac_addr);
                else
                        printf("Unable to read MAC address. Set <ethaddr>\n");
        }
index 9d6c3d6b5dc93d74825bf0f2e740fef60c8cdd68..cb40cc5f473ccde26e657fdcf2c0d8d1ae8b8653 100644 (file)
@@ -38,7 +38,7 @@ int board_eth_init(bd_t *bis)
        uint32_t mac_hi, mac_lo;
        struct ctrl_dev *cdev = (struct ctrl_dev *)CTRL_DEVICE_BASE;
 
-       if (!eth_getenv_enetaddr("ethaddr", mac_addr)) {
+       if (!eth_env_get_enetaddr("ethaddr", mac_addr)) {
                printf("<ethaddr> not set. Reading from E-fuse\n");
                /* try reading mac address from efuse */
                mac_lo = readl(&cdev->macid0l);
@@ -51,7 +51,7 @@ int board_eth_init(bd_t *bis)
                mac_addr[5] = (mac_lo & 0xFF00) >> 8;
 
                if (is_valid_ethaddr(mac_addr))
-                       eth_setenv_enetaddr("ethaddr", mac_addr);
+                       eth_env_set_enetaddr("ethaddr", mac_addr);
                else
                        printf("Unable to read MAC address. Set <ethaddr>\n");
        }
index d31eeb878a8fc0d9f8b3e28d6e5a444095c0eb34..741b3acce275378b2c996488d3a6bbd5865d6dcf 100644 (file)
@@ -102,7 +102,7 @@ int misc_init_r(void)
                        CONFIG_DM9000_BASE, GPMC_SIZE_16M);
 
        /* Use OMAP DIE_ID as MAC address */
-       if (!eth_getenv_enetaddr("ethaddr", enetaddr)) {
+       if (!eth_env_get_enetaddr("ethaddr", enetaddr)) {
                printf("ethaddr not set, using Die ID\n");
                die_id_0 = readl(&id_base->die_id_0);
                enetaddr[0] = 0x02; /* locally administered */
@@ -111,7 +111,7 @@ int misc_init_r(void)
                enetaddr[3] = (die_id_0 & 0x00ff0000) >> 16;
                enetaddr[4] = (die_id_0 & 0x0000ff00) >> 8;
                enetaddr[5] = (die_id_0 & 0x000000ff);
-               eth_setenv_enetaddr("ethaddr", enetaddr);
+               eth_env_set_enetaddr("ethaddr", enetaddr);
        }
 #endif
 
index 8e5613cb126124c7041791131e8a4e14b3337ba9..7a3e493faf168a908f73463501d434f8cb9da1a1 100644 (file)
@@ -9,6 +9,7 @@
 
 #include <common.h>
 #include <dm.h>
+#include <environment.h>
 #include <asm/arch/clock.h>
 #include <asm/arch/crm_regs.h>
 #include <asm/arch/mxc_hdmi.h>
@@ -803,7 +804,7 @@ int board_late_init(void)
 
        rev = get_board_rev();
        snprintf(env_str, ARRAY_SIZE(env_str), "%.4x", rev);
-       setenv("board_rev", env_str);
+       env_set("board_rev", env_str);
 
 #ifndef CONFIG_TDX_APALIS_IMX6_V1_0
        if ((rev & 0xfff0) == 0x0100) {
@@ -813,12 +814,12 @@ int board_late_init(void)
                setup_iomux_dce_uart();
 
                /* if using the default device tree, use version for V1.0 HW */
-               fdt_env = getenv("fdt_file");
+               fdt_env = env_get("fdt_file");
                if ((fdt_env != NULL) && (strcmp(FDT_FILE, fdt_env) == 0)) {
-                       setenv("fdt_file", FDT_FILE_V1_0);
+                       env_set("fdt_file", FDT_FILE_V1_0);
                        printf("patching fdt_file to " FDT_FILE_V1_0 "\n");
 #ifndef CONFIG_ENV_IS_NOWHERE
-                       saveenv();
+                       env_save();
 #endif
                }
        }
index cbf7aa952a90cef3ecdbbac237c769c57dd31ff6..dbcd2337829dbfb62231b34d5055c0927eea0d37 100644 (file)
@@ -676,7 +676,7 @@ int board_late_init(void)
 
        rev = get_board_rev();
        snprintf(env_str, ARRAY_SIZE(env_str), "%.4x", rev);
-       setenv("board_rev", env_str);
+       env_set("board_rev", env_str);
 #endif
 
        return 0;
index 46dd15bac81e3c6a8f66452f810e929421c51f23..3858af9c404e09fe19557971433e22ecdc82679a 100644 (file)
@@ -535,7 +535,7 @@ int board_late_init(void)
        if (((src->sbmr2 & SRC_SBMR2_BMOD_MASK) >> SRC_SBMR2_BMOD_SHIFT)
                        == SRC_SBMR2_BMOD_SERIAL) {
                printf("Serial Downloader recovery mode, disable autoboot\n");
-               setenv("bootdelay", "-1");
+               env_set("bootdelay", "-1");
        }
 
        return 0;
index 1bf8ca8f76d9ad17f12dd52ea2ee00ad753d5a6d..328c4c0200d09198177b9941c52f2b30c1ba8429 100644 (file)
@@ -278,7 +278,7 @@ static int get_cfgblock_interactive(void)
        len = cli_readline(message);
        it = console_buffer[0];
 
-       soc = getenv("soc");
+       soc = env_get("soc");
        if (!strcmp("mx6", soc)) {
 #ifdef CONFIG_MACH_TYPE
                if (it == 'y' || it == 'Y')
index 0d267877fa4f38ba3b8b8a67cb70855d956a8cef..b4e4727e63b01df238f7f0f6f542a91a5e054139 100644 (file)
@@ -80,24 +80,24 @@ int show_board_info(void)
                tdx_hw_tag.ver_minor,
                (char)tdx_hw_tag.ver_assembly + 'A');
 
-       setenv("serial#", tdx_serial_str);
+       env_set("serial#", tdx_serial_str);
 
        /*
         * Check if environment contains a valid MAC address,
         * set the one from config block if not
         */
-       if (!eth_getenv_enetaddr("ethaddr", ethaddr))
-               eth_setenv_enetaddr("ethaddr", (u8 *)&tdx_eth_addr);
+       if (!eth_env_get_enetaddr("ethaddr", ethaddr))
+               eth_env_set_enetaddr("ethaddr", (u8 *)&tdx_eth_addr);
 
 #ifdef CONFIG_TDX_CFG_BLOCK_2ND_ETHADDR
-       if (!eth_getenv_enetaddr("eth1addr", ethaddr)) {
+       if (!eth_env_get_enetaddr("eth1addr", ethaddr)) {
                /*
                 * Secondary MAC address is allocated from block
                 * 0x100000 higher then the first MAC address
                 */
                memcpy(ethaddr, &tdx_eth_addr, 6);
                ethaddr[3] += 0x10;
-               eth_setenv_enetaddr("eth1addr", ethaddr);
+               eth_env_set_enetaddr("eth1addr", ethaddr);
        }
 #endif
 
index fcdea34f050a06f6f61d1765e4be2aee2036973e..14991fdb00c078dd1512cbf5c8548db7f3207d91 100644 (file)
@@ -251,7 +251,7 @@ int power_init_board(void)
 
 int board_late_init(void)
 {
-       setenv("board_name", tqma6_get_boardname());
+       env_set("board_name", tqma6_get_boardname());
 
        tqma6_bb_board_late_init();
 
index 276c625cfd813683725bc14ba8509469f02c3370..7fa1289de0410799a267d5bad598f5476cfea2fb 100644 (file)
@@ -437,7 +437,7 @@ int checkboard(void)
 int board_late_init(void)
 {
 #ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG
-       setenv("board_name", board_string());
+       env_set("board_name", board_string());
 #endif
 
        return 0;
index 7534935dde0f64ce7f590161cb98a68f3fdbae03..a359626b818a727d3e83ecf61c3d428afac02e5d 100644 (file)
@@ -255,9 +255,9 @@ int board_late_init(void)
 {
 #ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG
        if (is_cpu_type(MXC_CPU_MX6Q))
-               setenv("board_rev", "MX6Q");
+               env_set("board_rev", "MX6Q");
        else
-               setenv("board_rev", "MX6DL");
+               env_set("board_rev", "MX6DL");
 #endif
        return 0;
 }
index b55ab818e6989dbd49f66328526fe41dbbe15b62..69f596a4ccf185827ed9057b1875826a4b534559 100644 (file)
@@ -401,7 +401,7 @@ int mac_read_from_generic_eeprom(const char *envvar, int chip,
                        mac[5]);
 
                printf("MAC: %s\n", ethaddr);
-               setenv(envvar, ethaddr);
+               env_set(envvar, ethaddr);
        }
 
        return ret;
@@ -486,8 +486,8 @@ int mac_read_from_eeprom_common(void)
                        /* Only initialize environment variables that are blank
                         * (i.e. have not yet been set)
                         */
-                       if (!getenv(enetvar))
-                               setenv(enetvar, ethaddr);
+                       if (!env_get(enetvar))
+                               env_set(enetvar, ethaddr);
                }
        }
 
index 74f4473877e27855974c8f77449ce5b36917d59c..30f518abe89469f9f82ddea7e2bb46c71df4828a 100644 (file)
@@ -87,8 +87,8 @@ int ft_board_setup(void *blob, bd_t *bd)
 
        ft_cpu_setup(blob, bd);
 
-       base = getenv_bootm_low();
-       size = getenv_bootm_size();
+       base = env_get_bootm_low();
+       size = env_get_bootm_size();
 
        fdt_fixup_memory(blob, (u64)base, (u64)size);
 
index d3b1f1564f3cd75344eeccb1aee3fd3c23d013c8..cb39190c286ae7d8ac33d344477ef7b5e3b500a4 100644 (file)
@@ -68,7 +68,7 @@ static int baltos_set_console(void)
        printf("DIPs: 0x%1x\n", (~dips) & 0xf);
 
        if ((dips & 0xf) == 0xe)
-               setenv("console", "ttyUSB0,115200n8");
+               env_set("console", "ttyUSB0,115200n8");
 
        return 0;
 }
@@ -373,7 +373,7 @@ int board_late_init(void)
                return -ENODEV;
        }
 
-       setenv("board_name", model);
+       env_set("board_name", model);
 #endif
 
        return 0;
@@ -453,11 +453,11 @@ int board_eth_init(bd_t *bis)
 
 #if (defined(CONFIG_DRIVER_TI_CPSW) && !defined(CONFIG_SPL_BUILD)) || \
        (defined(CONFIG_SPL_ETH_SUPPORT) && defined(CONFIG_SPL_BUILD))
-       if (!getenv("ethaddr")) {
+       if (!env_get("ethaddr")) {
                printf("<ethaddr> not set. Validating first E-fuse MAC\n");
 
                if (is_valid_ethaddr(mac_addr))
-                       eth_setenv_enetaddr("ethaddr", mac_addr);
+                       eth_env_set_enetaddr("ethaddr", mac_addr);
        }
 
 #ifdef CONFIG_DRIVER_TI_CPSW
index 1dbc966b6eedab437ce37a0d4b2e47a4814ec09c..adfcf485627d899f95f7101813ef3558a84c4603 100644 (file)
@@ -425,14 +425,14 @@ int board_late_init(void)
 
 #ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG
        if (is_mx6dq())
-               setenv("board_rev", "MX6Q");
+               env_set("board_rev", "MX6Q");
        else
-               setenv("board_rev", "MX6DL");
+               env_set("board_rev", "MX6DL");
 
        if (is_revc1())
-               setenv("board_name", "C1");
+               env_set("board_name", "C1");
        else
-               setenv("board_name", "B1");
+               env_set("board_name", "B1");
 #endif
        return 0;
 }
index 37a736351cb02acd5aeb4ac644e507798fd8d645..c997cea6f0d971d9466e90118f291f9e5dd58d6c 100644 (file)
@@ -228,7 +228,7 @@ void work_92105_display_init(void)
        i2c_write(0x2c, 0x01, 1, &enable_backlight, 1);
 
        /* set display contrast */
-       display_contrast_str = getenv("fwopt_dispcontrast");
+       display_contrast_str = env_get("fwopt_dispcontrast");
        if (display_contrast_str)
                display_contrast = simple_strtoul(display_contrast_str,
                        NULL, 10);
index 4ed6f50e5cf8f023dd40b235ff8b2d768b77ee3b..b76eb948d50ccec8a7ebdf8532c32d7c1ffcd946 100644 (file)
@@ -51,13 +51,13 @@ int checkboard(void)
 
        /* Display board specific information */
        puts("       ");
-       i = getenv_f("board_rev", buf, sizeof(buf));
+       i = env_get_f("board_rev", buf, sizeof(buf));
        if (i > 0)
                printf("Rev %s, ", buf);
-       i = getenv_f("serial#", buf, sizeof(buf));
+       i = env_get_f("serial#", buf, sizeof(buf));
        if (i > 0)
                printf("Serial# %s, ", buf);
-       i = getenv_f("board_cfg", buf, sizeof(buf));
+       i = env_get_f("board_cfg", buf, sizeof(buf));
        if (i > 0)
                printf("Cfg %s", buf);
        puts("\n");
index b2fbecf6dedd513213ae205e9a42007ebf6d678b..90ef542458a9c7a19e64be1c031282fe5f5cf3f6 100644 (file)
@@ -86,22 +86,22 @@ int board_late_init(void)
 {
        switch ((zynq_slcr_get_boot_mode()) & ZYNQ_BM_MASK) {
        case ZYNQ_BM_QSPI:
-               setenv("modeboot", "qspiboot");
+               env_set("modeboot", "qspiboot");
                break;
        case ZYNQ_BM_NAND:
-               setenv("modeboot", "nandboot");
+               env_set("modeboot", "nandboot");
                break;
        case ZYNQ_BM_NOR:
-               setenv("modeboot", "norboot");
+               env_set("modeboot", "norboot");
                break;
        case ZYNQ_BM_SD:
-               setenv("modeboot", "sdboot");
+               env_set("modeboot", "sdboot");
                break;
        case ZYNQ_BM_JTAG:
-               setenv("modeboot", "jtagboot");
+               env_set("modeboot", "jtagboot");
                break;
        default:
-               setenv("modeboot", "");
+               env_set("modeboot", "");
                break;
        }
 
index aebd3df8a9768a8b4c6f18099cea49dc9cd99ff7..d17868b0c2b7cec23997f89982008d6a208fb3cc 100644 (file)
@@ -318,10 +318,10 @@ int board_late_init(void)
         * and default boot_targets
         */
        new_targets = calloc(1, strlen(mode) +
-                               strlen(getenv("boot_targets")) + 2);
+                               strlen(env_get("boot_targets")) + 2);
 
-       sprintf(new_targets, "%s %s", mode, getenv("boot_targets"));
-       setenv("boot_targets", new_targets);
+       sprintf(new_targets, "%s %s", mode, env_get("boot_targets"));
+       env_set("boot_targets", new_targets);
 
        return 0;
 }
index 96d7b72df2333cc5be9400a350daa860896dc1ca..27ffcd55bcec3a3f0ae2c01fb6bddbd7ea5c5d52 100644 (file)
@@ -28,7 +28,7 @@ static void print_eth(int idx)
                sprintf(name, "eth%iaddr", idx);
        else
                strcpy(name, "ethaddr");
-       val = getenv(name);
+       val = env_get(name);
        if (!val)
                val = "(not set)";
        printf("%-12s= %s\n", name, val);
@@ -51,7 +51,7 @@ static void print_eths(void)
        } while (dev);
 
        printf("current eth = %s\n", eth_get_name());
-       printf("ip_addr     = %s\n", getenv("ipaddr"));
+       printf("ip_addr     = %s\n", env_get("ipaddr"));
 }
 #endif
 
@@ -141,7 +141,7 @@ static inline void print_eth_ip_addr(void)
 #if defined(CONFIG_HAS_ETH5)
        print_eth(5);
 #endif
-       printf("IP addr     = %s\n", getenv("ipaddr"));
+       printf("IP addr     = %s\n", env_get("ipaddr"));
 #endif
 }
 
index daf15d9e80fcb71be0e93cb0fed7eb214d0c213c..df0bbe19ca2ad88a81b477871f5af8c37deaf855 100644 (file)
@@ -138,7 +138,7 @@ int do_bootm(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 
 int bootm_maybe_autostart(cmd_tbl_t *cmdtp, const char *cmd)
 {
-       const char *ep = getenv("autostart");
+       const char *ep = env_get("autostart");
 
        if (ep && !strcmp(ep, "yes")) {
                char *local_args[2];
@@ -202,7 +202,7 @@ U_BOOT_CMD(
 #if defined(CONFIG_CMD_BOOTD)
 int do_bootd(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 {
-       return run_command(getenv("bootcmd"), flag);
+       return run_command(env_get("bootcmd"), flag);
 }
 
 U_BOOT_CMD(
index 5879065c2ea45cc7b9731884aad1aa9a95128340..870db7c1dea39084d38cb5824350f5bb1a3aa5ed 100644 (file)
@@ -53,7 +53,7 @@ static char *bootmenu_getoption(unsigned short int n)
                return NULL;
 
        sprintf(name, "bootmenu_%d", n);
-       return getenv(name);
+       return env_get(name);
 }
 
 static void bootmenu_print_entry(void *data)
@@ -483,7 +483,7 @@ int do_bootmenu(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
                delay_str = argv[1];
 
        if (!delay_str)
-               delay_str = getenv("bootmenu_delay");
+               delay_str = env_get("bootmenu_delay");
 
        if (delay_str)
                delay = (int)simple_strtol(delay_str, NULL, 10);
index 95a11a36160aa955339b227c0d6e4a8cb17c7ec8..799ba01fcc8efbfb14a6a5b5f80947e37cb23d22 100644 (file)
@@ -80,7 +80,7 @@ static int do_cbfs_fsload(cmd_tbl_t *cmdtp, int flag, int argc,
 
        printf("\n%ld bytes read\n", size);
 
-       setenv_hex("filesize", size);
+       env_set_hex("filesize", size);
 
        return 0;
 }
index 49ee36c74aec81cbdb512d0e46526ba7cce380e0..86f1bac272cce1a1e1033ca141f1bc86f349413c 100644 (file)
@@ -104,7 +104,7 @@ int do_cramfs_load(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
        struct mtdids id;
 
        ulong addr;
-       addr = simple_strtoul(getenv("cramfsaddr"), NULL, 16);
+       addr = simple_strtoul(env_get("cramfsaddr"), NULL, 16);
 
        /* hack! */
        /* cramfs_* only supports NOR flash chips */
@@ -117,9 +117,9 @@ int do_cramfs_load(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
        part.offset = (u64)(uintptr_t) map_sysmem(addr - OFFSET_ADJUSTMENT, 0);
 
        /* pre-set Boot file name */
-       if ((filename = getenv("bootfile")) == NULL) {
+       filename = env_get("bootfile");
+       if (!filename)
                filename = "uImage";
-       }
 
        if (argc == 2) {
                filename = argv[1];
@@ -138,7 +138,7 @@ int do_cramfs_load(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
        if (size > 0) {
                printf("### CRAMFS load complete: %d bytes loaded to 0x%lx\n",
                        size, offset);
-               setenv_hex("filesize", size);
+               env_set_hex("filesize", size);
        } else {
                printf("### CRAMFS LOAD ERROR<%x> for %s!\n", size, filename);
        }
@@ -169,7 +169,7 @@ int do_cramfs_ls(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
        struct mtdids id;
 
        ulong addr;
-       addr = simple_strtoul(getenv("cramfsaddr"), NULL, 16);
+       addr = simple_strtoul(env_get("cramfsaddr"), NULL, 16);
 
        /* hack! */
        /* cramfs_* only supports NOR flash chips */
index ed9625b221fe1d76abf424840e80dc6ab920b0ab..5745a389dae7038267fddd316605a6dce8d9a3dc 100644 (file)
--- a/cmd/elf.c
+++ b/cmd/elf.c
@@ -148,7 +148,7 @@ int do_bootelf(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
        unsigned long addr; /* Address of the ELF image */
        unsigned long rc; /* Return value from user code */
        char *sload = NULL;
-       const char *ep = getenv("autostart");
+       const char *ep = env_get("autostart");
        int rcode = 0;
 
        /* Consume 'bootelf' */
@@ -242,11 +242,11 @@ int do_bootvx(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
         */
 #if defined(CONFIG_WALNUT)
        tmp = (char *)CONFIG_SYS_NVRAM_BASE_ADDR + 0x500;
-       eth_getenv_enetaddr("ethaddr", (uchar *)build_buf);
+       eth_env_get_enetaddr("ethaddr", (uchar *)build_buf);
        memcpy(tmp, &build_buf[3], 3);
 #elif defined(CONFIG_SYS_VXWORKS_MAC_PTR)
        tmp = (char *)CONFIG_SYS_VXWORKS_MAC_PTR;
-       eth_getenv_enetaddr("ethaddr", (uchar *)build_buf);
+       eth_env_get_enetaddr("ethaddr", (uchar *)build_buf);
        memcpy(tmp, build_buf, 6);
 #else
        puts("## Ethernet MAC address not copied to NV RAM\n");
@@ -258,7 +258,7 @@ int do_bootvx(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
         * (LOCAL_MEM_LOCAL_ADRS + BOOT_LINE_OFFSET) as defined by
         * VxWorks BSP. For example, on PowerPC it defaults to 0x4200.
         */
-       tmp = getenv("bootaddr");
+       tmp = env_get("bootaddr");
        if (!tmp) {
                printf("## VxWorks bootline address not specified\n");
        } else {
@@ -269,21 +269,21 @@ int do_bootvx(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
                 * parameter. If it is not defined, we may be able to
                 * construct the info.
                 */
-               bootline = getenv("bootargs");
+               bootline = env_get("bootargs");
                if (bootline) {
                        memcpy((void *)bootaddr, bootline,
                               max(strlen(bootline), (size_t)255));
                        flush_cache(bootaddr, max(strlen(bootline),
                                                  (size_t)255));
                } else {
-                       tmp = getenv("bootdev");
+                       tmp = env_get("bootdev");
                        if (tmp) {
                                strcpy(build_buf, tmp);
                                ptr = strlen(tmp);
                        } else
                                printf("## VxWorks boot device not specified\n");
 
-                       tmp = getenv("bootfile");
+                       tmp = env_get("bootfile");
                        if (tmp)
                                ptr += sprintf(build_buf + ptr,
                                               "host:%s ", tmp);
@@ -295,12 +295,12 @@ int do_bootvx(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
                         * The following parameters are only needed if 'bootdev'
                         * is an ethernet device, otherwise they are optional.
                         */
-                       tmp = getenv("ipaddr");
+                       tmp = env_get("ipaddr");
                        if (tmp) {
                                ptr += sprintf(build_buf + ptr, "e=%s", tmp);
-                               tmp = getenv("netmask");
+                               tmp = env_get("netmask");
                                if (tmp) {
-                                       u32 mask = getenv_ip("netmask").s_addr;
+                                       u32 mask = env_get_ip("netmask").s_addr;
                                        ptr += sprintf(build_buf + ptr,
                                                       ":%08x ", ntohl(mask));
                                } else {
@@ -308,19 +308,19 @@ int do_bootvx(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
                                }
                        }
 
-                       tmp = getenv("serverip");
+                       tmp = env_get("serverip");
                        if (tmp)
                                ptr += sprintf(build_buf + ptr, "h=%s ", tmp);
 
-                       tmp = getenv("gatewayip");
+                       tmp = env_get("gatewayip");
                        if (tmp)
                                ptr += sprintf(build_buf + ptr, "g=%s ", tmp);
 
-                       tmp = getenv("hostname");
+                       tmp = env_get("hostname");
                        if (tmp)
                                ptr += sprintf(build_buf + ptr, "tn=%s ", tmp);
 
-                       tmp = getenv("othbootargs");
+                       tmp = env_get("othbootargs");
                        if (tmp) {
                                strcpy(build_buf + ptr, tmp);
                                ptr += strlen(tmp);
@@ -341,12 +341,12 @@ int do_bootvx(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
         * Since E820 information is critical to the kernel, if we don't
         * specify these in the environments, use a default one.
         */
-       tmp = getenv("e820data");
+       tmp = env_get("e820data");
        if (tmp)
                data = (struct e820entry *)simple_strtoul(tmp, NULL, 16);
        else
                data = (struct e820entry *)VXWORKS_E820_DATA_ADDR;
-       tmp = getenv("e820info");
+       tmp = env_get("e820info");
        if (tmp)
                info = (struct e820info *)simple_strtoul(tmp, NULL, 16);
        else
index 05e19f8a72bf2be0146d3e4789b09bbea81ceb58..118613f405169c82d70f5d50c76dec1341761200 100644 (file)
--- a/cmd/fdt.c
+++ b/cmd/fdt.c
@@ -43,21 +43,21 @@ void set_working_fdt_addr(ulong addr)
 
        buf = map_sysmem(addr, 0);
        working_fdt = buf;
-       setenv_hex("fdtaddr", addr);
+       env_set_hex("fdtaddr", addr);
 }
 
 /*
  * Get a value from the fdt and format it to be set in the environment
  */
-static int fdt_value_setenv(const void *nodep, int len, const char *var)
+static int fdt_value_env_set(const void *nodep, int len, const char *var)
 {
        if (is_printable_string(nodep, len))
-               setenv(var, (void *)nodep);
+               env_set(var, (void *)nodep);
        else if (len == 4) {
                char buf[11];
 
                sprintf(buf, "0x%08X", fdt32_to_cpu(*(fdt32_t *)nodep));
-               setenv(var, buf);
+               env_set(var, buf);
        } else if (len%4 == 0 && len <= 20) {
                /* Needed to print things like sha1 hashes. */
                char buf[41];
@@ -66,7 +66,7 @@ static int fdt_value_setenv(const void *nodep, int len, const char *var)
                for (i = 0; i < len; i += sizeof(unsigned int))
                        sprintf(buf + (i * 2), "%08x",
                                *(unsigned int *)(nodep + i));
-               setenv(var, buf);
+               env_set(var, buf);
        } else {
                printf("error: unprintable value\n");
                return 1;
@@ -111,7 +111,7 @@ static int do_fdt(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
                                return 1;
                        printf("The address of the fdt is %#08lx\n",
                               control ? (ulong)map_to_sysmem(blob) :
-                                       getenv_hex("fdtaddr", 0));
+                                       env_get_hex("fdtaddr", 0));
                        return 0;
                }
 
@@ -358,10 +358,12 @@ static int do_fdt(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
                                if (curDepth == startDepth + 1)
                                        curIndex++;
                                if (subcmd[0] == 'n' && curIndex == reqIndex) {
-                                       const char *nodeName = fdt_get_name(
-                                           working_fdt, nextNodeOffset, NULL);
+                                       const char *node_name;
 
-                                       setenv(var, (char *)nodeName);
+                                       node_name = fdt_get_name(working_fdt,
+                                                                nextNodeOffset,
+                                                                NULL);
+                                       env_set(var, node_name);
                                        return 0;
                                }
                                nextNodeOffset = fdt_next_node(
@@ -371,7 +373,7 @@ static int do_fdt(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
                        }
                        if (subcmd[0] == 's') {
                                /* get the num nodes at this level */
-                               setenv_ulong(var, curIndex + 1);
+                               env_set_ulong(var, curIndex + 1);
                        } else {
                                /* node index not found */
                                printf("libfdt node not found\n");
@@ -382,13 +384,14 @@ static int do_fdt(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
                                working_fdt, nodeoffset, prop, &len);
                        if (len == 0) {
                                /* no property value */
-                               setenv(var, "");
+                               env_set(var, "");
                                return 0;
                        } else if (nodep && len > 0) {
                                if (subcmd[0] == 'v') {
                                        int ret;
 
-                                       ret = fdt_value_setenv(nodep, len, var);
+                                       ret = fdt_value_env_set(nodep, len,
+                                                               var);
                                        if (ret != 0)
                                                return ret;
                                } else if (subcmd[0] == 'a') {
@@ -396,13 +399,13 @@ static int do_fdt(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
                                        char buf[11];
 
                                        sprintf(buf, "0x%p", nodep);
-                                       setenv(var, buf);
+                                       env_set(var, buf);
                                } else if (subcmd[0] == 's') {
                                        /* Get size */
                                        char buf[11];
 
                                        sprintf(buf, "0x%08X", len);
-                                       setenv(var, buf);
+                                       env_set(var, buf);
                                } else
                                        return CMD_RET_USAGE;
                                return 0;
index 016349f5608695ebdd6ec2f48bad36f018a35278..ac6f504140613b6753b42e66f9fd5f86ba971cc2 100644 (file)
@@ -43,8 +43,8 @@ int do_fpga(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
        int op, dev = FPGA_INVALID_DEVICE;
        size_t data_size = 0;
        void *fpga_data = NULL;
-       char *devstr = getenv("fpga");
-       char *datastr = getenv("fpgadata");
+       char *devstr = env_get("fpga");
+       char *datastr = env_get("fpgadata");
        int rc = FPGA_FAIL;
        int wrong_parms = 0;
 #if defined(CONFIG_FIT)
index 6f08f611168d422c4f44b10cd83533c58b9e9a0d..638aa198267be46c365b4a5956ff858b4210e83a 100644 (file)
--- a/cmd/gpt.c
+++ b/cmd/gpt.c
@@ -55,14 +55,14 @@ static int extract_env(const char *str, char **env)
        memset(s + strlen(s) - 1, '\0', 1);
        memmove(s, s + 2, strlen(s) - 1);
 
-       e = getenv(s);
+       e = env_get(s);
        if (e == NULL) {
 #ifdef CONFIG_RANDOM_UUID
                debug("%s unset. ", str);
                gen_rand_uuid_str(uuid_str, UUID_STR_FORMAT_GUID);
-               setenv(s, uuid_str);
+               env_set(s, uuid_str);
 
-               e = getenv(s);
+               e = env_get(s);
                if (e) {
                        debug("Set to random.\n");
                        ret = 0;
@@ -626,7 +626,7 @@ static int do_disk_guid(struct blk_desc *dev_desc, char * const namestr)
                return CMD_RET_FAILURE;
 
        if (namestr)
-               setenv(namestr, disk_guid);
+               env_set(namestr, disk_guid);
        else
                printf("%s\n", disk_guid);
 
index 727fd1c66407f2f253a59beff3cf1ab6d6c51f7c..8656299447b6b6b35ba53b8ccb3cdbaf23e4ac73 100644 (file)
--- a/cmd/ini.c
+++ b/cmd/ini.c
@@ -219,7 +219,7 @@ static int ini_handler(void *user, char *section, char *name, char *value)
                for (i = 0; i < strlen(value); i++)
                        value[i] = tolower(value[i]);
 #endif
-               setenv(name, value);
+               env_set(name, value);
                printf("ini: Imported %s as %s\n", name, value);
        }
 
@@ -238,9 +238,9 @@ static int do_ini(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 
        section = argv[1];
        file_address = (char *)simple_strtoul(
-               argc < 3 ? getenv("loadaddr") : argv[2], NULL, 16);
+               argc < 3 ? env_get("loadaddr") : argv[2], NULL, 16);
        file_size = (size_t)simple_strtoul(
-               argc < 4 ? getenv("filesize") : argv[3], NULL, 16);
+               argc < 4 ? env_get("filesize") : argv[3], NULL, 16);
 
        return ini_parse(file_address, file_size, ini_handler, (void *)section);
 }
index e1896d9f9728df3f8195d6d4a11321c5f67723b1..70db04a04f239e917e5f867a41804b965d62fd89 100644 (file)
@@ -101,7 +101,7 @@ static char * evalstr(char *s)
                        i++;
                }
                s[i] = 0;
-               return  getenv((const char *)&s[2]);
+               return  env_get((const char *)&s[2]);
        } else {
                return s;
        }
index dc94705ccd73ee87b9ee140905957aef99445a47..aee2f4513d44220006cc8b6b5695337ead7c8995 100644 (file)
@@ -479,9 +479,9 @@ int do_jffs2_fsload(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
        ulong offset = load_addr;
 
        /* pre-set Boot file name */
-       if ((filename = getenv("bootfile")) == NULL) {
+       filename = env_get("bootfile");
+       if (!filename)
                filename = "uImage";
-       }
 
        if (argc == 2) {
                filename = argv[1];
@@ -512,7 +512,7 @@ int do_jffs2_fsload(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
                if (size > 0) {
                        printf("### %s load complete: %d bytes loaded to 0x%lx\n",
                                fsname, size, offset);
-                       setenv_hex("filesize", size);
+                       env_set_hex("filesize", size);
                } else {
                        printf("### %s LOAD ERROR<%x> for %s!\n", fsname, size, filename);
                }
index 4597ec5618da2df839af0703541f3ce6087a7bb0..519c309a61cda77dac4daf4d8b08e6dd9fcf3f50 100644 (file)
@@ -50,11 +50,11 @@ static int do_load_serial(cmd_tbl_t *cmdtp, int flag, int argc,
        load_baudrate = current_baudrate = gd->baudrate;
 #endif
 
-       if (((env_echo = getenv("loads_echo")) != NULL) && (*env_echo == '1')) {
+       env_echo = env_get("loads_echo");
+       if (env_echo && *env_echo == '1')
                do_echo = 1;
-       } else {
+       else
                do_echo = 0;
-       }
 
 #ifdef CONFIG_SYS_LOADS_BAUD_CHANGE
        if (argc >= 2) {
@@ -182,7 +182,7 @@ static ulong load_serial(long offset)
                            start_addr, end_addr, size, size
                    );
                    flush_cache(start_addr, size);
-                   setenv_hex("filesize", size);
+                   env_set_hex("filesize", size);
                    return (addr);
                case SREC_START:
                    break;
@@ -427,9 +427,9 @@ static int do_load_serial_bin(cmd_tbl_t *cmdtp, int flag, int argc,
        offset = CONFIG_SYS_LOAD_ADDR;
 
        /* pre-set offset from $loadaddr */
-       if ((s = getenv("loadaddr")) != NULL) {
+       s = env_get("loadaddr");
+       if (s)
                offset = simple_strtoul(s, NULL, 16);
-       }
 
        load_baudrate = current_baudrate = gd->baudrate;
 
@@ -529,7 +529,7 @@ static ulong load_serial_bin(ulong offset)
        flush_cache(offset, size);
 
        printf("## Total Size      = 0x%08x = %d Bytes\n", size, size);
-       setenv_hex("filesize", size);
+       env_set_hex("filesize", size);
 
        return offset;
 }
@@ -1000,7 +1000,7 @@ static ulong load_serial_ymodem(ulong offset, int mode)
        flush_cache(offset, ALIGN(size, ARCH_DMA_MINALIGN));
 
        printf("## Total Size      = 0x%08x = %d Bytes\n", size, size);
-       setenv_hex("filesize", size);
+       env_set_hex("filesize", size);
 
        return offset;
 }
index 873ee4037196e1488ac78b9e21b6d9cb44208cdf..7a3bd5cd690d08df58907a124ec7c0d37e43e520 100644 (file)
--- a/cmd/log.c
+++ b/cmd/log.c
@@ -71,7 +71,8 @@ void logbuff_init_ptrs(void)
 #endif
 
        /* Set up log version */
-       if ((s = getenv ("logversion")) != NULL)
+       s = env_get("logversion");
+       if (s)
                log_version = (int)simple_strtoul(s, NULL, 10);
 
        if (log_version == 2)
@@ -94,7 +95,8 @@ void logbuff_init_ptrs(void)
                log->v2.start = log->v2.con;
 
        /* Initialize default loglevel if present */
-       if ((s = getenv ("loglevel")) != NULL)
+       s = env_get("loglevel");
+       if (s)
                console_loglevel = (int)simple_strtoul(s, NULL, 10);
 
        gd->flags |= GD_FLG_LOGINIT;
index c78df825e84b6c6ea2a0300142d88de75f5fda81..1b482edb587dc3fd8a8c4a0b92f5f6295d0f897b 100644 (file)
@@ -42,7 +42,7 @@ static int do_lzmadec(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
                return 1;
        printf("Uncompressed size: %ld = %#lX\n", (ulong)src_len,
               (ulong)src_len);
-       setenv_hex("filesize", src_len);
+       env_set_hex("filesize", src_len);
 
        return 0;
 }
index 23bb81e88cbf02ca73224b244e1c2359cd9c9f2a..c737cb23b5e27ee4203cf2290e2068599ac40203 100644 (file)
@@ -35,7 +35,7 @@ static void store_result(const u8 *sum, const char *dest)
                        sprintf(str_ptr, "%02x", sum[i]);
                        str_ptr += 2;
                }
-               setenv(dest, str_output);
+               env_set(dest, str_output);
        }
 }
 
@@ -54,7 +54,7 @@ static int parse_verify_sum(char *verify_str, u8 *vsum)
                if (strlen(verify_str) == 32)
                        vsum_str = verify_str;
                else {
-                       vsum_str = getenv(verify_str);
+                       vsum_str = env_get(verify_str);
                        if (vsum_str == NULL || strlen(vsum_str) != 32)
                                return 1;
                }
index 683c48bdad1bc0a9a1c023d8d3802f138d115da2..615aa7459af3b68967fd8eae483e126724c583d6 100644 (file)
@@ -239,19 +239,19 @@ static void index_partitions(void)
                        dev = list_entry(dentry, struct mtd_device, link);
                        if (dev == current_mtd_dev) {
                                mtddevnum += current_mtd_partnum;
-                               setenv_ulong("mtddevnum", mtddevnum);
+                               env_set_ulong("mtddevnum", mtddevnum);
                                break;
                        }
                        mtddevnum += dev->num_parts;
                }
 
                part = mtd_part_info(current_mtd_dev, current_mtd_partnum);
-               setenv("mtddevname", part->name);
+               env_set("mtddevname", part->name);
 
                debug("=> mtddevnum %d,\n=> mtddevname %s\n", mtddevnum, part->name);
        } else {
-               setenv("mtddevnum", NULL);
-               setenv("mtddevname", NULL);
+               env_set("mtddevnum", NULL);
+               env_set("mtddevname", NULL);
 
                debug("=> mtddevnum NULL\n=> mtddevname NULL\n");
        }
@@ -270,12 +270,12 @@ static void current_save(void)
                sprintf(buf, "%s%d,%d", MTD_DEV_TYPE(current_mtd_dev->id->type),
                                        current_mtd_dev->id->num, current_mtd_partnum);
 
-               setenv("partition", buf);
+               env_set("partition", buf);
                strncpy(last_partition, buf, 16);
 
                debug("=> partition %s\n", buf);
        } else {
-               setenv("partition", NULL);
+               env_set("partition", NULL);
                last_partition[0] = '\0';
 
                debug("=> partition NULL\n");
@@ -1213,9 +1213,9 @@ static int generate_mtdparts_save(char *buf, u32 buflen)
        ret = generate_mtdparts(buf, buflen);
 
        if ((buf[0] != '\0') && (ret == 0))
-               setenv("mtdparts", buf);
+               env_set("mtdparts", buf);
        else
-               setenv("mtdparts", NULL);
+               env_set("mtdparts", NULL);
 
        return ret;
 }
@@ -1533,11 +1533,11 @@ static int spread_partitions(void)
  * @param buf temporary buffer pointer MTDPARTS_MAXLEN long
  * @return mtdparts variable string, NULL if not found
  */
-static const char *getenv_mtdparts(char *buf)
+static const char *env_get_mtdparts(char *buf)
 {
        if (gd->flags & GD_FLG_ENV_READY)
-               return getenv("mtdparts");
-       if (getenv_f("mtdparts", buf, MTDPARTS_MAXLEN) != -1)
+               return env_get("mtdparts");
+       if (env_get_f("mtdparts", buf, MTDPARTS_MAXLEN) != -1)
                return buf;
        return NULL;
 }
@@ -1565,7 +1565,7 @@ static int parse_mtdparts(const char *const mtdparts)
        }
 
        /* re-read 'mtdparts' variable, mtd_devices_init may be updating env */
-       p = getenv_mtdparts(tmp_parts);
+       p = env_get_mtdparts(tmp_parts);
        if (!p)
                p = mtdparts;
 
@@ -1741,9 +1741,9 @@ int mtdparts_init(void)
        }
 
        /* get variables */
-       ids = getenv("mtdids");
-       parts = getenv_mtdparts(tmp_parts);
-       current_partition = getenv("partition");
+       ids = env_get("mtdids");
+       parts = env_get_mtdparts(tmp_parts);
+       current_partition = env_get("partition");
 
        /* save it for later parsing, cannot rely on current partition pointer
         * as 'partition' variable may be updated during init */
@@ -1764,7 +1764,7 @@ int mtdparts_init(void)
                if (mtdids_default) {
                        debug("mtdids variable not defined, using default\n");
                        ids = mtdids_default;
-                       setenv("mtdids", (char *)ids);
+                       env_set("mtdids", (char *)ids);
                } else {
                        printf("mtdids not defined, no default present\n");
                        return 1;
@@ -1780,7 +1780,7 @@ int mtdparts_init(void)
        if (!parts) {
                if (mtdparts_default && use_defaults) {
                        parts = mtdparts_default;
-                       if (setenv("mtdparts", (char *)parts) == 0)
+                       if (env_set("mtdparts", (char *)parts) == 0)
                                use_defaults = 0;
                } else
                        printf("mtdparts variable not set, see 'help mtdparts'\n");
@@ -1850,7 +1850,7 @@ int mtdparts_init(void)
                        current_mtd_partnum = pnum;
                        current_save();
                }
-       } else if (getenv("partition") == NULL) {
+       } else if (env_get("partition") == NULL) {
                debug("no partition variable set, setting...\n");
                current_save();
        }
@@ -1956,9 +1956,9 @@ static int do_mtdparts(cmd_tbl_t *cmdtp, int flag, int argc,
 {
        if (argc == 2) {
                if (strcmp(argv[1], "default") == 0) {
-                       setenv("mtdids", NULL);
-                       setenv("mtdparts", NULL);
-                       setenv("partition", NULL);
+                       env_set("mtdids", NULL);
+                       env_set("mtdparts", NULL);
+                       env_set("partition", NULL);
                        use_defaults = 1;
 
                        mtdparts_init();
@@ -1967,7 +1967,7 @@ static int do_mtdparts(cmd_tbl_t *cmdtp, int flag, int argc,
                        /* this may be the first run, initialize lists if needed */
                        mtdparts_init();
 
-                       setenv("mtdparts", NULL);
+                       env_set("mtdparts", NULL);
 
                        /* mtd_devices_init() calls current_save() */
                        return mtd_devices_init();
index ea46e7b108608ce963283c09e79a5d288be30d64..a1997ac0d34416dfa4d82081bc7154ad0e0068f6 100644 (file)
@@ -98,7 +98,7 @@ static ulong get_load_addr(void)
        const char *addr_str;
        unsigned long addr;
 
-       addr_str = getenv("loadaddr");
+       addr_str = env_get("loadaddr");
        if (addr_str)
                addr = simple_strtoul(addr_str, NULL, 16);
        else
index a2152ec8260e0546a5a19dbfd9bec8d0201ac7a3..a22945d144b32b9a8f37f734b837ffb34ab81629 100644 (file)
@@ -305,9 +305,9 @@ static void nand_print_and_set_info(int idx)
        printf("  bbt options 0x%08x\n", chip->bbt_options);
 
        /* Set geometry info */
-       setenv_hex("nand_writesize", mtd->writesize);
-       setenv_hex("nand_oobsize", mtd->oobsize);
-       setenv_hex("nand_erasesize", mtd->erasesize);
+       env_set_hex("nand_writesize", mtd->writesize);
+       env_set_hex("nand_oobsize", mtd->oobsize);
+       env_set_hex("nand_erasesize", mtd->erasesize);
 }
 
 static int raw_access(struct mtd_info *mtd, ulong addr, loff_t off,
@@ -383,7 +383,7 @@ static int do_nand(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 #else
        int quiet = 0;
 #endif
-       const char *quiet_str = getenv("quiet");
+       const char *quiet_str = env_get("quiet");
        int dev = nand_curr_device;
        int repeat = flag & CMD_FLAG_REPEAT;
 
@@ -966,11 +966,11 @@ static int do_nandboot(cmd_tbl_t *cmdtp, int flag, int argc,
        switch (argc) {
        case 1:
                addr = CONFIG_SYS_LOAD_ADDR;
-               boot_device = getenv("bootdevice");
+               boot_device = env_get("bootdevice");
                break;
        case 2:
                addr = simple_strtoul(argv[1], NULL, 16);
-               boot_device = getenv("bootdevice");
+               boot_device = env_get("bootdevice");
                break;
        case 3:
                addr = simple_strtoul(argv[1], NULL, 16);
index 5e91d3ab8a19584bc404f8117518b5dbb20fbac5..d7c776aacf3d0745f5c9f0e34cf7958082a63896 100644 (file)
--- a/cmd/net.c
+++ b/cmd/net.c
@@ -116,23 +116,23 @@ static void netboot_update_env(void)
 
        if (net_gateway.s_addr) {
                ip_to_string(net_gateway, tmp);
-               setenv("gatewayip", tmp);
+               env_set("gatewayip", tmp);
        }
 
        if (net_netmask.s_addr) {
                ip_to_string(net_netmask, tmp);
-               setenv("netmask", tmp);
+               env_set("netmask", tmp);
        }
 
        if (net_hostname[0])
-               setenv("hostname", net_hostname);
+               env_set("hostname", net_hostname);
 
        if (net_root_path[0])
-               setenv("rootpath", net_root_path);
+               env_set("rootpath", net_root_path);
 
        if (net_ip.s_addr) {
                ip_to_string(net_ip, tmp);
-               setenv("ipaddr", tmp);
+               env_set("ipaddr", tmp);
        }
 #if !defined(CONFIG_BOOTP_SERVERIP)
        /*
@@ -141,32 +141,32 @@ static void netboot_update_env(void)
         */
        if (net_server_ip.s_addr) {
                ip_to_string(net_server_ip, tmp);
-               setenv("serverip", tmp);
+               env_set("serverip", tmp);
        }
 #endif
        if (net_dns_server.s_addr) {
                ip_to_string(net_dns_server, tmp);
-               setenv("dnsip", tmp);
+               env_set("dnsip", tmp);
        }
 #if defined(CONFIG_BOOTP_DNS2)
        if (net_dns_server2.s_addr) {
                ip_to_string(net_dns_server2, tmp);
-               setenv("dnsip2", tmp);
+               env_set("dnsip2", tmp);
        }
 #endif
        if (net_nis_domain[0])
-               setenv("domain", net_nis_domain);
+               env_set("domain", net_nis_domain);
 
 #if defined(CONFIG_CMD_SNTP) && defined(CONFIG_BOOTP_TIMEOFFSET)
        if (net_ntp_time_offset) {
                sprintf(tmp, "%d", net_ntp_time_offset);
-               setenv("timeoffset", tmp);
+               env_set("timeoffset", tmp);
        }
 #endif
 #if defined(CONFIG_CMD_SNTP) && defined(CONFIG_BOOTP_NTPSERVER)
        if (net_ntp_server.s_addr) {
                ip_to_string(net_ntp_server, tmp);
-               setenv("ntpserverip", tmp);
+               env_set("ntpserverip", tmp);
        }
 #endif
 }
@@ -181,7 +181,7 @@ static int netboot_common(enum proto_t proto, cmd_tbl_t *cmdtp, int argc,
        ulong addr;
 
        /* pre-set load_addr */
-       s = getenv("loadaddr");
+       s = env_get("loadaddr");
        if (s != NULL)
                load_addr = simple_strtoul(s, NULL, 16);
 
@@ -291,14 +291,14 @@ static void cdp_update_env(void)
                printf("CDP offered appliance VLAN %d\n",
                       ntohs(cdp_appliance_vlan));
                vlan_to_string(cdp_appliance_vlan, tmp);
-               setenv("vlan", tmp);
+               env_set("vlan", tmp);
                net_our_vlan = cdp_appliance_vlan;
        }
 
        if (cdp_native_vlan != htons(-1)) {
                printf("CDP offered native VLAN %d\n", ntohs(cdp_native_vlan));
                vlan_to_string(cdp_native_vlan, tmp);
-               setenv("nvlan", tmp);
+               env_set("nvlan", tmp);
                net_native_vlan = cdp_native_vlan;
        }
 }
@@ -331,7 +331,7 @@ int do_sntp(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
        char *toff;
 
        if (argc < 2) {
-               net_ntp_server = getenv_ip("ntpserverip");
+               net_ntp_server = env_get_ip("ntpserverip");
                if (net_ntp_server.s_addr == 0) {
                        printf("ntpserverip not set\n");
                        return CMD_RET_FAILURE;
@@ -344,7 +344,7 @@ int do_sntp(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
                }
        }
 
-       toff = getenv("timeoffset");
+       toff = env_get("timeoffset");
        if (toff == NULL)
                net_ntp_time_offset = 0;
        else
@@ -423,14 +423,14 @@ static int do_link_local(cmd_tbl_t *cmdtp, int flag, int argc,
 
        net_gateway.s_addr = 0;
        ip_to_string(net_gateway, tmp);
-       setenv("gatewayip", tmp);
+       env_set("gatewayip", tmp);
 
        ip_to_string(net_netmask, tmp);
-       setenv("netmask", tmp);
+       env_set("netmask", tmp);
 
        ip_to_string(net_ip, tmp);
-       setenv("ipaddr", tmp);
-       setenv("llipaddr", tmp); /* store this for next time */
+       env_set("ipaddr", tmp);
+       env_set("llipaddr", tmp); /* store this for next time */
 
        return CMD_RET_SUCCESS;
 }
index cd17db6409705a79d6102f45888a96e9770b50c4..4033d90c8e2dd043384b93ba005fd15e1e93447c 100644 (file)
@@ -283,7 +283,7 @@ static int _do_env_set(int flag, int argc, char * const argv[], int env_flag)
        return 0;
 }
 
-int setenv(const char *varname, const char *varvalue)
+int env_set(const char *varname, const char *varvalue)
 {
        const char * const argv[4] = { "setenv", varname, varvalue, NULL };
 
@@ -304,12 +304,12 @@ int setenv(const char *varname, const char *varvalue)
  * @param value                Value to set it to
  * @return 0 if ok, 1 on error
  */
-int setenv_ulong(const char *varname, ulong value)
+int env_set_ulong(const char *varname, ulong value)
 {
        /* TODO: this should be unsigned */
        char *str = simple_itoa(value);
 
-       return setenv(varname, str);
+       return env_set(varname, str);
 }
 
 /**
@@ -319,21 +319,21 @@ int setenv_ulong(const char *varname, ulong value)
  * @param value                Value to set it to
  * @return 0 if ok, 1 on error
  */
-int setenv_hex(const char *varname, ulong value)
+int env_set_hex(const char *varname, ulong value)
 {
        char str[17];
 
        sprintf(str, "%lx", value);
-       return setenv(varname, str);
+       return env_set(varname, str);
 }
 
-ulong getenv_hex(const char *varname, ulong default_val)
+ulong env_get_hex(const char *varname, ulong default_val)
 {
        const char *s;
        ulong value;
        char *endp;
 
-       s = getenv(varname);
+       s = env_get(varname);
        if (s)
                value = simple_strtoul(s, &endp, 16);
        if (!s || endp == s)
@@ -594,7 +594,7 @@ static int do_env_edit(cmd_tbl_t *cmdtp, int flag, int argc,
                return 1;
 
        /* Set read buffer to initial value or empty sting */
-       init_val = getenv(argv[1]);
+       init_val = env_get(argv[1]);
        if (init_val)
                snprintf(buffer, CONFIG_SYS_CBSIZE, "%s", init_val);
        else
@@ -622,7 +622,7 @@ static int do_env_edit(cmd_tbl_t *cmdtp, int flag, int argc,
  * return address of storage for that variable,
  * or NULL if not found
  */
-char *getenv(const char *name)
+char *env_get(const char *name)
 {
        if (gd->flags & GD_FLG_ENV_READY) { /* after import into hashtable */
                ENTRY e, *ep;
@@ -637,7 +637,7 @@ char *getenv(const char *name)
        }
 
        /* restricted capabilities before import */
-       if (getenv_f(name, (char *)(gd->env_buf), sizeof(gd->env_buf)) > 0)
+       if (env_get_f(name, (char *)(gd->env_buf), sizeof(gd->env_buf)) > 0)
                return (char *)(gd->env_buf);
 
        return NULL;
@@ -646,7 +646,7 @@ char *getenv(const char *name)
 /*
  * Look up variable from environment for restricted C runtime env.
  */
-int getenv_f(const char *name, char *buf, unsigned len)
+int env_get_f(const char *name, char *buf, unsigned len)
 {
        int i, nxt;
 
@@ -690,13 +690,13 @@ int getenv_f(const char *name, char *buf, unsigned len)
  *                     found
  * @return the decoded value, or default_val if not found
  */
-ulong getenv_ulong(const char *name, int base, ulong default_val)
+ulong env_get_ulong(const char *name, int base, ulong default_val)
 {
        /*
-        * We can use getenv() here, even before relocation, since the
+        * We can use env_get() here, even before relocation, since the
         * environment variable value is an integer and thus short.
         */
-       const char *str = getenv(name);
+       const char *str = env_get(name);
 
        return str ? simple_strtoul(str, NULL, base) : default_val;
 }
@@ -706,9 +706,11 @@ ulong getenv_ulong(const char *name, int base, ulong default_val)
 static int do_env_save(cmd_tbl_t *cmdtp, int flag, int argc,
                       char * const argv[])
 {
-       printf("Saving Environment to %s...\n", env_name_spec);
+       struct env_driver *env = env_driver_lookup_default();
 
-       return saveenv() ? 1 : 0;
+       printf("Saving Environment to %s...\n", env->name);
+
+       return env_save() ? 1 : 0;
 }
 
 U_BOOT_CMD(
@@ -929,7 +931,7 @@ NXTARG:             ;
                        return 1;
                }
                sprintf(buf, "%zX", (size_t)len);
-               setenv("filesize", buf);
+               env_set("filesize", buf);
 
                return 0;
        }
@@ -955,7 +957,7 @@ NXTARG:             ;
                envp->flags = ACTIVE_FLAG;
 #endif
        }
-       setenv_hex("filesize", len + offsetof(env_t, data));
+       env_set_hex("filesize", len + offsetof(env_t, data));
 
        return 0;
 
index 8ba05984e474921883462640b0b1479c5019251e..746bf40b2d0a8ad50c78b7d3e49d96ab7a074990 100644 (file)
@@ -38,7 +38,7 @@ static int do_part_uuid(int argc, char * const argv[])
                return 1;
 
        if (argc > 2)
-               setenv(argv[2], info.uuid);
+               env_set(argv[2], info.uuid);
        else
                printf("%s\n", info.uuid);
 
@@ -99,7 +99,7 @@ static int do_part_list(int argc, char * const argv[])
                        sprintf(t, "%s%x", str[0] ? " " : "", p);
                        strcat(str, t);
                }
-               setenv(var, str);
+               env_set(var, str);
                return 0;
        }
 
@@ -135,7 +135,7 @@ static int do_part_start(int argc, char * const argv[])
        snprintf(buf, sizeof(buf), LBAF, info.start);
 
        if (argc > 3)
-               setenv(argv[3], buf);
+               env_set(argv[3], buf);
        else
                printf("%s\n", buf);
 
@@ -169,7 +169,7 @@ static int do_part_size(int argc, char * const argv[])
        snprintf(buf, sizeof(buf), LBAF, info.size);
 
        if (argc > 3)
-               setenv(argv[3], buf);
+               env_set(argv[3], buf);
        else
                printf("%s\n", buf);
 
index 0a07f14ca8fa94a8e15097cd9b394fc7705344ae..c5a770a26995fabc5a1b3b0b7450997d29e110db 100644 (file)
--- a/cmd/pxe.c
+++ b/cmd/pxe.c
@@ -33,15 +33,15 @@ const char *pxe_default_paths[] = {
 static bool is_pxe;
 
 /*
- * Like getenv, but prints an error if envvar isn't defined in the
- * environment.  It always returns what getenv does, so it can be used in
- * place of getenv without changing error handling otherwise.
+ * Like env_get, but prints an error if envvar isn't defined in the
+ * environment.  It always returns what env_get does, so it can be used in
+ * place of env_get without changing error handling otherwise.
  */
 static char *from_env(const char *envvar)
 {
        char *ret;
 
-       ret = getenv(envvar);
+       ret = env_get(envvar);
 
        if (!ret)
                printf("missing environment variable: %s\n", envvar);
@@ -70,8 +70,7 @@ static int format_mac_pxe(char *outbuf, size_t outbuf_len)
                return -EINVAL;
        }
 
-       if (!eth_getenv_enetaddr_by_index("eth", eth_get_dev_index(),
-                                         ethaddr))
+       if (!eth_env_get_enetaddr_by_index("eth", eth_get_dev_index(), ethaddr))
                return -ENOENT;
 
        sprintf(outbuf, "01-%02x-%02x-%02x-%02x-%02x-%02x",
@@ -591,7 +590,7 @@ static int label_localboot(struct pxe_label *label)
                char bootargs[CONFIG_SYS_CBSIZE];
 
                cli_simple_process_macros(label->append, bootargs);
-               setenv("bootargs", bootargs);
+               env_set("bootargs", bootargs);
        }
 
        debug("running: %s\n", localcmd);
@@ -649,9 +648,9 @@ static int label_boot(cmd_tbl_t *cmdtp, struct pxe_label *label)
                }
 
                bootm_argv[2] = initrd_str;
-               strcpy(bootm_argv[2], getenv("ramdisk_addr_r"));
+               strcpy(bootm_argv[2], env_get("ramdisk_addr_r"));
                strcat(bootm_argv[2], ":");
-               strcat(bootm_argv[2], getenv("filesize"));
+               strcat(bootm_argv[2], env_get("filesize"));
        }
 
        if (get_relfile_envaddr(cmdtp, label->kernel, "kernel_addr_r") < 0) {
@@ -662,8 +661,8 @@ static int label_boot(cmd_tbl_t *cmdtp, struct pxe_label *label)
 
        if (label->ipappend & 0x1) {
                sprintf(ip_str, " ip=%s:%s:%s:%s",
-                       getenv("ipaddr"), getenv("serverip"),
-                       getenv("gatewayip"), getenv("netmask"));
+                       env_get("ipaddr"), env_get("serverip"),
+                       env_get("gatewayip"), env_get("netmask"));
        }
 
 #ifdef CONFIG_CMD_NET
@@ -695,11 +694,11 @@ static int label_boot(cmd_tbl_t *cmdtp, struct pxe_label *label)
                strcat(bootargs, mac_str);
 
                cli_simple_process_macros(bootargs, finalbootargs);
-               setenv("bootargs", finalbootargs);
+               env_set("bootargs", finalbootargs);
                printf("append: %s\n", finalbootargs);
        }
 
-       bootm_argv[1] = getenv("kernel_addr_r");
+       bootm_argv[1] = env_get("kernel_addr_r");
 
        /*
         * fdt usage is optional:
@@ -714,7 +713,7 @@ static int label_boot(cmd_tbl_t *cmdtp, struct pxe_label *label)
         *
         * Scenario 3: fdt blob is not available.
         */
-       bootm_argv[3] = getenv("fdt_addr_r");
+       bootm_argv[3] = env_get("fdt_addr_r");
 
        /* if fdt label is defined then get fdt from server */
        if (bootm_argv[3]) {
@@ -726,7 +725,7 @@ static int label_boot(cmd_tbl_t *cmdtp, struct pxe_label *label)
                } else if (label->fdtdir) {
                        char *f1, *f2, *f3, *f4, *slash;
 
-                       f1 = getenv("fdtfile");
+                       f1 = env_get("fdtfile");
                        if (f1) {
                                f2 = "";
                                f3 = "";
@@ -739,9 +738,9 @@ static int label_boot(cmd_tbl_t *cmdtp, struct pxe_label *label)
                                 * or the boot scripts should set $fdtfile
                                 * before invoking "pxe" or "sysboot".
                                 */
-                               f1 = getenv("soc");
+                               f1 = env_get("soc");
                                f2 = "-";
-                               f3 = getenv("board");
+                               f3 = env_get("board");
                                f4 = ".dtb";
                        }
 
@@ -781,7 +780,7 @@ static int label_boot(cmd_tbl_t *cmdtp, struct pxe_label *label)
        }
 
        if (!bootm_argv[3])
-               bootm_argv[3] = getenv("fdt_addr");
+               bootm_argv[3] = env_get("fdt_addr");
 
        if (bootm_argv[3]) {
                if (!bootm_argv[2])
@@ -1671,10 +1670,10 @@ static int do_sysboot(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
        }
 
        if (argc < 6)
-               filename = getenv("bootfile");
+               filename = env_get("bootfile");
        else {
                filename = argv[5];
-               setenv("bootfile", filename);
+               env_set("bootfile", filename);
        }
 
        if (strstr(argv[3], "ext2"))
index 12436ec9b4efcba1884a01c27894a65bc716c40d..b38026ba81b76fd8d1685137f0967c728d928fda 100644 (file)
--- a/cmd/qfw.c
+++ b/cmd/qfw.c
@@ -55,7 +55,7 @@ static int qemu_fwcfg_setup_kernel(void *load_addr, void *initrd_addr)
                 * when invoking qemu), do not update bootargs
                 */
                if (*data_addr != '\0') {
-                       if (setenv("bootargs", data_addr) < 0)
+                       if (env_set("bootargs", data_addr) < 0)
                                printf("warning: unable to change bootargs\n");
                }
        }
@@ -123,7 +123,7 @@ static int qemu_fwcfg_do_load(cmd_tbl_t *cmdtp, int flag,
        void *load_addr;
        void *initrd_addr;
 
-       env = getenv("loadaddr");
+       env = env_get("loadaddr");
        load_addr = env ?
                (void *)simple_strtoul(env, NULL, 16) :
 #ifdef CONFIG_LOADADDR
@@ -132,7 +132,7 @@ static int qemu_fwcfg_do_load(cmd_tbl_t *cmdtp, int flag,
                NULL;
 #endif
 
-       env = getenv("ramdiskaddr");
+       env = env_get("ramdiskaddr");
        initrd_addr = env ?
                (void *)simple_strtoul(env, NULL, 16) :
 #ifdef CONFIG_RAMDISK_ADDR
index 9c3e9e9e582be7e19d1dcc8106397867fce6ae66..e10c7b9ebad76b69f3fb2f4a661306684e5c27b2 100644 (file)
@@ -88,18 +88,18 @@ int do_reiserload (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 
        switch (argc) {
        case 3:
-               addr_str = getenv("loadaddr");
+               addr_str = env_get("loadaddr");
                if (addr_str != NULL) {
                        addr = simple_strtoul (addr_str, NULL, 16);
                } else {
                        addr = CONFIG_SYS_LOAD_ADDR;
                }
-               filename = getenv ("bootfile");
+               filename = env_get("bootfile");
                count = 0;
                break;
        case 4:
                addr = simple_strtoul (argv[3], NULL, 16);
-               filename = getenv ("bootfile");
+               filename = env_get("bootfile");
                count = 0;
                break;
        case 5:
@@ -157,7 +157,7 @@ int do_reiserload (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
        load_addr = addr;
 
        printf ("\n%ld bytes read\n", filelen);
-       setenv_hex("filesize", filelen);
+       env_set_hex("filesize", filelen);
 
        return filelen;
 }
index e7194fc4f4137a1652250c0de047200aed75469c..af210225f1438727e846a17ccaa88f60b10f0372 100644 (file)
@@ -145,7 +145,7 @@ static int regex_sub(const char *name,
        }
 
        if (t == NULL) {
-               value = getenv(name);
+               value = env_get(name);
 
                if (value == NULL) {
                        printf("## Error: variable \"%s\" not defined\n", name);
@@ -282,11 +282,11 @@ static int regex_sub(const char *name,
                if (!global)
                        break;
        }
-       debug("## FINAL (now setenv()) :  %s\n", data);
+       debug("## FINAL (now env_set()) :  %s\n", data);
 
        printf("%s=%s\n", name, data);
 
-       return setenv(name, data);
+       return env_set(name, data);
 }
 #endif
 
@@ -314,7 +314,7 @@ static int do_setexpr(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 
        /* plain assignment: "setexpr name value" */
        if (argc == 3) {
-               setenv_hex(argv[1], a);
+               env_set_hex(argv[1], a);
                return 0;
        }
 
@@ -370,7 +370,7 @@ static int do_setexpr(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
                return 1;
        }
 
-       setenv_hex(argv[1], value);
+       env_set_hex(argv[1], value);
 
        return 0;
 }
index 177f86bb54d946e9f32ab4e57460ae3403c778a6..a9831b6608581661c8f274abec93a283f679bc01 100644 (file)
@@ -40,7 +40,7 @@ source (ulong addr, const char *fit_uname)
        size_t          fit_len;
 #endif
 
-       verify = getenv_yesno ("verify");
+       verify = env_get_yesno("verify");
 
        buf = map_sysmem(addr, 0);
        switch (genimg_get_format(buf)) {
index 0c4bc73ca6455d62d47b046c32401a3204e4e58a..d9b433582c1a4cad5dfb401b230e6861fed6256d 100644 (file)
--- a/cmd/tpm.c
+++ b/cmd/tpm.c
@@ -231,7 +231,7 @@ static int type_string_write_vars(const char *type_str, uint8_t *data,
                default:
                        return -1;
                }
-               if (setenv_ulong(*vars, value))
+               if (env_set_ulong(*vars, value))
                        return -1;
        }
 
@@ -624,7 +624,7 @@ static int do_tpm_load_key_by_sha1(cmd_tbl_t *cmdtp, int flag, int argc, char *
                                 &key_handle);
        if (!err) {
                printf("Key handle is 0x%x\n", key_handle);
-               setenv_hex("key_handle", key_handle);
+               env_set_hex("key_handle", key_handle);
        }
 
        return report_return_code(err);
index 1a6d8c304746214689a6edbb5891593e6a6c82a3..a0a7dd1995983445da4bd82ad0b2cbf5d63a355b 100644 (file)
@@ -16,10 +16,10 @@ static int get_args(int argc, char * const argv[], char **buff,
        if (argc < 2)
                return -1;
        if (argc < 4) {
-               *buff_size = getenv_ulong("profsize", 16, 0);
-               *buff = map_sysmem(getenv_ulong("profbase", 16, 0),
+               *buff_size = env_get_ulong("profsize", 16, 0);
+               *buff = map_sysmem(env_get_ulong("profbase", 16, 0),
                                   *buff_size);
-               *buff_ptr = getenv_ulong("profoffset", 16, 0);
+               *buff_ptr = env_get_ulong("profoffset", 16, 0);
        } else {
                *buff_size = simple_strtoul(argv[3], NULL, 16);
                *buff = map_sysmem(simple_strtoul(argv[2], NULL, 16),
@@ -46,9 +46,9 @@ static int create_func_list(int argc, char * const argv[])
        used = min(avail, (size_t)needed);
        printf("Function trace dumped to %08lx, size %#zx\n",
               (ulong)map_to_sysmem(buff + buff_ptr), used);
-       setenv_hex("profbase", map_to_sysmem(buff));
-       setenv_hex("profsize", buff_size);
-       setenv_hex("profoffset", buff_ptr + used);
+       env_set_hex("profbase", map_to_sysmem(buff));
+       env_set_hex("profsize", buff_size);
+       env_set_hex("profoffset", buff_ptr + used);
 
        return 0;
 }
@@ -71,9 +71,9 @@ static int create_call_list(int argc, char * const argv[])
        printf("Call list dumped to %08lx, size %#zx\n",
               (ulong)map_to_sysmem(buff + buff_ptr), used);
 
-       setenv_hex("profbase", map_to_sysmem(buff));
-       setenv_hex("profsize", buff_size);
-       setenv_hex("profoffset", buff_ptr + used);
+       env_set_hex("profbase", map_to_sysmem(buff));
+       env_set_hex("profsize", buff_size);
+       env_set_hex("profoffset", buff_ptr + used);
 
        return 0;
 }
index a8bcb1f529d2e60df610d44d9c3a6dbc498ce3f0..94f883f92a356cc7ff774192075ef0a7709de171 100644 (file)
@@ -29,7 +29,7 @@ static int do_unzip(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
                return 1;
 
        printf("Uncompressed size: %ld = 0x%lX\n", src_len, src_len);
-       setenv_hex("filesize", src_len);
+       env_set_hex("filesize", src_len);
 
        return 0;
 }
index d033c15b629cf2a88823bde658110dde23da2903..21b5c377218331012e39e10be13ec74a324cc00b 100644 (file)
@@ -52,7 +52,7 @@ do_imgextract(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
 #endif
        uint8_t         comp;
 
-       verify = getenv_yesno("verify");
+       verify = env_get_yesno("verify");
 
        if (argc > 1) {
                addr = simple_strtoul(argv[1], NULL, 16);
@@ -251,8 +251,8 @@ do_imgextract(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
 
        flush_cache(dest, len);
 
-       setenv_hex("fileaddr", data);
-       setenv_hex("filesize", len);
+       env_set_hex("fileaddr", data);
+       env_set_hex("filesize", len);
 
        return 0;
 }
index 3ed9912d19bd4d43a310233ff87e30a24917fcf9..6913043d7f408c61a11d216b6ccfedc85c63a53a 100644 (file)
--- a/cmd/zfs.c
+++ b/cmd/zfs.c
@@ -51,10 +51,10 @@ static int do_zfs_load(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]
 
        count = 0;
        addr = simple_strtoul(argv[3], NULL, 16);
-       filename = getenv("bootfile");
+       filename = env_get("bootfile");
        switch (argc) {
        case 3:
-               addr_str = getenv("loadaddr");
+               addr_str = env_get("loadaddr");
                if (addr_str != NULL)
                        addr = simple_strtoul(addr_str, NULL, 16);
                else
@@ -115,7 +115,7 @@ static int do_zfs_load(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]
        load_addr = addr;
 
        printf("%llu bytes read\n", zfile.size);
-       setenv_hex("filesize", zfile.size);
+       env_set_hex("filesize", zfile.size);
 
        return 0;
 }
index 7fcd9d5bf8731f1aa9ddd10185994b1ca09e2768..dac7527721861dfbf45c736304141d7236b3b632 100644 (file)
--- a/cmd/zip.c
+++ b/cmd/zip.c
@@ -30,7 +30,7 @@ static int do_zip(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
                return 1;
 
        printf("Compressed size: %ld = 0x%lX\n", dst_len, dst_len);
-       setenv_hex("filesize", dst_len);
+       env_set_hex("filesize", dst_len);
 
        return 0;
 }
index 3ef1ab0de3d04dc215318354ee9f6f41623360c3..4d8cae96109ad4e1d04dd385d469a37129a8023a 100644 (file)
@@ -174,448 +174,6 @@ config SPI_BOOT
 
 endmenu
 
-menu "Environment"
-
-config ENV_IS_IN_DATAFLASH
-       bool "Environment in dataflash"
-       depends on !CHAIN_OF_TRUST
-       help
-         Define this if you have a DataFlash memory device which you
-         want to use for the environment.
-
-         - CONFIG_ENV_OFFSET:
-         - CONFIG_ENV_ADDR:
-         - CONFIG_ENV_SIZE:
-
-         These three #defines specify the offset and size of the
-         environment area within the total memory of your DataFlash placed
-         at the specified address.
-
-config ENV_IS_IN_EEPROM
-       bool "Environment in EEPROM"
-       depends on !CHAIN_OF_TRUST
-       help
-         Use this if you have an EEPROM or similar serial access
-         device and a driver for it.
-
-         - CONFIG_ENV_OFFSET:
-         - CONFIG_ENV_SIZE:
-
-         These two #defines specify the offset and size of the
-         environment area within the total memory of your EEPROM.
-
-         - CONFIG_SYS_I2C_EEPROM_ADDR:
-         If defined, specified the chip address of the EEPROM device.
-         The default address is zero.
-
-         - CONFIG_SYS_I2C_EEPROM_BUS:
-         If defined, specified the i2c bus of the EEPROM device.
-
-         - CONFIG_SYS_EEPROM_PAGE_WRITE_BITS:
-         If defined, the number of bits used to address bytes in a
-         single page in the EEPROM device.  A 64 byte page, for example
-         would require six bits.
-
-         - CONFIG_SYS_EEPROM_PAGE_WRITE_DELAY_MS:
-         If defined, the number of milliseconds to delay between
-         page writes.  The default is zero milliseconds.
-
-         - CONFIG_SYS_I2C_EEPROM_ADDR_LEN:
-         The length in bytes of the EEPROM memory array address.  Note
-         that this is NOT the chip address length!
-
-         - CONFIG_SYS_I2C_EEPROM_ADDR_OVERFLOW:
-         EEPROM chips that implement "address overflow" are ones
-         like Catalyst 24WC04/08/16 which has 9/10/11 bits of
-         address and the extra bits end up in the "chip address" bit
-         slots. This makes a 24WC08 (1Kbyte) chip look like four 256
-         byte chips.
-
-         Note that we consider the length of the address field to
-         still be one byte because the extra address bits are hidden
-         in the chip address.
-
-         - CONFIG_SYS_EEPROM_SIZE:
-         The size in bytes of the EEPROM device.
-
-         - CONFIG_ENV_EEPROM_IS_ON_I2C
-         define this, if you have I2C and SPI activated, and your
-         EEPROM, which holds the environment, is on the I2C bus.
-
-         - CONFIG_I2C_ENV_EEPROM_BUS
-         if you have an Environment on an EEPROM reached over
-         I2C muxes, you can define here, how to reach this
-         EEPROM. For example:
-
-         #define CONFIG_I2C_ENV_EEPROM_BUS       1
-
-         EEPROM which holds the environment, is reached over
-         a pca9547 i2c mux with address 0x70, channel 3.
-
-config ENV_IS_IN_FAT
-       bool "Environment is in a FAT filesystem"
-       depends on !CHAIN_OF_TRUST
-       select FAT_WRITE
-       help
-         Define this if you want to use the FAT file system for the environment.
-
-
-         - CONFIG_FAT_WRITE:
-         This must be enabled. Otherwise it cannot save the environment file.
-
-config ENV_IS_IN_FLASH
-       bool "Environment in flash memory"
-       depends on !CHAIN_OF_TRUST
-       help
-         Define this if you have a flash device which you want to use for the
-         environment.
-
-         a) The environment occupies one whole flash sector, which is
-          "embedded" in the text segment with the U-Boot code. This
-          happens usually with "bottom boot sector" or "top boot
-          sector" type flash chips, which have several smaller
-          sectors at the start or the end. For instance, such a
-          layout can have sector sizes of 8, 2x4, 16, Nx32 kB. In
-          such a case you would place the environment in one of the
-          4 kB sectors - with U-Boot code before and after it. With
-          "top boot sector" type flash chips, you would put the
-          environment in one of the last sectors, leaving a gap
-          between U-Boot and the environment.
-
-         CONFIG_ENV_OFFSET:
-
-          Offset of environment data (variable area) to the
-          beginning of flash memory; for instance, with bottom boot
-          type flash chips the second sector can be used: the offset
-          for this sector is given here.
-
-          CONFIG_ENV_OFFSET is used relative to CONFIG_SYS_FLASH_BASE.
-
-         CONFIG_ENV_ADDR:
-
-          This is just another way to specify the start address of
-          the flash sector containing the environment (instead of
-          CONFIG_ENV_OFFSET).
-
-         CONFIG_ENV_SECT_SIZE:
-
-          Size of the sector containing the environment.
-
-
-         b) Sometimes flash chips have few, equal sized, BIG sectors.
-          In such a case you don't want to spend a whole sector for
-          the environment.
-
-         CONFIG_ENV_SIZE:
-
-          If you use this in combination with CONFIG_ENV_IS_IN_FLASH
-          and CONFIG_ENV_SECT_SIZE, you can specify to use only a part
-          of this flash sector for the environment. This saves
-          memory for the RAM copy of the environment.
-
-          It may also save flash memory if you decide to use this
-          when your environment is "embedded" within U-Boot code,
-          since then the remainder of the flash sector could be used
-          for U-Boot code. It should be pointed out that this is
-          STRONGLY DISCOURAGED from a robustness point of view:
-          updating the environment in flash makes it always
-          necessary to erase the WHOLE sector. If something goes
-          wrong before the contents has been restored from a copy in
-          RAM, your target system will be dead.
-
-         CONFIG_ENV_ADDR_REDUND
-         CONFIG_ENV_SIZE_REDUND
-
-          These settings describe a second storage area used to hold
-          a redundant copy of the environment data, so that there is
-          a valid backup copy in case there is a power failure during
-          a "saveenv" operation.
-
-         BE CAREFUL! Any changes to the flash layout, and some changes to the
-         source code will make it necessary to adapt <board>/u-boot.lds*
-         accordingly!
-
-config ENV_IS_IN_MMC
-       bool "Environment in an MMC device"
-       depends on !CHAIN_OF_TRUST
-       default y if ARCH_SUNXI
-       help
-         Define this if you have an MMC device which you want to use for the
-         environment.
-
-         CONFIG_SYS_MMC_ENV_DEV:
-
-         Specifies which MMC device the environment is stored in.
-
-         CONFIG_SYS_MMC_ENV_PART (optional):
-
-         Specifies which MMC partition the environment is stored in. If not
-         set, defaults to partition 0, the user area. Common values might be
-         1 (first MMC boot partition), 2 (second MMC boot partition).
-
-         CONFIG_ENV_OFFSET:
-         CONFIG_ENV_SIZE:
-
-         These two #defines specify the offset and size of the environment
-         area within the specified MMC device.
-
-         If offset is positive (the usual case), it is treated as relative to
-         the start of the MMC partition. If offset is negative, it is treated
-         as relative to the end of the MMC partition. This can be useful if
-         your board may be fitted with different MMC devices, which have
-         different sizes for the MMC partitions, and you always want the
-         environment placed at the very end of the partition, to leave the
-         maximum possible space before it, to store other data.
-
-         These two values are in units of bytes, but must be aligned to an
-         MMC sector boundary.
-
-         CONFIG_ENV_OFFSET_REDUND (optional):
-
-         Specifies a second storage area, of CONFIG_ENV_SIZE size, used to
-         hold a redundant copy of the environment data. This provides a
-         valid backup copy in case the other copy is corrupted, e.g. due
-         to a power failure during a "saveenv" operation.
-
-         This value may also be positive or negative; this is handled in the
-         same way as CONFIG_ENV_OFFSET.
-
-         This value is also in units of bytes, but must also be aligned to
-         an MMC sector boundary.
-
-         CONFIG_ENV_SIZE_REDUND (optional):
-
-         This value need not be set, even when CONFIG_ENV_OFFSET_REDUND is
-         set. If this value is set, it must be set to the same value as
-         CONFIG_ENV_SIZE.
-
-config ENV_IS_IN_NAND
-       bool "Environment in a NAND device"
-       depends on !CHAIN_OF_TRUST
-       help
-         Define this if you have a NAND device which you want to use for the
-         environment.
-
-         - CONFIG_ENV_OFFSET:
-         - CONFIG_ENV_SIZE:
-
-         These two #defines specify the offset and size of the environment
-         area within the first NAND device.  CONFIG_ENV_OFFSET must be
-         aligned to an erase block boundary.
-
-         - CONFIG_ENV_OFFSET_REDUND (optional):
-
-         This setting describes a second storage area of CONFIG_ENV_SIZE
-         size used to hold a redundant copy of the environment data, so
-         that there is a valid backup copy in case there is a power failure
-         during a "saveenv" operation.  CONFIG_ENV_OFFSET_REDUND must be
-         aligned to an erase block boundary.
-
-         - CONFIG_ENV_RANGE (optional):
-
-         Specifies the length of the region in which the environment
-         can be written.  This should be a multiple of the NAND device's
-         block size.  Specifying a range with more erase blocks than
-         are needed to hold CONFIG_ENV_SIZE allows bad blocks within
-         the range to be avoided.
-
-         - CONFIG_ENV_OFFSET_OOB (optional):
-
-         Enables support for dynamically retrieving the offset of the
-         environment from block zero's out-of-band data.  The
-         "nand env.oob" command can be used to record this offset.
-         Currently, CONFIG_ENV_OFFSET_REDUND is not supported when
-         using CONFIG_ENV_OFFSET_OOB.
-
-config ENV_IS_IN_NVRAM
-       bool "Environment in a non-volatile RAM"
-       depends on !CHAIN_OF_TRUST
-       help
-         Define this if you have some non-volatile memory device
-         (NVRAM, battery buffered SRAM) which you want to use for the
-         environment.
-
-         - CONFIG_ENV_ADDR:
-         - CONFIG_ENV_SIZE:
-
-         These two #defines are used to determine the memory area you
-         want to use for environment. It is assumed that this memory
-         can just be read and written to, without any special
-         provision.
-
-config ENV_IS_IN_ONENAND
-       bool "Environment is in OneNAND"
-       depends on !CHAIN_OF_TRUST
-       help
-         Define this if you want to put your local device's environment in
-         OneNAND.
-
-         - CONFIG_ENV_ADDR:
-         - CONFIG_ENV_SIZE:
-
-         These two #defines are used to determine the device range you
-         want to use for environment. It is assumed that this memory
-         can just be read and written to, without any special
-         provision.
-
-config ENV_IS_IN_REMOTE
-       bool "Environment is in remove memory space"
-       depends on !CHAIN_OF_TRUST
-       help
-         Define this if you have a remote memory space which you
-         want to use for the local device's environment.
-
-         - CONFIG_ENV_ADDR:
-         - CONFIG_ENV_SIZE:
-
-         These two #defines specify the address and size of the
-         environment area within the remote memory space. The
-         local device can get the environment from remote memory
-         space by SRIO or PCIE links.
-
-config ENV_IS_IN_SPI_FLASH
-       bool "Environment is in SPI flash"
-       depends on !CHAIN_OF_TRUST
-       help
-         Define this if you have a SPI Flash memory device which you
-         want to use for the environment.
-
-         - CONFIG_ENV_OFFSET:
-         - CONFIG_ENV_SIZE:
-
-         These two #defines specify the offset and size of the
-         environment area within the SPI Flash. CONFIG_ENV_OFFSET must be
-         aligned to an erase sector boundary.
-
-         - CONFIG_ENV_SECT_SIZE:
-
-         Define the SPI flash's sector size.
-
-         - CONFIG_ENV_OFFSET_REDUND (optional):
-
-         This setting describes a second storage area of CONFIG_ENV_SIZE
-         size used to hold a redundant copy of the environment data, so
-         that there is a valid backup copy in case there is a power failure
-         during a "saveenv" operation. CONFIG_ENV_OFFSET_REDUND must be
-         aligned to an erase sector boundary.
-
-         - CONFIG_ENV_SPI_BUS (optional):
-         - CONFIG_ENV_SPI_CS (optional):
-
-         Define the SPI bus and chip select. If not defined they will be 0.
-
-         - CONFIG_ENV_SPI_MAX_HZ (optional):
-
-         Define the SPI max work clock. If not defined then use 1MHz.
-
-         - CONFIG_ENV_SPI_MODE (optional):
-
-         Define the SPI work mode. If not defined then use SPI_MODE_3.
-
-config ENV_IS_IN_UBI
-       bool "Environment in a UBI volume"
-       depends on !CHAIN_OF_TRUST
-       help
-         Define this if you have an UBI volume that you want to use for the
-         environment.  This has the benefit of wear-leveling the environment
-         accesses, which is important on NAND.
-
-         - CONFIG_ENV_UBI_PART:
-
-         Define this to a string that is the mtd partition containing the UBI.
-
-         - CONFIG_ENV_UBI_VOLUME:
-
-         Define this to the name of the volume that you want to store the
-         environment in.
-
-         - CONFIG_ENV_UBI_VOLUME_REDUND:
-
-         Define this to the name of another volume to store a second copy of
-         the environment in.  This will enable redundant environments in UBI.
-         It is assumed that both volumes are in the same MTD partition.
-
-         - CONFIG_UBI_SILENCE_MSG
-         - CONFIG_UBIFS_SILENCE_MSG
-
-         You will probably want to define these to avoid a really noisy system
-         when storing the env in UBI.
-
-config ENV_IS_NOWHERE
-       bool "Environment is not stored"
-       help
-         Define this if you don't want to or can't have an environment stored
-         on a storage medium
-
-config ENV_FAT_INTERFACE
-       string "Name of the block device for the environment"
-       depends on ENV_IS_IN_FAT
-       default "mmc" if TI_COMMON_CMD_OPTIONS || ARCH_ZYNQMP || ARCH_AT91
-       help
-         Define this to a string that is the name of the block device.
-
-config ENV_FAT_DEVICE_AND_PART
-       string "Device and partition for where to store the environemt in FAT"
-       depends on ENV_IS_IN_FAT
-       default "0:1" if TI_COMMON_CMD_OPTIONS
-       default "0:auto" if ARCH_ZYNQMP
-       default "0" if ARCH_AT91
-       help
-         Define this to a string to specify the partition of the device. It can
-         be as following:
-
-           "D:P", "D:0", "D", "D:" or "D:auto" (D, P are integers. And P >= 1)
-              - "D:P": device D partition P. Error occurs if device D has no
-                       partition table.
-              - "D:0": device D.
-              - "D" or "D:": device D partition 1 if device D has partition
-                             table, or the whole device D if has no partition
-                             table.
-              - "D:auto": first partition in device D with bootable flag set.
-                          If none, first valid partition in device D. If no
-                          partition table then means device D.
-
-config ENV_FAT_FILE
-       string "Name of the FAT file to use for the environemnt"
-       depends on ENV_IS_IN_FAT
-       default "uboot.env"
-       help
-         It's a string of the FAT file name. This file use to store the
-         environment.
-
-if ARCH_SUNXI
-
-config ENV_OFFSET
-       hex "Environment Offset"
-       depends on !ENV_IS_IN_UBI
-       depends on !ENV_IS_NOWHERE
-       default 0x88000 if ARCH_SUNXI
-       help
-         Offset from the start of the device (or partition)
-
-config ENV_SIZE
-       hex "Environment Size"
-       depends on !ENV_IS_NOWHERE
-       default 0x20000 if ARCH_SUNXI
-       help
-         Size of the environment storage area
-
-config ENV_UBI_PART
-       string "UBI partition name"
-       depends on ENV_IS_IN_UBI
-       help
-         MTD partition containing the UBI device
-
-config ENV_UBI_VOLUME
-       string "UBI volume name"
-       depends on ENV_IS_IN_UBI
-       help
-         Name of the volume that you want to store the environment in.
-
-endif
-
-endmenu
-
 config BOOTDELAY
        int "delay in seconds before automatically booting"
        default 2
index 3ee7a6b18b9d08d2611d99f9204d8567a1c4f3f5..1b56cf9a70fc49e1fb039ee1d485319cc0d9f3ad 100644 (file)
@@ -19,7 +19,7 @@ ifdef CONFIG_BOOT_RETRY_TIME
 obj-y += bootretry.o
 endif
 
-# boards
+# boards
 obj-y += board_f.o
 obj-y += board_r.o
 obj-$(CONFIG_DISPLAY_BOARDINFO) += board_info.o
@@ -29,29 +29,6 @@ obj-$(CONFIG_CMD_BOOTM) += bootm.o bootm_os.o
 obj-$(CONFIG_CMD_BOOTZ) += bootm.o bootm_os.o
 obj-$(CONFIG_CMD_BOOTI) += bootm.o bootm_os.o
 
-# environment
-obj-y += env_attr.o
-obj-y += env_callback.o
-obj-y += env_flags.o
-obj-$(CONFIG_ENV_IS_IN_DATAFLASH) += env_dataflash.o
-obj-$(CONFIG_ENV_IS_IN_EEPROM) += env_eeprom.o
-extra-$(CONFIG_ENV_IS_EMBEDDED) += env_embedded.o
-obj-$(CONFIG_ENV_IS_IN_EEPROM) += env_embedded.o
-extra-$(CONFIG_ENV_IS_IN_FLASH) += env_embedded.o
-obj-$(CONFIG_ENV_IS_IN_NVRAM) += env_embedded.o
-obj-$(CONFIG_ENV_IS_IN_FLASH) += env_flash.o
-obj-$(CONFIG_ENV_IS_IN_MMC) += env_mmc.o
-obj-$(CONFIG_ENV_IS_IN_FAT) += env_fat.o
-obj-$(CONFIG_ENV_IS_IN_EXT4) += env_ext4.o
-obj-$(CONFIG_ENV_IS_IN_NAND) += env_nand.o
-obj-$(CONFIG_ENV_IS_IN_NVRAM) += env_nvram.o
-obj-$(CONFIG_ENV_IS_IN_ONENAND) += env_onenand.o
-obj-$(CONFIG_ENV_IS_IN_SATA) += env_sata.o
-obj-$(CONFIG_ENV_IS_IN_SPI_FLASH) += env_sf.o
-obj-$(CONFIG_ENV_IS_IN_REMOTE) += env_remote.o
-obj-$(CONFIG_ENV_IS_IN_UBI) += env_ubi.o
-obj-$(CONFIG_ENV_IS_NOWHERE) += env_nowhere.o
-
 obj-$(CONFIG_CMD_BEDBUG) += bedbug.o
 obj-$(CONFIG_$(SPL_TPL_)OF_LIBFDT) += fdt_support.o
 
@@ -92,7 +69,6 @@ ifdef CONFIG_SPL_BUILD
 obj-$(CONFIG_SPL_DFU_SUPPORT) += dfu.o
 obj-$(CONFIG_SPL_DFU_SUPPORT) += cli_hush.o
 obj-$(CONFIG_SPL_HASH_SUPPORT) += hash.o
-obj-$(CONFIG_ENV_IS_IN_FLASH) += env_flash.o
 obj-$(CONFIG_SPL_YMODEM_SUPPORT) += xyzModem.o
 obj-$(CONFIG_SPL_LOAD_FIT) += common_fit.o
 obj-$(CONFIG_SPL_NET_SUPPORT) += miiphyutil.o
@@ -101,28 +77,7 @@ ifdef CONFIG_SPL_USB_HOST_SUPPORT
 obj-$(CONFIG_SPL_USB_SUPPORT) += usb.o usb_hub.o
 obj-$(CONFIG_USB_STORAGE) += usb_storage.o
 endif
-# environment
-ifdef CONFIG_TPL_BUILD
-obj-$(CONFIG_TPL_ENV_SUPPORT) += env_attr.o
-obj-$(CONFIG_TPL_ENV_SUPPORT) += env_flags.o
-obj-$(CONFIG_TPL_ENV_SUPPORT) += env_callback.o
-else
-obj-$(CONFIG_SPL_ENV_SUPPORT) += env_attr.o
-obj-$(CONFIG_SPL_ENV_SUPPORT) += env_flags.o
-obj-$(CONFIG_SPL_ENV_SUPPORT) += env_callback.o
-endif
-ifneq ($(CONFIG_TPL_ENV_SUPPORT)$(CONFIG_SPL_ENV_SUPPORT),)
-obj-$(CONFIG_ENV_IS_NOWHERE) += env_nowhere.o
-obj-$(CONFIG_ENV_IS_IN_MMC) += env_mmc.o
-obj-$(CONFIG_ENV_IS_IN_FAT) += env_fat.o
-obj-$(CONFIG_ENV_IS_IN_EXT4) += env_ext4.o
-obj-$(CONFIG_ENV_IS_IN_NAND) += env_nand.o
-obj-$(CONFIG_ENV_IS_IN_SPI_FLASH) += env_sf.o
-obj-$(CONFIG_ENV_IS_IN_FLASH) += env_flash.o
-endif
 endif
-#environment
-obj-y += env_common.o
 #others
 obj-$(CONFIG_DDR_SPD) += ddr_spd.o
 obj-$(CONFIG_SPD_EEPROM) += ddr_spd.o
@@ -175,5 +130,3 @@ obj-$(CONFIG_CMD_DFU) += dfu.o
 obj-y += command.o
 obj-y += s_record.o
 obj-y += xyzModem.o
-
-CFLAGS_env_embedded.o := -Wa,--no-warn -DENV_CRC=$(shell tools/envcrc 2>/dev/null)
index c52bad84a4d0b8f89170ad0735379ea2c8034a23..a0118650287e08e12e979dffc3367acdb8bfc01c 100644 (file)
@@ -50,7 +50,7 @@ static int slow_equals(u8 *a, u8 *b, int len)
 
 static int passwd_abort(uint64_t etime)
 {
-       const char *sha_env_str = getenv("bootstopkeysha256");
+       const char *sha_env_str = env_get("bootstopkeysha256");
        u8 sha_env[SHA256_SUM_LEN];
        u8 sha[SHA256_SUM_LEN];
        char presskey[MAX_DELAY_STOP_STR];
@@ -109,8 +109,8 @@ static int passwd_abort(uint64_t etime)
                int retry;
        }
        delaykey[] = {
-               { .str = getenv("bootdelaykey"),  .retry = 1 },
-               { .str = getenv("bootstopkey"),   .retry = 0 },
+               { .str = env_get("bootdelaykey"),  .retry = 1 },
+               { .str = env_get("bootstopkey"),   .retry = 0 },
        };
 
        char presskey[MAX_DELAY_STOP_STR];
@@ -278,12 +278,12 @@ static void process_fdt_options(const void *blob)
        /* Add an env variable to point to a kernel payload, if available */
        addr = fdtdec_get_config_int(gd->fdt_blob, "kernel-offset", 0);
        if (addr)
-               setenv_addr("kernaddr", (void *)(CONFIG_SYS_TEXT_BASE + addr));
+               env_set_addr("kernaddr", (void *)(CONFIG_SYS_TEXT_BASE + addr));
 
        /* Add an env variable to point to a root disk, if available */
        addr = fdtdec_get_config_int(gd->fdt_blob, "rootdisk-offset", 0);
        if (addr)
-               setenv_addr("rootaddr", (void *)(CONFIG_SYS_TEXT_BASE + addr));
+               env_set_addr("rootaddr", (void *)(CONFIG_SYS_TEXT_BASE + addr));
 #endif /* CONFIG_OF_CONTROL && CONFIG_SYS_TEXT_BASE */
 }
 
@@ -300,11 +300,11 @@ const char *bootdelay_process(void)
        bootcount = bootcount_load();
        bootcount++;
        bootcount_store(bootcount);
-       setenv_ulong("bootcount", bootcount);
-       bootlimit = getenv_ulong("bootlimit", 10, 0);
+       env_set_ulong("bootcount", bootcount);
+       bootlimit = env_get_ulong("bootlimit", 10, 0);
 #endif /* CONFIG_BOOTCOUNT_LIMIT */
 
-       s = getenv("bootdelay");
+       s = env_get("bootdelay");
        bootdelay = s ? (int)simple_strtol(s, NULL, 10) : CONFIG_BOOTDELAY;
 
 #ifdef CONFIG_OF_CONTROL
@@ -321,17 +321,17 @@ const char *bootdelay_process(void)
 
 #ifdef CONFIG_POST
        if (gd->flags & GD_FLG_POSTFAIL) {
-               s = getenv("failbootcmd");
+               s = env_get("failbootcmd");
        } else
 #endif /* CONFIG_POST */
 #ifdef CONFIG_BOOTCOUNT_LIMIT
        if (bootlimit && (bootcount > bootlimit)) {
                printf("Warning: Bootlimit (%u) exceeded. Using altbootcmd.\n",
                       (unsigned)bootlimit);
-               s = getenv("altbootcmd");
+               s = env_get("altbootcmd");
        } else
 #endif /* CONFIG_BOOTCOUNT_LIMIT */
-               s = getenv("bootcmd");
+               s = env_get("bootcmd");
 
        process_fdt_options(gd->fdt_blob);
        stored_bootdelay = bootdelay;
@@ -357,7 +357,7 @@ void autoboot_command(const char *s)
 
 #ifdef CONFIG_MENUKEY
        if (menukey == CONFIG_MENUKEY) {
-               s = getenv("menucmd");
+               s = env_get("menucmd");
                if (s)
                        run_command_list(s, -1, 0);
        }
index 5915e500ae8532ebfda77ce2f33abfec709dea4a..de5f398a0b9f2ba0f918089b9e78a85df3db1304 100644 (file)
@@ -118,7 +118,7 @@ __weak void board_add_ram_info(int use_default)
 
 static int init_baud_rate(void)
 {
-       gd->baudrate = getenv_ulong("baudrate", 10, CONFIG_BAUDRATE);
+       gd->baudrate = env_get_ulong("baudrate", 10, CONFIG_BAUDRATE);
        return 0;
 }
 
@@ -324,7 +324,7 @@ static int reserve_pram(void)
 {
        ulong reg;
 
-       reg = getenv_ulong("pram", 10, CONFIG_PRAM);
+       reg = env_get_ulong("pram", 10, CONFIG_PRAM);
        gd->relocaddr -= (reg << 10);           /* size is in kB */
        debug("Reserving %ldk for protected RAM at %08lx\n", reg,
              gd->relocaddr);
index 985aa95c2aea2c664169d5acf453d0f557e663b1..94697e7bc104185b586e24c91bfecdd2b0d883a9 100644 (file)
@@ -372,7 +372,7 @@ static int initr_flash(void)
        *
        * NOTE: Maybe we should add some WATCHDOG_RESET()? XXX
        */
-       if (getenv_yesno("flashchecksum") == 1) {
+       if (env_get_yesno("flashchecksum") == 1) {
                printf("  CRC: %08X", crc32(0,
                        (const unsigned char *) CONFIG_SYS_FLASH_BASE,
                        flash_size));
@@ -486,11 +486,11 @@ static int initr_env(void)
        else
                set_default_env(NULL);
 #ifdef CONFIG_OF_CONTROL
-       setenv_addr("fdtcontroladdr", gd->fdt_blob);
+       env_set_addr("fdtcontroladdr", gd->fdt_blob);
 #endif
 
        /* Initialize from environment */
-       load_addr = getenv_ulong("loadaddr", 16, load_addr);
+       load_addr = env_get_ulong("loadaddr", 16, load_addr);
 
        return 0;
 }
@@ -537,21 +537,21 @@ static int initr_ethaddr(void)
        bd_t *bd = gd->bd;
 
        /* kept around for legacy kernels only ... ignore the next section */
-       eth_getenv_enetaddr("ethaddr", bd->bi_enetaddr);
+       eth_env_get_enetaddr("ethaddr", bd->bi_enetaddr);
 #ifdef CONFIG_HAS_ETH1
-       eth_getenv_enetaddr("eth1addr", bd->bi_enet1addr);
+       eth_env_get_enetaddr("eth1addr", bd->bi_enet1addr);
 #endif
 #ifdef CONFIG_HAS_ETH2
-       eth_getenv_enetaddr("eth2addr", bd->bi_enet2addr);
+       eth_env_get_enetaddr("eth2addr", bd->bi_enet2addr);
 #endif
 #ifdef CONFIG_HAS_ETH3
-       eth_getenv_enetaddr("eth3addr", bd->bi_enet3addr);
+       eth_env_get_enetaddr("eth3addr", bd->bi_enet3addr);
 #endif
 #ifdef CONFIG_HAS_ETH4
-       eth_getenv_enetaddr("eth4addr", bd->bi_enet4addr);
+       eth_env_get_enetaddr("eth4addr", bd->bi_enet4addr);
 #endif
 #ifdef CONFIG_HAS_ETH5
-       eth_getenv_enetaddr("eth5addr", bd->bi_enet5addr);
+       eth_env_get_enetaddr("eth5addr", bd->bi_enet5addr);
 #endif
        return 0;
 }
@@ -651,14 +651,14 @@ int initr_mem(void)
        char memsz[32];
 
 # ifdef CONFIG_PRAM
-       pram = getenv_ulong("pram", 10, CONFIG_PRAM);
+       pram = env_get_ulong("pram", 10, CONFIG_PRAM);
 # endif
 # if defined(CONFIG_LOGBUFFER) && !defined(CONFIG_ALT_LB_ADDR)
        /* Also take the logbuffer into account (pram is in kB) */
        pram += (LOGBUFF_LEN + LOGBUFF_OVERHEAD) / 1024;
 # endif
        sprintf(memsz, "%ldk", (long int) ((gd->ram_size / 1024) - pram));
-       setenv("mem", memsz);
+       env_set("mem", memsz);
 
        return 0;
 }
index b2c09126cecd380d914483de00c0e147c513928c..32b3ea8e2d093a203ae67f73ee03a207ba39f212 100644 (file)
@@ -55,8 +55,8 @@ static void boot_start_lmb(bootm_headers_t *images)
 
        lmb_init(&images->lmb);
 
-       mem_start = getenv_bootm_low();
-       mem_size = getenv_bootm_size();
+       mem_start = env_get_bootm_low();
+       mem_size = env_get_bootm_size();
 
        lmb_add(&images->lmb, (phys_addr_t)mem_start, mem_size);
 
@@ -72,7 +72,7 @@ static int bootm_start(cmd_tbl_t *cmdtp, int flag, int argc,
                       char * const argv[])
 {
        memset((void *)&images, 0, sizeof(images));
-       images.verify = getenv_yesno("verify");
+       images.verify = env_get_yesno("verify");
 
        boot_start_lmb(&images);
 
@@ -524,7 +524,7 @@ static void fixup_silent_linux(void)
 {
        char *buf;
        const char *env_val;
-       char *cmdline = getenv("bootargs");
+       char *cmdline = env_get("bootargs");
        int want_silent;
 
        /*
@@ -534,7 +534,7 @@ static void fixup_silent_linux(void)
         *      yes - we always fixup
         *      unset - we rely on the console silent flag
         */
-       want_silent = getenv_yesno("silent_linux");
+       want_silent = env_get_yesno("silent_linux");
        if (want_silent == 0)
                return;
        else if (want_silent == -1 && !(gd->flags & GD_FLG_SILENT))
@@ -569,7 +569,7 @@ static void fixup_silent_linux(void)
                env_val = CONSOLE_ARG;
        }
 
-       setenv("bootargs", env_val);
+       env_set("bootargs", env_val);
        debug("after silent fix-up: %s\n", env_val);
        free(buf);
 }
@@ -645,8 +645,8 @@ int do_bootm_states(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[],
                ret = boot_ramdisk_high(&images->lmb, images->rd_start,
                        rd_len, &images->initrd_start, &images->initrd_end);
                if (!ret) {
-                       setenv_hex("initrd_start", images->initrd_start);
-                       setenv_hex("initrd_end", images->initrd_end);
+                       env_set_hex("initrd_start", images->initrd_start);
+                       env_set_hex("initrd_end", images->initrd_end);
                }
        }
 #endif
@@ -691,7 +691,7 @@ int do_bootm_states(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[],
 #ifdef CONFIG_TRACE
        /* Pretend to run the OS, then run a user command */
        if (!ret && (states & BOOTM_STATE_OS_FAKE_GO)) {
-               char *cmd_list = getenv("fakegocmd");
+               char *cmd_list = env_get("fakegocmd");
 
                ret = boot_selected_os(argc, argv, BOOTM_STATE_OS_FAKE_GO,
                                images, boot_fn);
index d9e6e937f7ca627852d595ff23496b8d5af86fce..1feea8af175481fe0b10c2e47e84dedd7b22e744 100644 (file)
@@ -21,9 +21,9 @@ static int do_bootm_standalone(int flag, int argc, char * const argv[],
        int (*appl)(int, char *const[]);
 
        /* Don't start if "autostart" is set to "no" */
-       s = getenv("autostart");
+       s = env_get("autostart");
        if ((s != NULL) && !strcmp(s, "no")) {
-               setenv_hex("filesize", images->os.image_len);
+               env_set_hex("filesize", images->os.image_len);
                return 0;
        }
        appl = (int (*)(int, char * const []))images->ep;
@@ -96,7 +96,7 @@ static int do_bootm_netbsd(int flag, int argc, char * const argv[],
                cmdline = malloc(len);
                copy_args(cmdline, argc, argv, ' ');
        } else {
-               cmdline = getenv("bootargs");
+               cmdline = env_get("bootargs");
                if (cmdline == NULL)
                        cmdline = "";
        }
@@ -227,14 +227,14 @@ static int do_bootm_plan9(int flag, int argc, char * const argv[],
 #endif
 
        /* See README.plan9 */
-       s = getenv("confaddr");
+       s = env_get("confaddr");
        if (s != NULL) {
                char *confaddr = (char *)simple_strtoul(s, NULL, 16);
 
                if (argc > 0) {
                        copy_args(confaddr, argc, argv, '\n');
                } else {
-                       s = getenv("bootargs");
+                       s = env_get("bootargs");
                        if (s != NULL)
                                strcpy(confaddr, s);
                }
@@ -278,7 +278,7 @@ void do_bootvx_fdt(bootm_headers_t *images)
 
                ret = fdt_add_subnode(*of_flat_tree, 0, "chosen");
                if ((ret >= 0 || ret == -FDT_ERR_EXISTS)) {
-                       bootline = getenv("bootargs");
+                       bootline = env_get("bootargs");
                        if (bootline) {
                                ret = fdt_find_and_setprop(*of_flat_tree,
                                                "/chosen", "bootargs",
index 2d82798cd04bc6ba004d2382ceaab79637c79a85..b3b8271a92391d5f73a7a9c0d1202259aac9113c 100644 (file)
@@ -23,7 +23,7 @@ static int      retry_time = -1; /* -1 so can call readline before main_loop */
  */
 void bootretry_init_cmd_timeout(void)
 {
-       char *s = getenv("bootretry");
+       char *s = env_get("bootretry");
 
        if (s != NULL)
                retry_time = (int)simple_strtol(s, NULL, 10);
index a433ef21663cfb112cb6acd40e38057f22acab1e..57874d87977b7263c773bc41467922eda2ebee52 100644 (file)
@@ -129,7 +129,7 @@ int do_run(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
        for (i = 1; i < argc; ++i) {
                char *arg;
 
-               arg = getenv(argv[i]);
+               arg = env_get(argv[i]);
                if (arg == NULL) {
                        printf("## Error: \"%s\" not defined\n", argv[i]);
                        return 1;
index 00861e2d9e4b56c114a4dcae71fdbb0f89a996aa..07c048ec6a97a7ccd713d8dc0780244a8c98889a 100644 (file)
@@ -560,7 +560,7 @@ static int builtin_cd(struct child_prog *child)
 {
        char *newdir;
        if (child->argv[1] == NULL)
-               newdir = getenv("HOME");
+               newdir = env_get("HOME");
        else
                newdir = child->argv[1];
        if (chdir(newdir)) {
@@ -948,7 +948,7 @@ static inline void cmdedit_set_initial_prompt(void)
 #ifndef CONFIG_FEATURE_SH_FANCY_PROMPT
        PS1 = NULL;
 #else
-       PS1 = getenv("PS1");
+       PS1 = env_get("PS1");
        if(PS1==0)
                PS1 = "\\w \\$ ";
 #endif
@@ -987,9 +987,9 @@ static int uboot_cli_readline(struct in_str *i)
 
 #ifdef CONFIG_CMDLINE_PS_SUPPORT
        if (i->promptmode == 1)
-               ps_prompt = getenv("PS1");
+               ps_prompt = env_get("PS1");
        else
-               ps_prompt = getenv("PS2");
+               ps_prompt = env_get("PS2");
        if (ps_prompt)
                prompt = ps_prompt;
 #endif
@@ -2172,7 +2172,7 @@ int set_local_var(const char *s, int flg_export)
        name=strdup(s);
 
 #ifdef __U_BOOT__
-       if (getenv(name) != NULL) {
+       if (env_get(name) != NULL) {
                printf ("ERROR: "
                                "There is a global environment variable with the same name.\n");
                free(name);
@@ -2265,7 +2265,7 @@ void unset_local_var(const char *name)
                        } else {
 #ifndef __U_BOOT__
                                if(cur->flg_export)
-                                       unsetenv(cur->name);
+                                       unenv_set(cur->name);
 #endif
                                free(cur->name);
                                free(cur->value);
@@ -2793,7 +2793,7 @@ static char *lookup_param(char *src)
                }
        }
 
-       p = getenv(src);
+       p = env_get(src);
        if (!p)
                p = get_local_var(src);
 
@@ -3157,7 +3157,7 @@ static void mapset(const unsigned char *set, int code)
 static void update_ifs_map(void)
 {
        /* char *ifs and char map[256] are both globals. */
-       ifs = (uchar *)getenv("IFS");
+       ifs = (uchar *)env_get("IFS");
        if (ifs == NULL) ifs=(uchar *)" \t\n";
        /* Precompute a list of 'flow through' behavior so it can be treated
         * quickly up front.  Computation is necessary because of IFS.
index bb96aaead60452b87cf44979b9dc586630855cf7..cb642d2ff3bc93cedd2434ae37e4008a2ebbc371 100644 (file)
@@ -131,7 +131,7 @@ void cli_simple_process_macros(const char *input, char *output)
                                envname[i] = 0;
 
                                /* Get its value */
-                               envval = getenv(envname);
+                               envval = env_get(envname);
 
                                /* Copy into the line if it exists */
                                if (envval != NULL)
@@ -168,7 +168,7 @@ void cli_simple_process_macros(const char *input, char *output)
  * WARNING:
  *
  * We must create a temporary copy of the command since the command we get
- * may be the result from getenv(), which returns a pointer directly to
+ * may be the result from env_get(), which returns a pointer directly to
  * the environment data, which may change magicly when the command we run
  * creates or modifies environment variables (like "bootp" does).
  */
index ec4af3bd90dfdca971b912ec65034d46754d024c..3167921ec9aedd32c34f5191bc441bdecb3b735f 100644 (file)
@@ -666,7 +666,7 @@ int console_assign(int file, const char *devname)
 static void console_update_silent(void)
 {
 #ifdef CONFIG_SILENT_CONSOLE
-       if (getenv("silent") != NULL)
+       if (env_get("silent") != NULL)
                gd->flags |= GD_FLG_SILENT;
        else
                gd->flags &= ~GD_FLG_SILENT;
@@ -745,9 +745,9 @@ int console_init_r(void)
 
        /* stdin stdout and stderr are in environment */
        /* scan for it */
-       stdinname  = getenv("stdin");
-       stdoutname = getenv("stdout");
-       stderrname = getenv("stderr");
+       stdinname  = env_get("stdin");
+       stdoutname = env_get("stdout");
+       stderrname = env_get("stderr");
 
        if (OVERWRITE_CONSOLE == 0) {   /* if not overwritten by config switch */
                inputdev  = search_device(DEV_FLAGS_INPUT,  stdinname);
@@ -801,7 +801,7 @@ done:
 #ifdef CONFIG_SYS_CONSOLE_ENV_OVERWRITE
        /* set the environment variables (will overwrite previous env settings) */
        for (i = 0; i < 3; i++) {
-               setenv(stdio_names[i], stdio_devices[i]->name);
+               env_set(stdio_names[i], stdio_devices[i]->name);
        }
 #endif /* CONFIG_SYS_CONSOLE_ENV_OVERWRITE */
 
@@ -836,7 +836,7 @@ int console_init_r(void)
         * console to serial console in this case or suppress it if
         * "silent" mode was requested.
         */
-       if (getenv("splashimage") != NULL) {
+       if (env_get("splashimage") != NULL) {
                if (!(gd->flags & GD_FLG_SILENT))
                        outputdev = search_device (DEV_FLAGS_OUTPUT, "serial");
        }
@@ -880,7 +880,7 @@ int console_init_r(void)
 
        /* Setting environment variables */
        for (i = 0; i < 3; i++) {
-               setenv(stdio_names[i], stdio_devices[i]->name);
+               env_set(stdio_names[i], stdio_devices[i]->name);
        }
 
        gd->flags |= GD_FLG_DEVINIT;    /* device initialization completed */
index 2113b6c3723978f31372e1562010e76defb6f800..5065ad5f73b624801ba425bf9b2feee91954e60a 100644 (file)
@@ -49,7 +49,7 @@ static int part_get_info_by_name_or_alias(struct blk_desc *dev_desc,
                /* check for alias */
                strcpy(env_alias_name, "fastboot_partition_alias_");
                strncat(env_alias_name, name, 32);
-               aliased_part_name = getenv(env_alias_name);
+               aliased_part_name = env_get(env_alias_name);
                if (aliased_part_name != NULL)
                        ret = part_get_info_by_name(dev_desc,
                                        aliased_part_name, info);
index 7ccf8b19fd10e857cfd9f309218fcb52f2d4bbe7..916a448c11d43a82e25155f001c919cd8b5e9541 100644 (file)
@@ -197,7 +197,7 @@ int fdt_root(void *fdt)
                return err;
        }
 
-       serial = getenv("serial#");
+       serial = env_get("serial#");
        if (serial) {
                err = fdt_setprop(fdt, 0, "serial-number", serial,
                                  strlen(serial) + 1);
@@ -289,7 +289,7 @@ int fdt_chosen(void *fdt)
        if (nodeoffset < 0)
                return nodeoffset;
 
-       str = getenv("bootargs");
+       str = env_get("bootargs");
        if (str) {
                err = fdt_setprop(fdt, nodeoffset, "bootargs", str,
                                  strlen(str) + 1);
@@ -509,7 +509,7 @@ void fdt_fixup_ethernet(void *fdt)
                        } else {
                                continue;
                        }
-                       tmp = getenv(mac);
+                       tmp = env_get(mac);
                        if (!tmp)
                                continue;
 
index 771d8fa87f9424521ce0b5d3ceb465f079404ea8..dcf016d8a78119413cb8c0ef1bbf556b84b88d1e 100644 (file)
@@ -302,7 +302,7 @@ static void store_result(struct hash_algo *algo, const uint8_t *sum,
                        str_ptr += 2;
                }
                *str_ptr = '\0';
-               setenv(dest, str_output);
+               env_set(dest, str_output);
        } else {
                ulong addr;
                void *buf;
@@ -362,7 +362,7 @@ static int parse_verify_sum(struct hash_algo *algo, char *verify_str,
                if (strlen(verify_str) == digits)
                        vsum_str = verify_str;
                else {
-                       vsum_str = getenv(verify_str);
+                       vsum_str = env_get(verify_str);
                        if (vsum_str == NULL || strlen(vsum_str) != digits) {
                                printf("Expected %d hex digits in env var\n",
                                       digits);
index 4ae042ee33efe9327b5a647af910f343cb6fe3e5..e5186d77968f80d96ac1458f649ad2576512f1ef 100644 (file)
@@ -81,7 +81,7 @@ static const char *__hwconfig(const char *opt, size_t *arglen,
                                        "and before environment is ready\n");
                        return NULL;
                }
-               env_hwconfig = getenv("hwconfig");
+               env_hwconfig = env_get("hwconfig");
        }
 
        if (env_hwconfig) {
@@ -243,7 +243,7 @@ int main()
        const char *ret;
        size_t len;
 
-       setenv("hwconfig", "key1:subkey1=value1,subkey2=value2;key2:value3;;;;"
+       env_set("hwconfig", "key1:subkey1=value1,subkey2=value2;key2:value3;;;;"
                           "key3;:,:=;key4", 1);
 
        ret = hwconfig_arg("key1", &len);
@@ -274,7 +274,7 @@ int main()
        assert(hwconfig_arg("key4", &len) == NULL);
        assert(hwconfig_arg("bogus", &len) == NULL);
 
-       unsetenv("hwconfig");
+       unenv_set("hwconfig");
 
        assert(hwconfig(NULL) == 0);
        assert(hwconfig("") == 0);
index c668407817c8701a7bcce11450f300362ab0b390..e74d0aafca57e3d74ed2c7f898dfbc2f5ebfab08 100644 (file)
@@ -72,7 +72,7 @@ int android_image_get_kernel(const struct andr_img_hdr *hdr, int verify,
                len += strlen(hdr->cmdline);
        }
 
-       char *bootargs = getenv("bootargs");
+       char *bootargs = env_get("bootargs");
        if (bootargs)
                len += strlen(bootargs);
 
@@ -90,7 +90,7 @@ int android_image_get_kernel(const struct andr_img_hdr *hdr, int verify,
        if (*hdr->cmdline)
                strcat(newbootargs, hdr->cmdline);
 
-       setenv("bootargs", newbootargs);
+       env_set("bootargs", newbootargs);
 
        if (os_data) {
                *os_data = (ulong)hdr;
index c6e8832d66887af9615db5c5fff18492f4b083a8..da4d0070815db68782bdd0731b59bbf211067710 100644 (file)
@@ -132,7 +132,7 @@ int boot_relocate_fdt(struct lmb *lmb, char **of_flat_tree, ulong *of_size)
        of_len = *of_size + CONFIG_SYS_FDT_PAD;
 
        /* If fdt_high is set use it to select the relocation address */
-       fdt_high = getenv("fdt_high");
+       fdt_high = env_get("fdt_high");
        if (fdt_high) {
                void *desired_addr = (void *)simple_strtoul(fdt_high, NULL, 16);
 
@@ -156,8 +156,8 @@ int boot_relocate_fdt(struct lmb *lmb, char **of_flat_tree, ulong *of_size)
        } else {
                of_start =
                    (void *)(ulong) lmb_alloc_base(lmb, of_len, 0x1000,
-                                                  getenv_bootm_mapsize()
-                                                  + getenv_bootm_low());
+                                                  env_get_bootm_mapsize()
+                                                  + env_get_bootm_low());
        }
 
        if (of_start == NULL) {
index 0f88984f2d40212fe8bdafd124a8de97846cbc86..a058eb85e107bce98c7a155344250cc30f16ef18 100644 (file)
@@ -465,9 +465,9 @@ static int on_loadaddr(const char *name, const char *value, enum env_op op,
 }
 U_BOOT_ENV_CALLBACK(loadaddr, on_loadaddr);
 
-ulong getenv_bootm_low(void)
+ulong env_get_bootm_low(void)
 {
-       char *s = getenv("bootm_low");
+       char *s = env_get("bootm_low");
        if (s) {
                ulong tmp = simple_strtoul(s, NULL, 16);
                return tmp;
@@ -482,11 +482,11 @@ ulong getenv_bootm_low(void)
 #endif
 }
 
-phys_size_t getenv_bootm_size(void)
+phys_size_t env_get_bootm_size(void)
 {
        phys_size_t tmp, size;
        phys_addr_t start;
-       char *s = getenv("bootm_size");
+       char *s = env_get("bootm_size");
        if (s) {
                tmp = (phys_size_t)simple_strtoull(s, NULL, 16);
                return tmp;
@@ -500,7 +500,7 @@ phys_size_t getenv_bootm_size(void)
        size = gd->bd->bi_memsize;
 #endif
 
-       s = getenv("bootm_low");
+       s = env_get("bootm_low");
        if (s)
                tmp = (phys_size_t)simple_strtoull(s, NULL, 16);
        else
@@ -509,10 +509,10 @@ phys_size_t getenv_bootm_size(void)
        return size - (tmp - start);
 }
 
-phys_size_t getenv_bootm_mapsize(void)
+phys_size_t env_get_bootm_mapsize(void)
 {
        phys_size_t tmp;
-       char *s = getenv("bootm_mapsize");
+       char *s = env_get("bootm_mapsize");
        if (s) {
                tmp = (phys_size_t)simple_strtoull(s, NULL, 16);
                return tmp;
@@ -521,7 +521,7 @@ phys_size_t getenv_bootm_mapsize(void)
 #if defined(CONFIG_SYS_BOOTMAPSZ)
        return CONFIG_SYS_BOOTMAPSZ;
 #else
-       return getenv_bootm_size();
+       return env_get_bootm_size();
 #endif
 }
 
@@ -1224,7 +1224,8 @@ int boot_ramdisk_high(struct lmb *lmb, ulong rd_data, ulong rd_len,
        ulong   initrd_high;
        int     initrd_copy_to_ram = 1;
 
-       if ((s = getenv("initrd_high")) != NULL) {
+       s = env_get("initrd_high");
+       if (s) {
                /* a value of "no" or a similar string will act like 0,
                 * turning the "load high" feature off. This is intentional.
                 */
@@ -1232,7 +1233,7 @@ int boot_ramdisk_high(struct lmb *lmb, ulong rd_data, ulong rd_len,
                if (initrd_high == ~0)
                        initrd_copy_to_ram = 0;
        } else {
-               initrd_high = getenv_bootm_mapsize() + getenv_bootm_low();
+               initrd_high = env_get_bootm_mapsize() + env_get_bootm_low();
        }
 
 
@@ -1505,7 +1506,7 @@ int boot_get_loadable(int argc, char * const argv[], bootm_headers_t *images,
  * @cmd_end: pointer to a ulong variable, will hold cmdline end
  *
  * boot_get_cmdline() allocates space for kernel command line below
- * BOOTMAPSZ + getenv_bootm_low() address. If "bootargs" U-Boot environemnt
+ * BOOTMAPSZ + env_get_bootm_low() address. If "bootargs" U-Boot environemnt
  * variable is present its contents is copied to allocated kernel
  * command line.
  *
@@ -1519,12 +1520,13 @@ int boot_get_cmdline(struct lmb *lmb, ulong *cmd_start, ulong *cmd_end)
        char *s;
 
        cmdline = (char *)(ulong)lmb_alloc_base(lmb, CONFIG_SYS_BARGSIZE, 0xf,
-                               getenv_bootm_mapsize() + getenv_bootm_low());
+                               env_get_bootm_mapsize() + env_get_bootm_low());
 
        if (cmdline == NULL)
                return -1;
 
-       if ((s = getenv("bootargs")) == NULL)
+       s = env_get("bootargs");
+       if (!s)
                s = "";
 
        strcpy(cmdline, s);
@@ -1545,7 +1547,7 @@ int boot_get_cmdline(struct lmb *lmb, ulong *cmd_start, ulong *cmd_end)
  * @kbd: double pointer to board info data
  *
  * boot_get_kbd() allocates space for kernel copy of board info data below
- * BOOTMAPSZ + getenv_bootm_low() address and kernel board info is initialized
+ * BOOTMAPSZ + env_get_bootm_low() address and kernel board info is initialized
  * with the current u-boot board info data.
  *
  * returns:
@@ -1555,7 +1557,7 @@ int boot_get_cmdline(struct lmb *lmb, ulong *cmd_start, ulong *cmd_end)
 int boot_get_kbd(struct lmb *lmb, bd_t **kbd)
 {
        *kbd = (bd_t *)(ulong)lmb_alloc_base(lmb, sizeof(bd_t), 0xf,
-                               getenv_bootm_mapsize() + getenv_bootm_low());
+                               env_get_bootm_mapsize() + env_get_bootm_low());
        if (*kbd == NULL)
                return -1;
 
index 7e399cee2de6822a56703870302aa4eec987cc59..c3ff9599ed89cc0e03d60d8ff9a63f44c0e5afd1 100644 (file)
@@ -223,7 +223,7 @@ void lcd_clear(void)
        /* Paint the logo and retrieve LCD base address */
        debug("[LCD] Drawing the logo...\n");
        if (do_splash) {
-               s = getenv("splashimage");
+               s = env_get("splashimage");
                if (s) {
                        do_splash = 0;
                        addr = simple_strtoul(s, NULL, 16);
index 2116a9e0a2e0bc5d25993b43ad50aed9aab19e97..6a1159879edc4abb98a415bf369be8b02e621ca3 100644 (file)
@@ -25,7 +25,7 @@ static void run_preboot_environment_command(void)
 #ifdef CONFIG_PREBOOT
        char *p;
 
-       p = getenv("preboot");
+       p = env_get("preboot");
        if (p != NULL) {
 # ifdef CONFIG_AUTOBOOT_KEYED
                int prev = disable_ctrlc(1);    /* disable Control C checking */
@@ -48,7 +48,7 @@ void main_loop(void)
        bootstage_mark_name(BOOTSTAGE_ID_MAIN_LOOP, "main_loop");
 
 #ifdef CONFIG_VERSION_VARIABLE
-       setenv("ver", version_string);  /* set version variable */
+       env_set("ver", version_string);  /* set version variable */
 #endif /* CONFIG_VERSION_VARIABLE */
 
        cli_init();
index 51768575064dbc0ed4a8033c0b4bc581368d1017..582b685dad36b9cea6298481d49ceb214e8a5926 100644 (file)
@@ -278,8 +278,8 @@ config SPL_ENV_SUPPORT
          needed in SPL as it has a much simpler task with less
          configuration. But some boards use this to support 'Falcon' boot
          on EXT2 and FAT, where SPL boots directly into Linux without
-         starting U-Boot first. Enabling this option will make getenv()
-         and setenv() available in SPL.
+         starting U-Boot first. Enabling this option will make env_get()
+         and env_set() available in SPL.
 
 config SPL_SAVEENV
        bool "Support save environment"
index e8d0ba18e63beac632770a595a36d0f784b9d268..2c974735b11a8daf4eccdd3289307a488ffaaeba 100644 (file)
@@ -40,13 +40,13 @@ int spl_dfu_cmd(int usbctrl, char *dfu_alt_info, char *interface, char *devstr)
 
        /* set default environment */
        set_default_env(0);
-       str_env = getenv(dfu_alt_info);
+       str_env = env_get(dfu_alt_info);
        if (!str_env) {
                error("\"dfu_alt_info\" env variable not defined!\n");
                return -EINVAL;
        }
 
-       ret = setenv("dfu_alt_info", str_env);
+       ret = env_set("dfu_alt_info", str_env);
        if (ret) {
                error("unable to set env variable \"dfu_alt_info\"!\n");
                return -EINVAL;
index f17c6b949416c271c3172abb5d03856ca7b0b18e..559ba0b797126dc788ef243a67528771a90147d2 100644 (file)
@@ -89,7 +89,7 @@ int spl_load_image_ext_os(struct spl_image_info *spl_image,
                return -1;
        }
 #if defined(CONFIG_SPL_ENV_SUPPORT)
-       file = getenv("falcon_args_file");
+       file = env_get("falcon_args_file");
        if (file) {
                err = ext4fs_open(file, &filelen);
                if (err < 0) {
@@ -102,7 +102,7 @@ int spl_load_image_ext_os(struct spl_image_info *spl_image,
                               file, err);
                        goto defaults;
                }
-               file = getenv("falcon_image_file");
+               file = env_get("falcon_image_file");
                if (file) {
                        err = spl_load_image_ext(spl_image, block_dev,
                                                 partition, file);
index 5e312160d95d20530e6ed310a216a06dc9974275..60b85f082d45843de509bce8a0367ddcb1a49d3c 100644 (file)
@@ -113,7 +113,7 @@ int spl_load_image_fat_os(struct spl_image_info *spl_image,
                return err;
 
 #if defined(CONFIG_SPL_ENV_SUPPORT) && defined(CONFIG_SPL_OS_BOOT)
-       file = getenv("falcon_args_file");
+       file = env_get("falcon_args_file");
        if (file) {
                err = file_fat_read(file, (void *)CONFIG_SYS_SPL_ARGS_ADDR, 0);
                if (err <= 0) {
@@ -121,7 +121,7 @@ int spl_load_image_fat_os(struct spl_image_info *spl_image,
                               file, err);
                        goto defaults;
                }
-               file = getenv("falcon_image_file");
+               file = env_get("falcon_image_file");
                if (file) {
                        err = spl_load_image_fat(spl_image, block_dev,
                                                 partition, file);
index 85fe508b1760f0a2ebec85057d96dddffa0e1811..88831097fa60cb6dd681ad210ebe62a1ecad9680 100644 (file)
@@ -33,14 +33,14 @@ static int spl_net_load_image(struct spl_image_info *spl_image,
 
        env_init();
        env_relocate();
-       setenv("autoload", "yes");
+       env_set("autoload", "yes");
        rv = eth_initialize();
        if (rv == 0) {
                printf("No Ethernet devices found\n");
                return -ENODEV;
        }
        if (bootdev->boot_device_name)
-               setenv("ethact", bootdev->boot_device_name);
+               env_set("ethact", bootdev->boot_device_name);
        rv = net_loop(BOOTP);
        if (rv < 0) {
                printf("Problem booting with BOOTP\n");
index 89af437f2cafec3c648b13dc273e1fe4c1e4d287..d251b3b6547018f75faca2da742e89edd53af319 100644 (file)
@@ -60,7 +60,7 @@ __weak int splash_screen_prepare(void)
 #ifdef CONFIG_SPLASH_SCREEN_ALIGN
 void splash_get_pos(int *x, int *y)
 {
-       char *s = getenv("splashpos");
+       char *s = env_get("splashpos");
 
        if (!s)
                return;
index 867a7984870ddeae0e167d55911627f846ae7783..8c0ac581f7309f5bbf780970646e28e138e08a3f 100644 (file)
@@ -220,7 +220,7 @@ static int splash_load_fs(struct splash_location *location, u32 bmp_load_addr)
        loff_t actread;
        char *splash_file;
 
-       splash_file = getenv("splashfile");
+       splash_file = env_get("splashfile");
        if (!splash_file)
                splash_file = SPLASH_SOURCE_DEFAULT_FILE_NAME;
 
@@ -286,7 +286,7 @@ static struct splash_location *select_splash_location(
        if (!locations || size == 0)
                return NULL;
 
-       env_splashsource = getenv("splashsource");
+       env_splashsource = env_get("splashsource");
        if (env_splashsource == NULL)
                return &locations[0];
 
@@ -383,7 +383,7 @@ int splash_source_load(struct splash_location *locations, uint size)
        char *env_splashimage_value;
        u32 bmp_load_addr;
 
-       env_splashimage_value = getenv("splashimage");
+       env_splashimage_value = env_get("splashimage");
        if (env_splashimage_value == NULL)
                return -ENOENT;
 
index 0767fcbcb554042263472d139ce29922d1bdf2c0..974f4655e7ef1d492b9c589cdfe02738a9fd1134 100644 (file)
@@ -59,7 +59,7 @@ static int update_load(char *filename, ulong msec_max, int cnt_max, ulong addr)
        /* save used globals and env variable */
        saved_timeout_msecs = tftp_timeout_ms;
        saved_timeout_count = tftp_timeout_count_max;
-       saved_netretry = strdup(getenv("netretry"));
+       saved_netretry = strdup(env_get("netretry"));
        saved_bootfile = strdup(net_boot_file_name);
 
        /* set timeouts for auto-update */
@@ -67,7 +67,7 @@ static int update_load(char *filename, ulong msec_max, int cnt_max, ulong addr)
        tftp_timeout_count_max = cnt_max;
 
        /* we don't want to retry the connection if errors occur */
-       setenv("netretry", "no");
+       env_set("netretry", "no");
 
        /* download the update file */
        load_addr = addr;
@@ -83,7 +83,7 @@ static int update_load(char *filename, ulong msec_max, int cnt_max, ulong addr)
        tftp_timeout_ms = saved_timeout_msecs;
        tftp_timeout_count_max = saved_timeout_count;
 
-       setenv("netretry", saved_netretry);
+       env_set("netretry", saved_netretry);
        if (saved_netretry != NULL)
                free(saved_netretry);
 
@@ -254,7 +254,7 @@ int update_tftp(ulong addr, char *interface, char *devstring)
        printf("Auto-update from TFTP: ");
 
        /* get the file name of the update file */
-       filename = getenv(UPDATE_FILE_ENV);
+       filename = env_get(UPDATE_FILE_ENV);
        if (filename == NULL) {
                printf("failed, env. variable '%s' not found\n",
                                                        UPDATE_FILE_ENV);
@@ -264,7 +264,8 @@ int update_tftp(ulong addr, char *interface, char *devstring)
        printf("trying update file '%s'\n", filename);
 
        /* get load address of downloaded update file */
-       if ((env_addr = getenv("loadaddr")) != NULL)
+       env_addr = env_get("loadaddr");
+       if (env_addr)
                addr = simple_strtoul(env_addr, NULL, 16);
        else
                addr = CONFIG_UPDATE_LOAD_ADDR;
index 70bc6e2931164d31fd0f86ad71a314b713870c9b..86a347766432467dcd67f078d963fce1bffa561c 100644 (file)
@@ -189,7 +189,7 @@ static void usb_hub_power_on(struct usb_hub_device *hub)
         * but allow this time to be increased via env variable as some
         * devices break the spec and require longer warm-up times
         */
-       env = getenv("usb_pgood_delay");
+       env = env_get("usb_pgood_delay");
        if (env)
                pgood_delay = max(pgood_delay,
                                  (unsigned)simple_strtol(env, NULL, 0));
index d2d29cc98f5ed3e8cf7f91f13daa2d6619756df5..8cbdba6ac2984fd667e6e7130311249126ca6c78 100644 (file)
@@ -515,7 +515,7 @@ static int probe_usb_keyboard(struct usb_device *dev)
        if (error)
                return error;
 
-       stdinname = getenv("stdin");
+       stdinname = env_get("stdin");
 #if CONFIG_IS_ENABLED(CONSOLE_MUX)
        error = iomux_doenv(stdin, stdinname);
        if (error)
@@ -582,7 +582,7 @@ int usb_kbd_deregister(int force)
                if (stdio_deregister_dev(dev, force) != 0)
                        return 1;
 #if CONFIG_IS_ENABLED(CONSOLE_MUX)
-               if (iomux_doenv(stdin, getenv("stdin")) != 0)
+               if (iomux_doenv(stdin, env_get("stdin")) != 0)
                        return 1;
 #endif
 #ifdef CONFIG_SYS_USB_EVENT_POLL_VIA_INT_QUEUE
@@ -627,7 +627,7 @@ static int usb_kbd_remove(struct udevice *dev)
                goto err;
        }
 #if CONFIG_IS_ENABLED(CONSOLE_MUX)
-       if (iomux_doenv(stdin, getenv("stdin"))) {
+       if (iomux_doenv(stdin, env_get("stdin"))) {
                ret = -ENOLINK;
                goto err;
        }
diff --git a/configs/A20-OLinuXino-Lime2-eMMC_defconfig b/configs/A20-OLinuXino-Lime2-eMMC_defconfig
new file mode 100644 (file)
index 0000000..1c58c54
--- /dev/null
@@ -0,0 +1,37 @@
+CONFIG_ARM=y
+CONFIG_ARCH_SUNXI=y
+CONFIG_MACH_SUN7I=y
+CONFIG_DRAM_CLK=384
+CONFIG_MMC0_CD_PIN="PH1"
+CONFIG_MMC_SUNXI_SLOT_EXTRA=2
+CONFIG_USB0_VBUS_PIN="PC17"
+CONFIG_USB0_VBUS_DET="PH5"
+CONFIG_I2C1_ENABLE=y
+CONFIG_SATAPWR="PC3"
+CONFIG_DEFAULT_DEVICE_TREE="sun7i-a20-olinuxino-lime2-emmc"
+CONFIG_AHCI=y
+# CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set
+CONFIG_SPL=y
+CONFIG_SPL_I2C_SUPPORT=y
+# CONFIG_CMD_IMLS is not set
+# CONFIG_CMD_FLASH is not set
+CONFIG_CMD_DFU=y
+CONFIG_CMD_USB_MASS_STORAGE=y
+# CONFIG_CMD_FPGA is not set
+# CONFIG_SPL_DOS_PARTITION is not set
+# CONFIG_SPL_ISO_PARTITION is not set
+# CONFIG_SPL_PARTITION_UUIDS is not set
+CONFIG_DFU_RAM=y
+CONFIG_ETH_DESIGNWARE=y
+CONFIG_RGMII=y
+CONFIG_SUN7I_GMAC=y
+CONFIG_AXP_ALDO3_VOLT=2800
+CONFIG_AXP_ALDO4_VOLT=2800
+CONFIG_SCSI=y
+CONFIG_USB_EHCI_HCD=y
+CONFIG_USB_MUSB_GADGET=y
+CONFIG_USB_GADGET=y
+CONFIG_USB_GADGET_DOWNLOAD=y
+CONFIG_G_DNL_MANUFACTURER="Allwinner Technology"
+CONFIG_G_DNL_VENDOR_NUM=0x1f3a
+CONFIG_G_DNL_PRODUCT_NUM=0x1010
diff --git a/configs/a64-olinuxino_defconfig b/configs/a64-olinuxino_defconfig
new file mode 100644 (file)
index 0000000..14f2c3d
--- /dev/null
@@ -0,0 +1,15 @@
+CONFIG_ARM=y
+CONFIG_ARCH_SUNXI=y
+CONFIG_MACH_SUN50I=y
+CONFIG_RESERVE_ALLWINNER_BOOT0_HEADER=y
+CONFIG_DEFAULT_DEVICE_TREE="sun50i-a64-olinuxino"
+# CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set
+CONFIG_SPL=y
+# CONFIG_CMD_IMLS is not set
+# CONFIG_CMD_FLASH is not set
+# CONFIG_CMD_FPGA is not set
+# CONFIG_SPL_DOS_PARTITION is not set
+# CONFIG_SPL_ISO_PARTITION is not set
+# CONFIG_SPL_EFI_PARTITION is not set
+CONFIG_SUN8I_EMAC=y
+CONFIG_USB_EHCI_HCD=y
index 312924983dc708b608f0a206a633ba6c24254198..48983f59a160c547308d8b2c7eca971a51c9d94e 100644 (file)
@@ -38,3 +38,4 @@ CONFIG_DM_PCI=y
 CONFIG_PCI_XILINX=y
 CONFIG_SYS_NS16550=y
 CONFIG_LZ4=y
+CONFIG_ENV_IS_IN_FLASH=y
index ee47e2c738daf4a4d92036503217583b46ea1f22..0e1cf29b43c97bc63bdf0fb8504ad5c9464adf10 100644 (file)
@@ -39,3 +39,4 @@ CONFIG_DM_PCI=y
 CONFIG_PCI_XILINX=y
 CONFIG_SYS_NS16550=y
 CONFIG_LZ4=y
+CONFIG_ENV_IS_IN_FLASH=y
index a98fe97fb544e60312e439dd5df1d751bac9f67c..5010a0e104f15905b8428bfecb1f5dcec8cbabfa 100644 (file)
@@ -39,3 +39,4 @@ CONFIG_DM_PCI=y
 CONFIG_PCI_XILINX=y
 CONFIG_SYS_NS16550=y
 CONFIG_LZ4=y
+CONFIG_ENV_IS_IN_FLASH=y
index a361447b9a4bef55b669c8892beed0536d6554c3..ae090bf4aa13cd1abd69255b7f2f865d4238d0ec 100644 (file)
@@ -40,3 +40,4 @@ CONFIG_DM_PCI=y
 CONFIG_PCI_XILINX=y
 CONFIG_SYS_NS16550=y
 CONFIG_LZ4=y
+CONFIG_ENV_IS_IN_FLASH=y
index b55cc78e045467260344ee9a0ad82cbf32dcfbbb..0aa7a45a9159418a0cbb9a90e5b55411eb9833aa 100644 (file)
@@ -24,6 +24,7 @@ CONFIG_CMD_EXT4_WRITE=y
 CONFIG_CMD_FAT=y
 CONFIG_CMD_FS_GENERIC=y
 CONFIG_OF_EMBED=y
+CONFIG_ENV_IS_IN_MMC=y
 CONFIG_CPU=y
 CONFIG_DFU_MMC=y
 CONFIG_DFU_RAM=y
index c70c1cc6c46fbd7d634f7145957bff56f8b43944..9a4ef2746b11395a4952446b6665680bdbd69889 100644 (file)
@@ -21,3 +21,4 @@ CONFIG_OF_EMBED=y
 CONFIG_MTD_NOR_FLASH=y
 CONFIG_PCI=y
 CONFIG_SYS_NS16550=y
+CONFIG_ENV_IS_IN_FLASH=y
index a05d76d005b272710d3772deeb1b7e2e7398ffb5..1d076d46fa5757899facc5785e35487dd1f7ed08 100644 (file)
@@ -22,3 +22,4 @@ CONFIG_OF_EMBED=y
 CONFIG_MTD_NOR_FLASH=y
 CONFIG_PCI=y
 CONFIG_SYS_NS16550=y
+CONFIG_ENV_IS_IN_FLASH=y
index f0a0f209d7a8b76f23ea1db6a5061a226a738e3a..6c7034e11d03b4798865e43fa6b8ffdce7f669a2 100644 (file)
@@ -20,3 +20,4 @@ CONFIG_OF_EMBED=y
 CONFIG_MTD_NOR_FLASH=y
 CONFIG_PCI=y
 CONFIG_SYS_NS16550=y
+CONFIG_ENV_IS_IN_FLASH=y
index dcbd5d0cd74b3ec43f66b672b5ecfa7c63ea5039..c19f9256aa1e0eb1bfd9a07df1640dc0098e161b 100644 (file)
@@ -21,3 +21,4 @@ CONFIG_OF_EMBED=y
 CONFIG_MTD_NOR_FLASH=y
 CONFIG_PCI=y
 CONFIG_SYS_NS16550=y
+CONFIG_ENV_IS_IN_FLASH=y
index 1036abec574a73836f679d33083c4c8b9c0f65e1..953801e6d0c36d766f2a5b91f8d0457937cf6c3f 100644 (file)
@@ -37,6 +37,7 @@ CONFIG_CMD_UBI=y
 # CONFIG_CMD_UBIFS is not set
 CONFIG_SPL_OF_CONTROL=y
 CONFIG_OF_EMBED=y
+CONFIG_ENV_IS_IN_FLASH=y
 CONFIG_NETCONSOLE=y
 CONFIG_SPL_DM=y
 CONFIG_MTD_NOR_FLASH=y
diff --git a/configs/nanopi_a64_defconfig b/configs/nanopi_a64_defconfig
new file mode 100644 (file)
index 0000000..2f4ed11
--- /dev/null
@@ -0,0 +1,15 @@
+CONFIG_ARM=y
+CONFIG_ARCH_SUNXI=y
+CONFIG_MACH_SUN50I=y
+CONFIG_RESERVE_ALLWINNER_BOOT0_HEADER=y
+CONFIG_DEFAULT_DEVICE_TREE="sun50i-a64-nanopi-a64"
+# CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set
+CONFIG_SPL=y
+# CONFIG_CMD_IMLS is not set
+# CONFIG_CMD_FLASH is not set
+# CONFIG_CMD_FPGA is not set
+# CONFIG_SPL_DOS_PARTITION is not set
+# CONFIG_SPL_ISO_PARTITION is not set
+# CONFIG_SPL_EFI_PARTITION is not set
+CONFIG_SUN8I_EMAC=y
+CONFIG_USB_EHCI_HCD=y
index 5a64ad3f41339b8c6881af5c6dc9e0aac52e9ed5..b72514d3b9ee86f5c10b5153b330680210485668 100644 (file)
@@ -4,6 +4,7 @@ CONFIG_SPL_SPI_FLASH_SUPPORT=y
 CONFIG_MACH_SUN50I_H5=y
 CONFIG_DRAM_CLK=672
 CONFIG_DRAM_ZQ=3881977
+CONFIG_MACPWR="PD6"
 CONFIG_DEFAULT_DEVICE_TREE="sun50i-h5-orangepi-pc2"
 # CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set
 CONFIG_SPL=y
index c650ce87d9d873413a1467d88ad0c9caab1844b9..16a3929aa50e7872566ffd8882fc2b77386342e0 100644 (file)
@@ -2,7 +2,7 @@ CONFIG_ARM=y
 CONFIG_ARCH_SUNXI=y
 CONFIG_SPL_SPI_FLASH_SUPPORT=y
 CONFIG_MACH_SUN8I_H3=y
-CONFIG_DRAM_CLK=672
+CONFIG_DRAM_CLK=624
 CONFIG_DRAM_ZQ=3881979
 CONFIG_DRAM_ODT_EN=y
 # CONFIG_VIDEO_DE2 is not set
diff --git a/configs/pfla02_defconfig b/configs/pfla02_defconfig
new file mode 100644 (file)
index 0000000..bcd83ed
--- /dev/null
@@ -0,0 +1,55 @@
+CONFIG_ARM=y
+CONFIG_ARCH_MX6=y
+CONFIG_SPL_GPIO_SUPPORT=y
+CONFIG_SPL_LIBCOMMON_SUPPORT=y
+CONFIG_SPL_LIBGENERIC_SUPPORT=y
+CONFIG_TARGET_PFLA02=y
+CONFIG_SPL_MMC_SUPPORT=y
+CONFIG_SPL_SERIAL_SUPPORT=y
+CONFIG_SPL_LIBDISK_SUPPORT=y
+CONFIG_SPL_SPI_FLASH_SUPPORT=y
+CONFIG_SPL_SPI_SUPPORT=y
+CONFIG_SPL_WATCHDOG_SUPPORT=y
+CONFIG_CMD_HDMIDETECT=y
+CONFIG_FIT=y
+CONFIG_SYS_EXTRA_OPTIONS="IMX_CONFIG=arch/arm/mach-imx/spl_sd.cfg,MX6QDL"
+CONFIG_BOOTDELAY=3
+CONFIG_BOARD_EARLY_INIT_F=y
+CONFIG_SPL=y
+CONFIG_SPL_DMA_SUPPORT=y
+CONFIG_SPL_EXT_SUPPORT=y
+CONFIG_SPL_I2C_SUPPORT=y
+CONFIG_SPL_YMODEM_SUPPORT=y
+CONFIG_HUSH_PARSER=y
+CONFIG_CMD_BOOTZ=y
+# CONFIG_CMD_IMLS is not set
+# CONFIG_CMD_FLASH is not set
+CONFIG_CMD_GPIO=y
+CONFIG_CMD_I2C=y
+CONFIG_CMD_MMC=y
+CONFIG_CMD_SF=y
+CONFIG_CMD_DHCP=y
+CONFIG_CMD_MII=y
+CONFIG_CMD_PING=y
+CONFIG_CMD_CACHE=y
+CONFIG_CMD_EXT2=y
+CONFIG_CMD_EXT4=y
+CONFIG_CMD_EXT4_WRITE=y
+CONFIG_CMD_FAT=y
+CONFIG_CMD_FS_GENERIC=y
+CONFIG_CMD_UBI=y
+CONFIG_ISO_PARTITION=y
+CONFIG_EFI_PARTITION=y
+# CONFIG_PARTITION_UUIDS is not set
+# CONFIG_SPL_PARTITION_UUIDS is not set
+CONFIG_DM=y
+CONFIG_MTD=y
+CONFIG_SPI_FLASH=y
+CONFIG_SPI_FLASH_STMICRO=y
+CONFIG_PHYLIB=y
+CONFIG_PHY_MICREL=y
+CONFIG_PHY_MICREL_KSZ90X1=y
+CONFIG_NETDEVICES=y
+CONFIG_FEC_MXC=y
+CONFIG_DM_THERMAL=y
+CONFIG_OF_LIBFDT=y
index 6835cf1c5ce85712f44d01dcc9247ad4001cb768..426293493979958c2ff328ead448fb0616b3cbfa 100644 (file)
@@ -16,3 +16,4 @@ CONFIG_CMD_FAT=y
 CONFIG_MTD_NOR_FLASH=y
 CONFIG_SYS_NS16550=y
 CONFIG_LZMA=y
+CONFIG_ENV_IS_IN_FLASH=y
index 60bd6164fcebd7c4aa672832ce790f7a328661a0..60278358a9f693f380522e9e972efe0b54b9c90d 100644 (file)
@@ -17,3 +17,4 @@ CONFIG_CMD_FAT=y
 CONFIG_MTD_NOR_FLASH=y
 CONFIG_SYS_NS16550=y
 CONFIG_LZMA=y
+CONFIG_ENV_IS_IN_FLASH=y
index c6f08b4efb7c4318e93cb20b0c35fbdc8b49b235..cedb9060c5cce4fff0d2f4e2c27deed053d6f745 100644 (file)
@@ -14,3 +14,4 @@ CONFIG_CMD_FAT=y
 CONFIG_MTD_NOR_FLASH=y
 CONFIG_SYS_NS16550=y
 CONFIG_LZMA=y
+CONFIG_ENV_IS_IN_FLASH=y
index b8c206971d7f33f62708d798e6f35d0f0f4ade6a..5bb84da5ae308b841f465632a6f9c4b330f1b900 100644 (file)
@@ -15,3 +15,4 @@ CONFIG_CMD_FAT=y
 CONFIG_MTD_NOR_FLASH=y
 CONFIG_SYS_NS16550=y
 CONFIG_LZMA=y
+CONFIG_ENV_IS_IN_FLASH=y
index 6e967f5dd8264eb6c704fb5ee457c36d13d364f6..8b6b03ba32a7335cc5ff3dbfd34bd47e7ccdf0d2 100644 (file)
@@ -17,6 +17,7 @@ CONFIG_CMD_DHCP=y
 CONFIG_CMD_MII=y
 CONFIG_CMD_PING=y
 CONFIG_OF_CONTROL=y
+CONFIG_ENV_IS_IN_MMC=y
 CONFIG_CLK=y
 CONFIG_CLK_RENESAS=y
 CONFIG_SH_SDHI=y
index 62ec2a5d9478986aa4380d3406c1404ebf6aea01..bc995deea05841f3b1b21793f8a2ca121242c7a3 100644 (file)
@@ -18,6 +18,7 @@ CONFIG_CMD_DHCP=y
 CONFIG_CMD_MII=y
 CONFIG_CMD_PING=y
 CONFIG_OF_CONTROL=y
+CONFIG_ENV_IS_IN_MMC=y
 CONFIG_CLK=y
 CONFIG_CLK_RENESAS=y
 CONFIG_SH_SDHI=y
index d76aa903a8c6deba137d710e6be320fe566056bb..c67fdacc79257f12b64583de2bd845cb98445151 100644 (file)
@@ -455,7 +455,7 @@ int blk_get_device_part_str(const char *ifname, const char *dev_part_str,
        /* If no dev_part_str, use bootdevice environment variable */
        if (!dev_part_str || !strlen(dev_part_str) ||
            !strcmp(dev_part_str, "-"))
-               dev_part_str = getenv("bootdevice");
+               dev_part_str = env_get("bootdevice");
 
        /* If still no dev_part_str, it's an error */
        if (!dev_part_str) {
index 25fe56ce4242a8e6e48f42ce3b4e1839253d7bbb..f8dae008d74a8202d6cfcea56b0eba789ea3ead4 100644 (file)
@@ -132,7 +132,7 @@ struct rigid_disk_block *get_rdisk(struct blk_desc *dev_desc)
     int limit;
     char *s;
 
-    s = getenv("amiga_scanlimit");
+    s = env_get("amiga_scanlimit");
     if (s)
        limit = simple_strtoul(s, NULL, 10);
     else
@@ -172,7 +172,7 @@ struct bootcode_block *get_bootcode(struct blk_desc *dev_desc)
     int limit;
     char *s;
 
-    s = getenv("amiga_scanlimit");
+    s = env_get("amiga_scanlimit");
     if (s)
        limit = simple_strtoul(s, NULL, 10);
     else
index 50e4899787792246face19fcb4561afe0eafca1e..f9264859866c1ca57cd927b00d96e3960fbad756 100644 (file)
@@ -84,7 +84,7 @@ uchar enetaddr[6];
 eth_parse_enetaddr(addr, enetaddr);
 /* enetaddr now equals { 0x00, 0x11, 0x22, 0x33, 0x44, 0x55 } */
 
-       * int eth_getenv_enetaddr(char *name, uchar *enetaddr);
+       * int eth_env_get_enetaddr(char *name, uchar *enetaddr);
 
 Look up an environment variable and convert the stored address.  If the address
 is valid, then the function returns 1.  Otherwise, the function returns 0.  In
@@ -92,18 +92,18 @@ all cases, the enetaddr memory is initialized.  If the env var is not found,
 then it is set to all zeros.  The common function is_valid_ethaddr() is used
 to determine address validity.
 uchar enetaddr[6];
-if (!eth_getenv_enetaddr("ethaddr", enetaddr)) {
+if (!eth_env_get_enetaddr("ethaddr", enetaddr)) {
        /* "ethaddr" is not set in the environment */
        ... try and setup "ethaddr" in the env ...
 }
 /* enetaddr is now set to the value stored in the ethaddr env var */
 
-       * int eth_setenv_enetaddr(char *name, const uchar *enetaddr);
+       * int eth_env_set_enetaddr(char *name, const uchar *enetaddr);
 
 Store the MAC address into the named environment variable.  The return value is
-the same as the setenv() function.
+the same as the env_set() function.
 uchar enetaddr[6] = { 0x00, 0x11, 0x22, 0x33, 0x44, 0x55 };
-eth_setenv_enetaddr("ethaddr", enetaddr);
+eth_env_set_enetaddr("ethaddr", enetaddr);
 /* the "ethaddr" env var should now be set to "00:11:22:33:44:55" */
 
        * the %pM format modifier
index 2d6e8db126eabec07438111c65d0d0cac5531d68..c3618d3a596b624fb382fda0e134b0d663720468 100644 (file)
@@ -6,24 +6,25 @@
  */
 
 #include <common.h>
+#include <environment.h>
 
 void bootcount_store(ulong a)
 {
-       int upgrade_available = getenv_ulong("upgrade_available", 10, 0);
+       int upgrade_available = env_get_ulong("upgrade_available", 10, 0);
 
        if (upgrade_available) {
-               setenv_ulong("bootcount", a);
-               saveenv();
+               env_set_ulong("bootcount", a);
+               env_save();
        }
 }
 
 ulong bootcount_load(void)
 {
-       int upgrade_available = getenv_ulong("upgrade_available", 10, 0);
+       int upgrade_available = env_get_ulong("upgrade_available", 10, 0);
        ulong val = 0;
 
        if (upgrade_available)
-               val = getenv_ulong("bootcount", 10, 0);
+               val = env_get_ulong("bootcount", 10, 0);
 
        return val;
 }
index 3349fc5c3b5907a4195c74b539dbb3002614d4e2..058c9b9da8cbf663ee184862e15337b4ba425d63 100644 (file)
@@ -469,7 +469,7 @@ step2:
 #define CTLR_INTLV_MASK        0x20000000
        /* Perform build-in test on memory. Three-way interleaving is not yet
         * supported by this code. */
-       if (getenv_f("ddr_bist", buffer, CONFIG_SYS_CBSIZE) >= 0) {
+       if (env_get_f("ddr_bist", buffer, CONFIG_SYS_CBSIZE) >= 0) {
                puts("Running BIST test. This will take a while...");
                cs0_config = ddr_in32(&ddr->cs0_config);
                cs0_bnds = ddr_in32(&ddr->cs0_bnds);
index 653bbabc95623d96244c58aa1b47353ae2b43b3f..c99bd2fb6d014ffa306a42fc6f8c8c179a61bb18 100644 (file)
@@ -1861,7 +1861,7 @@ int fsl_ddr_interactive_env_var_exists(void)
 {
        char buffer[CONFIG_SYS_CBSIZE];
 
-       if (getenv_f("ddr_interactive", buffer, CONFIG_SYS_CBSIZE) >= 0)
+       if (env_get_f("ddr_interactive", buffer, CONFIG_SYS_CBSIZE) >= 0)
                return 1;
 
        return 0;
@@ -1891,11 +1891,11 @@ unsigned long long fsl_ddr_interactive(fsl_ddr_info_t *pinfo, int var_is_set)
        };
 
        if (var_is_set) {
-               if (getenv_f("ddr_interactive", buffer2, CONFIG_SYS_CBSIZE) > 0) {
+               if (env_get_f("ddr_interactive", buffer2,
+                             CONFIG_SYS_CBSIZE) > 0)
                        p = buffer2;
-               } else {
+               else
                        var_is_set = 0;
-               }
        }
 
        /*
index 20edd2dc28e54b48318af47e8cb9786daf483407..a7eaed1bd74e6c2b656e5cef9dd5afe635ed74e0 100644 (file)
@@ -18,7 +18,7 @@
  * Use our own stack based buffer before relocation to allow accessing longer
  * hwconfig strings that might be in the environment before we've relocated.
  * This is pretty fragile on both the use of stack and if the buffer is big
- * enough. However we will get a warning from getenv_f for the later.
+ * enough. However we will get a warning from env_get_f() for the latter.
  */
 
 /* Board-specific functions defined in each board's ddr.c */
@@ -755,7 +755,7 @@ unsigned int populate_memctl_options(const common_timing_params_t *common_dimm,
         * Extract hwconfig from environment since we have not properly setup
         * the environment but need it for ddr config params
         */
-       if (getenv_f("hwconfig", buffer, sizeof(buffer)) > 0)
+       if (env_get_f("hwconfig", buffer, sizeof(buffer)) > 0)
                buf = buffer;
 
 #if defined(CONFIG_SYS_FSL_DDR3) || \
@@ -1399,7 +1399,7 @@ int fsl_use_spd(void)
         * Extract hwconfig from environment since we have not properly setup
         * the environment but need it for ddr config params
         */
-       if (getenv_f("hwconfig", buffer, sizeof(buffer)) > 0)
+       if (env_get_f("hwconfig", buffer, sizeof(buffer)) > 0)
                buf = buffer;
 
        /* if hwconfig is not enabled, or "sdram" is not defined, use spd */
index f6281f4baad42aba448d55f05268fbd4a0524749..ff732ac309fe2aa1604652fbd43a4a2a3caffb0d 100644 (file)
@@ -62,7 +62,7 @@ int dfu_init_env_entities(char *interface, char *devstr)
 #ifdef CONFIG_SET_DFU_ALT_INFO
        set_dfu_alt_info(interface, devstr);
 #endif
-       str_env = getenv("dfu_alt_info");
+       str_env = env_get("dfu_alt_info");
        if (!str_env) {
                error("\"dfu_alt_info\" env variable not defined!\n");
                return -EINVAL;
@@ -101,7 +101,7 @@ unsigned char *dfu_get_buf(struct dfu_entity *dfu)
        if (dfu_buf != NULL)
                return dfu_buf;
 
-       s = getenv("dfu_bufsiz");
+       s = env_get("dfu_bufsiz");
        if (s)
                dfu_buf_size = (unsigned long)simple_strtol(s, NULL, 0);
 
@@ -123,7 +123,7 @@ static char *dfu_get_hash_algo(void)
 {
        char *s;
 
-       s = getenv("dfu_hash_algo");
+       s = env_get("dfu_hash_algo");
        if (!s)
                return NULL;
 
index bb23e7fdcb08e8f683e575d2264c994cef45cc50..39e10b1a5a67ea209af02245c7e5b2437af4905c 100644 (file)
@@ -161,7 +161,7 @@ static int mmc_file_op(enum dfu_op op, struct dfu_entity *dfu,
        }
 
        if (op != DFU_OP_WRITE) {
-               str_env = getenv("filesize");
+               str_env = env_get("filesize");
                if (str_env == NULL) {
                        puts("dfu: Wrong file size!\n");
                        return -1;
index 0fd25b17ec0878a0ebe06b0ecc4ff7348a3eba1a..18476e97d1886d8569e1343a1d9129c73835b4ce 100644 (file)
@@ -274,7 +274,7 @@ static int i8042_start(struct udevice *dev)
 
        /* Init keyboard device (default US layout) */
        keymap = KBD_US;
-       penv = getenv("keymap");
+       penv = env_get("keymap");
        if (penv != NULL) {
                if (strncmp(penv, "de", 3) == 0)
                        keymap = KBD_GER;
index 011667fedda4269a26dedfa8b1f83a9486086519..26da3a95ff02f1775be22f438a76355f277438e9 100644 (file)
@@ -652,7 +652,7 @@ int input_stdio_register(struct stdio_dev *dev)
        error = stdio_register(dev);
 
        /* check if this is the standard input device */
-       if (!error && strcmp(getenv("stdin"), dev->name) == 0) {
+       if (!error && strcmp(env_get("stdin"), dev->name) == 0) {
                /* reassign the console */
                if (OVERWRITE_CONSOLE ||
                                console_assign(stdin, dev->name))
index 048a51785ebcf6d1515fd38c7ea3d0648f502e5c..42bc2efd90d7820f29a3e321abbade99644510f5 100644 (file)
@@ -2353,7 +2353,7 @@ unsigned long flash_init (void)
 #ifdef CONFIG_SYS_FLASH_PROTECTION
        /* read environment from EEPROM */
        char s[64];
-       getenv_f("unlock", s, sizeof(s));
+       env_get_f("unlock", s, sizeof(s));
 #endif
 
 #ifdef CONFIG_CFI_FLASH /* for driver model */
index 2d2c318adfb3e3341307229c365fc94512c47c28..e961f518b085107e34636cb868f2316cc6508fdd 100644 (file)
@@ -155,7 +155,7 @@ int AT91F_DataflashInit (void)
        return found[0];
 }
 
-void AT91F_DataflashSetEnv (void)
+void AT91F_Dataflashenv_set(void)
 {
        int i, j;
        int part;
@@ -169,8 +169,9 @@ void AT91F_DataflashSetEnv (void)
                        /* Set the environment according to the label...*/
                        if((env & FLAG_SETENV) == FLAG_SETENV) {
                                start = dataflash_info[i].Device.area_list[j].start;
-                               sprintf((char*) s,"%lX",start);
-                               setenv((char*) area_list[part].label,(char*) s);
+                               sprintf((char *)s, "%lX", start);
+                               env_set((char *)area_list[part].label,
+                                       (char *)s);
                        }
                        part++;
                }
index bcddfa07556bb9f1bd68b6606f29d20e22b84375..e5c0e12faa392f0ffd0a2e0cdf593b266dda726a 100644 (file)
@@ -134,11 +134,17 @@ static int spi_dataflash_erase(struct udevice *dev, u32 offset, size_t len)
        debug("%s: erase addr=0x%x len 0x%x\n", dev->name, offset, len);
 
        div_u64_rem(len, spi_flash->page_size, &rem);
-       if (rem)
+       if (rem) {
+               printf("%s: len(0x%x) isn't the multiple of page size(0x%x)\n",
+                      dev->name, len, spi_flash->page_size);
                return -EINVAL;
+       }
        div_u64_rem(offset, spi_flash->page_size, &rem);
-       if (rem)
+       if (rem) {
+               printf("%s: offset(0x%x) isn't the multiple of page size(0x%x)\n",
+                      dev->name, offset, spi_flash->page_size);
                return -EINVAL;
+       }
 
        status = spi_claim_bus(spi);
        if (status) {
index 0034a28d5f36cc70086d8c476227c942ef07ba3b..34f68881ed78231decd515a3bb3a5ae463fd0159 100644 (file)
@@ -947,11 +947,25 @@ int spi_flash_scan(struct spi_flash *flash)
        if (IS_ERR_OR_NULL(info))
                return -ENOENT;
 
-       /* Flash powers up read-only, so clear BP# bits */
+       /*
+        * Flash powers up read-only, so clear BP# bits.
+        *
+        * Note on some flash (like Macronix), QE (quad enable) bit is in the
+        * same status register as BP# bits, and we need preserve its original
+        * value during a reboot cycle as this is required by some platforms
+        * (like Intel ICH SPI controller working under descriptor mode).
+        */
        if (JEDEC_MFR(info) == SPI_FLASH_CFI_MFR_ATMEL ||
-           JEDEC_MFR(info) == SPI_FLASH_CFI_MFR_MACRONIX ||
-           JEDEC_MFR(info) == SPI_FLASH_CFI_MFR_SST)
-               write_sr(flash, 0);
+          (JEDEC_MFR(info) == SPI_FLASH_CFI_MFR_SST) ||
+          (JEDEC_MFR(info) == SPI_FLASH_CFI_MFR_MACRONIX)) {
+               u8 sr = 0;
+
+               if (JEDEC_MFR(info) == SPI_FLASH_CFI_MFR_MACRONIX) {
+                       read_sr(flash, &sr);
+                       sr &= STATUS_QEB_MXIC;
+               }
+               write_sr(flash, sr);
+       }
 
        flash->name = info->name;
        flash->memory_map = spi->memory_map;
index edca94e30cf033544bd1513e2da50ef6c80c190a..c4ccf48af4a3163f466afff3c31c1b58961f41e3 100644 (file)
@@ -81,6 +81,7 @@ const struct spi_flash_info spi_flash_ids[] = {
        {"mx25l12805",     INFO(0xc22018, 0x0, 64 * 1024,   256, RD_FULL | WR_QPP) },
        {"mx25l25635f",    INFO(0xc22019, 0x0, 64 * 1024,   512, RD_FULL | WR_QPP) },
        {"mx25l51235f",    INFO(0xc2201a, 0x0, 64 * 1024,  1024, RD_FULL | WR_QPP) },
+       {"mx25u6435f",     INFO(0xc22537, 0x0, 64 * 1024,   128, RD_FULL | WR_QPP) },
        {"mx25l12855e",    INFO(0xc22618, 0x0, 64 * 1024,   256, RD_FULL | WR_QPP) },
        {"mx66u51235f",    INFO(0xc2253a, 0x0, 64 * 1024,  1024, RD_FULL | WR_QPP) },
        {"mx66l1g45g",     INFO(0xc2201b, 0x0, 64 * 1024,  2048, RD_FULL | WR_QPP) },
index 8245cf51cc9fcec32baa4abed1c1f6499754496a..f38f36beb15fb294a76fa2aabfb4ffac467ffda7 100644 (file)
@@ -750,7 +750,7 @@ static void update_srom(struct eth_device *dev, bd_t *bis)
        uchar enetaddr[6];
 
        /* Ethernet Addr... */
-       if (!eth_getenv_enetaddr("ethaddr", enetaddr))
+       if (!eth_env_get_enetaddr("ethaddr", enetaddr))
                return;
        eeprom[0x0a] = (enetaddr[1] << 8) | enetaddr[0];
        eeprom[0x0b] = (enetaddr[3] << 8) | enetaddr[2];
index 40be52070eae9c0dfa6e7537d163c6eed34cfa86..f16b2990d7ce4c56c6a45983cd7c5775bcbe670c 100644 (file)
@@ -985,9 +985,18 @@ static void fec_free_descs(struct fec_priv *fec)
        free(fec->tbd_base);
 }
 
+#ifdef CONFIG_DM_ETH
+struct mii_dev *fec_get_miibus(struct udevice *dev, int dev_id)
+#else
 struct mii_dev *fec_get_miibus(uint32_t base_addr, int dev_id)
+#endif
 {
+#ifdef CONFIG_DM_ETH
+       struct fec_priv *priv = dev_get_priv(dev);
+       struct ethernet_regs *eth = priv->eth;
+#else
        struct ethernet_regs *eth = (struct ethernet_regs *)base_addr;
+#endif
        struct mii_dev *bus;
        int ret;
 
@@ -1096,8 +1105,8 @@ static int fec_probe(bd_t *bd, int dev_id, uint32_t base_addr,
                        sprintf(mac, "eth%daddr", fec->dev_id);
                else
                        strcpy(mac, "ethaddr");
-               if (!getenv(mac))
-                       eth_setenv_enetaddr(mac, ethaddr);
+               if (!env_get(mac))
+                       eth_env_set_enetaddr(mac, ethaddr);
        }
        return ret;
 err4:
index 5aeeb872824826b4c5fb8a243487d604e1e6c453..3245bee473a1a3052b89ed03ac268ba1226ffe33 100644 (file)
@@ -97,7 +97,7 @@ phy_interface_t fman_port_enet_if(enum fm_port port)
                         * Extract hwconfig from environment since environment
                         * is not setup yet
                         */
-                       getenv_f("hwconfig", buffer, sizeof(buffer));
+                       env_get_f("hwconfig", buffer, sizeof(buffer));
                        buf = buffer;
 
                        /* check if XFI interface enable in hwconfig for 10g */
index 9918d8089a1fa993776ebcb14b849657fe922d98..5920fecea125d3c02b5115028d75f89b532256a3 100644 (file)
@@ -36,7 +36,7 @@ void fdt_fixup_fman_firmware(void *blob)
                return;
 
        /* If the environment variable is not set, then exit silently */
-       p = getenv("fman_ucode");
+       p = env_get("fman_ucode");
        if (!p)
                return;
 
index 9fe34ad4a98380708bb4e77b15c291440e235e80..451dfded77bf7562e69643d3639e22534a2b2beb 100644 (file)
@@ -418,7 +418,7 @@ int fm_init_common(int index, struct ccsr_fman *reg)
        rc = fman_upload_firmware(index, &reg->fm_imem, addr);
        if (rc)
                return rc;
-       setenv_addr("fman_ucode", addr);
+       env_set_addr("fman_ucode", addr);
 
        fm_init_muram(index, &reg->muram);
        fm_init_qmi(&reg->fm_qmi_common);
index 3a30c03b8530c2ac90383865f80480f90a73f507..bdb6792c72aa4ffce3bf7dea6e4f4338cb672e9d 100644 (file)
@@ -190,8 +190,8 @@ static int mc_fixup_mac_addr(void *blob, int nodeoffset,
        /* MAC address property present */
        if (fdt_get_property(blob, nodeoffset, propname, NULL)) {
                /* u-boot MAC addr randomly assigned - leave the present one */
-               if (!eth_getenv_enetaddr_by_index("eth", eth_dev->index,
-                                                 env_enetaddr))
+               if (!eth_env_get_enetaddr_by_index("eth", eth_dev->index,
+                                                  env_enetaddr))
                        return err;
        } else {
                size = MC_DT_INCREASE_SIZE + strlen(propname) + len;
@@ -530,7 +530,7 @@ static unsigned long get_mc_boot_timeout_ms(void)
 {
        unsigned long timeout_ms = CONFIG_SYS_LS_MC_BOOT_TIMEOUT_MS;
 
-       char *timeout_ms_env_var = getenv(MC_BOOT_TIMEOUT_ENV_VAR);
+       char *timeout_ms_env_var = env_get(MC_BOOT_TIMEOUT_ENV_VAR);
 
        if (timeout_ms_env_var) {
                timeout_ms = simple_strtoul(timeout_ms_env_var, NULL, 10);
@@ -815,7 +815,7 @@ unsigned long mc_get_dram_block_size(void)
 {
        unsigned long dram_block_size = CONFIG_SYS_LS_MC_DRAM_BLOCK_MIN_SIZE;
 
-       char *dram_block_size_env_var = getenv(MC_MEM_SIZE_ENV_VAR);
+       char *dram_block_size_env_var = env_get(MC_MEM_SIZE_ENV_VAR);
 
        if (dram_block_size_env_var) {
                dram_block_size = simple_strtoul(dram_block_size_env_var, NULL,
@@ -1518,7 +1518,7 @@ void mc_env_boot(void)
         * address info properly. Without MAC addresses, the MC code
         * can not properly initialize the DPC.
         */
-       mc_boot_env_var = getenv(MC_BOOT_ENV_VAR);
+       mc_boot_env_var = env_get(MC_BOOT_ENV_VAR);
        if (mc_boot_env_var)
                run_command_list(mc_boot_env_var, -1, 0);
 #endif /* CONFIG_FSL_MC_ENET */
index 628b420add8934bd96bde88036c9ee76d6aaabbd..26c714cc04d2d72afb95df4e400309a112d07cb0 100644 (file)
@@ -383,9 +383,9 @@ static int fec_init(struct eth_device *dev, bd_t * bd)
 
        /* Set station address   */
        if ((u32) fecp == CONFIG_SYS_FEC0_IOBASE)
-               eth_getenv_enetaddr("ethaddr", enetaddr);
+               eth_env_get_enetaddr("ethaddr", enetaddr);
        else
-               eth_getenv_enetaddr("eth1addr", enetaddr);
+               eth_env_get_enetaddr("eth1addr", enetaddr);
        fec_set_hwaddr(fecp, enetaddr);
 
        /* Set Opcode/Pause Duration Register */
index 5ccc4beda817891edf8fdc39f69711eb8b36f94a..d0939e93dc6f61020b4adc78e0fe87d0e0185045 100644 (file)
@@ -346,7 +346,7 @@ static void ftgmac100_set_mac(struct eth_device *dev,
 
 static void ftgmac100_set_mac_from_env(struct eth_device *dev)
 {
-       eth_getenv_enetaddr("ethaddr", dev->enetaddr);
+       eth_env_get_enetaddr("ethaddr", dev->enetaddr);
 
        ftgmac100_set_mac(dev, dev->enetaddr);
 }
index cd24a21f04f1e45c843222384a10a51ac2283d5b..f231e6b33bc97b4fe8fd85a1cd4d412e770a5b75 100644 (file)
@@ -355,7 +355,7 @@ static int ftmac100_free_pkt(struct udevice *dev, uchar *packet, int length)
 int ftmac100_read_rom_hwaddr(struct udevice *dev)
 {
        struct eth_pdata *pdata = dev_get_platdata(dev);
-       eth_getenv_enetaddr("ethaddr", pdata->enetaddr);
+       eth_env_get_enetaddr("ethaddr", pdata->enetaddr);
        return 0;
 }
 
index 3526876d1419cfb2bd2660f190306d90aa0798bf..a9fc74bdeebb3fd7ca867d398088b1bae0be2c4a 100644 (file)
@@ -704,13 +704,13 @@ static int smc_get_ethaddr(bd_t *bd, struct eth_device *dev)
 {
        uchar v_mac[6];
 
-       if (!eth_getenv_enetaddr("ethaddr", v_mac)) {
+       if (!eth_env_get_enetaddr("ethaddr", v_mac)) {
                /* get ROM mac value if any */
                if (!get_rom_mac(dev, v_mac)) {
                        printf("\n*** ERROR: ethaddr is NOT set !!\n");
                        return -1;
                }
-               eth_setenv_enetaddr("ethaddr", v_mac);
+               eth_env_set_enetaddr("ethaddr", v_mac);
        }
 
        smc_set_mac_addr(v_mac); /* use old function to update smc default */
index e1b06b25d7c01257c3a9cb169eb8bff1a359965e..39a67473209636d9b4da555ab3989b1addf5925b 100644 (file)
@@ -428,25 +428,25 @@ int fec_init(struct eth_device *dev, bd_t * bd)
        if ((u32) fecp == CONFIG_SYS_FEC0_IOBASE) {
 #ifdef CONFIG_SYS_FEC1_IOBASE
                volatile fec_t *fecp1 = (fec_t *) (CONFIG_SYS_FEC1_IOBASE);
-               eth_getenv_enetaddr("eth1addr", ea);
+               eth_env_get_enetaddr("eth1addr", ea);
                fecp1->palr =
                    (ea[0] << 24) | (ea[1] << 16) | (ea[2] << 8) | (ea[3]);
                fecp1->paur = (ea[4] << 24) | (ea[5] << 16);
 #endif
-               eth_getenv_enetaddr("ethaddr", ea);
+               eth_env_get_enetaddr("ethaddr", ea);
                fecp->palr =
                    (ea[0] << 24) | (ea[1] << 16) | (ea[2] << 8) | (ea[3]);
                fecp->paur = (ea[4] << 24) | (ea[5] << 16);
        } else {
 #ifdef CONFIG_SYS_FEC0_IOBASE
                volatile fec_t *fecp0 = (fec_t *) (CONFIG_SYS_FEC0_IOBASE);
-               eth_getenv_enetaddr("ethaddr", ea);
+               eth_env_get_enetaddr("ethaddr", ea);
                fecp0->palr =
                    (ea[0] << 24) | (ea[1] << 16) | (ea[2] << 8) | (ea[3]);
                fecp0->paur = (ea[4] << 24) | (ea[5] << 16);
 #endif
 #ifdef CONFIG_SYS_FEC1_IOBASE
-               eth_getenv_enetaddr("eth1addr", ea);
+               eth_env_get_enetaddr("eth1addr", ea);
                fecp->palr =
                    (ea[0] << 24) | (ea[1] << 16) | (ea[2] << 8) | (ea[3]);
                fecp->paur = (ea[4] << 24) | (ea[5] << 16);
index 377d87f04bb627f9cd5410c3acef96cb86b55e86..fb088e06a43b8690fdc5af65e80ef1d6b735f41c 100644 (file)
@@ -715,15 +715,15 @@ static int ne2k_setup_driver(struct eth_device *dev)
         * to the MAC address value in the environment, so we do not read
         * it from the prom or eeprom if it is specified in the environment.
         */
-       if (!eth_getenv_enetaddr("ethaddr", dev->enetaddr)) {
+       if (!eth_env_get_enetaddr("ethaddr", dev->enetaddr)) {
                /* If the MAC address is not in the environment, get it: */
                if (!get_prom(dev->enetaddr, nic.base)) /* get MAC from prom */
                        dp83902a_init(dev->enetaddr);   /* fallback: seeprom */
                /* And write it into the environment otherwise eth_write_hwaddr
-                * returns -1 due to eth_getenv_enetaddr_by_index() failing,
+                * returns -1 due to eth_env_get_enetaddr_by_index() failing,
                 * and this causes "Warning: failed to set MAC address", and
                 * cmd_bdinfo has no ethaddr value which it can show: */
-               eth_setenv_enetaddr("ethaddr", dev->enetaddr);
+               eth_env_set_enetaddr("ethaddr", dev->enetaddr);
        }
        return 0;
 }
index 350004757715011de9de0bb5b9176e36059dea1a..e9dbedf32680ec05143e63d70cfa335261fafbf2 100644 (file)
@@ -62,8 +62,8 @@ static int is_broadcast(struct in_addr ip)
 
        /* update only when the environment has changed */
        if (env_changed_id != env_id) {
-               netmask = getenv_ip("netmask");
-               our_ip = getenv_ip("ipaddr");
+               netmask = env_get_ip("netmask");
+               our_ip = env_get_ip("ipaddr");
 
                env_changed_id = env_id;
        }
@@ -82,11 +82,11 @@ static int refresh_settings_from_env(void)
 
        /* update only when the environment has changed */
        if (env_changed_id != env_id) {
-               if (getenv("ncip")) {
-                       nc_ip = getenv_ip("ncip");
+               if (env_get("ncip")) {
+                       nc_ip = env_get_ip("ncip");
                        if (!nc_ip.s_addr)
                                return -1;      /* ncip is 0.0.0.0 */
-                       p = strchr(getenv("ncip"), ':');
+                       p = strchr(env_get("ncip"), ':');
                        if (p != NULL) {
                                nc_out_port = simple_strtoul(p + 1, NULL, 10);
                                nc_in_port = nc_out_port;
@@ -95,10 +95,10 @@ static int refresh_settings_from_env(void)
                        nc_ip.s_addr = ~0; /* ncip is not set, so broadcast */
                }
 
-               p = getenv("ncoutport");
+               p = env_get("ncoutport");
                if (p != NULL)
                        nc_out_port = simple_strtoul(p, NULL, 10);
-               p = getenv("ncinport");
+               p = env_get("ncinport");
                if (p != NULL)
                        nc_in_port = simple_strtoul(p, NULL, 10);
 
index 20f8a551963cee8c4efc2c7c46fa97e244f6ec06..0bb99e6bc6ba4194558c195cbfadfb304ef4be35 100644 (file)
@@ -258,7 +258,7 @@ static int ksz9021_config(struct phy_device *phydev)
        if (ret)
                return ret;
 
-       if (getenv("disable_giga"))
+       if (env_get("disable_giga"))
                features &= ~(SUPPORTED_1000baseT_Half |
                SUPPORTED_1000baseT_Full);
        /* force master mode for 1000BaseT due to chip errata */
@@ -344,7 +344,7 @@ static int ksz9031_config(struct phy_device *phydev)
                return ret;
 
        /* add an option to disable the gigabit feature of this PHY */
-       if (getenv("disable_giga")) {
+       if (env_get("disable_giga")) {
                unsigned features;
                unsigned bmcr;
 
index f5fa0e8533b6b8acc207742d5324c68f0708cb32..590ae0c0fcdec98e6e245c16bd1e31011b26b929 100644 (file)
@@ -33,8 +33,8 @@ static int sb_eth_raw_start(struct udevice *dev)
 
        if (strcmp(interface, "lo") == 0) {
                priv->local = 1;
-               setenv("ipaddr", "127.0.0.1");
-               setenv("serverip", "127.0.0.1");
+               env_set("ipaddr", "127.0.0.1");
+               env_set("serverip", "127.0.0.1");
        }
        return sandbox_eth_raw_os_start(interface, pdata->enetaddr, priv);
 }
index a7c265b980a8da54743d740d9c386e8fa05a4a73..970d730e5622e3ba6554843c97806ec8d1146f34 100644 (file)
@@ -578,7 +578,7 @@ int sh_eth_initialize(bd_t *bd)
        if (retval < 0)
                return retval;
 
-       if (!eth_getenv_enetaddr("ethaddr", dev->enetaddr))
+       if (!eth_env_get_enetaddr("ethaddr", dev->enetaddr))
                puts("Please set MAC address\n");
 
        return ret;
index af20cf0f3e7db183f2333a894e9f082443a1c4c2..df76a9414455047c41768aae902f5f90138ce64a 100644 (file)
@@ -390,7 +390,7 @@ void fsl_pci_init(struct pci_controller *hose, struct fsl_pci_info *pci_info)
 
 #ifdef CONFIG_SRIO_PCIE_BOOT_MASTER
        /* boot from PCIE --master */
-       char *s = getenv("bootmaster");
+       char *s = env_get("bootmaster");
        char pcie[6];
        sprintf(pcie, "PCIE%d", pci_info->pci_num);
 
@@ -673,7 +673,7 @@ int fsl_pci_init_port(struct fsl_pci_info *pci_info,
 #ifdef CONFIG_SRIO_PCIE_BOOT_MASTER
        } else {
                /* boot from PCIE --master releases slave's core 0 */
-               char *s = getenv("bootmaster");
+               char *s = env_get("bootmaster");
                char pcie[6];
                sprintf(pcie, "PCIE%d", pci_info->pci_num);
 
index 6b36c187b522740e75efb7366330a974b2acf1fc..bbc7dab366d321bdeb4092a2a8be1922b1703efe 100644 (file)
@@ -427,7 +427,7 @@ int pci_hose_scan(struct pci_controller *hose)
 
        if (!gd->pcidelay_done) {
                /* wait "pcidelay" ms (if defined)... */
-               s = getenv("pcidelay");
+               s = env_get("pcidelay");
                if (s) {
                        int val = simple_strtoul(s, NULL, 10);
                        for (i = 0; i < val; i++)
@@ -459,7 +459,7 @@ void pci_init(void)
        hose_head = NULL;
 
        /* allow env to disable pci init/enum */
-       if (getenv("pcidisable") != NULL)
+       if (env_get("pcidisable") != NULL)
                return;
 
        /* now call board specific pci_init()... */
index 6526de80db89160bb51230c973e44b0113808a14..faf25d96cbcaa6a6cdb80c8bb11d487269fe8b9b 100644 (file)
@@ -89,7 +89,7 @@ __weak int pci_skip_dev(struct pci_controller *hose, pci_dev_t dev)
                /*
                 * Only skip configuration if "pciconfighost" is not set
                 */
-               if (getenv("pciconfighost") == NULL)
+               if (env_get("pciconfighost") == NULL)
                        return 1;
 #else
                return 1;
index 95083f0d7202e036d8c53757654e670709f45e27..2ddfd4ea5cbaa6b7b4dbfcb60fdb410c232500aa 100644 (file)
@@ -200,7 +200,7 @@ int rtc_set(struct rtc_time *tmp)
 void rtc_reset(void)
 {
        uchar *const data = rtc_validate();
-       char const *const s = getenv("rtccal");
+       char const *const s = env_get("rtccal");
 
        if (!data)
                return;
index f192ca597c61cbb2d8047b4a973f0530fa344007..1a65a3f9b943b58667da497b5b81526ced1c94e4 100644 (file)
@@ -682,7 +682,7 @@ int scsi_scan(bool verbose)
 
        printf("Found %d device(s).\n", scsi_max_devs);
 #ifndef CONFIG_SPL_BUILD
-       setenv_ulong("scsidevs", scsi_max_devs);
+       env_set_ulong("scsidevs", scsi_max_devs);
 #endif
        return 0;
 }
index 29799dce93a00fa1a547118fc16d493ad4323da7..353109c0700af1e66641bca0451685a7c66cc0a4 100644 (file)
@@ -526,9 +526,9 @@ int drv_usbtty_init (void)
        int snlen;
 
        /* Ger seiral number */
-       if (!(sn = getenv("serial#"))) {
+       sn = env_get("serial#");
+       if (!sn)
                sn = "000000000000";
-       }
        snlen = strlen(sn);
        if (snlen > sizeof(serial_number) - 1) {
                printf ("Warning: serial number %s is too long (%d > %lu)\n",
@@ -540,10 +540,9 @@ int drv_usbtty_init (void)
 
        /* Decide on which type of UDC device to be.
         */
-
-       if(!(tt = getenv("usbtty"))) {
+       tt = env_get("usbtty");
+       if (!tt)
                tt = "generic";
-       }
        usbtty_init_terminal_type(strcmp(tt,"cdc_acm"));
 
        /* prepare buffers... */
index 0db7a3b6c15566b65b4d7260603a30c59284b43f..a25f5019e8a70b482f9f3a6fe35e7340053bef2e 100644 (file)
@@ -601,7 +601,7 @@ void udc_setup_ep(struct usb_device_instance *device,
        if ((ep != 0) && (udc_device->device_state < STATE_ADDRESSED))
                return;
 
-       tt = getenv("usbtty");
+       tt = env_get("usbtty");
        if (!tt)
                tt = "generic";
 
index 4137d76c42afb29a95a29b66a49798e54322af64..2cf5c8d31e25acb1c8a557d8e38e2ec7e84fa1ad 100644 (file)
@@ -2384,12 +2384,12 @@ static int _usb_eth_init(struct ether_priv *priv)
        strlcpy(host_addr, CONFIG_USBNET_HOST_ADDR, sizeof(host_addr));
 #endif
        /* Check if the user overruled the MAC addresses */
-       if (getenv("usbnet_devaddr"))
-               strlcpy(dev_addr, getenv("usbnet_devaddr"),
+       if (env_get("usbnet_devaddr"))
+               strlcpy(dev_addr, env_get("usbnet_devaddr"),
                        sizeof(dev_addr));
 
-       if (getenv("usbnet_hostaddr"))
-               strlcpy(host_addr, getenv("usbnet_hostaddr"),
+       if (env_get("usbnet_hostaddr"))
+               strlcpy(host_addr, env_get("usbnet_hostaddr"),
                        sizeof(host_addr));
 
        if (!is_eth_addr_valid(dev_addr)) {
@@ -2420,8 +2420,8 @@ static int _usb_eth_init(struct ether_priv *priv)
        gadget = dev->gadget;
        usb_gadget_connect(gadget);
 
-       if (getenv("cdc_connect_timeout"))
-               timeout = simple_strtoul(getenv("cdc_connect_timeout"),
+       if (env_get("cdc_connect_timeout"))
+               timeout = simple_strtoul(env_get("cdc_connect_timeout"),
                                                NULL, 10) * CONFIG_SYS_HZ;
        ts = get_timer(0);
        while (!dev->network_started) {
@@ -2685,7 +2685,7 @@ static int usb_eth_probe(struct udevice *dev)
        l_priv = priv;
 
        get_ether_addr(CONFIG_USBNET_DEVADDR, pdata->enetaddr);
-       eth_setenv_enetaddr("usbnet_devaddr", pdata->enetaddr);
+       eth_env_set_enetaddr("usbnet_devaddr", pdata->enetaddr);
 
        return 0;
 }
index dfa435957793db6ec2783ad3776e69c5f94bbdbd..bc4be712da7f08ac8b8ba61692e5a6fc60983560 100644 (file)
@@ -725,7 +725,7 @@ static int dfu_bind(struct usb_configuration *c, struct usb_function *f)
 
        cdev->req->context = f_dfu;
 
-       s = getenv("serial#");
+       s = env_get("serial#");
        if (s)
                g_dnl_set_serialnumber((char *)s);
 
index 7cd6d24bf50ea5839d0af1fb17738c2df1ae5381..d05b74b2d2afe2270e77d532a5ab459e7b785b90 100644 (file)
@@ -212,7 +212,7 @@ static int fastboot_bind(struct usb_configuration *c, struct usb_function *f)
                f->hs_descriptors = fb_hs_function;
        }
 
-       s = getenv("serial#");
+       s = env_get("serial#");
        if (s)
                g_dnl_set_serialnumber((char *)s);
 
@@ -426,7 +426,7 @@ static void cb_getvar(struct usb_ep *ep, struct usb_request *req)
                sprintf(str_num, "0x%08x", CONFIG_FASTBOOT_BUF_SIZE);
                strncat(response, str_num, chars_left);
        } else if (!strcmp_l1("serialno", cmd)) {
-               s = getenv("serial#");
+               s = env_get("serial#");
                if (s)
                        strncat(response, s, chars_left);
                else
@@ -441,7 +441,7 @@ static void cb_getvar(struct usb_ep *ep, struct usb_request *req)
                }
 
                sprintf(envstr, "fastboot.%s", cmd);
-               s = getenv(envstr);
+               s = env_get(envstr);
                if (s) {
                        strncat(response, s, chars_left);
                } else {
index b57c6cd35ac36b003a1ba9b71c9d81c658fde880..62c431b99f7bb62eaf0a52f44cf97759be5c73b0 100644 (file)
@@ -225,7 +225,7 @@ static int ehci_fsl_init(int index, struct usb_ehci *ehci,
                                "phy_type", &len);
 #endif
        else
-               phy_type = getenv("usb_phy_type");
+               phy_type = env_get("usb_phy_type");
 
        if (!phy_type) {
 #ifdef CONFIG_SYS_FSL_USB_INTERNAL_UTMI_PHY
index 07a29eaba1c1841dfc5095026a8123a4f207b9ae..5b6c42291cb0c482a29f0b1afd05fe436cc358b5 100644 (file)
@@ -637,7 +637,8 @@ void *video_hw_init(void)
 
        videomode = CONFIG_SYS_DEFAULT_VIDEO_MODE;
        /* get video mode via environment */
-       if ((penv = getenv ("videomode")) != NULL) {
+       penv = env_get("videomode");
+       if (penv) {
                /* deceide if it is a string */
                if (penv[0] <= '9') {
                        videomode = (int) simple_strtoul (penv, NULL, 16);
index b6fc7e145b42cba79fa321d04ee09502361f1c43..6c5425c195e927d4594d6f4ccc97cbb56f88bbfa 100644 (file)
@@ -1856,7 +1856,7 @@ static void *video_logo(void)
        splash_get_pos(&video_logo_xpos, &video_logo_ypos);
 
 #ifdef CONFIG_SPLASH_SCREEN
-       s = getenv("splashimage");
+       s = env_get("splashimage");
        if (s != NULL) {
                ret = splash_screen_prepare();
                if (ret < 0)
index 1c74e97c5e9d955de8b21bf2cb99735f9a877231..e0565e1d2e51e67ebc96cb781f324e8a35e8ab10 100644 (file)
@@ -246,7 +246,8 @@ unsigned int card_init (void)
        tmp = 0;
        videomode = 0x310;
        /* get video mode via environment */
-       if ((penv = getenv ("videomode")) != NULL) {
+       penv = env_get("videomode");
+       if (penv) {
                /* decide if it is a string */
                if (penv[0] <= '9') {
                        videomode = (int) simple_strtoul (penv, NULL, 16);
index 51d06d6677a1757b5a2e2aa9ec582cbf0ef47966..78e595ea4a27460033200fb328dd8a55305a8718 100644 (file)
@@ -816,7 +816,7 @@ void *video_hw_init(void)
 
        videomode = CONFIG_SYS_DEFAULT_VIDEO_MODE;
        /* get video mode via environment */
-       penv = getenv("videomode");
+       penv = env_get("videomode");
        if (penv) {
                /* decide if it is a string */
                if (penv[0] <= '9') {
index 0ddce3db58bd1a4b7d1bac8d538c18a4527363a1..9d810bab31dee19a24241f9f75f78ad3e8686c07 100644 (file)
@@ -161,7 +161,7 @@ void *video_hw_init(void)
        puts("Video: ");
 
        /* Suck display configuration from "videomode" variable */
-       penv = getenv("videomode");
+       penv = env_get("videomode");
        if (!penv) {
                puts("MXSFB: 'videomode' variable not set!\n");
                return NULL;
index cf71ad120ecef3ab2fe49ff4fdb09db5123fdcae..6d96b33f20d0f2e532b77c70e0c177b663da9eaa 100644 (file)
@@ -165,7 +165,8 @@ int video_get_params (struct ctfb_res_modes *pPar, char *penv)
        /* first search for the environment containing the real param string */
        s = penv;
 
-       if ((p = getenv (s)) != NULL)
+       p = env_get(s);
+       if (p)
                s = p;
 
        /*
@@ -234,7 +235,7 @@ int video_get_params (struct ctfb_res_modes *pPar, char *penv)
 int video_get_video_mode(unsigned int *xres, unsigned int *yres,
        unsigned int *depth, unsigned int *freq, const char **options)
 {
-       char *p = getenv("video-mode");
+       char *p = env_get("video-mode");
        if (!p)
                return 0;
 
diff --git a/env/Kconfig b/env/Kconfig
new file mode 100644 (file)
index 0000000..748f534
--- /dev/null
@@ -0,0 +1,475 @@
+menu "Environment"
+
+choice
+       prompt "Select the location of the environment"
+       default ENV_IS_IN_MMC if ARCH_SUNXI
+       default ENV_IS_IN_FAT if ARCH_BCM283X
+       default ENV_IS_IN_MMC if ARCH_UNIPHIER
+       default ENV_IS_IN_MMC if ARCH_EXYNOS4
+       default ENV_IS_IN_MMC if MX6SX || MX7D
+       default ENV_IS_IN_FLASH if ARCH_CINTEGRATOR
+       default ENV_IS_IN_SPI_FLASH if ARMADA_XP
+       default ENV_IS_IN_MMC if TEGRA30 || TEGRA124
+       default ENV_IS_IN_MMC if TEGRA_ARMV8_COMMON
+       default ENV_IS_IN_FLASH if ARCH_INTEGRATOR_CP
+       default ENV_IS_IN_FLASH if M548x || M547x || M5282 || MCF547x_8x
+       default ENV_IS_IN_FLASH if MCF532x || MCF52x2
+       default ENV_IS_IN_FLASH if MPC86xx || MPC83xx
+       default ENV_IS_IN_FLASH if ARCH_MPC8572 || ARCH_MPC8548 || ARCH_MPC8641
+       default ENV_IS_IN_FLASH if SH && !CPU_SH4
+       default ENV_IS_IN_SPI_FLASH if INTEL_BAYTRAIL
+       default ENV_IS_IN_SPI_FLASH if INTEL_BROADWELL
+       default ENV_IS_IN_SPI_FLASH if NORTHBRIDGE_INTEL_IVYBRIDGE
+       default ENV_IS_IN_SPI_FLASH if INTEL_QUARK
+       default ENV_IS_IN_SPI_FLASH if INTEL_QUEENSBAY
+       default ENV_IS_IN_FAT if MMC_OMAP_HS && TI_COMMON_CMD_OPTIONS
+       default ENV_IS_NOWHERE
+       help
+         At present the environment can be stored in only one place. Use this
+         option to select the location. This is either a device (where the
+         environemnt information is simply written to a fixed location or
+         partition on the device) or a filesystem (where the environment
+         information is written to a file).
+
+config ENV_IS_NOWHERE
+       bool "Environment is not stored"
+       help
+         Define this if you don't want to or can't have an environment stored
+         on a storage medium. In this case the environemnt will still exist
+         while U-Boot is running, but once U-Boot exits it will not be
+         stored. U-Boot will therefore always start up with a default
+         environment.
+
+config ENV_IS_IN_DATAFLASH
+       bool "Environment in dataflash"
+       depends on !CHAIN_OF_TRUST
+       help
+         Define this if you have a DataFlash memory device which you
+         want to use for the environment.
+
+         - CONFIG_ENV_OFFSET:
+         - CONFIG_ENV_ADDR:
+         - CONFIG_ENV_SIZE:
+
+         These three #defines specify the offset and size of the
+         environment area within the total memory of your DataFlash placed
+         at the specified address.
+
+config ENV_IS_IN_EEPROM
+       bool "Environment in EEPROM"
+       depends on !CHAIN_OF_TRUST
+       help
+         Use this if you have an EEPROM or similar serial access
+         device and a driver for it.
+
+         - CONFIG_ENV_OFFSET:
+         - CONFIG_ENV_SIZE:
+
+         These two #defines specify the offset and size of the
+         environment area within the total memory of your EEPROM.
+
+         - CONFIG_SYS_I2C_EEPROM_ADDR:
+         If defined, specified the chip address of the EEPROM device.
+         The default address is zero.
+
+         - CONFIG_SYS_I2C_EEPROM_BUS:
+         If defined, specified the i2c bus of the EEPROM device.
+
+         - CONFIG_SYS_EEPROM_PAGE_WRITE_BITS:
+         If defined, the number of bits used to address bytes in a
+         single page in the EEPROM device.  A 64 byte page, for example
+         would require six bits.
+
+         - CONFIG_SYS_EEPROM_PAGE_WRITE_DELAY_MS:
+         If defined, the number of milliseconds to delay between
+         page writes.  The default is zero milliseconds.
+
+         - CONFIG_SYS_I2C_EEPROM_ADDR_LEN:
+         The length in bytes of the EEPROM memory array address.  Note
+         that this is NOT the chip address length!
+
+         - CONFIG_SYS_I2C_EEPROM_ADDR_OVERFLOW:
+         EEPROM chips that implement "address overflow" are ones
+         like Catalyst 24WC04/08/16 which has 9/10/11 bits of
+         address and the extra bits end up in the "chip address" bit
+         slots. This makes a 24WC08 (1Kbyte) chip look like four 256
+         byte chips.
+
+         Note that we consider the length of the address field to
+         still be one byte because the extra address bits are hidden
+         in the chip address.
+
+         - CONFIG_SYS_EEPROM_SIZE:
+         The size in bytes of the EEPROM device.
+
+         - CONFIG_ENV_EEPROM_IS_ON_I2C
+         define this, if you have I2C and SPI activated, and your
+         EEPROM, which holds the environment, is on the I2C bus.
+
+         - CONFIG_I2C_ENV_EEPROM_BUS
+         if you have an Environment on an EEPROM reached over
+         I2C muxes, you can define here, how to reach this
+         EEPROM. For example:
+
+         #define CONFIG_I2C_ENV_EEPROM_BUS       1
+
+         EEPROM which holds the environment, is reached over
+         a pca9547 i2c mux with address 0x70, channel 3.
+
+config ENV_IS_IN_FAT
+       bool "Environment is in a FAT filesystem"
+       depends on !CHAIN_OF_TRUST
+       select FAT_WRITE
+       help
+         Define this if you want to use the FAT file system for the environment.
+
+         - CONFIG_FAT_WRITE:
+         This must be enabled. Otherwise it cannot save the environment file.
+
+config ENV_IS_IN_FLASH
+       bool "Environment in flash memory"
+       depends on !CHAIN_OF_TRUST
+       help
+         Define this if you have a flash device which you want to use for the
+         environment.
+
+         a) The environment occupies one whole flash sector, which is
+          "embedded" in the text segment with the U-Boot code. This
+          happens usually with "bottom boot sector" or "top boot
+          sector" type flash chips, which have several smaller
+          sectors at the start or the end. For instance, such a
+          layout can have sector sizes of 8, 2x4, 16, Nx32 kB. In
+          such a case you would place the environment in one of the
+          4 kB sectors - with U-Boot code before and after it. With
+          "top boot sector" type flash chips, you would put the
+          environment in one of the last sectors, leaving a gap
+          between U-Boot and the environment.
+
+         CONFIG_ENV_OFFSET:
+
+          Offset of environment data (variable area) to the
+          beginning of flash memory; for instance, with bottom boot
+          type flash chips the second sector can be used: the offset
+          for this sector is given here.
+
+          CONFIG_ENV_OFFSET is used relative to CONFIG_SYS_FLASH_BASE.
+
+         CONFIG_ENV_ADDR:
+
+          This is just another way to specify the start address of
+          the flash sector containing the environment (instead of
+          CONFIG_ENV_OFFSET).
+
+         CONFIG_ENV_SECT_SIZE:
+
+          Size of the sector containing the environment.
+
+
+         b) Sometimes flash chips have few, equal sized, BIG sectors.
+          In such a case you don't want to spend a whole sector for
+          the environment.
+
+         CONFIG_ENV_SIZE:
+
+          If you use this in combination with CONFIG_ENV_IS_IN_FLASH
+          and CONFIG_ENV_SECT_SIZE, you can specify to use only a part
+          of this flash sector for the environment. This saves
+          memory for the RAM copy of the environment.
+
+          It may also save flash memory if you decide to use this
+          when your environment is "embedded" within U-Boot code,
+          since then the remainder of the flash sector could be used
+          for U-Boot code. It should be pointed out that this is
+          STRONGLY DISCOURAGED from a robustness point of view:
+          updating the environment in flash makes it always
+          necessary to erase the WHOLE sector. If something goes
+          wrong before the contents has been restored from a copy in
+          RAM, your target system will be dead.
+
+         CONFIG_ENV_ADDR_REDUND
+         CONFIG_ENV_SIZE_REDUND
+
+          These settings describe a second storage area used to hold
+          a redundant copy of the environment data, so that there is
+          a valid backup copy in case there is a power failure during
+          a "saveenv" operation.
+
+         BE CAREFUL! Any changes to the flash layout, and some changes to the
+         source code will make it necessary to adapt <board>/u-boot.lds*
+         accordingly!
+
+config ENV_IS_IN_MMC
+       bool "Environment in an MMC device"
+       depends on !CHAIN_OF_TRUST
+       help
+         Define this if you have an MMC device which you want to use for the
+         environment.
+
+         CONFIG_SYS_MMC_ENV_DEV:
+
+         Specifies which MMC device the environment is stored in.
+
+         CONFIG_SYS_MMC_ENV_PART (optional):
+
+         Specifies which MMC partition the environment is stored in. If not
+         set, defaults to partition 0, the user area. Common values might be
+         1 (first MMC boot partition), 2 (second MMC boot partition).
+
+         CONFIG_ENV_OFFSET:
+         CONFIG_ENV_SIZE:
+
+         These two #defines specify the offset and size of the environment
+         area within the specified MMC device.
+
+         If offset is positive (the usual case), it is treated as relative to
+         the start of the MMC partition. If offset is negative, it is treated
+         as relative to the end of the MMC partition. This can be useful if
+         your board may be fitted with different MMC devices, which have
+         different sizes for the MMC partitions, and you always want the
+         environment placed at the very end of the partition, to leave the
+         maximum possible space before it, to store other data.
+
+         These two values are in units of bytes, but must be aligned to an
+         MMC sector boundary.
+
+         CONFIG_ENV_OFFSET_REDUND (optional):
+
+         Specifies a second storage area, of CONFIG_ENV_SIZE size, used to
+         hold a redundant copy of the environment data. This provides a
+         valid backup copy in case the other copy is corrupted, e.g. due
+         to a power failure during a "saveenv" operation.
+
+         This value may also be positive or negative; this is handled in the
+         same way as CONFIG_ENV_OFFSET.
+
+         This value is also in units of bytes, but must also be aligned to
+         an MMC sector boundary.
+
+         CONFIG_ENV_SIZE_REDUND (optional):
+
+         This value need not be set, even when CONFIG_ENV_OFFSET_REDUND is
+         set. If this value is set, it must be set to the same value as
+         CONFIG_ENV_SIZE.
+
+config ENV_IS_IN_NAND
+       bool "Environment in a NAND device"
+       depends on !CHAIN_OF_TRUST
+       help
+         Define this if you have a NAND device which you want to use for the
+         environment.
+
+         - CONFIG_ENV_OFFSET:
+         - CONFIG_ENV_SIZE:
+
+         These two #defines specify the offset and size of the environment
+         area within the first NAND device.  CONFIG_ENV_OFFSET must be
+         aligned to an erase block boundary.
+
+         - CONFIG_ENV_OFFSET_REDUND (optional):
+
+         This setting describes a second storage area of CONFIG_ENV_SIZE
+         size used to hold a redundant copy of the environment data, so
+         that there is a valid backup copy in case there is a power failure
+         during a "saveenv" operation.  CONFIG_ENV_OFFSET_REDUND must be
+         aligned to an erase block boundary.
+
+         - CONFIG_ENV_RANGE (optional):
+
+         Specifies the length of the region in which the environment
+         can be written.  This should be a multiple of the NAND device's
+         block size.  Specifying a range with more erase blocks than
+         are needed to hold CONFIG_ENV_SIZE allows bad blocks within
+         the range to be avoided.
+
+         - CONFIG_ENV_OFFSET_OOB (optional):
+
+         Enables support for dynamically retrieving the offset of the
+         environment from block zero's out-of-band data.  The
+         "nand env.oob" command can be used to record this offset.
+         Currently, CONFIG_ENV_OFFSET_REDUND is not supported when
+         using CONFIG_ENV_OFFSET_OOB.
+
+config ENV_IS_IN_NVRAM
+       bool "Environment in a non-volatile RAM"
+       depends on !CHAIN_OF_TRUST
+       help
+         Define this if you have some non-volatile memory device
+         (NVRAM, battery buffered SRAM) which you want to use for the
+         environment.
+
+         - CONFIG_ENV_ADDR:
+         - CONFIG_ENV_SIZE:
+
+         These two #defines are used to determine the memory area you
+         want to use for environment. It is assumed that this memory
+         can just be read and written to, without any special
+         provision.
+
+config ENV_IS_IN_ONENAND
+       bool "Environment is in OneNAND"
+       depends on !CHAIN_OF_TRUST
+       help
+         Define this if you want to put your local device's environment in
+         OneNAND.
+
+         - CONFIG_ENV_ADDR:
+         - CONFIG_ENV_SIZE:
+
+         These two #defines are used to determine the device range you
+         want to use for environment. It is assumed that this memory
+         can just be read and written to, without any special
+         provision.
+
+config ENV_IS_IN_REMOTE
+       bool "Environment is in remove memory space"
+       depends on !CHAIN_OF_TRUST
+       help
+         Define this if you have a remote memory space which you
+         want to use for the local device's environment.
+
+         - CONFIG_ENV_ADDR:
+         - CONFIG_ENV_SIZE:
+
+         These two #defines specify the address and size of the
+         environment area within the remote memory space. The
+         local device can get the environment from remote memory
+         space by SRIO or PCIE links.
+
+config ENV_IS_IN_SPI_FLASH
+       bool "Environment is in SPI flash"
+       depends on !CHAIN_OF_TRUST
+       help
+         Define this if you have a SPI Flash memory device which you
+         want to use for the environment.
+
+         - CONFIG_ENV_OFFSET:
+         - CONFIG_ENV_SIZE:
+
+         These two #defines specify the offset and size of the
+         environment area within the SPI Flash. CONFIG_ENV_OFFSET must be
+         aligned to an erase sector boundary.
+
+         - CONFIG_ENV_SECT_SIZE:
+
+         Define the SPI flash's sector size.
+
+         - CONFIG_ENV_OFFSET_REDUND (optional):
+
+         This setting describes a second storage area of CONFIG_ENV_SIZE
+         size used to hold a redundant copy of the environment data, so
+         that there is a valid backup copy in case there is a power failure
+         during a "saveenv" operation. CONFIG_ENV_OFFSET_REDUND must be
+         aligned to an erase sector boundary.
+
+         - CONFIG_ENV_SPI_BUS (optional):
+         - CONFIG_ENV_SPI_CS (optional):
+
+         Define the SPI bus and chip select. If not defined they will be 0.
+
+         - CONFIG_ENV_SPI_MAX_HZ (optional):
+
+         Define the SPI max work clock. If not defined then use 1MHz.
+
+         - CONFIG_ENV_SPI_MODE (optional):
+
+         Define the SPI work mode. If not defined then use SPI_MODE_3.
+
+config ENV_IS_IN_UBI
+       bool "Environment in a UBI volume"
+       depends on !CHAIN_OF_TRUST
+       help
+         Define this if you have an UBI volume that you want to use for the
+         environment.  This has the benefit of wear-leveling the environment
+         accesses, which is important on NAND.
+
+         - CONFIG_ENV_UBI_PART:
+
+         Define this to a string that is the mtd partition containing the UBI.
+
+         - CONFIG_ENV_UBI_VOLUME:
+
+         Define this to the name of the volume that you want to store the
+         environment in.
+
+         - CONFIG_ENV_UBI_VOLUME_REDUND:
+
+         Define this to the name of another volume to store a second copy of
+         the environment in.  This will enable redundant environments in UBI.
+         It is assumed that both volumes are in the same MTD partition.
+
+         - CONFIG_UBI_SILENCE_MSG
+         - CONFIG_UBIFS_SILENCE_MSG
+
+         You will probably want to define these to avoid a really noisy system
+         when storing the env in UBI.
+
+endchoice
+
+config ENV_FAT_INTERFACE
+       string "Name of the block device for the environment"
+       depends on ENV_IS_IN_FAT
+       default "mmc" if TI_COMMON_CMD_OPTIONS || ARCH_ZYNQMP || ARCH_AT91
+       help
+         Define this to a string that is the name of the block device.
+
+config ENV_FAT_DEVICE_AND_PART
+       string "Device and partition for where to store the environemt in FAT"
+       depends on ENV_IS_IN_FAT
+       default "0:1" if TI_COMMON_CMD_OPTIONS
+       default "0:auto" if ARCH_ZYNQMP
+       default "0" if ARCH_AT91
+       help
+         Define this to a string to specify the partition of the device. It can
+         be as following:
+
+           "D:P", "D:0", "D", "D:" or "D:auto" (D, P are integers. And P >= 1)
+              - "D:P": device D partition P. Error occurs if device D has no
+                       partition table.
+              - "D:0": device D.
+              - "D" or "D:": device D partition 1 if device D has partition
+                             table, or the whole device D if has no partition
+                             table.
+              - "D:auto": first partition in device D with bootable flag set.
+                          If none, first valid partition in device D. If no
+                          partition table then means device D.
+
+config ENV_FAT_FILE
+       string "Name of the FAT file to use for the environemnt"
+       depends on ENV_IS_IN_FAT
+       default "uboot.env"
+       help
+         It's a string of the FAT file name. This file use to store the
+         environment.
+
+if ARCH_SUNXI
+
+config ENV_OFFSET
+       hex "Environment Offset"
+       depends on !ENV_IS_IN_UBI
+       depends on !ENV_IS_NOWHERE
+       default 0x88000 if ARCH_SUNXI
+       help
+         Offset from the start of the device (or partition)
+
+config ENV_SIZE
+       hex "Environment Size"
+       depends on !ENV_IS_NOWHERE
+       default 0x20000 if ARCH_SUNXI
+       help
+         Size of the environment storage area
+
+config ENV_UBI_PART
+       string "UBI partition name"
+       depends on ENV_IS_IN_UBI
+       help
+         MTD partition containing the UBI device
+
+config ENV_UBI_VOLUME
+       string "UBI volume name"
+       depends on ENV_IS_IN_UBI
+       help
+         Name of the volume that you want to store the environment in.
+
+endif
+
+endmenu
diff --git a/env/Makefile b/env/Makefile
new file mode 100644 (file)
index 0000000..8df5b9d
--- /dev/null
@@ -0,0 +1,57 @@
+#
+# (C) Copyright 2004-2006
+# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
+#
+# SPDX-License-Identifier:     GPL-2.0+
+#
+
+obj-y += common.o env.o
+
+ifndef CONFIG_SPL_BUILD
+obj-y += attr.o
+obj-y += callback.o
+obj-y += flags.o
+obj-$(CONFIG_ENV_IS_IN_DATAFLASH) += dataflash.o
+obj-$(CONFIG_ENV_IS_IN_EEPROM) += eeprom.o
+extra-$(CONFIG_ENV_IS_EMBEDDED) += embedded.o
+obj-$(CONFIG_ENV_IS_IN_EEPROM) += embedded.o
+extra-$(CONFIG_ENV_IS_IN_FLASH) += embedded.o
+obj-$(CONFIG_ENV_IS_IN_NVRAM) += embedded.o
+obj-$(CONFIG_ENV_IS_IN_FLASH) += flash.o
+obj-$(CONFIG_ENV_IS_IN_MMC) += mmc.o
+obj-$(CONFIG_ENV_IS_IN_FAT) += fat.o
+obj-$(CONFIG_ENV_IS_IN_EXT4) += ext4.o
+obj-$(CONFIG_ENV_IS_IN_NAND) += nand.o
+obj-$(CONFIG_ENV_IS_IN_NVRAM) += nvram.o
+obj-$(CONFIG_ENV_IS_IN_ONENAND) += onenand.o
+obj-$(CONFIG_ENV_IS_IN_SATA) += sata.o
+obj-$(CONFIG_ENV_IS_IN_SPI_FLASH) += sf.o
+obj-$(CONFIG_ENV_IS_IN_REMOTE) += remote.o
+obj-$(CONFIG_ENV_IS_IN_UBI) += ubi.o
+obj-$(CONFIG_ENV_IS_NOWHERE) += nowhere.o
+endif
+
+ifdef CONFIG_SPL_BUILD
+obj-$(CONFIG_ENV_IS_IN_FLASH) += flash.o
+# environment
+ifdef CONFIG_TPL_BUILD
+obj-$(CONFIG_TPL_ENV_SUPPORT) += attr.o
+obj-$(CONFIG_TPL_ENV_SUPPORT) += flags.o
+obj-$(CONFIG_TPL_ENV_SUPPORT) += callback.o
+else
+obj-$(CONFIG_SPL_ENV_SUPPORT) += attr.o
+obj-$(CONFIG_SPL_ENV_SUPPORT) += flags.o
+obj-$(CONFIG_SPL_ENV_SUPPORT) += callback.o
+endif
+ifneq ($(CONFIG_TPL_ENV_SUPPORT)$(CONFIG_SPL_ENV_SUPPORT),)
+obj-$(CONFIG_ENV_IS_NOWHERE) += nowhere.o
+obj-$(CONFIG_ENV_IS_IN_MMC) += mmc.o
+obj-$(CONFIG_ENV_IS_IN_FAT) += fat.o
+obj-$(CONFIG_ENV_IS_IN_EXT4) += ext4.o
+obj-$(CONFIG_ENV_IS_IN_NAND) += nand.o
+obj-$(CONFIG_ENV_IS_IN_SPI_FLASH) += sf.o
+obj-$(CONFIG_ENV_IS_IN_FLASH) += flash.o
+endif
+endif
+
+CFLAGS_embedded.o := -Wa,--no-warn -DENV_CRC=$(shell tools/envcrc 2>/dev/null)
similarity index 100%
rename from common/env_attr.c
rename to env/attr.c
similarity index 98%
rename from common/env_callback.c
rename to env/callback.c
index 1957cc199648b715a0d7ef81fe614fa775a590db..be70980f04e46c8efac81a6dbbbdaba7a1f8abfe 100644 (file)
@@ -51,7 +51,7 @@ void env_callback_init(ENTRY *var_entry)
        int ret = 1;
 
        if (first_call) {
-               callback_list = getenv(ENV_CALLBACK_VAR);
+               callback_list = env_get(ENV_CALLBACK_VAR);
                first_call = 0;
        }
 
similarity index 89%
rename from common/env_common.c
rename to env/common.c
index d9c0c4e3f347453e704d0682df743349009bdb47..688d5ab4c8985434288bc090d5797b95462eb96d 100644 (file)
@@ -27,49 +27,13 @@ struct hsearch_data env_htab = {
        .change_ok = env_flags_validate,
 };
 
-__weak uchar env_get_char_spec(int index)
-{
-       return *((uchar *)(gd->env_addr + index));
-}
-
-static uchar env_get_char_init(int index)
-{
-       /* if crc was bad, use the default environment */
-       if (gd->env_valid)
-               return env_get_char_spec(index);
-       else
-               return default_environment[index];
-}
-
-uchar env_get_char_memory(int index)
-{
-       return *env_get_addr(index);
-}
-
-uchar env_get_char(int index)
-{
-       /* if relocated to RAM */
-       if (gd->flags & GD_FLG_RELOC)
-               return env_get_char_memory(index);
-       else
-               return env_get_char_init(index);
-}
-
-const uchar *env_get_addr(int index)
-{
-       if (gd->env_valid)
-               return (uchar *)(gd->env_addr + index);
-       else
-               return &default_environment[index];
-}
-
 /*
  * Read an environment variable as a boolean
  * Return -1 if variable does not exist (default to true)
  */
-int getenv_yesno(const char *var)
+int env_get_yesno(const char *var)
 {
-       char *s = getenv(var);
+       char *s = env_get(var);
 
        if (s == NULL)
                return -1;
@@ -80,7 +44,7 @@ int getenv_yesno(const char *var)
 /*
  * Look up the variable from the default environment
  */
-char *getenv_default(const char *name)
+char *env_get_default(const char *name)
 {
        char *ret_val;
        unsigned long really_valid = gd->env_valid;
@@ -89,7 +53,7 @@ char *getenv_default(const char *name)
        /* Pretend that the image is bad. */
        gd->flags &= ~GD_FLG_ENV_READY;
        gd->env_valid = 0;
-       ret_val = getenv(name);
+       ret_val = env_get(name);
        gd->env_valid = really_valid;
        gd->flags = real_gd_flags;
        return ret_val;
@@ -316,7 +280,7 @@ void env_relocate(void)
                set_default_env("!bad CRC");
 #endif
        } else {
-               env_relocate_spec();
+               env_load();
        }
 }
 
similarity index 75%
rename from common/env_dataflash.c
rename to env/dataflash.c
index 034e3231693e3b751dc41f6e181a9672f03d6540..77bc595e0debc4c65a4518900237d80022166731 100644 (file)
 
 DECLARE_GLOBAL_DATA_PTR;
 
-env_t *env_ptr;
-
-char *env_name_spec = "dataflash";
-
-uchar env_get_char_spec(int index)
+static int env_dataflash_get_char(int index)
 {
        uchar c;
 
@@ -27,7 +23,7 @@ uchar env_get_char_spec(int index)
        return c;
 }
 
-void env_relocate_spec(void)
+static int env_dataflash_load(void)
 {
        ulong crc, new = 0;
        unsigned off;
@@ -48,13 +44,15 @@ void env_relocate_spec(void)
                env_import(buf, 1);
        else
                set_default_env("!bad CRC");
+
+       return 0;
 }
 
 #ifdef CONFIG_ENV_OFFSET_REDUND
 #error No support for redundant environment on dataflash yet!
 #endif
 
-int saveenv(void)
+static int env_dataflash_save(void)
 {
        env_t env_new;
        int ret;
@@ -68,17 +66,10 @@ int saveenv(void)
                                CONFIG_ENV_SIZE);
 }
 
-/*
- * Initialize environment use
- *
- * We are still running from ROM, so data use is limited.
- * Use a (moderately small) buffer on the stack
- */
-int env_init(void)
-{
-       /* use default */
-       gd->env_addr = (ulong)&default_environment[0];
-       gd->env_valid = 1;
-
-       return 0;
-}
+U_BOOT_ENV_LOCATION(dataflash) = {
+       .location       = ENVL_DATAFLASH,
+       ENV_NAME("dataflash")
+       .get_char       = env_dataflash_get_char,
+       .load           = env_dataflash_load,
+       .save           = env_save_ptr(env_dataflash_save),
+};
similarity index 86%
rename from common/env_eeprom.c
rename to env/eeprom.c
index 5f63a6cd4a98d71f9b10a924da02000e87667ed1..08ef6307fc5c672ed7a814757cd7bef090b97361 100644 (file)
 
 DECLARE_GLOBAL_DATA_PTR;
 
-env_t *env_ptr;
-
-char *env_name_spec = "EEPROM";
-
 static int eeprom_bus_read(unsigned dev_addr, unsigned offset,
                           uchar *buffer, unsigned cnt)
 {
@@ -65,13 +61,13 @@ static int eeprom_bus_write(unsigned dev_addr, unsigned offset,
        return rcode;
 }
 
-uchar env_get_char_spec(int index)
+static int env_eeprom_get_char(int index)
 {
        uchar c;
        unsigned int off = CONFIG_ENV_OFFSET;
 
 #ifdef CONFIG_ENV_OFFSET_REDUND
-       if (gd->env_valid == 2)
+       if (gd->env_valid == ENV_REDUND)
                off = CONFIG_ENV_OFFSET_REDUND;
 #endif
        eeprom_bus_read(CONFIG_SYS_DEF_EEPROM_ADDR,
@@ -80,7 +76,7 @@ uchar env_get_char_spec(int index)
        return c;
 }
 
-void env_relocate_spec(void)
+static int env_eeprom_load(void)
 {
        char buf_env[CONFIG_ENV_SIZE];
        unsigned int off = CONFIG_ENV_OFFSET;
@@ -128,21 +124,21 @@ void env_relocate_spec(void)
                gd->env_addr    = 0;
                gd->env_valid   = 0;
        } else if (crc_ok[0] && !crc_ok[1]) {
-               gd->env_valid = 1;
+               gd->env_valid = ENV_VALID;
        } else if (!crc_ok[0] && crc_ok[1]) {
-               gd->env_valid = 2;
+               gd->env_valid = ENV_REDUND;
        } else {
                /* both ok - check serial */
                if (flags[0] == ACTIVE_FLAG && flags[1] == OBSOLETE_FLAG)
-                       gd->env_valid = 1;
+                       gd->env_valid = ENV_VALID;
                else if (flags[0] == OBSOLETE_FLAG && flags[1] == ACTIVE_FLAG)
-                       gd->env_valid = 2;
+                       gd->env_valid = ENV_REDUND;
                else if (flags[0] == 0xFF && flags[1] == 0)
-                       gd->env_valid = 2;
+                       gd->env_valid = ENV_REDUND;
                else if (flags[1] == 0xFF && flags[0] == 0)
-                       gd->env_valid = 1;
+                       gd->env_valid = ENV_VALID;
                else /* flags are equal - almost impossible */
-                       gd->env_valid = 1;
+                       gd->env_valid = ENV_VALID;
        }
 
 #else /* CONFIG_ENV_OFFSET_REDUND */
@@ -170,7 +166,7 @@ void env_relocate_spec(void)
        }
 
        if (crc == new) {
-               gd->env_valid   = 1;
+               gd->env_valid   = ENV_VALID;
        } else {
                gd->env_valid   = 0;
        }
@@ -178,7 +174,7 @@ void env_relocate_spec(void)
 
        off = CONFIG_ENV_OFFSET;
 #ifdef CONFIG_ENV_OFFSET_REDUND
-       if (gd->env_valid == 2)
+       if (gd->env_valid == ENV_REDUND)
                off = CONFIG_ENV_OFFSET_REDUND;
 #endif
 
@@ -186,9 +182,11 @@ void env_relocate_spec(void)
                off, (uchar *)buf_env, CONFIG_ENV_SIZE);
 
        env_import(buf_env, 1);
+
+       return 0;
 }
 
-int saveenv(void)
+static int env_eeprom_save(void)
 {
        env_t   env_new;
        int     rc;
@@ -198,14 +196,12 @@ int saveenv(void)
        char flag_obsolete      = OBSOLETE_FLAG;
 #endif
 
-       BUG_ON(env_ptr != NULL);
-
        rc = env_export(&env_new);
        if (rc)
                return rc;
 
 #ifdef CONFIG_ENV_OFFSET_REDUND
-       if (gd->env_valid == 1) {
+       if (gd->env_valid == ENV_VALID) {
                off     = CONFIG_ENV_OFFSET_REDUND;
                off_red = CONFIG_ENV_OFFSET;
        }
@@ -222,24 +218,19 @@ int saveenv(void)
                                 off_red + offsetof(env_t, flags),
                                 (uchar *)&flag_obsolete, 1);
 
-               if (gd->env_valid == 1)
-                       gd->env_valid = 2;
+               if (gd->env_valid == ENV_VALID)
+                       gd->env_valid = ENV_REDUND;
                else
-                       gd->env_valid = 1;
+                       gd->env_valid = ENV_VALID;
        }
 #endif
        return rc;
 }
 
-/*
- * Initialize Environment use
- *
- * We are still running from ROM, so data use is limited.
- * Use a (moderately small) buffer on the stack
- */
-int env_init(void)
-{
-       gd->env_addr = (ulong)&default_environment[0];
-       gd->env_valid = 1;
-       return 0;
-}
+U_BOOT_ENV_LOCATION(eeprom) = {
+       .location       = ENVL_EEPROM,
+       ENV_NAME("EEPROM")
+       .get_char       = env_eeprom_get_char,
+       .load           = env_eeprom_load,
+       .save           = env_save_ptr(env_eeprom_save),
+};
similarity index 100%
rename from common/env_embedded.c
rename to env/embedded.c
diff --git a/env/env.c b/env/env.c
new file mode 100644 (file)
index 0000000..2b8b961
--- /dev/null
+++ b/env/env.c
@@ -0,0 +1,151 @@
+/*
+ * Copyright (C) 2017 Google, Inc
+ * Written by Simon Glass <sjg@chromium.org>
+ *
+ * SPDX-License-Identifier:     GPL-2.0+
+ */
+
+#include <common.h>
+#include <environment.h>
+
+DECLARE_GLOBAL_DATA_PTR;
+
+static struct env_driver *env_driver_lookup(enum env_location loc)
+{
+       struct env_driver *drv;
+       const int n_ents = ll_entry_count(struct env_driver, env_driver);
+       struct env_driver *entry;
+
+       drv = ll_entry_start(struct env_driver, env_driver);
+       for (entry = drv; entry != drv + n_ents; entry++) {
+               if (loc == entry->location)
+                       return entry;
+       }
+
+       /* Not found */
+       return NULL;
+}
+
+static enum env_location env_get_default_location(void)
+{
+       if IS_ENABLED(CONFIG_ENV_IS_IN_DATAFLASH)
+               return ENVL_DATAFLASH;
+       else if IS_ENABLED(CONFIG_ENV_IS_IN_EEPROM)
+               return ENVL_EEPROM;
+       else if IS_ENABLED(CONFIG_ENV_IS_IN_FAT)
+               return ENVL_FAT;
+       else if IS_ENABLED(CONFIG_ENV_IS_IN_FLASH)
+               return ENVL_FLASH;
+       else if IS_ENABLED(CONFIG_ENV_IS_IN_MMC)
+               return ENVL_MMC;
+       else if IS_ENABLED(CONFIG_ENV_IS_IN_NAND)
+               return ENVL_NAND;
+       else if IS_ENABLED(CONFIG_ENV_IS_IN_NVRAM)
+               return ENVL_NVRAM;
+       else if IS_ENABLED(CONFIG_ENV_IS_IN_REMOTE)
+               return ENVL_REMOTE;
+       else if IS_ENABLED(CONFIG_ENV_IS_IN_SPI_FLASH)
+               return ENVL_SPI_FLASH;
+       else if IS_ENABLED(CONFIG_ENV_IS_IN_UBI)
+               return ENVL_UBI;
+       else if IS_ENABLED(CONFIG_ENV_IS_NOWHERE)
+               return ENVL_NOWHERE;
+       else
+               return ENVL_UNKNOWN;
+}
+
+struct env_driver *env_driver_lookup_default(void)
+{
+       enum env_location loc = env_get_default_location();
+       struct env_driver *drv;
+
+       drv = env_driver_lookup(loc);
+       if (!drv) {
+               debug("%s: No environment driver for location %d\n", __func__,
+                     loc);
+               return NULL;
+       }
+
+       return drv;
+}
+
+int env_get_char(int index)
+{
+       struct env_driver *drv = env_driver_lookup_default();
+       int ret;
+
+       if (!gd->env_valid)
+               return default_environment[index];
+       if (!drv)
+               return -ENODEV;
+       if (!drv->get_char)
+               return *(uchar *)(gd->env_addr + index);
+       ret = drv->get_char(index);
+       if (ret < 0) {
+               debug("%s: Environment failed to load (err=%d)\n",
+                     __func__, ret);
+       }
+
+       return ret;
+}
+
+int env_load(void)
+{
+       struct env_driver *drv = env_driver_lookup_default();
+       int ret = 0;
+
+       if (!drv)
+               return -ENODEV;
+       if (!drv->load)
+               return 0;
+       drv->load();  /* TODO(sjg@chromium.org): Make this return an error */
+       if (ret) {
+               debug("%s: Environment failed to load (err=%d)\n", __func__,
+                     ret);
+               return ret;
+       }
+
+       return 0;
+}
+
+int env_save(void)
+{
+       struct env_driver *drv = env_driver_lookup_default();
+       int ret;
+
+       if (!drv)
+               return -ENODEV;
+       if (!drv->save)
+               return -ENOSYS;
+       ret = drv->save();
+       if (ret) {
+               debug("%s: Environment failed to save (err=%d)\n", __func__,
+                     ret);
+               return ret;
+       }
+
+       return 0;
+}
+
+int env_init(void)
+{
+       struct env_driver *drv = env_driver_lookup_default();
+       int ret = -ENOENT;
+
+       if (!drv)
+               return -ENODEV;
+       if (drv->init)
+               ret = drv->init();
+       if (ret == -ENOENT) {
+               gd->env_addr = (ulong)&default_environment[0];
+               gd->env_valid = 0;
+
+               return 0;
+       } else if (ret) {
+               debug("%s: Environment failed to init (err=%d)\n", __func__,
+                     ret);
+               return ret;
+       }
+
+       return 0;
+}
similarity index 91%
rename from common/env_ext4.c
rename to env/ext4.c
index adefa7dc991ee5f7cd4f415cd79223803bf38a16..65202213d3a80328f1117e5153c6178cc957ca8e 100644 (file)
 #include <ext4fs.h>
 #include <mmc.h>
 
-char *env_name_spec = "EXT4";
-
-env_t *env_ptr;
-
 DECLARE_GLOBAL_DATA_PTR;
 
-int env_init(void)
-{
-       /* use default */
-       gd->env_addr = (ulong)&default_environment[0];
-       gd->env_valid = 1;
-
-       return 0;
-}
-
 #ifdef CONFIG_CMD_SAVEENV
-int saveenv(void)
+static int env_ext4_save(void)
 {
        env_t   env_new;
        struct blk_desc *dev_desc = NULL;
@@ -88,7 +75,7 @@ int saveenv(void)
 }
 #endif /* CONFIG_CMD_SAVEENV */
 
-void env_relocate_spec(void)
+static int env_ext4_load(void)
 {
        ALLOC_CACHE_ALIGN_BUFFER(char, buf, CONFIG_ENV_SIZE);
        struct blk_desc *dev_desc = NULL;
@@ -122,8 +109,17 @@ void env_relocate_spec(void)
        }
 
        env_import(buf, 1);
-       return;
+       return 0;
 
 err_env_relocate:
        set_default_env(NULL);
+
+       return -EIO;
 }
+
+U_BOOT_ENV_LOCATION(ext4) = {
+       .location       = ENVL_EXT4,
+       ENV_NAME("EXT4")
+       .load           = env_ext4_load,
+       .save           = env_save_ptr(env_ext4_save),
+};
similarity index 76%
rename from common/env_fat.c
rename to env/fat.c
index b51c920cd45fdc01cda9d5ad353c184b73f8e395..ec49c39053691a5d6638fc64af2e9caf910ca5ea 100644 (file)
+++ b/env/fat.c
 #include <fat.h>
 #include <mmc.h>
 
-char *env_name_spec = "FAT";
-
-env_t *env_ptr;
+#ifdef CONFIG_SPL_BUILD
+/* TODO(sjg@chromium.org): Figure out why this is needed */
+# if !defined(CONFIG_TARGET_AM335X_EVM) || defined(CONFIG_SPL_OS_BOOT)
+#  define LOADENV
+# endif
+#else
+# define LOADENV
+# if defined(CONFIG_CMD_SAVEENV)
+#  define CMD_SAVEENV
+# endif
+#endif
 
 DECLARE_GLOBAL_DATA_PTR;
 
-int env_init(void)
-{
-       /* use default */
-       gd->env_addr = (ulong)&default_environment[0];
-       gd->env_valid = 1;
-
-       return 0;
-}
-
-#ifdef CONFIG_CMD_SAVEENV
-int saveenv(void)
+#ifdef CMD_SAVEENV
+static int env_fat_save(void)
 {
        env_t   env_new;
        struct blk_desc *dev_desc = NULL;
@@ -72,9 +71,10 @@ int saveenv(void)
        puts("done\n");
        return 0;
 }
-#endif /* CONFIG_CMD_SAVEENV */
+#endif /* CMD_SAVEENV */
 
-void env_relocate_spec(void)
+#ifdef LOADENV
+static int env_fat_load(void)
 {
        ALLOC_CACHE_ALIGN_BUFFER(char, buf, CONFIG_ENV_SIZE);
        struct blk_desc *dev_desc = NULL;
@@ -103,8 +103,22 @@ void env_relocate_spec(void)
        }
 
        env_import(buf, 1);
-       return;
+       return 0;
 
 err_env_relocate:
        set_default_env(NULL);
+
+       return -EIO;
 }
+#endif /* LOADENV */
+
+U_BOOT_ENV_LOCATION(fat) = {
+       .location       = ENVL_FAT,
+       ENV_NAME("FAT")
+#ifdef LOADENV
+       .load           = env_fat_load,
+#endif
+#ifdef CMD_SAVEENV
+       .save           = env_save_ptr(env_fat_save),
+#endif
+};
similarity index 98%
rename from common/env_flags.c
rename to env/flags.c
index 3c50620cb34df8b527131d3809e4ce5cddf3ff12..4b0ddb6bb85b2c709040295b75b702763b0612a6 100644 (file)
@@ -15,7 +15,7 @@
 #include "fw_env.h"
 #include <env_attr.h>
 #include <env_flags.h>
-#define getenv fw_getenv
+#define env_get fw_getenv
 #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
 #else
 #include <common.h>
@@ -308,7 +308,7 @@ static inline int env_flags_lookup(const char *flags_list, const char *name,
  */
 enum env_flags_vartype env_flags_get_type(const char *name)
 {
-       const char *flags_list = getenv(ENV_FLAGS_VAR);
+       const char *flags_list = env_get(ENV_FLAGS_VAR);
        char flags[ENV_FLAGS_ATTR_MAX_LEN + 1];
 
        if (env_flags_lookup(flags_list, name, flags))
@@ -325,7 +325,7 @@ enum env_flags_vartype env_flags_get_type(const char *name)
  */
 enum env_flags_varaccess env_flags_get_varaccess(const char *name)
 {
-       const char *flags_list = getenv(ENV_FLAGS_VAR);
+       const char *flags_list = env_get(ENV_FLAGS_VAR);
        char flags[ENV_FLAGS_ATTR_MAX_LEN + 1];
 
        if (env_flags_lookup(flags_list, name, flags))
@@ -426,7 +426,7 @@ void env_flags_init(ENTRY *var_entry)
        int ret = 1;
 
        if (first_call) {
-               flags_list = getenv(ENV_FLAGS_VAR);
+               flags_list = env_get(ENV_FLAGS_VAR);
                first_call = 0;
        }
        /* look in the ".flags" and static for a reference to this variable */
@@ -541,7 +541,7 @@ int env_flags_validate(const ENTRY *item, const char *newval, enum env_op op,
                        return 1;
                } else if (item->flags &
                    ENV_FLAGS_VARACCESS_PREVENT_NONDEF_OVERWR) {
-                       const char *defval = getenv_default(name);
+                       const char *defval = env_get_default(name);
 
                        if (defval == NULL)
                                defval = "";
similarity index 80%
rename from common/env_flash.c
rename to env/flash.c
index 004e8849a7dd23508dd790a41e3298f92b167c43..b60be57a8dd1585bcc9edb895e9d00dce1f4d789 100644 (file)
 
 DECLARE_GLOBAL_DATA_PTR;
 
-#if defined(CONFIG_CMD_SAVEENV) && defined(CONFIG_CMD_FLASH)
-#define CMD_SAVEENV
-#elif defined(CONFIG_ENV_ADDR_REDUND)
-#error CONFIG_ENV_ADDR_REDUND must have CONFIG_CMD_SAVEENV & CONFIG_CMD_FLASH
+#ifndef CONFIG_SPL_BUILD
+# if defined(CONFIG_CMD_SAVEENV) && defined(CONFIG_CMD_FLASH)
+#  define CMD_SAVEENV
+# elif defined(CONFIG_ENV_ADDR_REDUND)
+#  error CONFIG_ENV_ADDR_REDUND must have CONFIG_CMD_SAVEENV & CONFIG_CMD_FLASH
+# endif
 #endif
 
 #if defined(CONFIG_ENV_SIZE_REDUND) && \
@@ -31,34 +33,45 @@ DECLARE_GLOBAL_DATA_PTR;
 #error CONFIG_ENV_SIZE_REDUND should not be less then CONFIG_ENV_SIZE
 #endif
 
-char *env_name_spec = "Flash";
+/* TODO(sjg@chromium.org): Figure out all these special cases */
+#if (!defined(CONFIG_MICROBLAZE) && !defined(CONFIG_ARCH_ZYNQ) && \
+       !defined(CONFIG_TARGET_MCCMON6) && !defined(CONFIG_TARGET_X600) && \
+       !defined(CONFIG_TARGET_EDMINIV2)) || \
+       !defined(CONFIG_SPL_BUILD)
+#define LOADENV
+#endif
+
+#if !defined(CONFIG_TARGET_X600) || !defined(CONFIG_SPL_BUILD)
+#define INITENV
+#endif
 
 #ifdef ENV_IS_EMBEDDED
 env_t *env_ptr = &environment;
 
-static env_t *flash_addr = (env_t *)CONFIG_ENV_ADDR;
+static __maybe_unused env_t *flash_addr = (env_t *)CONFIG_ENV_ADDR;
 
 #else /* ! ENV_IS_EMBEDDED */
 
 env_t *env_ptr = (env_t *)CONFIG_ENV_ADDR;
-static env_t *flash_addr = (env_t *)CONFIG_ENV_ADDR;
+static __maybe_unused env_t *flash_addr = (env_t *)CONFIG_ENV_ADDR;
 #endif /* ENV_IS_EMBEDDED */
 
-#if defined(CMD_SAVEENV) || defined(CONFIG_ENV_ADDR_REDUND)
 /* CONFIG_ENV_ADDR is supposed to be on sector boundary */
-static ulong end_addr = CONFIG_ENV_ADDR + CONFIG_ENV_SECT_SIZE - 1;
-#endif
+static ulong __maybe_unused end_addr =
+               CONFIG_ENV_ADDR + CONFIG_ENV_SECT_SIZE - 1;
 
 #ifdef CONFIG_ENV_ADDR_REDUND
-static env_t *flash_addr_new = (env_t *)CONFIG_ENV_ADDR_REDUND;
+
+static env_t __maybe_unused *flash_addr_new = (env_t *)CONFIG_ENV_ADDR_REDUND;
 
 /* CONFIG_ENV_ADDR_REDUND is supposed to be on sector boundary */
-static ulong end_addr_new = CONFIG_ENV_ADDR_REDUND + CONFIG_ENV_SECT_SIZE - 1;
+static ulong __maybe_unused end_addr_new =
+               CONFIG_ENV_ADDR_REDUND + CONFIG_ENV_SECT_SIZE - 1;
 #endif /* CONFIG_ENV_ADDR_REDUND */
 
-
 #ifdef CONFIG_ENV_ADDR_REDUND
-int env_init(void)
+#ifdef INITENV
+static int env_flash_init(void)
 {
        int crc1_ok = 0, crc2_ok = 0;
 
@@ -75,35 +88,36 @@ int env_init(void)
 
        if (crc1_ok && !crc2_ok) {
                gd->env_addr    = addr1;
-               gd->env_valid   = 1;
+               gd->env_valid   = ENV_VALID;
        } else if (!crc1_ok && crc2_ok) {
                gd->env_addr    = addr2;
-               gd->env_valid   = 1;
+               gd->env_valid   = ENV_VALID;
        } else if (!crc1_ok && !crc2_ok) {
                gd->env_addr    = addr_default;
                gd->env_valid   = 0;
        } else if (flag1 == ACTIVE_FLAG && flag2 == OBSOLETE_FLAG) {
                gd->env_addr    = addr1;
-               gd->env_valid   = 1;
+               gd->env_valid   = ENV_VALID;
        } else if (flag1 == OBSOLETE_FLAG && flag2 == ACTIVE_FLAG) {
                gd->env_addr    = addr2;
-               gd->env_valid   = 1;
+               gd->env_valid   = ENV_VALID;
        } else if (flag1 == flag2) {
                gd->env_addr    = addr1;
-               gd->env_valid   = 2;
+               gd->env_valid   = ENV_REDUND;
        } else if (flag1 == 0xFF) {
                gd->env_addr    = addr1;
-               gd->env_valid   = 2;
+               gd->env_valid   = ENV_REDUND;
        } else if (flag2 == 0xFF) {
                gd->env_addr    = addr2;
-               gd->env_valid   = 2;
+               gd->env_valid   = ENV_REDUND;
        }
 
        return 0;
 }
+#endif
 
 #ifdef CMD_SAVEENV
-int saveenv(void)
+static int env_flash_save(void)
 {
        env_t   env_new;
        char    *saved_data = NULL;
@@ -207,11 +221,12 @@ done:
 
 #else /* ! CONFIG_ENV_ADDR_REDUND */
 
-int env_init(void)
+#ifdef INITENV
+static int env_flash_init(void)
 {
        if (crc32(0, env_ptr->data, ENV_SIZE) == env_ptr->crc) {
                gd->env_addr    = (ulong)&(env_ptr->data);
-               gd->env_valid   = 1;
+               gd->env_valid   = ENV_VALID;
                return 0;
        }
 
@@ -219,9 +234,10 @@ int env_init(void)
        gd->env_valid   = 0;
        return 0;
 }
+#endif
 
 #ifdef CMD_SAVEENV
-int saveenv(void)
+static int env_flash_save(void)
 {
        env_t   env_new;
        int     rc = 1;
@@ -291,7 +307,8 @@ done:
 
 #endif /* CONFIG_ENV_ADDR_REDUND */
 
-void env_relocate_spec(void)
+#ifdef LOADENV
+static int env_flash_load(void)
 {
 #ifdef CONFIG_ENV_ADDR_REDUND
        if (gd->env_addr != (ulong)&(flash_addr->data)) {
@@ -309,7 +326,7 @@ void env_relocate_spec(void)
            crc32(0, flash_addr_new->data, ENV_SIZE) == flash_addr_new->crc) {
                char flag = OBSOLETE_FLAG;
 
-               gd->env_valid = 2;
+               gd->env_valid = ENV_REDUND;
                flash_sect_protect(0, (ulong)flash_addr_new, end_addr_new);
                flash_write(&flag,
                            (ulong)&(flash_addr_new->flags),
@@ -321,7 +338,7 @@ void env_relocate_spec(void)
            (flash_addr->flags & ACTIVE_FLAG) == ACTIVE_FLAG) {
                char flag = ACTIVE_FLAG;
 
-               gd->env_valid = 2;
+               gd->env_valid = ENV_REDUND;
                flash_sect_protect(0, (ulong)flash_addr, end_addr);
                flash_write(&flag,
                            (ulong)&(flash_addr->flags),
@@ -329,10 +346,27 @@ void env_relocate_spec(void)
                flash_sect_protect(1, (ulong)flash_addr, end_addr);
        }
 
-       if (gd->env_valid == 2)
+       if (gd->env_valid == ENV_REDUND)
                puts("*** Warning - some problems detected "
                     "reading environment; recovered successfully\n\n");
 #endif /* CONFIG_ENV_ADDR_REDUND */
 
        env_import((char *)flash_addr, 1);
+
+       return 0;
 }
+#endif /* LOADENV */
+
+U_BOOT_ENV_LOCATION(flash) = {
+       .location       = ENVL_FLASH,
+       ENV_NAME("Flash")
+#ifdef LOADENV
+       .load           = env_flash_load,
+#endif
+#ifdef CMD_SAVEENV
+       .save           = env_save_ptr(env_flash_save),
+#endif
+#ifdef INITENV
+       .init           = env_flash_init,
+#endif
+};
similarity index 90%
rename from common/env_mmc.c
rename to env/mmc.c
index bb760a00ed82db5b563fc861437f3ae1f9aa2049..3f3092d975607a48161e3e74819d98a67a16ad64 100644 (file)
+++ b/env/mmc.c
 #error CONFIG_ENV_SIZE_REDUND should be the same as CONFIG_ENV_SIZE
 #endif
 
-char *env_name_spec = "MMC";
-
-#ifdef ENV_IS_EMBEDDED
-env_t *env_ptr = &environment;
-#else /* ! ENV_IS_EMBEDDED */
-env_t *env_ptr;
-#endif /* ENV_IS_EMBEDDED */
-
 DECLARE_GLOBAL_DATA_PTR;
 
 #if !defined(CONFIG_ENV_OFFSET)
@@ -82,15 +74,6 @@ __weak int mmc_get_env_dev(void)
        return CONFIG_SYS_MMC_ENV_DEV;
 }
 
-int env_init(void)
-{
-       /* use default */
-       gd->env_addr    = (ulong)&default_environment[0];
-       gd->env_valid   = 1;
-
-       return 0;
-}
-
 #ifdef CONFIG_SYS_MMC_ENV_PART
 __weak uint mmc_get_env_part(struct mmc *mmc)
 {
@@ -145,7 +128,7 @@ static void fini_mmc_for_env(struct mmc *mmc)
 #endif
 }
 
-#ifdef CONFIG_CMD_SAVEENV
+#if defined(CONFIG_CMD_SAVEENV) && !defined(CONFIG_SPL_BUILD)
 static inline int write_env(struct mmc *mmc, unsigned long size,
                            unsigned long offset, const void *buffer)
 {
@@ -160,7 +143,7 @@ static inline int write_env(struct mmc *mmc, unsigned long size,
        return (n == blk_cnt) ? 0 : -1;
 }
 
-int saveenv(void)
+static int env_mmc_save(void)
 {
        ALLOC_CACHE_ALIGN_BUFFER(env_t, env_new, 1);
        int dev = mmc_get_env_dev();
@@ -180,7 +163,7 @@ int saveenv(void)
                goto fini;
 
 #ifdef CONFIG_ENV_OFFSET_REDUND
-       if (gd->env_valid == 1)
+       if (gd->env_valid == ENV_VALID)
                copy = 1;
 #endif
 
@@ -200,14 +183,14 @@ int saveenv(void)
        ret = 0;
 
 #ifdef CONFIG_ENV_OFFSET_REDUND
-       gd->env_valid = gd->env_valid == 2 ? 1 : 2;
+       gd->env_valid = gd->env_valid == ENV_REDUND ? ENV_VALID : ENV_REDUND;
 #endif
 
 fini:
        fini_mmc_for_env(mmc);
        return ret;
 }
-#endif /* CONFIG_CMD_SAVEENV */
+#endif /* CONFIG_CMD_SAVEENV && !CONFIG_SPL_BUILD */
 
 static inline int read_env(struct mmc *mmc, unsigned long size,
                           unsigned long offset, const void *buffer)
@@ -224,7 +207,7 @@ static inline int read_env(struct mmc *mmc, unsigned long size,
 }
 
 #ifdef CONFIG_ENV_OFFSET_REDUND
-void env_relocate_spec(void)
+static int env_mmc_load(void)
 {
 #if !defined(ENV_IS_EMBEDDED)
        struct mmc *mmc;
@@ -241,13 +224,13 @@ void env_relocate_spec(void)
 
        errmsg = init_mmc_for_env(mmc);
        if (errmsg) {
-               ret = 1;
+               ret = -EIO;
                goto err;
        }
 
        if (mmc_get_env_addr(mmc, 0, &offset1) ||
            mmc_get_env_addr(mmc, 1, &offset2)) {
-               ret = 1;
+               ret = -EIO;
                goto fini;
        }
 
@@ -262,13 +245,13 @@ void env_relocate_spec(void)
 
        if (read1_fail && read2_fail) {
                errmsg = "!bad CRC";
-               ret = 1;
+               ret = -EIO;
                goto fini;
        } else if (!read1_fail && read2_fail) {
-               gd->env_valid = 1;
+               gd->env_valid = ENV_VALID;
                env_import((char *)tmp_env1, 1);
        } else if (read1_fail && !read2_fail) {
-               gd->env_valid = 2;
+               gd->env_valid = ENV_REDUND;
                env_import((char *)tmp_env2, 1);
        } else {
                env_import_redund((char *)tmp_env1, (char *)tmp_env2);
@@ -281,10 +264,12 @@ fini:
 err:
        if (ret)
                set_default_env(errmsg);
+
 #endif
+       return ret;
 }
 #else /* ! CONFIG_ENV_OFFSET_REDUND */
-void env_relocate_spec(void)
+static int env_mmc_load(void)
 {
 #if !defined(ENV_IS_EMBEDDED)
        ALLOC_CACHE_ALIGN_BUFFER(char, buf, CONFIG_ENV_SIZE);
@@ -298,18 +283,18 @@ void env_relocate_spec(void)
 
        errmsg = init_mmc_for_env(mmc);
        if (errmsg) {
-               ret = 1;
+               ret = -EIO;
                goto err;
        }
 
        if (mmc_get_env_addr(mmc, 0, &offset)) {
-               ret = 1;
+               ret = -EIO;
                goto fini;
        }
 
        if (read_env(mmc, CONFIG_ENV_SIZE, offset, buf)) {
                errmsg = "!read failed";
-               ret = 1;
+               ret = -EIO;
                goto fini;
        }
 
@@ -322,5 +307,15 @@ err:
        if (ret)
                set_default_env(errmsg);
 #endif
+       return ret;
 }
 #endif /* CONFIG_ENV_OFFSET_REDUND */
+
+U_BOOT_ENV_LOCATION(mmc) = {
+       .location       = ENVL_MMC,
+       ENV_NAME("MMC")
+       .load           = env_mmc_load,
+#ifndef CONFIG_SPL_BUILD
+       .save           = env_save_ptr(env_mmc_save),
+#endif
+};
similarity index 87%
rename from common/env_nand.c
rename to env/nand.c
index 760f6859e354daeaa5299cf159f53938ae64f975..dea7b00720ef9fbb11309abfda326f11d8568aa5 100644 (file)
@@ -24,7 +24,8 @@
 #include <search.h>
 #include <errno.h>
 
-#if defined(CONFIG_CMD_SAVEENV) && defined(CONFIG_CMD_NAND)
+#if defined(CONFIG_CMD_SAVEENV) && defined(CONFIG_CMD_NAND) && \
+               !defined(CONFIG_SPL_BUILD)
 #define CMD_SAVEENV
 #elif defined(CONFIG_ENV_OFFSET_REDUND)
 #error CONFIG_ENV_OFFSET_REDUND must have CONFIG_CMD_SAVEENV & CONFIG_CMD_NAND
@@ -39,8 +40,6 @@
 #define CONFIG_ENV_RANGE       CONFIG_ENV_SIZE
 #endif
 
-char *env_name_spec = "NAND";
-
 #if defined(ENV_IS_EMBEDDED)
 env_t *env_ptr = &environment;
 #elif defined(CONFIG_NAND_ENV_DST)
@@ -63,7 +62,7 @@ DECLARE_GLOBAL_DATA_PTR;
  * This way the SPL loads not only the U-Boot image from NAND but
  * also the environment.
  */
-int env_init(void)
+static int env_nand_init(void)
 {
 #if defined(ENV_IS_EMBEDDED) || defined(CONFIG_NAND_ENV_DST)
        int crc1_ok = 0, crc2_ok = 0;
@@ -84,37 +83,37 @@ int env_init(void)
 
                return 0;
        } else if (crc1_ok && !crc2_ok) {
-               gd->env_valid = 1;
+               gd->env_valid = ENV_VALID;
        }
 #ifdef CONFIG_ENV_OFFSET_REDUND
        else if (!crc1_ok && crc2_ok) {
-               gd->env_valid = 2;
+               gd->env_valid = ENV_REDUND;
        } else {
                /* both ok - check serial */
                if (tmp_env1->flags == 255 && tmp_env2->flags == 0)
-                       gd->env_valid = 2;
+                       gd->env_valid = ENV_REDUND;
                else if (tmp_env2->flags == 255 && tmp_env1->flags == 0)
-                       gd->env_valid = 1;
+                       gd->env_valid = ENV_VALID;
                else if (tmp_env1->flags > tmp_env2->flags)
-                       gd->env_valid = 1;
+                       gd->env_valid = ENV_VALID;
                else if (tmp_env2->flags > tmp_env1->flags)
-                       gd->env_valid = 2;
+                       gd->env_valid = ENV_REDUND;
                else /* flags are equal - almost impossible */
-                       gd->env_valid = 1;
+                       gd->env_valid = ENV_VALID;
        }
 
-       if (gd->env_valid == 2)
+       if (gd->env_valid == ENV_REDUND)
                env_ptr = tmp_env2;
        else
 #endif
-       if (gd->env_valid == 1)
+       if (gd->env_valid == ENV_VALID)
                env_ptr = tmp_env1;
 
        gd->env_addr = (ulong)env_ptr->data;
 
 #else /* ENV_IS_EMBEDDED || CONFIG_NAND_ENV_DST */
        gd->env_addr    = (ulong)&default_environment[0];
-       gd->env_valid   = 1;
+       gd->env_valid   = ENV_VALID;
 #endif /* ENV_IS_EMBEDDED || CONFIG_NAND_ENV_DST */
 
        return 0;
@@ -158,12 +157,12 @@ static int writeenv(size_t offset, u_char *buf)
        return 0;
 }
 
-struct env_location {
+struct nand_env_location {
        const char *name;
        const nand_erase_options_t erase_opts;
 };
 
-static int erase_and_write_env(const struct env_location *location,
+static int erase_and_write_env(const struct nand_env_location *location,
                u_char *env_new)
 {
        struct mtd_info *mtd;
@@ -184,12 +183,12 @@ static int erase_and_write_env(const struct env_location *location,
        return ret;
 }
 
-int saveenv(void)
+static int env_nand_save(void)
 {
        int     ret = 0;
        ALLOC_CACHE_ALIGN_BUFFER(env_t, env_new, 1);
        int     env_idx = 0;
-       static const struct env_location location[] = {
+       static const struct nand_env_location location[] = {
                {
                        .name = "NAND",
                        .erase_opts = {
@@ -217,14 +216,15 @@ int saveenv(void)
                return ret;
 
 #ifdef CONFIG_ENV_OFFSET_REDUND
-       env_idx = (gd->env_valid == 1);
+       env_idx = (gd->env_valid == ENV_VALID);
 #endif
 
        ret = erase_and_write_env(&location[env_idx], (u_char *)env_new);
 #ifdef CONFIG_ENV_OFFSET_REDUND
        if (!ret) {
                /* preset other copy for next write */
-               gd->env_valid = gd->env_valid == 2 ? 1 : 2;
+               gd->env_valid = gd->env_valid == ENV_REDUND ? ENV_VALID :
+                               ENV_REDUND;
                return ret;
        }
 
@@ -302,7 +302,7 @@ int get_nand_env_oob(struct mtd_info *mtd, unsigned long *result)
        }
 
        if (oob_buf[0] == ENV_OOB_MARKER) {
-               *result = oob_buf[1] * mtd->erasesize;
+               *result = ovoid ob_buf[1] * mtd->erasesize;
        } else if (oob_buf[0] == ENV_OOB_MARKER_OLD) {
                *result = oob_buf[1];
        } else {
@@ -315,17 +315,21 @@ int get_nand_env_oob(struct mtd_info *mtd, unsigned long *result)
 #endif
 
 #ifdef CONFIG_ENV_OFFSET_REDUND
-void env_relocate_spec(void)
+static int env_nand_load(void)
 {
-#if !defined(ENV_IS_EMBEDDED)
+#if defined(ENV_IS_EMBEDDED)
+       return 0;
+#else
        int read1_fail = 0, read2_fail = 0;
        env_t *tmp_env1, *tmp_env2;
+       int ret = 0;
 
        tmp_env1 = (env_t *)malloc(CONFIG_ENV_SIZE);
        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");
+               ret = -EIO;
                goto done;
        }
 
@@ -342,10 +346,10 @@ void env_relocate_spec(void)
                set_default_env("!bad env area");
                goto done;
        } else if (!read1_fail && read2_fail) {
-               gd->env_valid = 1;
+               gd->env_valid = ENV_VALID;
                env_import((char *)tmp_env1, 1);
        } else if (read1_fail && !read2_fail) {
-               gd->env_valid = 2;
+               gd->env_valid = ENV_REDUND;
                env_import((char *)tmp_env2, 1);
        } else {
                env_import_redund((char *)tmp_env1, (char *)tmp_env2);
@@ -355,6 +359,7 @@ done:
        free(tmp_env1);
        free(tmp_env2);
 
+       return ret;
 #endif /* ! ENV_IS_EMBEDDED */
 }
 #else /* ! CONFIG_ENV_OFFSET_REDUND */
@@ -363,7 +368,7 @@ done:
  * device i.e., nand_dev_desc + 0. This is also the behaviour using
  * the new NAND code.
  */
-void env_relocate_spec(void)
+static int env_nand_load(void)
 {
 #if !defined(ENV_IS_EMBEDDED)
        int ret;
@@ -386,10 +391,22 @@ void env_relocate_spec(void)
        ret = readenv(CONFIG_ENV_OFFSET, (u_char *)buf);
        if (ret) {
                set_default_env("!readenv() failed");
-               return;
+               return -EIO;
        }
 
        env_import(buf, 1);
 #endif /* ! ENV_IS_EMBEDDED */
+
+       return 0;
 }
 #endif /* CONFIG_ENV_OFFSET_REDUND */
+
+U_BOOT_ENV_LOCATION(nand) = {
+       .location       = ENVL_NAND,
+       ENV_NAME("NAND")
+       .load           = env_nand_load,
+#if defined(CMD_SAVEENV)
+       .save           = env_save_ptr(env_nand_save),
+#endif
+       .init           = env_nand_init,
+};
similarity index 58%
rename from common/env_nowhere.c
rename to env/nowhere.c
index bdc1ed5e6769ec7873d29117ea4d7b6f9c5eac1c..d60de494e6c40eadaca899ec44f8cc4b2314e2ec 100644 (file)
 
 DECLARE_GLOBAL_DATA_PTR;
 
-env_t *env_ptr;
-
-void env_relocate_spec(void)
-{
-}
-
-/*
- * Initialize Environment use
- *
- * We are still running from ROM, so data use is limited
- */
-int env_init(void)
-{
-       gd->env_addr    = (ulong)&default_environment[0];
-       gd->env_valid   = 0;
-
-       return 0;
-}
+U_BOOT_ENV_LOCATION(nowhere) = {
+       .location       = ENVL_NOWHERE,
+       ENV_NAME("nowhere")
+};
similarity index 86%
rename from common/env_nvram.c
rename to env/nvram.c
index 524f07d5f8967460ac37dd7eb453f385f54cafc8..5fb3115ce65af3db82429e8311c3d507adc6fa47 100644 (file)
@@ -36,15 +36,12 @@ DECLARE_GLOBAL_DATA_PTR;
 #ifdef CONFIG_SYS_NVRAM_ACCESS_ROUTINE
 extern void *nvram_read(void *dest, const long src, size_t count);
 extern void nvram_write(long dest, const void *src, size_t count);
-env_t *env_ptr;
 #else
 env_t *env_ptr = (env_t *)CONFIG_ENV_ADDR;
 #endif
 
-char *env_name_spec = "NVRAM";
-
 #ifdef CONFIG_SYS_NVRAM_ACCESS_ROUTINE
-uchar env_get_char_spec(int index)
+static int env_nvram_get_char(int index)
 {
        uchar c;
 
@@ -54,7 +51,7 @@ uchar env_get_char_spec(int index)
 }
 #endif
 
-void env_relocate_spec(void)
+static int env_nvram_load(void)
 {
        char buf[CONFIG_ENV_SIZE];
 
@@ -64,9 +61,11 @@ void env_relocate_spec(void)
        memcpy(buf, (void *)CONFIG_ENV_ADDR, CONFIG_ENV_SIZE);
 #endif
        env_import(buf, 1);
+
+       return 0;
 }
 
-int saveenv(void)
+static int env_nvram_save(void)
 {
        env_t   env_new;
        int     rcode = 0;
@@ -89,7 +88,7 @@ int saveenv(void)
  *
  * We are still running from ROM, so data use is limited
  */
-int env_init(void)
+static int env_nvram_init(void)
 {
 #if defined(CONFIG_SYS_NVRAM_ACCESS_ROUTINE)
        ulong crc;
@@ -104,7 +103,7 @@ int env_init(void)
        if (crc32(0, env_ptr->data, ENV_SIZE) == env_ptr->crc) {
                gd->env_addr    = (ulong)&env_ptr->data;
 #endif
-               gd->env_valid   = 1;
+               gd->env_valid = ENV_VALID;
        } else {
                gd->env_addr    = (ulong)&default_environment[0];
                gd->env_valid   = 0;
@@ -112,3 +111,14 @@ int env_init(void)
 
        return 0;
 }
+
+U_BOOT_ENV_LOCATION(nvram) = {
+       .location       = ENVL_NVRAM,
+       ENV_NAME("NVRAM")
+#ifdef CONFIG_SYS_NVRAM_ACCESS_ROUTINE
+       .get_char       = env_nvram_get_char,
+#endif
+       .load           = env_nvram_load,
+       .save           = env_save_ptr(env_nvram_save),
+       .init           = env_nvram_init,
+};
similarity index 89%
rename from common/env_onenand.c
rename to env/onenand.c
index cc3d670de83d4314834695c86ef8ab654f56a8fd..2e3045c5f5de69b9de5acaa60eb58df1c8f435af 100644 (file)
 #include <linux/mtd/mtd.h>
 #include <linux/mtd/onenand.h>
 
-char *env_name_spec = "OneNAND";
-
 #define ONENAND_MAX_ENV_SIZE   CONFIG_ENV_SIZE
 #define ONENAND_ENV_SIZE(mtd)  (ONENAND_MAX_ENV_SIZE - ENV_HEADER_SIZE)
 
 DECLARE_GLOBAL_DATA_PTR;
 
-void env_relocate_spec(void)
+static int env_onenand_load(void)
 {
        struct mtd_info *mtd = &onenand_mtd;
 #ifdef CONFIG_ENV_ADDR_FLEX
@@ -60,10 +58,12 @@ void env_relocate_spec(void)
 
        rc = env_import(buf, 1);
        if (rc)
-               gd->env_valid = 1;
+               gd->env_valid = ENV_VALID;
+
+       return rc ? 0 : -EIO;
 }
 
-int saveenv(void)
+static int env_onenand_save(void)
 {
        env_t   env_new;
        int ret;
@@ -106,11 +106,9 @@ int saveenv(void)
        return 0;
 }
 
-int env_init(void)
-{
-       /* use default */
-       gd->env_addr = (ulong)&default_environment[0];
-       gd->env_valid = 1;
-
-       return 0;
-}
+U_BOOT_ENV_LOCATION(onenand) = {
+       .location       = ENVL_ONENAND,
+       ENV_NAME("OneNAND")
+       .load           = env_onenand_load,
+       .save           = env_save_ptr(env_onenand_save),
+};
similarity index 73%
rename from common/env_remote.c
rename to env/remote.c
index eb977ee1fe81a2b3398b5c27f94f7f95eef2a299..c013fdd4b0194181d50905a54b92e4b169fee6a7 100644 (file)
@@ -11,8 +11,6 @@
 #include <environment.h>
 #include <linux/stddef.h>
 
-char *env_name_spec = "Remote";
-
 #ifdef ENV_IS_EMBEDDED
 env_t *env_ptr = &environment;
 #else /* ! ENV_IS_EMBEDDED */
@@ -25,21 +23,19 @@ DECLARE_GLOBAL_DATA_PTR;
 #define CONFIG_ENV_OFFSET 0
 #endif
 
-int env_init(void)
+static int env_remote_init(void)
 {
        if (crc32(0, env_ptr->data, ENV_SIZE) == env_ptr->crc) {
                gd->env_addr = (ulong)&(env_ptr->data);
-               gd->env_valid = 1;
+               gd->env_valid = ENV_VALID;
                return 0;
        }
 
-       gd->env_addr = (ulong)default_environment;
-       gd->env_valid = 0;
-       return 0;
+       return -ENOENT;
 }
 
 #ifdef CONFIG_CMD_SAVEENV
-int saveenv(void)
+static int env_remote_save(void)
 {
 #ifdef CONFIG_SRIO_PCIE_BOOT_SLAVE
        printf("Can not support the 'saveenv' when boot from SRIO or PCIE!\n");
@@ -50,9 +46,19 @@ int saveenv(void)
 }
 #endif /* CONFIG_CMD_SAVEENV */
 
-void env_relocate_spec(void)
+static int env_remote_load(void)
 {
 #ifndef ENV_IS_EMBEDDED
        env_import((char *)env_ptr, 1);
 #endif
+
+       return 0;
 }
+
+U_BOOT_ENV_LOCATION(remote) = {
+       .location       = ENVL_REMOTE,
+       ENV_NAME("Remote")
+       .load           = env_remote_load,
+       .save           = env_save_ptr(env_remote_save),
+       .init           = env_remote_init,
+};
similarity index 84%
rename from common/env_sata.c
rename to env/sata.c
index b0cee35a60fd60f80fea0c4b9bbd445993e0c664..a77029774e1f5f46baa09ce09abc18d13f1bde77 100644 (file)
@@ -24,8 +24,6 @@
 #error CONFIG_ENV_OFFSET or CONFIG_ENV_SIZE not defined
 #endif
 
-char *env_name_spec = "SATA";
-
 DECLARE_GLOBAL_DATA_PTR;
 
 __weak int sata_get_env_dev(void)
@@ -33,15 +31,6 @@ __weak int sata_get_env_dev(void)
        return CONFIG_SYS_SATA_ENV_DEV;
 }
 
-int env_init(void)
-{
-       /* use default */
-       gd->env_addr = (ulong)&default_environment[0];
-       gd->env_valid = 1;
-
-       return 0;
-}
-
 #ifdef CONFIG_CMD_SAVEENV
 static inline int write_env(struct blk_desc *sata, unsigned long size,
                            unsigned long offset, void *buffer)
@@ -56,7 +45,7 @@ static inline int write_env(struct blk_desc *sata, unsigned long size,
        return (n == blk_cnt) ? 0 : -1;
 }
 
-int saveenv(void)
+static int env_sata_save(void)
 {
        ALLOC_CACHE_ALIGN_BUFFER(env_t, env_new, 1);
        struct blk_desc *sata = NULL;
@@ -102,26 +91,36 @@ static inline int read_env(struct blk_desc *sata, unsigned long size,
        return (n == blk_cnt) ? 0 : -1;
 }
 
-void env_relocate_spec(void)
+static void env_sata_load(void)
 {
        ALLOC_CACHE_ALIGN_BUFFER(char, buf, CONFIG_ENV_SIZE);
        struct blk_desc *sata = NULL;
        int env_sata;
 
        if (sata_initialize())
-               return;
+               return -EIO;
 
        env_sata = sata_get_env_dev();
 
        sata = sata_get_dev(env_sata);
        if (sata == NULL) {
-               printf("Unknown SATA(%d) device for environment!\n",
-                      env_sata);
-               return;
+               printf("Unknown SATA(%d) device for environment!\n", env_sata);
+               return -EIO;
        }
 
-       if (read_env(sata, CONFIG_ENV_SIZE, CONFIG_ENV_OFFSET, buf))
-               return set_default_env(NULL);
+       if (read_env(sata, CONFIG_ENV_SIZE, CONFIG_ENV_OFFSET, buf)) {
+               set_default_env(NULL);
+               return -EIO;
+       }
 
        env_import(buf, 1);
+
+       return 0;
 }
+
+U_BOOT_ENV_LOCATION(sata) = {
+       .location       = ENVL_ESATA,
+       ENV_NAME("SATA")
+       .load           = env_sata_load,
+       .save           = env_save_ptr(env_sata_save),
+};
similarity index 87%
rename from common/env_sf.c
rename to env/sf.c
index 45f441a042b5ec0caedf226c81754ba63106c041..6f74371c098203e2ba9c805227da7a9a492bae7a 100644 (file)
+++ b/env/sf.c
 # define CONFIG_ENV_SPI_MODE   CONFIG_SF_DEFAULT_MODE
 #endif
 
+#ifndef CONFIG_SPL_BUILD
+#define CMD_SAVEENV
+#endif
+
 #ifdef CONFIG_ENV_OFFSET_REDUND
+#ifdef CMD_SAVEENV
 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
@@ -42,8 +48,6 @@ static ulong env_new_offset   = CONFIG_ENV_OFFSET_REDUND;
 
 DECLARE_GLOBAL_DATA_PTR;
 
-char *env_name_spec = "SPI Flash";
-
 static struct spi_flash *env_flash;
 
 static int setup_flash_device(void)
@@ -57,7 +61,7 @@ static int setup_flash_device(void)
                                     0, 0, &new);
        if (ret) {
                set_default_env("!spi_flash_probe_bus_cs() failed");
-               return 1;
+               return ret;
        }
 
        env_flash = dev_get_uclass_priv(new);
@@ -69,7 +73,7 @@ static int setup_flash_device(void)
                        CONFIG_ENV_SPI_MAX_HZ, CONFIG_ENV_SPI_MODE);
                if (!env_flash) {
                        set_default_env("!spi_flash_probe() failed");
-                       return 1;
+                       return -EIO;
                }
        }
 #endif
@@ -77,7 +81,8 @@ static int setup_flash_device(void)
 }
 
 #if defined(CONFIG_ENV_OFFSET_REDUND)
-int saveenv(void)
+#ifdef CMD_SAVEENV
+static int env_sf_save(void)
 {
        env_t   env_new;
        char    *saved_buffer = NULL, flag = OBSOLETE_FLAG;
@@ -90,10 +95,10 @@ int saveenv(void)
 
        ret = env_export(&env_new);
        if (ret)
-               return ret;
+               return -EIO;
        env_new.flags   = ACTIVE_FLAG;
 
-       if (gd->env_valid == 1) {
+       if (gd->env_valid == ENV_VALID) {
                env_new_offset = CONFIG_ENV_OFFSET_REDUND;
                env_offset = CONFIG_ENV_OFFSET;
        } else {
@@ -107,7 +112,7 @@ int saveenv(void)
                saved_offset = env_new_offset + CONFIG_ENV_SIZE;
                saved_buffer = memalign(ARCH_DMA_MINALIGN, saved_size);
                if (!saved_buffer) {
-                       ret = 1;
+                       ret = -ENOMEM;
                        goto done;
                }
                ret = spi_flash_read(env_flash, saved_offset,
@@ -145,7 +150,7 @@ int saveenv(void)
 
        puts("done\n");
 
-       gd->env_valid = gd->env_valid == 2 ? 1 : 2;
+       gd->env_valid = gd->env_valid == ENV_REDUND ? ENV_VALID : ENV_REDUND;
 
        printf("Valid environment: %d\n", (int)gd->env_valid);
 
@@ -155,8 +160,9 @@ int saveenv(void)
 
        return ret;
 }
+#endif /* CMD_SAVEENV */
 
-void env_relocate_spec(void)
+static int env_sf_load(void)
 {
        int ret;
        int crc1_ok = 0, crc2_ok = 0;
@@ -170,6 +176,7 @@ void env_relocate_spec(void)
                        CONFIG_ENV_SIZE);
        if (!tmp_env1 || !tmp_env2) {
                set_default_env("!malloc() failed");
+               ret = -EIO;
                goto out;
        }
 
@@ -196,32 +203,33 @@ void env_relocate_spec(void)
 
        if (!crc1_ok && !crc2_ok) {
                set_default_env("!bad CRC");
+               ret = -EIO;
                goto err_read;
        } else if (crc1_ok && !crc2_ok) {
-               gd->env_valid = 1;
+               gd->env_valid = ENV_VALID;
        } else if (!crc1_ok && crc2_ok) {
-               gd->env_valid = 2;
+               gd->env_valid = ENV_REDUND;
        } else if (tmp_env1->flags == ACTIVE_FLAG &&
                   tmp_env2->flags == OBSOLETE_FLAG) {
-               gd->env_valid = 1;
+               gd->env_valid = ENV_VALID;
        } else if (tmp_env1->flags == OBSOLETE_FLAG &&
                   tmp_env2->flags == ACTIVE_FLAG) {
-               gd->env_valid = 2;
+               gd->env_valid = ENV_REDUND;
        } else if (tmp_env1->flags == tmp_env2->flags) {
-               gd->env_valid = 1;
+               gd->env_valid = ENV_VALID;
        } else if (tmp_env1->flags == 0xFF) {
-               gd->env_valid = 1;
+               gd->env_valid = ENV_VALID;
        } else if (tmp_env2->flags == 0xFF) {
-               gd->env_valid = 2;
+               gd->env_valid = ENV_REDUND;
        } else {
                /*
                 * this differs from code in env_flash.c, but I think a sane
                 * default path is desirable.
                 */
-               gd->env_valid = 1;
+               gd->env_valid = ENV_VALID;
        }
 
-       if (gd->env_valid == 1)
+       if (gd->env_valid == ENV_VALID)
                ep = tmp_env1;
        else
                ep = tmp_env2;
@@ -238,9 +246,12 @@ err_read:
 out:
        free(tmp_env1);
        free(tmp_env2);
+
+       return ret;
 }
 #else
-int saveenv(void)
+#ifdef CMD_SAVEENV
+static int env_sf_save(void)
 {
        u32     saved_size, saved_offset, sector;
        char    *saved_buffer = NULL;
@@ -299,8 +310,9 @@ int saveenv(void)
 
        return ret;
 }
+#endif /* CMD_SAVEENV */
 
-void env_relocate_spec(void)
+static int env_sf_load(void)
 {
        int ret;
        char *buf = NULL;
@@ -308,7 +320,7 @@ void env_relocate_spec(void)
        buf = (char *)memalign(ARCH_DMA_MINALIGN, CONFIG_ENV_SIZE);
        if (!buf) {
                set_default_env("!malloc() failed");
-               return;
+               return -EIO;
        }
 
        ret = setup_flash_device();
@@ -324,21 +336,23 @@ void env_relocate_spec(void)
 
        ret = env_import(buf, 1);
        if (ret)
-               gd->env_valid = 1;
+               gd->env_valid = ENV_VALID;
 
 err_read:
        spi_flash_free(env_flash);
        env_flash = NULL;
 out:
        free(buf);
+
+       return ret;
 }
 #endif
 
-int env_init(void)
-{
-       /* SPI flash isn't usable before relocation */
-       gd->env_addr = (ulong)&default_environment[0];
-       gd->env_valid = 1;
-
-       return 0;
-}
+U_BOOT_ENV_LOCATION(sf) = {
+       .location       = ENVL_SPI_FLASH,
+       ENV_NAME("SPI Flash")
+       .load           = env_sf_load,
+#ifdef CMD_SAVEENV
+       .save           = env_save_ptr(env_sf_save),
+#endif
+};
similarity index 91%
rename from common/env_ubi.c
rename to env/ubi.c
index 95b527ddca47c60c7dbe6a55cde935b523a1f8e0..1c4653d4f6ac440e3b2e7b89c9815c26a77e6cd1 100644 (file)
+++ b/env/ubi.c
 #include <ubi_uboot.h>
 #undef crc32
 
-char *env_name_spec = "UBI";
-
-env_t *env_ptr;
-
 DECLARE_GLOBAL_DATA_PTR;
 
-int env_init(void)
-{
-       /* use default */
-       gd->env_addr = (ulong)&default_environment[0];
-       gd->env_valid = 1;
-
-       return 0;
-}
-
 #ifdef CONFIG_CMD_SAVEENV
 #ifdef CONFIG_SYS_REDUNDAND_ENVIRONMENT
-int saveenv(void)
+static int env_ubi_save(void)
 {
        ALLOC_CACHE_ALIGN_BUFFER(env_t, env_new, 1);
        int ret;
@@ -48,7 +35,7 @@ int saveenv(void)
                return 1;
        }
 
-       if (gd->env_valid == 1) {
+       if (gd->env_valid == ENV_VALID) {
                puts("Writing to redundant UBI... ");
                if (ubi_volume_write(CONFIG_ENV_UBI_VOLUME_REDUND,
                                     (void *)env_new, CONFIG_ENV_SIZE)) {
@@ -70,12 +57,12 @@ int saveenv(void)
 
        puts("done\n");
 
-       gd->env_valid = gd->env_valid == 2 ? 1 : 2;
+       gd->env_valid = gd->env_valid == ENV_REDUND ? ENV_VALID : ENV_REDUND;
 
        return 0;
 }
 #else /* ! CONFIG_SYS_REDUNDAND_ENVIRONMENT */
-int saveenv(void)
+static int env_ubi_save(void)
 {
        ALLOC_CACHE_ALIGN_BUFFER(env_t, env_new, 1);
        int ret;
@@ -104,7 +91,7 @@ int saveenv(void)
 #endif /* CONFIG_CMD_SAVEENV */
 
 #ifdef CONFIG_SYS_REDUNDAND_ENVIRONMENT
-void env_relocate_spec(void)
+static int env_ubi_load(void)
 {
        ALLOC_CACHE_ALIGN_BUFFER(char, env1_buf, CONFIG_ENV_SIZE);
        ALLOC_CACHE_ALIGN_BUFFER(char, env2_buf, CONFIG_ENV_SIZE);
@@ -128,7 +115,7 @@ void env_relocate_spec(void)
                printf("\n** Cannot find mtd partition \"%s\"\n",
                       CONFIG_ENV_UBI_PART);
                set_default_env(NULL);
-               return;
+               return -EIO;
        }
 
        if (ubi_volume_read(CONFIG_ENV_UBI_VOLUME, (void *)tmp_env1,
@@ -144,9 +131,11 @@ void env_relocate_spec(void)
        }
 
        env_import_redund((char *)tmp_env1, (char *)tmp_env2);
+
+       return 0;
 }
 #else /* ! CONFIG_SYS_REDUNDAND_ENVIRONMENT */
-void env_relocate_spec(void)
+static int env_ubi_load(void)
 {
        ALLOC_CACHE_ALIGN_BUFFER(char, buf, CONFIG_ENV_SIZE);
 
@@ -164,16 +153,24 @@ void env_relocate_spec(void)
                printf("\n** Cannot find mtd partition \"%s\"\n",
                       CONFIG_ENV_UBI_PART);
                set_default_env(NULL);
-               return;
+               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);
-               return;
+               return -EIO;
        }
 
        env_import(buf, 1);
+
+       return 0;
 }
 #endif /* CONFIG_SYS_REDUNDAND_ENVIRONMENT */
+
+U_BOOT_ENV_LOCATION(ubi) = {
+       .location       = ENVL_UBI,
+       .load           = env_ubi_load,
+       .save           = env_save_ptr(env_ubi_save),
+};
diff --git a/fs/fs.c b/fs/fs.c
index 595ff1fe69b5bc446ebd32c3d7badd7726348d63..13cd3626c6f811248553ef625b7f64e02e27dfc0 100644 (file)
--- a/fs/fs.c
+++ b/fs/fs.c
@@ -348,7 +348,7 @@ int do_size(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[],
        if (fs_size(argv[3], &size) < 0)
                return CMD_RET_FAILURE;
 
-       setenv_hex("filesize", size);
+       env_set_hex("filesize", size);
 
        return 0;
 }
@@ -379,7 +379,7 @@ int do_load(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[],
                if (ep == argv[3] || *ep != '\0')
                        return CMD_RET_USAGE;
        } else {
-               addr_str = getenv("loadaddr");
+               addr_str = env_get("loadaddr");
                if (addr_str != NULL)
                        addr = simple_strtoul(addr_str, NULL, 16);
                else
@@ -388,7 +388,7 @@ int do_load(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[],
        if (argc >= 5) {
                filename = argv[4];
        } else {
-               filename = getenv("bootfile");
+               filename = env_get("bootfile");
                if (!filename) {
                        puts("** No boot file defined **\n");
                        return 1;
@@ -417,8 +417,8 @@ int do_load(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[],
        }
        puts("\n");
 
-       setenv_hex("fileaddr", addr);
-       setenv_hex("filesize", len_read);
+       env_set_hex("fileaddr", addr);
+       env_set_hex("filesize", len_read);
 
        return 0;
 }
@@ -509,7 +509,7 @@ int do_fs_uuid(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[],
                return CMD_RET_FAILURE;
 
        if (argc == 4)
-               setenv(argv[3], uuid);
+               env_set(argv[3], uuid);
        else
                printf("%s\n", uuid);
 
@@ -529,7 +529,7 @@ int do_fs_type(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
        info = fs_get_info(fs_type);
 
        if (argc == 4)
-               setenv(argv[3], info->name);
+               env_set(argv[3], info->name);
        else
                printf("%s\n", info->name);
 
index db29489eca7517c4a21151fcd91dbdc53b270dfc..8f1c9d167d741fe0a1b65475de10713785d29e1d 100644 (file)
@@ -941,7 +941,7 @@ int ubifs_load(char *filename, u32 addr, u32 size)
 
        err = ubifs_read(filename, (void *)(uintptr_t)addr, 0, size, &actread);
        if (err == 0) {
-               setenv_hex("filesize", actread);
+               env_set_hex("filesize", actread);
                printf("Done\n");
        }
 
index 6ff4364e443d25af802d4dd3c997450bf576a5f5..5416041243d67c025b6c79f9f58b1bde40bb2680 100644 (file)
@@ -31,8 +31,8 @@
        EXPORT_FUNC(vprintf, int, vprintf, const char *, va_list)
        EXPORT_FUNC(do_reset, int, do_reset, cmd_tbl_t *,
                    int , int , char * const [])
-       EXPORT_FUNC(getenv, char  *, getenv, const char*)
-       EXPORT_FUNC(setenv, int, setenv, const char *, const char *)
+       EXPORT_FUNC(env_get, char  *, env_get, const char*)
+       EXPORT_FUNC(env_set, int, env_set, const char *, const char *)
        EXPORT_FUNC(simple_strtoul, unsigned long, simple_strtoul,
                    const char *, char **, unsigned int)
        EXPORT_FUNC(strict_strtoul, int, strict_strtoul,
index 86bf6565f689ede5d33747769f3b45b8b4eb687a..944f58195cafb767672b9c6a360c6c96912b5181 100644 (file)
@@ -49,7 +49,7 @@ typedef struct global_data {
        unsigned long precon_buf_idx;   /* Pre-Console buffer index */
 #endif
        unsigned long env_addr;         /* Address  of Environment struct */
-       unsigned long env_valid;        /* Checksum of Environment valid? */
+       unsigned long env_valid;        /* Environment valid? enum env_valid */
 
        unsigned long ram_top;          /* Top address of RAM used by U-Boot */
        unsigned long relocaddr;        /* Start address of U-Boot in RAM */
@@ -76,7 +76,7 @@ typedef struct global_data {
        struct device_node *of_root;
 #endif
        struct jt_funcs *jt;            /* jump table */
-       char env_buf[32];               /* buffer for getenv() before reloc. */
+       char env_buf[32];               /* buffer for env_get() before reloc. */
 #ifdef CONFIG_TRACE
        void            *trace_buff;    /* The trace buffer */
 #endif
index c8fb277cde5f50ab831791a1ca247619dcae03ff..aaed13167123b2bd5a0e8aeb5da2014c82720cdf 100644 (file)
@@ -311,16 +311,45 @@ int       env_init     (void);
 void   env_relocate (void);
 int    envmatch     (uchar *, int);
 
-/* Avoid unfortunate conflict with libc's getenv() */
-#ifdef CONFIG_SANDBOX
-#define getenv uboot_getenv
-#endif
-char   *getenv      (const char *);
-int    getenv_f     (const char *name, char *buf, unsigned len);
-ulong getenv_ulong(const char *name, int base, ulong default_val);
+/**
+ * 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);
 
 /**
- * getenv_hex() - Return an environment variable as a hex 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
@@ -329,27 +358,54 @@ ulong getenv_ulong(const char *name, int base, ulong default_val);
  * @varname:           Variable to decode
  * @default_val:       Value to return on error
  */
-ulong getenv_hex(const char *varname, ulong default_val);
+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 getenv_yesno(const char *var);
-int    saveenv      (void);
-int    setenv       (const char *, const char *);
-int setenv_ulong(const char *varname, ulong value);
-int setenv_hex(const char *varname, ulong value);
+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);
+
 /**
- * setenv_addr - Set an environment variable to an address in hex
+ * 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 setenv_addr(const char *varname, const void *addr)
+static inline int env_set_addr(const char *varname, const void *addr)
 {
-       return setenv_hex(varname, (ulong)addr);
+       return env_set_hex(varname, (ulong)addr);
 }
 
 #ifdef CONFIG_AUTO_COMPLETE
@@ -693,9 +749,9 @@ int zzip(void *dst, unsigned long *lenp, unsigned char *src,
 
 /* lib/net_utils.c */
 #include <net.h>
-static inline struct in_addr getenv_ip(char *var)
+static inline struct in_addr env_get_ip(char *var)
 {
-       return string_to_ip(getenv(var));
+       return string_to_ip(env_get(var));
 }
 
 int    pcmcia_init (void);
index 0fbf457cdcafab14e9c869ddedf2298d65a12d49..c56cbd9f54f488d85ecbda04a66f0f953d7e8003 100644 (file)
 #define CONFIG_ENV_SECT_SIZE           0x2000
 
 #define LDS_BOARD_TEXT \
-        . = DEFINED(env_offset) ? env_offset : .; \
-        common/env_embedded.o (.text*);
+       . = DEFINED(env_offset) ? env_offset : .; \
+       env/embedded.o(.text*);
 
 /* Cache Configuration */
 #define CONFIG_SYS_CACHELINE_SIZE      16
index dac2a32383aa9a0b8b3f4bce4b2eb8ec8d1d8d25..57bc57817d23fe0237d92dd2b5282bc582bef3e5 100644 (file)
 
 #define LDS_BOARD_TEXT \
        . = DEFINED(env_offset) ? env_offset : .; \
-       common/env_embedded.o (.text);
+       env/embedded.o(.text);
 
 #ifdef NORFLASH_PS32BIT
 #      define CONFIG_ENV_OFFSET                (0x8000)
index f6027e231f2aacd7a795c93a60841ceed04038b6..df0733e6c2050f0babccb1f10beab2cb3faef922 100644 (file)
@@ -85,8 +85,8 @@
 #define CONFIG_SYS_INIT_SP_OFFSET      CONFIG_SYS_GBL_DATA_OFFSET
 
 #define LDS_BOARD_TEXT \
-        . = DEFINED(env_offset) ? env_offset : .; \
-        common/env_embedded.o (.text);
+       . = DEFINED(env_offset) ? env_offset : .; \
+       env/embedded.o(.text);
 
 #define CONFIG_ENV_OFFSET              0x4000  /* Address of Environment Sector*/
 #define CONFIG_ENV_SIZE                0x2000  /* Total Size of Environment Sector     */
index 2bdfe80ef5dd30bd3c80f2d9a5cf66a1180e1c73..da8333ac6fdafd12d584a01fb10abc7a49bbfaf9 100644 (file)
@@ -29,8 +29,8 @@
 #endif
 
 #define LDS_BOARD_TEXT \
-        . = DEFINED(env_offset) ? env_offset : .; \
-        common/env_embedded.o (.text*);
+       . = DEFINED(env_offset) ? env_offset : .; \
+       env/embedded.o(.text*);
 
 /*
  * Command line configuration.
index 0722ea19e3c9c2eca58cf5f8006b6bd826e6f0a1..5a2f0e204f654147cdab0e2955eb23a4243d3b95 100644 (file)
@@ -31,7 +31,7 @@
 
 #define LDS_BOARD_TEXT \
        . = DEFINED(env_offset) ? env_offset : .; \
-       common/env_embedded.o      (.text)
+       env/embedded.o(.text)
 
 /*
  * BOOTP options
index e6bd7f360991ab9a1f7f6dc7bfc7fa2e8fd81591..f5693d81780805b1ca20939eaae6c528b2c84147 100644 (file)
@@ -39,8 +39,8 @@
 #endif
 
 #define LDS_BOARD_TEXT \
-        . = DEFINED(env_offset) ? env_offset : .; \
-        common/env_embedded.o (.text);
+       . = DEFINED(env_offset) ? env_offset : .; \
+       env/embedded.o(.text);
 
 /*
  * BOOTP options
index 6bcd6b6f2e88ec58cf31aae87bb093f5dcd6d850..339a03c7b10559da5ad3a63c0d74d78a9f1119ab 100644 (file)
@@ -40,8 +40,8 @@
 #endif
 
 #define LDS_BOARD_TEXT \
-        . = DEFINED(env_offset) ? env_offset : .; \
-        common/env_embedded.o (.text);
+       . = DEFINED(env_offset) ? env_offset : .; \
+       env/embedded.o(.text);
 
 /*
  * BOOTP options
index cc703aac19a5b94d45700cc7d612793e90d8c6fb..3f2d9a9bacda052701cd77717ce9677855d9c617 100644 (file)
@@ -32,7 +32,7 @@
 
 #define LDS_BOARD_TEXT \
        . = DEFINED(env_offset) ? env_offset : .; \
-       common/env_embedded.o (.text*);
+       env/embedded.o(.text*);
 
 /*
  * BOOTP options
index f7812468af0d0cbe7814a35eae823dd2ff7b609c..45e4be2f017d1532d8263a7bfa2ca0931a13d85d 100644 (file)
 
 #define LDS_BOARD_TEXT \
        . = DEFINED(env_offset) ? env_offset : .; \
-       common/env_embedded.o       (.text*)
+       env/embedded.o(.text*)
 
 /*-----------------------------------------------------------------------
  * Cache Configuration
index f7b284fda8b2decf206dd2f0127dd2e5d729c336..1b5cae2dfebc69b7ae86edbc713ff87662d94a7c 100644 (file)
 #define CONFIG_ENV_SECT_SIZE   0x2000
 
 #define LDS_BOARD_TEXT \
-        . = DEFINED(env_offset) ? env_offset : .; \
-        common/env_embedded.o (.text*);
+       . = DEFINED(env_offset) ? env_offset : .; \
+       env/embedded.o(.text*);
 
 /*-----------------------------------------------------------------------
  * Cache Configuration
index b85e0f088f343181af19d8d0f8729c719b7f04d9..a0e582e2b8938ad7244af8a811da46d68f861ec5 100644 (file)
 #define CONFIG_ENV_SECT_SIZE   0x2000
 
 #define LDS_BOARD_TEXT \
-        . = DEFINED(env_offset) ? env_offset : .; \
-        common/env_embedded.o (.text*);
+       . = DEFINED(env_offset) ? env_offset : .; \
+       env/embedded.o(.text*);
 
 /*-----------------------------------------------------------------------
  * Cache Configuration
index 0a4074611297066f2ca8e677787a15854312123c..5f8b6c5518f72bc28d08904754d616db36a5658f 100644 (file)
@@ -93,8 +93,8 @@
 #define CONFIG_ENV_SECT_SIZE           0x1000
 
 #define LDS_BOARD_TEXT \
-        . = DEFINED(env_offset) ? env_offset : .; \
-        common/env_embedded.o (.text*);
+       . = DEFINED(env_offset) ? env_offset : .; \
+       env/embedded.o(.text*);
 
 /* memory map space for linux boot data */
 #define CONFIG_SYS_BOOTMAPSZ           (8 << 20)
index af03b303c452bd4282705684fd5729afb54e1c3b..563732a5c44ed5639eb90d1b1c000af10610113e 100644 (file)
 
 #define LDS_BOARD_TEXT \
        . = DEFINED(env_offset) ? env_offset : .; \
-       common/env_embedded.o       (.text*)
+       env/embedded.o(.text*)
 
 #if ENABLE_JFFS
 /* JFFS Partition offset set */
index c44c6cae5889dd3a1f8f4328031a950a20cd752c..9adf7a35f0ed32227dfab9eb8332b18a64922aa9 100644 (file)
 #endif
 
 #define LDS_BOARD_TEXT \
-        . = DEFINED(env_offset) ? env_offset : .; \
-        common/env_embedded.o (.text);
+       . = DEFINED(env_offset) ? env_offset : .; \
+       env/embedded.o(.text);
 
 /*
  * BOOTP options
index dfac340c2f5e042d3d71d5d93b8fb60a6015cc19..399fbc7d9c42793e4ea77768d3af06b1816b0550 100644 (file)
@@ -42,7 +42,6 @@
 #define CONFIG_SYS_MEMTEST_END                 0x01000000
 
 /* Environment */
-#define CONFIG_ENV_IS_IN_MMC
 #define CONFIG_SYS_MMC_ENV_DEV                 0
 #define CONFIG_SYS_MMC_ENV_PART                        0
 #define CONFIG_ENV_SIZE                                (64 * 1024)
diff --git a/include/configs/pfla02.h b/include/configs/pfla02.h
new file mode 100644 (file)
index 0000000..be90ce9
--- /dev/null
@@ -0,0 +1,174 @@
+/*
+ * Copyright (C) Stefano Babic <sbabic@denx.de>
+ *
+ * SPDX-License-Identifier:    GPL-2.0+
+ */
+
+
+#ifndef __PCM058_CONFIG_H
+#define __PCM058_CONFIG_H
+
+#include <config_distro_defaults.h>
+
+#ifdef CONFIG_SPL
+#define CONFIG_SPL_SPI_LOAD
+#define CONFIG_SYS_SPI_U_BOOT_OFFS     (64 * 1024)
+#include "imx6_spl.h"
+#endif
+
+#include "mx6_common.h"
+
+/* Thermal */
+#define CONFIG_IMX_THERMAL
+
+/* Serial */
+#define CONFIG_MXC_UART
+#define CONFIG_MXC_UART_BASE          UART4_BASE
+#define CONSOLE_DEV            "ttymxc3"
+
+/* Early setup */
+#define CONFIG_DISPLAY_BOARDINFO_LATE
+
+
+/* Size of malloc() pool */
+#define CONFIG_SYS_MALLOC_LEN          (8 * SZ_1M)
+
+/* Ethernet */
+#define CONFIG_MII
+#define IMX_FEC_BASE                   ENET_BASE_ADDR
+#define CONFIG_FEC_XCV_TYPE            RGMII
+#define CONFIG_ETHPRIME                        "FEC"
+#define CONFIG_FEC_MXC_PHYADDR         3
+
+/* SPI Flash */
+#define CONFIG_MXC_SPI
+#define CONFIG_SF_DEFAULT_BUS          2
+#define CONFIG_SF_DEFAULT_CS           0
+#define CONFIG_SF_DEFAULT_SPEED                20000000
+#define CONFIG_SF_DEFAULT_MODE         SPI_MODE_0
+
+/* I2C Configs */
+#define CONFIG_SYS_I2C
+#define CONFIG_SYS_I2C_MXC
+#define CONFIG_SYS_I2C_MXC_I2C1                /* enable I2C bus 0 */
+#define CONFIG_SYS_I2C_SPEED             100000
+
+#ifndef CONFIG_SPL_BUILD
+#define CONFIG_CMD_NAND
+/* Enable NAND support */
+#define CONFIG_CMD_NAND_TRIMFFS
+#define CONFIG_NAND_MXS
+#define CONFIG_SYS_MAX_NAND_DEVICE     1
+#define CONFIG_SYS_NAND_BASE           0x40000000
+#define CONFIG_SYS_NAND_5_ADDR_CYCLE
+#define CONFIG_SYS_NAND_ONFI_DETECTION
+#endif
+
+/* DMA stuff, needed for GPMI/MXS NAND support */
+#define CONFIG_APBH_DMA
+#define CONFIG_APBH_DMA_BURST
+#define CONFIG_APBH_DMA_BURST8
+
+/* Filesystem support */
+#define CONFIG_MTD_PARTITIONS
+#define CONFIG_MTD_DEVICE
+#define MTDIDS_DEFAULT    "nand0=gpmi-nand"
+#define MTDPARTS_DEFAULT  "mtdparts=gpmi-nand:-(nand);" \
+       "spi2.0:1024k(bootloader),64k(env1),64k(env2),-(rescue)"
+
+/* Various command support */
+
+/* Physical Memory Map */
+#define CONFIG_NR_DRAM_BANKS           1
+#define PHYS_SDRAM                     MMDC0_ARB_BASE_ADDR
+
+#define CONFIG_SYS_SDRAM_BASE          PHYS_SDRAM
+#define CONFIG_SYS_INIT_RAM_ADDR       IRAM_BASE_ADDR
+#define CONFIG_SYS_INIT_RAM_SIZE       IRAM_SIZE
+
+#define CONFIG_SYS_INIT_SP_OFFSET \
+       (CONFIG_SYS_INIT_RAM_SIZE - GENERATED_GBL_DATA_SIZE)
+#define CONFIG_SYS_INIT_SP_ADDR \
+       (CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_SP_OFFSET)
+
+/* MMC Configs */
+#define CONFIG_SYS_FSL_ESDHC_ADDR      0
+#define CONFIG_SYS_FSL_USDHC_NUM       2
+
+/* Environment organization */
+#define CONFIG_ENV_IS_IN_SPI_FLASH
+#define CONFIG_ENV_SIZE                (16 * 1024)
+#define CONFIG_ENV_OFFSET              (1024 * SZ_1K)
+#define CONFIG_ENV_SECT_SIZE           (64 * SZ_1K)
+#define CONFIG_ENV_SPI_BUS             CONFIG_SF_DEFAULT_BUS
+#define CONFIG_ENV_SPI_CS              CONFIG_SF_DEFAULT_CS
+#define CONFIG_ENV_SPI_MODE            CONFIG_SF_DEFAULT_MODE
+#define CONFIG_ENV_SPI_MAX_HZ          CONFIG_SF_DEFAULT_SPEED
+#define CONFIG_SYS_REDUNDAND_ENVIRONMENT
+#define CONFIG_ENV_OFFSET_REDUND       (CONFIG_ENV_OFFSET + \
+                                               CONFIG_ENV_SECT_SIZE)
+#define CONFIG_ENV_SIZE_REDUND         CONFIG_ENV_SIZE
+
+#ifdef CONFIG_ENV_IS_IN_NAND
+#define CONFIG_ENV_OFFSET              (0x1E0000)
+#define CONFIG_ENV_SECT_SIZE           (128 * SZ_1K)
+#endif
+
+/* Default environment */
+#define CONFIG_EXTRA_ENV_SETTINGS \
+       "addcons=setenv bootargs ${bootargs} "                          \
+               "console=${console},${baudrate}\0"                      \
+       "addip=setenv bootargs ${bootargs} "                            \
+               "ip=${ipaddr}:${serverip}:${gatewayip}:"                \
+               "${netmask}:${hostname}:${netdev}:off\0"                \
+       "addmisc=setenv bootargs ${bootargs} ${miscargs}\0"             \
+       "addmtd=run mtdnand;run mtdspi;"                                \
+               "setenv bootargs ${bootargs} ${mtdparts}\0"             \
+       "mtdnand=setenv mtdparts mtdparts=gpmi-nand:"                   \
+               "40m(Kernels),400m(root),-(nand)\0"                     \
+       "mtdspi=setenv mtdparts ${mtdparts}"                            \
+               "';spi2.0:1024k(bootloader),"                           \
+                       "64k(env1),64k(env2),-(rescue)'\0"              \
+       "bootcmd=if test -n ${rescue};"                                 \
+               "then run swupdate;fi;run nandboot;run swupdate\0"      \
+       "bootfile=uImage\0"                                             \
+       "bootimage=uImage\0"                                            \
+       "console=ttymxc3\0"                                             \
+       "fdt_addr_r=0x18000000\0"                                       \
+       "fdt_file=pfla02.dtb\0"                                         \
+       "fdt_high=0xffffffff\0"                                         \
+       "initrd_high=0xffffffff\0"                                      \
+       "kernel_addr_r=" __stringify(CONFIG_LOADADDR) "\0"              \
+       "miscargs=panic=1 quiet\0"                                      \
+       "mmcargs=setenv bootargs root=${mmcroot} rw rootwait\0"         \
+       "mmcboot=if run mmcload;then "                                  \
+               "run mmcargs addcons addmisc;"                          \
+                       "bootm;fi\0"                                    \
+       "mmcload=mmc rescan;"                                           \
+               "load mmc 0:${mmcpart} ${kernel_addr_r} boot/fitImage\0"\
+       "mmcpart=1\0"                                                   \
+       "mmcroot=/dev/mmcblk0p1\0"                                      \
+       "ubiroot=1\0"                                                   \
+       "nandargs=setenv bootargs ubi.mtd=1 "                           \
+               "root=ubi0:rootfs${ubiroot} rootfstype=ubifs\0"         \
+       "nandboot=run mtdnand;ubi part nand0,0;"                        \
+               "ubi readvol ${kernel_addr_r} kernel${ubiroot};"        \
+               "run nandargs addip addcons addmtd addmisc;"            \
+               "bootm ${kernel_addr_r}\0"                              \
+       "net_nfs=tftp ${kernel_addr_r} ${board_name}/${bootfile};"      \
+               "tftp ${fdt_addr_r} ${board_name}/${fdt_file};"         \
+               "run nfsargs addip addcons addmtd addmisc;"             \
+               "bootm ${kernel_addr_r} - ${fdt_addr_r}\0"              \
+       "net_nfs_fit=tftp ${kernel_addr_r} ${board_name}/${fitfile};"   \
+               "run nfsargs addip addcons addmtd addmisc;"             \
+               "bootm ${kernel_addr_r}\0"                              \
+       "nfsargs=setenv bootargs root=/dev/nfs"                         \
+               " nfsroot=${serverip}:${nfsroot},v3 panic=1\0"          \
+       "swupdate=setenv bootargs root=/dev/ram;"                       \
+               "run addip addcons addmtd addmisc;"                     \
+               "sf probe;"                                             \
+               "sf read ${kernel_addr_r} 120000 600000;"               \
+               "sf read 14000000 730000 800000;"                       \
+               "bootm ${kernel_addr_r} 14000000\0"
+
+#endif
index 54223c475adca04aa943bf178be0068847dd2484..433625105a5050a0c57443b0cf75984431593c0e 100644 (file)
@@ -334,7 +334,7 @@ do {                                                                \
                else                                            \
                        strcpy(ethname, "ethaddr");             \
                printf("Setting %s from EEPROM with %s\n", ethname, buf);\
-               setenv(ethname, buf);                           \
+               env_set(ethname, buf);                          \
        }                                                       \
 } while (0)
 
index 921b9e5ec66ee68b4ae25cc20394b4c82d3d3f4a..cce245613d78d378fe373a2442468c0c35b76695 100644 (file)
@@ -93,7 +93,6 @@ unsigned char ulcb_softspi_read(void);
 #define CONFIG_SH_SDHI_FREQ            200000000
 
 /* Environment in eMMC, at the end of 2nd "boot sector" */
-#define CONFIG_ENV_IS_IN_MMC
 #define CONFIG_ENV_OFFSET              (-CONFIG_ENV_SIZE)
 #define CONFIG_SYS_MMC_ENV_DEV         1
 #define CONFIG_SYS_MMC_ENV_PART                2
index ed25f420d00b6e71820aa707e84d510f9f8986e3..d9237d7b81b03138cc500ca1424c476c54d9de61 100644 (file)
 #define BOOT_TARGET_DEVICES(func) \
        func(MMC, mmc, 0) \
        func(MMC, mmc, 1) \
+       func(SATA, sata, 0) \
        func(USB, usb, 0) \
        func(PXE, pxe, na) \
        func(DHCP, dhcp, na)
index 84a56c30ce2608c0c60f9e177a86bab7796f35c4..c9f22200cfd721421017042ee356b5b2713cd47e 100644 (file)
@@ -197,7 +197,7 @@ extern int AT91F_DataflashInit(void);
 
 extern void dataflash_print_info (void);
 extern void dataflash_perror (int err);
-extern void AT91F_DataflashSetEnv (void);
+extern void AT91F_Dataflashenv_set(void);
 
 extern struct dataflash_addr cs[CONFIG_SYS_MAX_DATAFLASH_BANKS];
 extern dataflash_protect_t area_list[NB_DATAFLASH_AREA];
index d86230a2e927e311b4e44d44c3f9dae481e778f8..03b41e0c51160d295b17f4764abfb4cb6dff312e 100644 (file)
@@ -143,10 +143,6 @@ extern unsigned long nand_env_oob_offset;
 # define ENV_HEADER_SIZE       (sizeof(uint32_t))
 #endif
 
-#if defined(CONFIG_CMD_SAVEENV) && !defined(CONFIG_ENV_IS_NOWHERE)
-extern char *env_name_spec;
-#endif
-
 #ifdef CONFIG_ENV_AES
 /* Make sure the payload is multiple of AES block size */
 #define ENV_SIZE ((CONFIG_ENV_SIZE - ENV_HEADER_SIZE) & ~(16 - 1))
@@ -174,9 +170,6 @@ extern env_t environment;
 extern const unsigned char default_environment[];
 extern env_t *env_ptr;
 
-extern void env_relocate_spec(void);
-extern unsigned char env_get_char_spec(int);
-
 #if defined(CONFIG_NEEDS_MANUAL_RELOC)
 extern void env_reloc(void);
 #endif
@@ -197,20 +190,101 @@ extern uint mmc_get_env_part(struct mmc *mmc);
 #include <env_flags.h>
 #include <search.h>
 
-extern struct hsearch_data env_htab;
+/* 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_DATAFLASH,
+       ENVL_EEPROM,
+       ENVL_EXT4,
+       ENVL_FAT,
+       ENVL_FLASH,
+       ENVL_MMC,
+       ENVL_NAND,
+       ENVL_NVRAM,
+       ENVL_ONENAND,
+       ENVL_REMOTE,
+       ENVL_SPI_FLASH,
+       ENVL_UBI,
+       ENVL_NOWHERE,
+
+       ENVL_COUNT,
+       ENVL_UNKNOWN,
+};
+
+struct env_driver {
+       const char *name;
+       enum env_location location;
+
+       /**
+        * get_char() - Read a character from the environment
+        *
+        * This method is optional. If not provided, a default implementation
+        * will read from gd->env_addr.
+        *
+        * @index: Index of character to read (0=first)
+        * @return character read, or -ve on error
+        */
+       int (*get_char)(int index);
+
+       /**
+        * load() - Load the environment from storage
+        *
+        * This method is optional. If not provided, no environment will be
+        * loaded.
+        *
+        * @return 0 if OK, -ve on error
+        */
+       int (*load)(void);
+
+       /**
+        * save() - Save the environment to storage
+        *
+        * This method is required for 'saveenv' to work.
+        *
+        * @return 0 if OK, -ve on error
+        */
+       int (*save)(void);
+
+       /**
+        * init() - Set up the initial pre-relocation environment
+        *
+        * This method is optional.
+        *
+        * @return 0 if OK, -ENOENT if no initial environment could be found,
+        * other -ve on error
+        */
+       int (*init)(void);
+};
+
+/* Declare a new environment location driver */
+#define U_BOOT_ENV_LOCATION(__name)                                    \
+       ll_entry_declare(struct env_driver, __name, env_driver)
+
+/* Declare the name of a location */
+#ifdef CONFIG_CMD_SAVEENV
+#define ENV_NAME(_name) .name = _name,
+#else
+#define ENV_NAME(_name)
+#endif
 
-/* Function that returns a character from the environment */
-unsigned char env_get_char(int);
+#ifdef CONFIG_CMD_SAVEENV
+#define env_save_ptr(x) x
+#else
+#define env_save_ptr(x) NULL
+#endif
 
-/* Function that returns a pointer to a value from the environment */
-const unsigned char *env_get_addr(int);
-unsigned char env_get_char_memory(int index);
+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 *getenv_default(const char *name);
+char *env_get_default(const char *name);
 
 /* [re]set to the default environment */
 void set_default_env(const char *s);
@@ -229,6 +303,37 @@ int env_export(env_t *env_out);
 int env_import_redund(const char *buf1, const char *buf2);
 #endif
 
+/**
+ * env_driver_lookup_default() - Look up the default environment driver
+ *
+ * @return pointer to driver, or NULL if none (which should not happen)
+ */
+struct env_driver *env_driver_lookup_default(void);
+
+/**
+ * env_get_char() - Get a character from the early environment
+ *
+ * This reads from the pre-relocation environemnt
+ *
+ * @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);
+
 #endif /* DO_DEPS_ONLY */
 
 #endif /* _ENVIRONMENT_H_ */
index 1d81bc4b289815707a98a0d5b4baf4e1474bfa8e..ebe81d914cb226256730bece027cc6fceb28dc68 100644 (file)
@@ -27,8 +27,8 @@ unsigned long get_timer(unsigned long);
 int vprintf(const char *, va_list);
 unsigned long simple_strtoul(const char *cp, char **endp, unsigned int base);
 int strict_strtoul(const char *cp, unsigned int base, unsigned long *res);
-char *getenv (const char *name);
-int setenv (const char *varname, const char *varvalue);
+char *env_get(const char *name);
+int env_set(const char *varname, const char *value);
 long simple_strtol(const char *cp, char **endp, unsigned int base);
 int strcmp(const char *cs, const char *ct);
 unsigned long ustrtoul(const char *cp, char **endp, unsigned int base);
index c6f1513220a31d29a0bf68a2879afd97eb3a62ab..1f4bfda2f3f1a314e3a176ae66a88eb34715250a 100644 (file)
@@ -373,7 +373,7 @@ typedef struct bootm_headers {
        bd_t            *kbd;
 #endif
 
-       int             verify;         /* getenv("verify")[0] != 'n' */
+       int             verify;         /* env_get("verify")[0] != 'n' */
 
 #define        BOOTM_STATE_START       (0x00000001)
 #define        BOOTM_STATE_FINDOS      (0x00000002)
@@ -769,9 +769,9 @@ static inline void image_set_name(image_header_t *hdr, const char *name)
 int image_check_hcrc(const image_header_t *hdr);
 int image_check_dcrc(const image_header_t *hdr);
 #ifndef USE_HOSTCC
-ulong getenv_bootm_low(void);
-phys_size_t getenv_bootm_size(void);
-phys_size_t getenv_bootm_mapsize(void);
+ulong env_get_bootm_low(void);
+phys_size_t env_get_bootm_size(void);
+phys_size_t env_get_bootm_mapsize(void);
 #endif
 void memmove_wd(void *to, void *from, size_t len, ulong chunksz);
 
index e1269486ad9cf11562c5aa432a33527f894ce325..455b48f6c720d3694888e3802a0bb52fe7c6ea17 100644 (file)
@@ -239,11 +239,11 @@ void eth_set_current(void);               /* set nterface to ethcur var */
 
 int eth_get_dev_index(void);           /* get the device index */
 void eth_parse_enetaddr(const char *addr, uchar *enetaddr);
-int eth_getenv_enetaddr(const char *name, uchar *enetaddr);
-int eth_setenv_enetaddr(const char *name, const uchar *enetaddr);
+int eth_env_get_enetaddr(const char *name, uchar *enetaddr);
+int eth_env_set_enetaddr(const char *name, const uchar *enetaddr);
 
 /**
- * eth_setenv_enetaddr_by_index() - set the MAC address environment variable
+ * eth_env_set_enetaddr_by_index() - set the MAC address environment variable
  *
  * This sets up an environment variable with the given MAC address (@enetaddr).
  * The environment variable to be set is defined by <@base_name><@index>addr.
@@ -255,7 +255,7 @@ int eth_setenv_enetaddr(const char *name, const uchar *enetaddr);
  * @enetaddr:   Pointer to MAC address to put into the variable
  * @return 0 if OK, other value on error
  */
-int eth_setenv_enetaddr_by_index(const char *base_name, int index,
+int eth_env_set_enetaddr_by_index(const char *base_name, int index,
                                 uchar *enetaddr);
 
 
@@ -275,7 +275,7 @@ int usb_ether_init(void);
  * Returns:
  *     Return true if the address is valid.
  */
-int eth_getenv_enetaddr_by_index(const char *base_name, int index,
+int eth_env_get_enetaddr_by_index(const char *base_name, int index,
                                 uchar *enetaddr);
 
 int eth_init(void);                    /* Initialize the device */
@@ -834,7 +834,7 @@ void vlan_to_string(ushort x, char *s);
 ushort string_to_vlan(const char *s);
 
 /* read a VLAN id from an environment variable */
-ushort getenv_vlan(char *);
+ushort env_get_vlan(char *);
 
 /* copy a filename (allow for "..." notation, limit length) */
 void copy_filename(char *dst, const char *src, int size);
index c06b90886b3da80c0a6a21957cc3e34bf2132fce..b9bfebac67f79d550fa026a2e45d0fe9f090df62 100644 (file)
@@ -130,7 +130,12 @@ static inline int pci_eth_init(bd_t *bis)
        return num;
 }
 
+#ifdef CONFIG_DM_ETH
+struct mii_dev *fec_get_miibus(struct udevice *dev, int dev_id);
+#else
 struct mii_dev *fec_get_miibus(uint32_t base_addr, int dev_id);
+#endif
+
 #ifdef CONFIG_PHYLIB
 struct phy_device;
 int fec_probe(bd_t *bd, int dev_id, uint32_t base_addr,
index 402dfd84fba315a76e322e5e7ec9a821dbfeb890..df5d61c2eb884b1f49f35a60cc546bce435efc55 100644 (file)
@@ -118,7 +118,7 @@ extern int hwalk_r(struct hsearch_data *__htab, int (*callback)(ENTRY *));
 #define H_MATCH_SUBSTR (1 << 7) /* search for substring matches             */
 #define H_MATCH_REGEX  (1 << 8) /* search for regular expression matches    */
 #define H_MATCH_METHOD (H_MATCH_IDENT | H_MATCH_SUBSTR | H_MATCH_REGEX)
-#define H_PROGRAMMATIC (1 << 9) /* indicate that an import is from setenv() */
+#define H_PROGRAMMATIC (1 << 9) /* indicate that an import is from env_set() */
 #define H_ORIGIN_FLAGS (H_INTERACTIVE | H_PROGRAMMATIC)
 
 #endif /* _SEARCH_H_ */
index d2dbd0f122ea1b358306586ea3613ae263dc0c3c..107a892e79c274e0b6e2c44cf2516aef7d469a1e 100644 (file)
@@ -1240,7 +1240,7 @@ int fdtdec_setup(void)
 # endif
 # ifndef CONFIG_SPL_BUILD
        /* Allow the early environment to override the fdt address */
-       gd->fdt_blob = (void *)getenv_ulong("fdtcontroladdr", 16,
+       gd->fdt_blob = (void *)env_get_ulong("fdtcontroladdr", 16,
                                                (uintptr_t)gd->fdt_blob);
 # endif
 #endif
index 22ca247fec8881ba3dcc87ffc831769f85cf1a4a..8f19ad89c121ebbc2ae1a7842edc8a8e432e3b8b 100644 (file)
@@ -112,7 +112,7 @@ static int smbios_write_type1(ulong *current, int handle)
 {
        struct smbios_type1 *t = (struct smbios_type1 *)*current;
        int len = sizeof(struct smbios_type1);
-       char *serial_str = getenv("serial#");
+       char *serial_str = env_get("serial#");
 
        memset(t, 0, sizeof(struct smbios_type1));
        fill_smbios_header(t, SMBIOS_SYSTEM_INFORMATION, len, handle);
index c8584edcb861ad7e15ad207a8a27d83e822be56a..1536c027da27c82df8953be81207296c979a1111 100644 (file)
@@ -291,7 +291,7 @@ int do_uuid(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
        if (argc == 1)
                printf("%s\n", uuid);
        else
-               setenv(argv[1], uuid);
+               env_set(argv[1], uuid);
 
        return CMD_RET_SUCCESS;
 }
index f3ceff9ed89c3886f90e5b10efd2cec624017f78..4c79e09ccbf6d8cb3ba49a31f98bf26aedaa0ae2 100644 (file)
--- a/net/arp.c
+++ b/net/arp.c
@@ -194,7 +194,7 @@ void arp_receive(struct ethernet_hdr *et, struct ip_udp_hdr *ip, int len)
                if (net_server_ip.s_addr == net_arp_wait_packet_ip.s_addr) {
                        char buf[20];
                        sprintf(buf, "%pM", &arp->ar_sha);
-                       setenv("serveraddr", buf);
+                       env_set("serveraddr", buf);
                }
 #endif
 
index be8f710e0c5ca9bb0a2a884891932966c86d21c6..73370a13fe7de813f9bb6ec7ff9daad7982b9047 100644 (file)
@@ -170,7 +170,7 @@ static void store_net_params(struct bootp_hdr *bp)
         * not contain a new value
         */
        if (*net_boot_file_name)
-               setenv("bootfile", net_boot_file_name);
+               env_set("bootfile", net_boot_file_name);
 #endif
        net_copy_ip(&net_ip, &bp->bp_yiaddr);
 }
@@ -414,7 +414,7 @@ static void bootp_timeout_handler(void)
 static u8 *add_vci(u8 *e)
 {
        char *vci = NULL;
-       char *env_vci = getenv("bootp_vci");
+       char *env_vci = env_get("bootp_vci");
 
 #if defined(CONFIG_SPL_BUILD) && defined(CONFIG_SPL_NET_VCI_STRING)
        vci = CONFIG_SPL_NET_VCI_STRING;
@@ -488,7 +488,7 @@ static int dhcp_extended(u8 *e, int message_type, struct in_addr server_ip,
                *e++ = tmp & 0xff;
        }
 #if defined(CONFIG_BOOTP_SEND_HOSTNAME)
-       hostname = getenv("hostname");
+       hostname = env_get("hostname");
        if (hostname) {
                int hostnamelen = strlen(hostname);
 
@@ -503,8 +503,8 @@ static int dhcp_extended(u8 *e, int message_type, struct in_addr server_ip,
        clientarch = CONFIG_BOOTP_PXE_CLIENTARCH;
 #endif
 
-       if (getenv("bootp_arch"))
-               clientarch = getenv_ulong("bootp_arch", 16, clientarch);
+       if (env_get("bootp_arch"))
+               clientarch = env_get_ulong("bootp_arch", 16, clientarch);
 
        if (clientarch > 0) {
                *e++ = 93;      /* Client System Architecture */
@@ -520,7 +520,7 @@ static int dhcp_extended(u8 *e, int message_type, struct in_addr server_ip,
        *e++ = 0;       /* minor revision */
 
 #ifdef CONFIG_LIB_UUID
-       uuid = getenv("pxeuuid");
+       uuid = env_get("pxeuuid");
 
        if (uuid) {
                if (uuid_str_valid(uuid)) {
@@ -713,7 +713,7 @@ void bootp_request(void)
        dhcp_state = INIT;
 #endif
 
-       ep = getenv("bootpretryperiod");
+       ep = env_get("bootpretryperiod");
        if (ep != NULL)
                time_taken_max = simple_strtoul(ep, NULL, 10);
        else
index 7017bac75af5faf7a99ce2e17ee088bcc6fd5a32..eee8a02f7c4fbe2485263b8b6666a38546f27be7 100644 (file)
--- a/net/dns.c
+++ b/net/dns.c
@@ -184,7 +184,7 @@ static void dns_handler(uchar *pkt, unsigned dest, struct in_addr sip,
                        ip_to_string(ip_addr, ip_str);
                        printf("%s\n", ip_str);
                        if (net_dns_env_var)
-                               setenv(net_dns_env_var, ip_str);
+                               env_set(net_dns_env_var, ip_str);
                } else {
                        puts("server responded with invalid IP number\n");
                }
index b659961a5dd4dd883c933f5dad3e3a2754bc2d89..d30b04ba862a8b90d370b97116a7683c1d752f36 100644 (file)
@@ -241,8 +241,8 @@ U_BOOT_ENV_CALLBACK(ethaddr, on_ethaddr);
 
 int eth_init(void)
 {
-       char *ethact = getenv("ethact");
-       char *ethrotate = getenv("ethrotate");
+       char *ethact = env_get("ethact");
+       char *ethrotate = env_get("ethrotate");
        struct udevice *current = NULL;
        struct udevice *old_current;
        int ret = -ENODEV;
@@ -401,7 +401,7 @@ int eth_initialize(void)
                printf("No ethernet found.\n");
                bootstage_error(BOOTSTAGE_ID_NET_ETH_START);
        } else {
-               char *ethprime = getenv("ethprime");
+               char *ethprime = env_get("ethprime");
                struct udevice *prime_dev = NULL;
 
                if (ethprime)
@@ -495,7 +495,7 @@ static int eth_post_probe(struct udevice *dev)
        if (eth_get_ops(dev)->read_rom_hwaddr)
                eth_get_ops(dev)->read_rom_hwaddr(dev);
 
-       eth_getenv_enetaddr_by_index("eth", dev->seq, env_enetaddr);
+       eth_env_get_enetaddr_by_index("eth", dev->seq, env_enetaddr);
        if (!is_zero_ethaddr(env_enetaddr)) {
                if (!is_zero_ethaddr(pdata->enetaddr) &&
                    memcmp(pdata->enetaddr, env_enetaddr, ARP_HLEN)) {
@@ -510,7 +510,7 @@ static int eth_post_probe(struct udevice *dev)
                /* Override the ROM MAC address */
                memcpy(pdata->enetaddr, env_enetaddr, ARP_HLEN);
        } else if (is_valid_ethaddr(pdata->enetaddr)) {
-               eth_setenv_enetaddr_by_index("eth", dev->seq, pdata->enetaddr);
+               eth_env_set_enetaddr_by_index("eth", dev->seq, pdata->enetaddr);
                printf("\nWarning: %s using MAC address from ROM\n",
                       dev->name);
        } else if (is_zero_ethaddr(pdata->enetaddr) ||
index 58fa295771020639ba8924d906787dc3f9d78430..66d0d22966e01463d453a8e22a2898a65e67c8a1 100644 (file)
@@ -24,38 +24,38 @@ void eth_parse_enetaddr(const char *addr, uchar *enetaddr)
        }
 }
 
-int eth_getenv_enetaddr(const char *name, uchar *enetaddr)
+int eth_env_get_enetaddr(const char *name, uchar *enetaddr)
 {
-       eth_parse_enetaddr(getenv(name), enetaddr);
+       eth_parse_enetaddr(env_get(name), enetaddr);
        return is_valid_ethaddr(enetaddr);
 }
 
-int eth_setenv_enetaddr(const char *name, const uchar *enetaddr)
+int eth_env_set_enetaddr(const char *name, const uchar *enetaddr)
 {
        char buf[ARP_HLEN_ASCII + 1];
 
-       if (eth_getenv_enetaddr(name, (uchar *)buf))
+       if (eth_env_get_enetaddr(name, (uchar *)buf))
                return -EEXIST;
 
        sprintf(buf, "%pM", enetaddr);
 
-       return setenv(name, buf);
+       return env_set(name, buf);
 }
 
-int eth_getenv_enetaddr_by_index(const char *base_name, int index,
+int eth_env_get_enetaddr_by_index(const char *base_name, int index,
                                 uchar *enetaddr)
 {
        char enetvar[32];
        sprintf(enetvar, index ? "%s%daddr" : "%saddr", base_name, index);
-       return eth_getenv_enetaddr(enetvar, enetaddr);
+       return eth_env_get_enetaddr(enetvar, enetaddr);
 }
 
-int eth_setenv_enetaddr_by_index(const char *base_name, int index,
+int eth_env_set_enetaddr_by_index(const char *base_name, int index,
                                 uchar *enetaddr)
 {
        char enetvar[32];
        sprintf(enetvar, index ? "%s%daddr" : "%saddr", base_name, index);
-       return eth_setenv_enetaddr(enetvar, enetaddr);
+       return eth_env_set_enetaddr(enetvar, enetaddr);
 }
 
 void eth_common_init(void)
@@ -76,13 +76,13 @@ int eth_mac_skip(int index)
        char *skip_state;
 
        sprintf(enetvar, index ? "eth%dmacskip" : "ethmacskip", index);
-       skip_state = getenv(enetvar);
+       skip_state = env_get(enetvar);
        return skip_state != NULL;
 }
 
 void eth_current_changed(void)
 {
-       char *act = getenv("ethact");
+       char *act = env_get("ethact");
        char *ethrotate;
 
        /*
@@ -90,21 +90,21 @@ void eth_current_changed(void)
         * ethernet device if uc_priv->current == NULL. This is not what
         * we want when 'ethrotate' variable is 'no'.
         */
-       ethrotate = getenv("ethrotate");
+       ethrotate = env_get("ethrotate");
        if ((ethrotate != NULL) && (strcmp(ethrotate, "no") == 0))
                return;
 
        /* update current ethernet name */
        if (eth_get_dev()) {
                if (act == NULL || strcmp(act, eth_get_name()) != 0)
-                       setenv("ethact", eth_get_name());
+                       env_set("ethact", eth_get_name());
        }
        /*
         * remove the variable completely if there is no active
         * interface
         */
        else if (act != NULL)
-               setenv("ethact", NULL);
+               env_set("ethact", NULL);
 }
 
 void eth_try_another(int first_restart)
@@ -116,7 +116,7 @@ void eth_try_another(int first_restart)
         * Do not rotate between network interfaces when
         * 'ethrotate' variable is set to 'no'.
         */
-       ethrotate = getenv("ethrotate");
+       ethrotate = env_get("ethrotate");
        if ((ethrotate != NULL) && (strcmp(ethrotate, "no") == 0))
                return;
 
@@ -142,12 +142,12 @@ void eth_set_current(void)
 
        env_id = get_env_id();
        if ((act == NULL) || (env_changed_id != env_id)) {
-               act = getenv("ethact");
+               act = env_get("ethact");
                env_changed_id = env_id;
        }
 
        if (act == NULL) {
-               char *ethprime = getenv("ethprime");
+               char *ethprime = env_get("ethprime");
                void *dev = NULL;
 
                if (ethprime)
index a14b20844f896148be0af43aad950ba36e69ea8e..4b0e716b732e0dc111f97f802195b67ff455fb4c 100644 (file)
@@ -13,7 +13,7 @@
 void eth_common_init(void);
 
 /**
- * eth_setenv_enetaddr_by_index() - set the MAC address environment variable
+ * eth_env_set_enetaddr_by_index() - set the MAC address environment variable
  *
  * This sets up an environment variable with the given MAC address (@enetaddr).
  * The environment variable to be set is defined by <@base_name><@index>addr.
@@ -25,7 +25,7 @@ void eth_common_init(void);
  * @enetaddr:  Pointer to MAC address to put into the variable
  * @return 0 if OK, other value on error
  */
-int eth_setenv_enetaddr_by_index(const char *base_name, int index,
+int eth_env_set_enetaddr_by_index(const char *base_name, int index,
                                 uchar *enetaddr);
 
 int eth_mac_skip(int index);
index e4bd0f4c1ac8ca035e4c38f97f1c2032b4b58721..be0cf64a3dd16f654cc55cbd7043bcdc3f6c2e86 100644 (file)
@@ -137,7 +137,7 @@ int eth_write_hwaddr(struct eth_device *dev, const char *base_name,
        unsigned char env_enetaddr[ARP_HLEN];
        int ret = 0;
 
-       eth_getenv_enetaddr_by_index(base_name, eth_number, env_enetaddr);
+       eth_env_get_enetaddr_by_index(base_name, eth_number, env_enetaddr);
 
        if (!is_zero_ethaddr(env_enetaddr)) {
                if (!is_zero_ethaddr(dev->enetaddr) &&
@@ -152,8 +152,8 @@ int eth_write_hwaddr(struct eth_device *dev, const char *base_name,
 
                memcpy(dev->enetaddr, env_enetaddr, ARP_HLEN);
        } else if (is_valid_ethaddr(dev->enetaddr)) {
-               eth_setenv_enetaddr_by_index(base_name, eth_number,
-                                            dev->enetaddr);
+               eth_env_set_enetaddr_by_index(base_name, eth_number,
+                                             dev->enetaddr);
        } else if (is_zero_ethaddr(dev->enetaddr)) {
 #ifdef CONFIG_NET_RANDOM_ETHADDR
                net_random_ethaddr(dev->enetaddr);
@@ -261,7 +261,7 @@ int eth_initialize(void)
                bootstage_error(BOOTSTAGE_ID_NET_ETH_START);
        } else {
                struct eth_device *dev = eth_devices;
-               char *ethprime = getenv("ethprime");
+               char *ethprime = env_get("ethprime");
 
                bootstage_mark(BOOTSTAGE_ID_NET_ETH_INIT);
                do {
index dfd240dfbcfd90288de50fdf54c934bbe754549a..31cdef4083a2e7afc183159f9552e9a00564193b 100644 (file)
@@ -104,7 +104,7 @@ static void configure_wait(void)
 
 void link_local_start(void)
 {
-       ip = getenv_ip("llipaddr");
+       ip = env_get_ip("llipaddr");
        if (ip.s_addr != 0 &&
            (ntohl(ip.s_addr) & IN_CLASSB_NET) != LINKLOCAL_ADDR) {
                puts("invalid link address");
index 2268890ab54e7bd6ac0ef104212570f4b45b3402..4259c9e321d6905efef6ca5abe441e89943eab9f 100644 (file)
--- a/net/net.c
+++ b/net/net.c
@@ -319,7 +319,7 @@ U_BOOT_ENV_CALLBACK(dnsip, on_dnsip);
 void net_auto_load(void)
 {
 #if defined(CONFIG_CMD_NFS)
-       const char *s = getenv("autoload");
+       const char *s = env_get("autoload");
 
        if (s != NULL && strcmp(s, "NFS") == 0) {
                /*
@@ -329,7 +329,7 @@ void net_auto_load(void)
                return;
        }
 #endif
-       if (getenv_yesno("autoload") == 0) {
+       if (env_get_yesno("autoload") == 0) {
                /*
                 * Just use BOOTP/RARP to configure system;
                 * Do not use TFTP to load the bootfile.
@@ -616,8 +616,8 @@ restart:
                        if (net_boot_file_size > 0) {
                                printf("Bytes transferred = %d (%x hex)\n",
                                       net_boot_file_size, net_boot_file_size);
-                               setenv_hex("filesize", net_boot_file_size);
-                               setenv_hex("fileaddr", load_addr);
+                               env_set_hex("filesize", net_boot_file_size);
+                               env_set_hex("fileaddr", load_addr);
                        }
                        if (protocol != NETCONS)
                                eth_halt();
@@ -668,7 +668,7 @@ int net_start_again(void)
        unsigned long retrycnt = 0;
        int ret;
 
-       nretry = getenv("netretry");
+       nretry = env_get("netretry");
        if (nretry) {
                if (!strcmp(nretry, "yes"))
                        retry_forever = 1;
@@ -1536,7 +1536,7 @@ ushort string_to_vlan(const char *s)
        return htons(id);
 }
 
-ushort getenv_vlan(char *var)
+ushort env_get_vlan(char *var)
 {
-       return string_to_vlan(getenv(var));
+       return string_to_vlan(env_get(var));
 }
index 61e1671068039f2be225e5a8b0af9164237fbaa9..a5ed8c5d0a3507b5f8dc270aae53194db4c0deb7 100644 (file)
@@ -706,11 +706,11 @@ void tftp_start(enum proto_t protocol)
         * TFTP protocol has a minimal timeout of 1 second.
         */
 
-       ep = getenv("tftpblocksize");
+       ep = env_get("tftpblocksize");
        if (ep != NULL)
                tftp_block_size_option = simple_strtol(ep, NULL, 10);
 
-       ep = getenv("tftptimeout");
+       ep = env_get("tftptimeout");
        if (ep != NULL)
                timeout_ms = simple_strtol(ep, NULL, 10);
 
@@ -720,7 +720,7 @@ void tftp_start(enum proto_t protocol)
                timeout_ms = 1000;
        }
 
-       ep = getenv("tftptimeoutcountmax");
+       ep = env_get("tftptimeoutcountmax");
        if (ep != NULL)
                tftp_timeout_count_max = simple_strtol(ep, NULL, 10);
 
@@ -822,10 +822,10 @@ void tftp_start(enum proto_t protocol)
        tftp_our_port = 1024 + (get_timer(0) % 3072);
 
 #ifdef CONFIG_TFTP_PORT
-       ep = getenv("tftpdstp");
+       ep = env_get("tftpdstp");
        if (ep != NULL)
                tftp_remote_port = simple_strtol(ep, NULL, 10);
-       ep = getenv("tftpsrcp");
+       ep = env_get("tftpsrcp");
        if (ep != NULL)
                tftp_our_port = simple_strtol(ep, NULL, 10);
 #endif
index 8c2c822acbd2c51e6a814f5125ef96fafc8bf253..8fef0c34127d2a635cbe83db5895ad1f819ff8a9 100644 (file)
@@ -180,7 +180,7 @@ static void post_get_env_flags(int *test_flags)
        int i, j;
 
        for (i = 0; i < varnum; i++) {
-               if (getenv_f(var[i], list, sizeof(list)) <= 0)
+               if (env_get_f(var[i], list, sizeof(list)) <= 0)
                        continue;
 
                for (j = 0; j < post_list_size; j++)
index 167b2d9d2977c0259f4b11671343167a713352e6..3ba00077d34a91cab9ead3ebc3f4082ce287d5f5 100644 (file)
@@ -69,10 +69,10 @@ libs-y += common/init/
 
 # Special handling for a few options which support SPL/TPL
 ifeq ($(CONFIG_TPL_BUILD),y)
-libs-$(CONFIG_TPL_LIBCOMMON_SUPPORT) += common/ cmd/
+libs-$(CONFIG_TPL_LIBCOMMON_SUPPORT) += common/ cmd/ env/
 libs-$(CONFIG_TPL_LIBGENERIC_SUPPORT) += lib/
 else
-libs-$(CONFIG_SPL_LIBCOMMON_SUPPORT) += common/ cmd/
+libs-$(CONFIG_SPL_LIBCOMMON_SUPPORT) += common/ cmd/ env/
 libs-$(CONFIG_SPL_LIBGENERIC_SUPPORT) += lib/
 endif
 
index 21283eb35732568abd464f10a1d8fa32aac3f931..f76d52569da70a64c1445ef41203fca158d635a3 100644 (file)
@@ -19,16 +19,16 @@ static int do_ut_cmd(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 
        /* commands separated by \n */
        run_command_list("setenv list 1\n setenv list ${list}1", -1, 0);
-       assert(!strcmp("11", getenv("list")));
+       assert(!strcmp("11", env_get("list")));
 
        /* command followed by \n and nothing else */
        run_command_list("setenv list 1${list}\n", -1, 0);
-       assert(!strcmp("111", getenv("list")));
+       assert(!strcmp("111", env_get("list")));
 
        /* a command string with \0 in it. Stuff after \0 should be ignored */
        run_command("setenv list", 0);
        run_command_list(test_cmd, sizeof(test_cmd), 0);
-       assert(!strcmp("123", getenv("list")));
+       assert(!strcmp("123", env_get("list")));
 
        /*
         * a command list where we limit execution to only the first command
@@ -36,7 +36,7 @@ static int do_ut_cmd(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
         */
        run_command_list("setenv list 1\n setenv list ${list}2; "
                "setenv list ${list}3", strlen("setenv list 1"), 0);
-       assert(!strcmp("1", getenv("list")));
+       assert(!strcmp("1", env_get("list")));
 
        assert(run_command("false", 0) == 1);
        assert(run_command("echo", 0) == 0);
@@ -46,10 +46,10 @@ static int do_ut_cmd(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 #ifdef CONFIG_HUSH_PARSER
        run_command("setenv foo 'setenv black 1\nsetenv adder 2'", 0);
        run_command("run foo", 0);
-       assert(getenv("black") != NULL);
-       assert(!strcmp("1", getenv("black")));
-       assert(getenv("adder") != NULL);
-       assert(!strcmp("2", getenv("adder")));
+       assert(env_get("black") != NULL);
+       assert(!strcmp("1", env_get("black")));
+       assert(env_get("adder") != NULL);
+       assert(!strcmp("2", env_get("adder")));
 #endif
 
        assert(run_command("", 0) == 0);
index 564ad36916016f241909fc90971e1cae91e4fe54..122fab924d6ac4491cb87907029b50a3d5cd259e 100644 (file)
@@ -26,17 +26,17 @@ static int dm_test_eth(struct unit_test_state *uts)
 {
        net_ping_ip = string_to_ip("1.1.2.2");
 
-       setenv("ethact", "eth@10002000");
+       env_set("ethact", "eth@10002000");
        ut_assertok(net_loop(PING));
-       ut_asserteq_str("eth@10002000", getenv("ethact"));
+       ut_asserteq_str("eth@10002000", env_get("ethact"));
 
-       setenv("ethact", "eth@10003000");
+       env_set("ethact", "eth@10003000");
        ut_assertok(net_loop(PING));
-       ut_asserteq_str("eth@10003000", getenv("ethact"));
+       ut_asserteq_str("eth@10003000", env_get("ethact"));
 
-       setenv("ethact", "eth@10004000");
+       env_set("ethact", "eth@10004000");
        ut_assertok(net_loop(PING));
-       ut_asserteq_str("eth@10004000", getenv("ethact"));
+       ut_asserteq_str("eth@10004000", env_get("ethact"));
 
        return 0;
 }
@@ -45,22 +45,22 @@ DM_TEST(dm_test_eth, DM_TESTF_SCAN_FDT);
 static int dm_test_eth_alias(struct unit_test_state *uts)
 {
        net_ping_ip = string_to_ip("1.1.2.2");
-       setenv("ethact", "eth0");
+       env_set("ethact", "eth0");
        ut_assertok(net_loop(PING));
-       ut_asserteq_str("eth@10002000", getenv("ethact"));
+       ut_asserteq_str("eth@10002000", env_get("ethact"));
 
-       setenv("ethact", "eth1");
+       env_set("ethact", "eth1");
        ut_assertok(net_loop(PING));
-       ut_asserteq_str("eth@10004000", getenv("ethact"));
+       ut_asserteq_str("eth@10004000", env_get("ethact"));
 
        /* Expected to fail since eth2 is not defined in the device tree */
-       setenv("ethact", "eth2");
+       env_set("ethact", "eth2");
        ut_assertok(net_loop(PING));
-       ut_asserteq_str("eth@10002000", getenv("ethact"));
+       ut_asserteq_str("eth@10002000", env_get("ethact"));
 
-       setenv("ethact", "eth5");
+       env_set("ethact", "eth5");
        ut_assertok(net_loop(PING));
-       ut_asserteq_str("eth@10003000", getenv("ethact"));
+       ut_asserteq_str("eth@10003000", env_get("ethact"));
 
        return 0;
 }
@@ -71,16 +71,16 @@ static int dm_test_eth_prime(struct unit_test_state *uts)
        net_ping_ip = string_to_ip("1.1.2.2");
 
        /* Expected to be "eth@10003000" because of ethprime variable */
-       setenv("ethact", NULL);
-       setenv("ethprime", "eth5");
+       env_set("ethact", NULL);
+       env_set("ethprime", "eth5");
        ut_assertok(net_loop(PING));
-       ut_asserteq_str("eth@10003000", getenv("ethact"));
+       ut_asserteq_str("eth@10003000", env_get("ethact"));
 
        /* Expected to be "eth@10002000" because it is first */
-       setenv("ethact", NULL);
-       setenv("ethprime", NULL);
+       env_set("ethact", NULL);
+       env_set("ethprime", NULL);
        ut_assertok(net_loop(PING));
-       ut_asserteq_str("eth@10002000", getenv("ethact"));
+       ut_asserteq_str("eth@10002000", env_get("ethact"));
 
        return 0;
 }
@@ -119,28 +119,28 @@ static int dm_test_eth_act(struct unit_test_state *uts)
                ut_assertok(device_remove(dev[i], DM_REMOVE_NORMAL));
 
                /* Invalidate MAC address */
-               strcpy(ethaddr[i], getenv(addrname[i]));
+               strcpy(ethaddr[i], env_get(addrname[i]));
                /* Must disable access protection for ethaddr before clearing */
-               setenv(".flags", addrname[i]);
-               setenv(addrname[i], NULL);
+               env_set(".flags", addrname[i]);
+               env_set(addrname[i], NULL);
        }
 
        /* Set ethact to "eth@10002000" */
-       setenv("ethact", ethname[0]);
+       env_set("ethact", ethname[0]);
 
        /* Segment fault might happen if something is wrong */
        ut_asserteq(-ENODEV, net_loop(PING));
 
        for (i = 0; i < DM_TEST_ETH_NUM; i++) {
                /* Restore the env */
-               setenv(".flags", addrname[i]);
-               setenv(addrname[i], ethaddr[i]);
+               env_set(".flags", addrname[i]);
+               env_set(addrname[i], ethaddr[i]);
 
                /* Probe the device again */
                ut_assertok(device_probe(dev[i]));
        }
-       setenv(".flags", NULL);
-       setenv("ethact", NULL);
+       env_set(".flags", NULL);
+       env_set("ethact", NULL);
 
        return 0;
 }
@@ -150,15 +150,15 @@ DM_TEST(dm_test_eth_act, DM_TESTF_SCAN_FDT);
 static int _dm_test_eth_rotate1(struct unit_test_state *uts)
 {
        /* Make sure that the default is to rotate to the next interface */
-       setenv("ethact", "eth@10004000");
+       env_set("ethact", "eth@10004000");
        ut_assertok(net_loop(PING));
-       ut_asserteq_str("eth@10002000", getenv("ethact"));
+       ut_asserteq_str("eth@10002000", env_get("ethact"));
 
        /* If ethrotate is no, then we should fail on a bad MAC */
-       setenv("ethact", "eth@10004000");
-       setenv("ethrotate", "no");
+       env_set("ethact", "eth@10004000");
+       env_set("ethrotate", "no");
        ut_asserteq(-EINVAL, net_loop(PING));
-       ut_asserteq_str("eth@10004000", getenv("ethact"));
+       ut_asserteq_str("eth@10004000", env_get("ethact"));
 
        return 0;
 }
@@ -166,14 +166,14 @@ static int _dm_test_eth_rotate1(struct unit_test_state *uts)
 static int _dm_test_eth_rotate2(struct unit_test_state *uts)
 {
        /* Make sure we can skip invalid devices */
-       setenv("ethact", "eth@10004000");
+       env_set("ethact", "eth@10004000");
        ut_assertok(net_loop(PING));
-       ut_asserteq_str("eth@10004000", getenv("ethact"));
+       ut_asserteq_str("eth@10004000", env_get("ethact"));
 
        /* Make sure we can handle device name which is not eth# */
-       setenv("ethact", "sbe5");
+       env_set("ethact", "sbe5");
        ut_assertok(net_loop(PING));
-       ut_asserteq_str("sbe5", getenv("ethact"));
+       ut_asserteq_str("sbe5", env_get("ethact"));
 
        return 0;
 }
@@ -187,31 +187,31 @@ static int dm_test_eth_rotate(struct unit_test_state *uts)
        net_ping_ip = string_to_ip("1.1.2.2");
 
        /* Invalidate eth1's MAC address */
-       strcpy(ethaddr, getenv("eth1addr"));
+       strcpy(ethaddr, env_get("eth1addr"));
        /* Must disable access protection for eth1addr before clearing */
-       setenv(".flags", "eth1addr");
-       setenv("eth1addr", NULL);
+       env_set(".flags", "eth1addr");
+       env_set("eth1addr", NULL);
 
        retval = _dm_test_eth_rotate1(uts);
 
        /* Restore the env */
-       setenv("eth1addr", ethaddr);
-       setenv("ethrotate", NULL);
+       env_set("eth1addr", ethaddr);
+       env_set("ethrotate", NULL);
 
        if (!retval) {
                /* Invalidate eth0's MAC address */
-               strcpy(ethaddr, getenv("ethaddr"));
+               strcpy(ethaddr, env_get("ethaddr"));
                /* Must disable access protection for ethaddr before clearing */
-               setenv(".flags", "ethaddr");
-               setenv("ethaddr", NULL);
+               env_set(".flags", "ethaddr");
+               env_set("ethaddr", NULL);
 
                retval = _dm_test_eth_rotate2(uts);
 
                /* Restore the env */
-               setenv("ethaddr", ethaddr);
+               env_set("ethaddr", ethaddr);
        }
        /* Restore the env */
-       setenv(".flags", NULL);
+       env_set(".flags", NULL);
 
        return retval;
 }
@@ -225,21 +225,21 @@ static int _dm_test_net_retry(struct unit_test_state *uts)
         * the active device should be eth0
         */
        sandbox_eth_disable_response(1, true);
-       setenv("ethact", "eth@10004000");
-       setenv("netretry", "yes");
+       env_set("ethact", "eth@10004000");
+       env_set("netretry", "yes");
        sandbox_eth_skip_timeout();
        ut_assertok(net_loop(PING));
-       ut_asserteq_str("eth@10002000", getenv("ethact"));
+       ut_asserteq_str("eth@10002000", env_get("ethact"));
 
        /*
         * eth1 is disabled and netretry is no, so the ping should fail and the
         * active device should be eth1
         */
-       setenv("ethact", "eth@10004000");
-       setenv("netretry", "no");
+       env_set("ethact", "eth@10004000");
+       env_set("netretry", "no");
        sandbox_eth_skip_timeout();
        ut_asserteq(-ETIMEDOUT, net_loop(PING));
-       ut_asserteq_str("eth@10004000", getenv("ethact"));
+       ut_asserteq_str("eth@10004000", env_get("ethact"));
 
        return 0;
 }
@@ -253,7 +253,7 @@ static int dm_test_net_retry(struct unit_test_state *uts)
        retval = _dm_test_net_retry(uts);
 
        /* Restore the env */
-       setenv("netretry", NULL);
+       env_set("netretry", NULL);
        sandbox_eth_disable_response(1, false);
 
        return retval;
index 0743677dc82a3abc3a84f1d6c8f4a6e9f5818b28..a1790ebd59b24c4d6d18d66e0b082e17063e1fc4 100644 (file)
@@ -37,7 +37,7 @@ hostprogs-$(CONFIG_VIDEO_LOGO) += bmp_logo
 HOSTCFLAGS_bmp_logo.o := -pedantic
 
 hostprogs-$(CONFIG_BUILD_ENVCRC) += envcrc
-envcrc-objs := envcrc.o lib/crc32.o common/env_embedded.o lib/sha1.o
+envcrc-objs := envcrc.o lib/crc32.o env/embedded.o lib/sha1.o
 
 hostprogs-$(CONFIG_CMD_NET) += gen_eth_addr
 HOSTCFLAGS_gen_eth_addr.o := -pedantic
@@ -225,7 +225,7 @@ HOSTCFLAGS_sha256.o := -pedantic
 quiet_cmd_wrap = WRAP    $@
 cmd_wrap = echo "\#include <../$(patsubst $(obj)/%,%,$@)>" >$@
 
-$(obj)/lib/%.c $(obj)/common/%.c:
+$(obj)/lib/%.c $(obj)/common/%.c $(obj)/env/%.c:
        $(call cmd,wrap)
 
 clean-dirs := lib common
index c9c79e066dc1282a57baadb6249df937f0ff1ab2..e50c0755597dab5cf8aa392336e6fa146ad754e4 100644 (file)
@@ -468,7 +468,7 @@ int fw_env_write(char *name, char *value)
  *         modified or deleted
  *
  */
-int fw_setenv(int argc, char *argv[], struct env_opts *opts)
+int fw_env_set(int argc, char *argv[], struct env_opts *opts)
 {
        int i;
        size_t len;
index 04bb64602b2561dfbb9982faa128eb2327296407..2d37eb505309601ad6720533d02389a831c5a6b0 100644 (file)
@@ -44,7 +44,7 @@ int parse_aes_key(char *key, uint8_t *bin_key);
 int fw_printenv(int argc, char *argv[], int value_only, struct env_opts *opts);
 
 /**
- * fw_setenv() - adds or removes one variable to the environment
+ * fw_env_set() - adds or removes one variable to the environment
  *
  * @argc: number of strings in argv, argv[0] is variable name,
  *          argc==1 means erase variable, argc > 1 means add a variable
@@ -61,7 +61,7 @@ int fw_printenv(int argc, char *argv[], int value_only, struct env_opts *opts);
  * ERRORS:
  *  EROFS - some variables ("ethaddr", "serial#") cannot be modified
  */
-int fw_setenv(int argc, char *argv[], struct env_opts *opts);
+int fw_env_set(int argc, char *argv[], struct env_opts *opts);
 
 /**
  * fw_parse_script() - adds or removes multiple variables with a batch script
index b8bff264eb4ef5e0da6f90d3aff3b2aed3406d6e..6e278ca80b4dd5676d2364657d7bb35b0658c751 100644 (file)
@@ -78,7 +78,7 @@ void usage_printenv(void)
                "\n");
 }
 
-void usage_setenv(void)
+void usage_env_set(void)
 {
        fprintf(stderr,
                "Usage: fw_setenv [OPTIONS]... [VARIABLE]...\n"
@@ -142,7 +142,7 @@ static void parse_common_args(int argc, char *argv[])
                        env_opts.lockname = optarg;
                        break;
                case 'h':
-                       do_printenv ? usage_printenv() : usage_setenv();
+                       do_printenv ? usage_printenv() : usage_env_set();
                        exit(EXIT_SUCCESS);
                        break;
                default:
@@ -202,7 +202,7 @@ int parse_setenv_args(int argc, char *argv[])
                        /* ignore common options */
                        break;
                default: /* '?' */
-                       usage_setenv();
+                       usage_env_set();
                        exit(EXIT_FAILURE);
                        break;
                }
@@ -273,7 +273,7 @@ int main(int argc, char *argv[])
                        retval = EXIT_FAILURE;
        } else {
                if (!script_file) {
-                       if (fw_setenv(argc, argv, &env_opts) != 0)
+                       if (fw_env_set(argc, argv, &env_opts) != 0)
                                retval = EXIT_FAILURE;
                } else {
                        if (fw_parse_script(script_file, &env_opts) != 0)