diff options
Diffstat (limited to 'board')
210 files changed, 1464 insertions, 683 deletions
diff --git a/board/Arcturus/ucp1020/cmd_arc.c b/board/Arcturus/ucp1020/cmd_arc.c index fa6b4853f9..0d3ac88fff 100644 --- a/board/Arcturus/ucp1020/cmd_arc.c +++ b/board/Arcturus/ucp1020/cmd_arc.c @@ -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); diff --git a/board/Arcturus/ucp1020/spl.c b/board/Arcturus/ucp1020/spl.c index cd484fc44b..b5e7a5db06 100644 --- a/board/Arcturus/ucp1020/spl.c +++ b/board/Arcturus/ucp1020/spl.c @@ -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 diff --git a/board/Arcturus/ucp1020/ucp1020.c b/board/Arcturus/ucp1020/ucp1020.c index 0d086e87fa..3f786a2014 100644 --- a/board/Arcturus/ucp1020/ucp1020.c +++ b/board/Arcturus/ucp1020/ucp1020.c @@ -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); diff --git a/board/Barix/ipam390/ipam390.c b/board/Barix/ipam390/ipam390.c index 3a584021ac..d203429738 100644 --- a/board/Barix/ipam390/ipam390.c +++ b/board/Barix/ipam390/ipam390.c @@ -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); diff --git a/board/BuR/brppt1/board.c b/board/BuR/brppt1/board.c index a22722122b..6083479f2b 100644 --- a/board/BuR/brppt1/board.c +++ b/board/BuR/brppt1/board.c @@ -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; } diff --git a/board/BuR/brxre1/board.c b/board/BuR/brxre1/board.c index f4bfa410cc..ca08f3cd90 100644 --- a/board/BuR/brxre1/board.c +++ b/board/BuR/brxre1/board.c @@ -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 diff --git a/board/BuR/common/common.c b/board/BuR/common/common.c index c3a56db76a..c1cd010023 100644 --- a/board/BuR/common/common.c +++ b/board/BuR/common/common.c @@ -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); diff --git a/board/BuS/eb_cpu5282/eb_cpu5282.c b/board/BuS/eb_cpu5282/eb_cpu5282.c index a00a83a4a5..d23b9f3a4f 100644 --- a/board/BuS/eb_cpu5282/eb_cpu5282.c +++ b/board/BuS/eb_cpu5282/eb_cpu5282.c @@ -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(); diff --git a/board/CZ.NIC/turris_omnia/turris_omnia.c b/board/CZ.NIC/turris_omnia/turris_omnia.c index a4275091d2..af66837909 100644 --- a/board/CZ.NIC/turris_omnia/turris_omnia.c +++ b/board/CZ.NIC/turris_omnia/turris_omnia.c @@ -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 diff --git a/board/CarMediaLab/flea3/flea3.c b/board/CarMediaLab/flea3/flea3.c index 3cd4dc95fe..5e75eb0b64 100644 --- a/board/CarMediaLab/flea3/flea3.c +++ b/board/CarMediaLab/flea3/flea3.c @@ -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; } diff --git a/board/LaCie/net2big_v2/net2big_v2.c b/board/LaCie/net2big_v2/net2big_v2.c index 2e6e9ef916..f639a37d4d 100644 --- a/board/LaCie/net2big_v2/net2big_v2.c +++ b/board/LaCie/net2big_v2/net2big_v2.c @@ -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(); diff --git a/board/LaCie/netspace_v2/netspace_v2.c b/board/LaCie/netspace_v2/netspace_v2.c index 16d694716f..52f36644a3 100644 --- a/board/LaCie/netspace_v2/netspace_v2.c +++ b/board/LaCie/netspace_v2/netspace_v2.c @@ -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; diff --git a/board/Synology/ds414/cmd_syno.c b/board/Synology/ds414/cmd_syno.c index 20544e29c4..6313882a52 100644 --- a/board/Synology/ds414/cmd_syno.c +++ b/board/Synology/ds414/cmd_syno.c @@ -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); diff --git a/board/amazon/kc1/kc1.c b/board/amazon/kc1/kc1.c index 13a9c6a0fe..eead98b24e 100644 --- a/board/amazon/kc1/kc1.c +++ b/board/amazon/kc1/kc1.c @@ -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(); diff --git a/board/amlogic/odroid-c2/odroid-c2.c b/board/amlogic/odroid-c2/odroid-c2.c index b29f56d5eb..eac04d8178 100644 --- a/board/amlogic/odroid-c2/odroid-c2.c +++ b/board/amlogic/odroid-c2/odroid-c2.c @@ -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; diff --git a/board/aries/ma5d4evk/ma5d4evk.c b/board/aries/ma5d4evk/ma5d4evk.c index b9294fc881..956c297e72 100644 --- a/board/aries/ma5d4evk/ma5d4evk.c +++ b/board/aries/ma5d4evk/ma5d4evk.c @@ -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; } diff --git a/board/aristainetos/aristainetos-v2.c b/board/aristainetos/aristainetos-v2.c index 6abc2159bb..698715ca20 100644 --- a/board/aristainetos/aristainetos-v2.c +++ b/board/aristainetos/aristainetos-v2.c @@ -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 */ diff --git a/board/armltd/integrator/integrator.c b/board/armltd/integrator/integrator.c index c3bafd453e..858f74e5cf 100644 --- a/board/armltd/integrator/integrator.c +++ b/board/armltd/integrator/integrator.c @@ -116,7 +116,7 @@ extern void cm_remap(void); int misc_init_r (void) { - setenv("verify", "n"); + env_set("verify", "n"); return (0); } diff --git a/board/atmel/sama5d2_xplained/sama5d2_xplained.c b/board/atmel/sama5d2_xplained/sama5d2_xplained.c index 48f45b35ce..3f0860c555 100644 --- a/board/atmel/sama5d2_xplained/sama5d2_xplained.c +++ b/board/atmel/sama5d2_xplained/sama5d2_xplained.c @@ -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) diff --git a/board/atmel/sama5d3xek/sama5d3xek.c b/board/atmel/sama5d3xek/sama5d3xek.c index c1f2769f1c..88bcd876c9 100644 --- a/board/atmel/sama5d3xek/sama5d3xek.c +++ b/board/atmel/sama5d3xek/sama5d3xek.c @@ -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; } diff --git a/board/bachmann/ot1200/ot1200.c b/board/bachmann/ot1200/ot1200.c index 1ad4ef93cf..df10d6a0d0 100644 --- a/board/bachmann/ot1200/ot1200.c +++ b/board/bachmann/ot1200/ot1200.c @@ -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); diff --git a/board/birdland/bav335x/board.c b/board/birdland/bav335x/board.c index 67aca3cc43..f284568ec9 100644 --- a/board/birdland/bav335x/board.c +++ b/board/birdland/bav335x/board.c @@ -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 diff --git a/board/bluegiga/apx4devkit/apx4devkit.c b/board/bluegiga/apx4devkit/apx4devkit.c index 2215c29c9c..25e5c3d80c 100644 --- a/board/bluegiga/apx4devkit/apx4devkit.c +++ b/board/bluegiga/apx4devkit/apx4devkit.c @@ -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 diff --git a/board/bluewater/gurnard/gurnard.c b/board/bluewater/gurnard/gurnard.c index e82c691841..8733a9af16 100644 --- a/board/bluewater/gurnard/gurnard.c +++ b/board/bluewater/gurnard/gurnard.c @@ -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"); diff --git a/board/bosch/shc/board.c b/board/bosch/shc/board.c index 38577f30f1..999ed95c31 100644 --- a/board/bosch/shc/board.c +++ b/board/bosch/shc/board.c @@ -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) diff --git a/board/boundary/nitrogen6x/nitrogen6x.c b/board/boundary/nitrogen6x/nitrogen6x.c index 17fd6f56ea..3b92b64f6a 100644 --- a/board/boundary/nitrogen6x/nitrogen6x.c +++ b/board/boundary/nitrogen6x/nitrogen6x.c @@ -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; } diff --git a/board/broadcom/bcm23550_w1d/bcm23550_w1d.c b/board/broadcom/bcm23550_w1d/bcm23550_w1d.c index 5f4c634362..0267582186 100644 --- a/board/broadcom/bcm23550_w1d/bcm23550_w1d.c +++ b/board/broadcom/bcm23550_w1d/bcm23550_w1d.c @@ -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; } diff --git a/board/broadcom/bcm28155_ap/bcm28155_ap.c b/board/broadcom/bcm28155_ap/bcm28155_ap.c index f5b94f6430..8f48ccbf1c 100644 --- a/board/broadcom/bcm28155_ap/bcm28155_ap.c +++ b/board/broadcom/bcm28155_ap/bcm28155_ap.c @@ -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; } diff --git a/board/buffalo/lsxl/lsxl.c b/board/buffalo/lsxl/lsxl.c index 0f3734587a..2d01ac25d8 100644 --- a/board/buffalo/lsxl/lsxl.c +++ b/board/buffalo/lsxl/lsxl.c @@ -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) diff --git a/board/cadence/xtfpga/xtfpga.c b/board/cadence/xtfpga/xtfpga.c index 0265e9bb36..f81fa95c18 100644 --- a/board/cadence/xtfpga/xtfpga.c +++ b/board/cadence/xtfpga/xtfpga.c @@ -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 */ diff --git a/board/ccv/xpress/xpress.c b/board/ccv/xpress/xpress.c index 542e534270..b65646588a 100644 --- a/board/ccv/xpress/xpress.c +++ b/board/ccv/xpress/xpress.c @@ -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; } diff --git a/board/compulab/cl-som-am57x/eth.c b/board/compulab/cl-som-am57x/eth.c index 0c4bf91c13..b615fb9e7e 100644 --- a/board/compulab/cl-som-am57x/eth.c +++ b/board/compulab/cl-som-am57x/eth.c @@ -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); diff --git a/board/compulab/cm_fx6/cm_fx6.c b/board/compulab/cm_fx6/cm_fx6.c index c59884a8c3..a1da2780aa 100644 --- a/board/compulab/cm_fx6/cm_fx6.c +++ b/board/compulab/cm_fx6/cm_fx6.c @@ -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); } diff --git a/board/compulab/cm_t335/cm_t335.c b/board/compulab/cm_t335/cm_t335.c index c4506b910e..6f6ba49af5 100644 --- a/board/compulab/cm_t335/cm_t335.c +++ b/board/compulab/cm_t335/cm_t335.c @@ -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 diff --git a/board/compulab/cm_t35/cm_t35.c b/board/compulab/cm_t35/cm_t35.c index da6709889a..be938eb2cf 100644 --- a/board/compulab/cm_t35/cm_t35.c +++ b/board/compulab/cm_t35/cm_t35.c @@ -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); } /* diff --git a/board/compulab/cm_t3517/cm_t3517.c b/board/compulab/cm_t3517/cm_t3517.c index 38eb641bc4..0ff49dcdcc 100644 --- a/board/compulab/cm_t3517/cm_t3517.c +++ b/board/compulab/cm_t3517/cm_t3517.c @@ -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 diff --git a/board/compulab/cm_t54/cm_t54.c b/board/compulab/cm_t54/cm_t54.c index 6437718415..31730a4d1c 100644 --- a/board/compulab/cm_t54/cm_t54.c +++ b/board/compulab/cm_t54/cm_t54.c @@ -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) diff --git a/board/compulab/common/omap3_display.c b/board/compulab/common/omap3_display.c index 61707f5b90..ed2077e361 100644 --- a/board/compulab/common/omap3_display.c +++ b/board/compulab/common/omap3_display.c @@ -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; } diff --git a/board/congatec/cgtqmx6eval/cgtqmx6eval.c b/board/congatec/cgtqmx6eval/cgtqmx6eval.c index 5cb97b4778..8cd0090887 100644 --- a/board/congatec/cgtqmx6eval/cgtqmx6eval.c +++ b/board/congatec/cgtqmx6eval/cgtqmx6eval.c @@ -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; diff --git a/board/cssi/MCR3000/MCR3000.c b/board/cssi/MCR3000/MCR3000.c index 43c4cb77bb..c928881804 100644 --- a/board/cssi/MCR3000/MCR3000.c +++ b/board/cssi/MCR3000/MCR3000.c @@ -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; } diff --git a/board/davinci/da8xxevm/da850evm.c b/board/davinci/da8xxevm/da850evm.c index 11ea52f240..c2d2e8e882 100644 --- a/board/davinci/da8xxevm/da850evm.c +++ b/board/davinci/da8xxevm/da850evm.c @@ -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); diff --git a/board/davinci/da8xxevm/omapl138_lcdk.c b/board/davinci/da8xxevm/omapl138_lcdk.c index 52bb7363a7..565020760d 100644 --- a/board/davinci/da8xxevm/omapl138_lcdk.c +++ b/board/davinci/da8xxevm/omapl138_lcdk.c @@ -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"); } diff --git a/board/el/el6x/el6x.c b/board/el/el6x/el6x.c index cbe355a600..6b98b5c3eb 100644 --- a/board/el/el6x/el6x.c +++ b/board/el/el6x/el6x.c @@ -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; } diff --git a/board/engicam/common/board.c b/board/engicam/common/board.c index e3bb5698f6..c7ec55ff82 100644 --- a/board/engicam/common/board.c +++ b/board/engicam/common/board.c @@ -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(); diff --git a/board/engicam/geam6ul/geam6ul.c b/board/engicam/geam6ul/geam6ul.c index bc36fc77ee..ffd383a0ee 100644 --- a/board/engicam/geam6ul/geam6ul.c +++ b/board/engicam/geam6ul/geam6ul.c @@ -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 diff --git a/board/engicam/icorem6/icorem6.c b/board/engicam/icorem6/icorem6.c index 5b2ed066b4..3d4f713c3e 100644 --- a/board/engicam/icorem6/icorem6.c +++ b/board/engicam/icorem6/icorem6.c @@ -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 diff --git a/board/engicam/icorem6_rqs/icorem6_rqs.c b/board/engicam/icorem6_rqs/icorem6_rqs.c index 10a9471730..2a321dca50 100644 --- a/board/engicam/icorem6_rqs/icorem6_rqs.c +++ b/board/engicam/icorem6_rqs/icorem6_rqs.c @@ -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 diff --git a/board/engicam/isiotmx6ul/isiotmx6ul.c b/board/engicam/isiotmx6ul/isiotmx6ul.c index 4dcc9ea11b..fbf17242f8 100644 --- a/board/engicam/isiotmx6ul/isiotmx6ul.c +++ b/board/engicam/isiotmx6ul/isiotmx6ul.c @@ -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 } } diff --git a/board/esd/meesc/meesc.c b/board/esd/meesc/meesc.c index 93a02ab0ee..0c5900a15a 100644 --- a/board/esd/meesc/meesc.c +++ b/board/esd/meesc/meesc.c @@ -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); diff --git a/board/freescale/b4860qds/b4860qds.c b/board/freescale/b4860qds/b4860qds.c index 83a70153e8..5d872fdfd9 100644 --- a/board/freescale/b4860qds/b4860qds.c +++ b/board/freescale/b4860qds/b4860qds.c @@ -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); diff --git a/board/freescale/b4860qds/spl.c b/board/freescale/b4860qds/spl.c index 60d7f0d48a..b1824b07a2 100644 --- a/board/freescale/b4860qds/spl.c +++ b/board/freescale/b4860qds/spl.c @@ -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(); diff --git a/board/freescale/bsc9131rdb/bsc9131rdb.c b/board/freescale/bsc9131rdb/bsc9131rdb.c index fb8bb39d87..c642e88a09 100644 --- a/board/freescale/bsc9131rdb/bsc9131rdb.c +++ b/board/freescale/bsc9131rdb/bsc9131rdb.c @@ -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 diff --git a/board/freescale/bsc9132qds/bsc9132qds.c b/board/freescale/bsc9132qds/bsc9132qds.c index a7772c4bf4..ed0b453e54 100644 --- a/board/freescale/bsc9132qds/bsc9132qds.c +++ b/board/freescale/bsc9132qds/bsc9132qds.c @@ -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; diff --git a/board/freescale/c29xpcie/c29xpcie.c b/board/freescale/c29xpcie/c29xpcie.c index 45f463f01f..23901a4f96 100644 --- a/board/freescale/c29xpcie/c29xpcie.c +++ b/board/freescale/c29xpcie/c29xpcie.c @@ -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; diff --git a/board/freescale/c29xpcie/spl.c b/board/freescale/c29xpcie/spl.c index 94093f11a8..28541a72cb 100644 --- a/board/freescale/c29xpcie/spl.c +++ b/board/freescale/c29xpcie/spl.c @@ -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(); diff --git a/board/freescale/common/cmd_esbc_validate.c b/board/freescale/common/cmd_esbc_validate.c index cefe3cc531..b3e5f019b8 100644 --- a/board/freescale/common/cmd_esbc_validate.c +++ b/board/freescale/common/cmd_esbc_validate.c @@ -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; diff --git a/board/freescale/common/fsl_chain_of_trust.c b/board/freescale/common/fsl_chain_of_trust.c index dfe5d204d4..6e750b08bc 100644 --- a/board/freescale/common/fsl_chain_of_trust.c +++ b/board/freescale/common/fsl_chain_of_trust.c @@ -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; diff --git a/board/freescale/common/sys_eeprom.c b/board/freescale/common/sys_eeprom.c index 29aa778dbe..152ad84672 100644 --- a/board/freescale/common/sys_eeprom.c +++ b/board/freescale/common/sys_eeprom.c @@ -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); } } diff --git a/board/freescale/common/vid.c b/board/freescale/common/vid.c index 9b65c13b1a..d6d1bfc861 100644 --- a/board/freescale/common/vid.c +++ b/board/freescale/common/vid.c @@ -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; diff --git a/board/freescale/corenet_ds/corenet_ds.c b/board/freescale/corenet_ds/corenet_ds.c index 93e1258295..132650c938 100644 --- a/board/freescale/corenet_ds/corenet_ds.c +++ b/board/freescale/corenet_ds/corenet_ds.c @@ -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); diff --git a/board/freescale/ls2080aqds/eth.c b/board/freescale/ls2080aqds/eth.c index defcac5263..aca29bc361 100644 --- a/board/freescale/ls2080aqds/eth.c +++ b/board/freescale/ls2080aqds/eth.c @@ -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(); diff --git a/board/freescale/ls2080aqds/ls2080aqds.c b/board/freescale/ls2080aqds/ls2080aqds.c index f36fb9810b..83773d0af5 100644 --- a/board/freescale/ls2080aqds/ls2080aqds.c +++ b/board/freescale/ls2080aqds/ls2080aqds.c @@ -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))) diff --git a/board/freescale/ls2080ardb/ls2080ardb.c b/board/freescale/ls2080ardb/ls2080ardb.c index d7122b3dfc..07ba0266d5 100644 --- a/board/freescale/ls2080ardb/ls2080ardb.c +++ b/board/freescale/ls2080ardb/ls2080ardb.c @@ -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))) diff --git a/board/freescale/mpc8323erdb/mpc8323erdb.c b/board/freescale/mpc8323erdb/mpc8323erdb.c index f30a1510ee..b715d8363e 100644 --- a/board/freescale/mpc8323erdb/mpc8323erdb.c +++ b/board/freescale/mpc8323erdb/mpc8323erdb.c @@ -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); } } } diff --git a/board/freescale/mpc837xemds/pci.c b/board/freescale/mpc837xemds/pci.c index 39c40e5cc9..e5d3dfd454 100644 --- a/board/freescale/mpc837xemds/pci.c +++ b/board/freescale/mpc837xemds/pci.c @@ -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; diff --git a/board/freescale/mpc837xerdb/mpc837xerdb.c b/board/freescale/mpc837xerdb/mpc837xerdb.c index 319f0479e2..9a0ab7f2ad 100644 --- a/board/freescale/mpc837xerdb/mpc837xerdb.c +++ b/board/freescale/mpc837xerdb/mpc837xerdb.c @@ -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) diff --git a/board/freescale/mpc8572ds/mpc8572ds.c b/board/freescale/mpc8572ds/mpc8572ds.c index ed6836a930..93d54f5c4a 100644 --- a/board/freescale/mpc8572ds/mpc8572ds.c +++ b/board/freescale/mpc8572ds/mpc8572ds.c @@ -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); diff --git a/board/freescale/mx31ads/u-boot.lds b/board/freescale/mx31ads/u-boot.lds index 8a4a8a2f07..71a63f188e 100644 --- a/board/freescale/mx31ads/u-boot.lds +++ b/board/freescale/mx31ads/u-boot.lds @@ -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*) } diff --git a/board/freescale/mx51evk/mx51evk_video.c b/board/freescale/mx51evk/mx51evk_video.c index 86ec7508db..cc2c855b88 100644 --- a/board/freescale/mx51evk/mx51evk_video.c +++ b/board/freescale/mx51evk/mx51evk_video.c @@ -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) { diff --git a/board/freescale/mx53loco/mx53loco.c b/board/freescale/mx53loco/mx53loco.c index 27d606f310..ea36603686 100644 --- a/board/freescale/mx53loco/mx53loco.c +++ b/board/freescale/mx53loco/mx53loco.c @@ -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); diff --git a/board/freescale/mx53loco/mx53loco_video.c b/board/freescale/mx53loco/mx53loco_video.c index bc5e8a9d3e..5fb0f04387 100644 --- a/board/freescale/mx53loco/mx53loco_video.c +++ b/board/freescale/mx53loco/mx53loco_video.c @@ -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) { diff --git a/board/freescale/mx6sabreauto/mx6sabreauto.c b/board/freescale/mx6sabreauto/mx6sabreauto.c index a5703a35b1..f8f77f616c 100644 --- a/board/freescale/mx6sabreauto/mx6sabreauto.c +++ b/board/freescale/mx6sabreauto/mx6sabreauto.c @@ -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]); diff --git a/board/freescale/mx6sabresd/mx6sabresd.c b/board/freescale/mx6sabresd/mx6sabresd.c index e4160420fa..9a562b3424 100644 --- a/board/freescale/mx6sabresd/mx6sabresd.c +++ b/board/freescale/mx6sabresd/mx6sabresd.c @@ -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]); diff --git a/board/freescale/mx6ul_14x14_evk/mx6ul_14x14_evk.c b/board/freescale/mx6ul_14x14_evk/mx6ul_14x14_evk.c index a30c379e4d..cf7a069c56 100644 --- a/board/freescale/mx6ul_14x14_evk/mx6ul_14x14_evk.c +++ b/board/freescale/mx6ul_14x14_evk/mx6ul_14x14_evk.c @@ -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; diff --git a/board/freescale/mx6ullevk/mx6ullevk.c b/board/freescale/mx6ullevk/mx6ullevk.c index 66b08f823e..cebcec738f 100644 --- a/board/freescale/mx6ullevk/mx6ullevk.c +++ b/board/freescale/mx6ullevk/mx6ullevk.c @@ -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; diff --git a/board/freescale/p1010rdb/p1010rdb.c b/board/freescale/p1010rdb/p1010rdb.c index 65bb575a96..aa04e993c4 100644 --- a/board/freescale/p1010rdb/p1010rdb.c +++ b/board/freescale/p1010rdb/p1010rdb.c @@ -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; diff --git a/board/freescale/p1010rdb/spl.c b/board/freescale/p1010rdb/spl.c index 2cebc2c002..001308874e 100644 --- a/board/freescale/p1010rdb/spl.c +++ b/board/freescale/p1010rdb/spl.c @@ -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 diff --git a/board/freescale/p1022ds/p1022ds.c b/board/freescale/p1022ds/p1022ds.c index 345feac0b2..bf493262d0 100644 --- a/board/freescale/p1022ds/p1022ds.c +++ b/board/freescale/p1022ds/p1022ds.c @@ -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); diff --git a/board/freescale/p1022ds/spl.c b/board/freescale/p1022ds/spl.c index a117dc3a2c..94b357d446 100644 --- a/board/freescale/p1022ds/spl.c +++ b/board/freescale/p1022ds/spl.c @@ -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 diff --git a/board/freescale/p1023rdb/p1023rdb.c b/board/freescale/p1023rdb/p1023rdb.c index 0451722603..ccda824125 100644 --- a/board/freescale/p1023rdb/p1023rdb.c +++ b/board/freescale/p1023rdb/p1023rdb.c @@ -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); diff --git a/board/freescale/p1_p2_rdb_pc/p1_p2_rdb_pc.c b/board/freescale/p1_p2_rdb_pc/p1_p2_rdb_pc.c index 51217c58e5..31c8ed9ae1 100644 --- a/board/freescale/p1_p2_rdb_pc/p1_p2_rdb_pc.c +++ b/board/freescale/p1_p2_rdb_pc/p1_p2_rdb_pc.c @@ -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); diff --git a/board/freescale/p1_p2_rdb_pc/spl.c b/board/freescale/p1_p2_rdb_pc/spl.c index ca7ba5754e..c1d4c36b06 100644 --- a/board/freescale/p1_p2_rdb_pc/spl.c +++ b/board/freescale/p1_p2_rdb_pc/spl.c @@ -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 diff --git a/board/freescale/p1_twr/p1_twr.c b/board/freescale/p1_twr/p1_twr.c index f54a6ff8dc..02c89998cb 100644 --- a/board/freescale/p1_twr/p1_twr.c +++ b/board/freescale/p1_twr/p1_twr.c @@ -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); diff --git a/board/freescale/p2041rdb/p2041rdb.c b/board/freescale/p2041rdb/p2041rdb.c index 21fb66f184..78ee74770c 100644 --- a/board/freescale/p2041rdb/p2041rdb.c +++ b/board/freescale/p2041rdb/p2041rdb.c @@ -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); diff --git a/board/freescale/qemu-ppce500/qemu-ppce500.c b/board/freescale/qemu-ppce500/qemu-ppce500.c index 0c65ec72d2..cf5023c505 100644 --- a/board/freescale/qemu-ppce500/qemu-ppce500.c +++ b/board/freescale/qemu-ppce500/qemu-ppce500.c @@ -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; } diff --git a/board/freescale/t102xqds/spl.c b/board/freescale/t102xqds/spl.c index b987ecea1d..3aa19e6715 100644 --- a/board/freescale/t102xqds/spl.c +++ b/board/freescale/t102xqds/spl.c @@ -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(); diff --git a/board/freescale/t102xqds/t102xqds.c b/board/freescale/t102xqds/t102xqds.c index 1b2f6b2487..20374baf48 100644 --- a/board/freescale/t102xqds/t102xqds.c +++ b/board/freescale/t102xqds/t102xqds.c @@ -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); diff --git a/board/freescale/t102xrdb/spl.c b/board/freescale/t102xrdb/spl.c index dc6d9eeef6..ca1e49ffa7 100644 --- a/board/freescale/t102xrdb/spl.c +++ b/board/freescale/t102xrdb/spl.c @@ -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(); diff --git a/board/freescale/t102xrdb/t102xrdb.c b/board/freescale/t102xrdb/t102xrdb.c index f370f72baa..8885a546fa 100644 --- a/board/freescale/t102xrdb/t102xrdb.c +++ b/board/freescale/t102xrdb/t102xrdb.c @@ -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); diff --git a/board/freescale/t1040qds/t1040qds.c b/board/freescale/t1040qds/t1040qds.c index 5466fbf5f6..a36997b48c 100644 --- a/board/freescale/t1040qds/t1040qds.c +++ b/board/freescale/t1040qds/t1040qds.c @@ -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); diff --git a/board/freescale/t104xrdb/spl.c b/board/freescale/t104xrdb/spl.c index 2e43307b2d..4fb9323873 100644 --- a/board/freescale/t104xrdb/spl.c +++ b/board/freescale/t104xrdb/spl.c @@ -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(); diff --git a/board/freescale/t104xrdb/t104xrdb.c b/board/freescale/t104xrdb/t104xrdb.c index d4c3d4dcb4..2818cdf274 100644 --- a/board/freescale/t104xrdb/t104xrdb.c +++ b/board/freescale/t104xrdb/t104xrdb.c @@ -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); diff --git a/board/freescale/t208xqds/spl.c b/board/freescale/t208xqds/spl.c index d7d716b690..36961dc9b0 100644 --- a/board/freescale/t208xqds/spl.c +++ b/board/freescale/t208xqds/spl.c @@ -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(); diff --git a/board/freescale/t208xqds/t208xqds.c b/board/freescale/t208xqds/t208xqds.c index 26093ea9d2..ed3d3f4b71 100644 --- a/board/freescale/t208xqds/t208xqds.c +++ b/board/freescale/t208xqds/t208xqds.c @@ -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); diff --git a/board/freescale/t208xrdb/spl.c b/board/freescale/t208xrdb/spl.c index b43140148b..f0cc34d788 100644 --- a/board/freescale/t208xrdb/spl.c +++ b/board/freescale/t208xrdb/spl.c @@ -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(); diff --git a/board/freescale/t208xrdb/t208xrdb.c b/board/freescale/t208xrdb/t208xrdb.c index 1ab05ec9fd..619495e6ab 100644 --- a/board/freescale/t208xrdb/t208xrdb.c +++ b/board/freescale/t208xrdb/t208xrdb.c @@ -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); diff --git a/board/freescale/t4qds/spl.c b/board/freescale/t4qds/spl.c index 9ecdaedda3..750f155493 100644 --- a/board/freescale/t4qds/spl.c +++ b/board/freescale/t4qds/spl.c @@ -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(); diff --git a/board/freescale/t4qds/t4240emu.c b/board/freescale/t4qds/t4240emu.c index 35ad19e045..7136acafea 100644 --- a/board/freescale/t4qds/t4240emu.c +++ b/board/freescale/t4qds/t4240emu.c @@ -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); diff --git a/board/freescale/t4qds/t4240qds.c b/board/freescale/t4qds/t4240qds.c index 8f9e7e8255..7b71b541fd 100644 --- a/board/freescale/t4qds/t4240qds.c +++ b/board/freescale/t4qds/t4240qds.c @@ -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); diff --git a/board/freescale/t4rdb/spl.c b/board/freescale/t4rdb/spl.c index 5feab1cfcd..932954e93d 100644 --- a/board/freescale/t4rdb/spl.c +++ b/board/freescale/t4rdb/spl.c @@ -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(); diff --git a/board/freescale/t4rdb/t4240rdb.c b/board/freescale/t4rdb/t4240rdb.c index bdd6f4ef49..f511706b9f 100644 --- a/board/freescale/t4rdb/t4240rdb.c +++ b/board/freescale/t4rdb/t4240rdb.c @@ -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); diff --git a/board/gateworks/gw_ventana/common.c b/board/gateworks/gw_ventana/common.c index 46404b4d59..e9865b4adb 100644 --- a/board/gateworks/gw_ventana/common.c +++ b/board/gateworks/gw_ventana/common.c @@ -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; diff --git a/board/gateworks/gw_ventana/gw_ventana.c b/board/gateworks/gw_ventana/gw_ventana.c index 89848c8f07..4ddc7e1fa2 100644 --- a/board/gateworks/gw_ventana/gw_ventana.c +++ b/board/gateworks/gw_ventana/gw_ventana.c @@ -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; } diff --git a/board/gateworks/gw_ventana/gw_ventana_spl.c b/board/gateworks/gw_ventana/gw_ventana_spl.c index 69a638d71d..9524da7daf 100644 --- a/board/gateworks/gw_ventana/gw_ventana_spl.c +++ b/board/gateworks/gw_ventana/gw_ventana_spl.c @@ -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) */ diff --git a/board/gdsys/a38x/keyprogram.c b/board/gdsys/a38x/keyprogram.c index a4a6f1cca5..d75e08b39f 100644 --- a/board/gdsys/a38x/keyprogram.c +++ b/board/gdsys/a38x/keyprogram.c @@ -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; diff --git a/board/gdsys/mpc8308/hrcon.c b/board/gdsys/mpc8308/hrcon.c index c6566e9196..7e485074ce 100644 --- a/board/gdsys/mpc8308/hrcon.c +++ b/board/gdsys/mpc8308/hrcon.c @@ -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: "); diff --git a/board/gdsys/mpc8308/strider.c b/board/gdsys/mpc8308/strider.c index 34e9d1956e..fec691515d 100644 --- a/board/gdsys/mpc8308/strider.c +++ b/board/gdsys/mpc8308/strider.c @@ -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: "); diff --git a/board/gdsys/p1022/controlcenterd-id.c b/board/gdsys/p1022/controlcenterd-id.c index 95f11fb69f..1813a58e60 100644 --- a/board/gdsys/p1022/controlcenterd-id.c +++ b/board/gdsys/p1022/controlcenterd-id.c @@ -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; diff --git a/board/gdsys/p1022/controlcenterd.c b/board/gdsys/p1022/controlcenterd.c index 01064dcfde..9fb814d8c7 100644 --- a/board/gdsys/p1022/controlcenterd.c +++ b/board/gdsys/p1022/controlcenterd.c @@ -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); diff --git a/board/grinn/chiliboard/board.c b/board/grinn/chiliboard/board.c index e3f82b0a80..2f5974a246 100644 --- a/board/grinn/chiliboard/board.c +++ b/board/grinn/chiliboard/board.c @@ -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 diff --git a/board/grinn/liteboard/board.c b/board/grinn/liteboard/board.c index 817e22fd45..941e7ea2c8 100644 --- a/board/grinn/liteboard/board.c +++ b/board/grinn/liteboard/board.c @@ -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); diff --git a/board/gumstix/pepper/board.c b/board/gumstix/pepper/board.c index d76c28bd3c..bfc5fd1c46 100644 --- a/board/gumstix/pepper/board.c +++ b/board/gumstix/pepper/board.c @@ -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); diff --git a/board/highbank/highbank.c b/board/highbank/highbank.c index 1af2207867..f7c05ab08f 100644 --- a/board/highbank/highbank.c +++ b/board/highbank/highbank.c @@ -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; } diff --git a/board/htkw/mcx/mcx.c b/board/htkw/mcx/mcx.c index 1deb2bdd8b..0a02e44046 100644 --- a/board/htkw/mcx/mcx.c +++ b/board/htkw/mcx/mcx.c @@ -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; } diff --git a/board/intel/edison/edison.c b/board/intel/edison/edison.c index a1a7d4d7c8..4b1e6d0f47 100644 --- a/board/intel/edison/edison.c +++ b/board/intel/edison/edison.c @@ -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; diff --git a/board/isee/igep003x/board.c b/board/isee/igep003x/board.c index e33170d65f..d33dc960a5 100644 --- a/board/isee/igep003x/board.c +++ b/board/isee/igep003x/board.c @@ -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), diff --git a/board/isee/igep00x0/igep00x0.c b/board/isee/igep00x0/igep00x0.c index 843d35eb2d..a7a75601dd 100644 --- a/board/isee/igep00x0/igep00x0.c +++ b/board/isee/igep00x0/igep00x0.c @@ -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; } } diff --git a/board/keymile/common/common.c b/board/keymile/common/common.c index 408079c9a1..6cd281218e 100644 --- a/board/keymile/common/common.c +++ b/board/keymile/common/common.c @@ -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) { diff --git a/board/keymile/common/ivm.c b/board/keymile/common/ivm.c index e9e518cf72..f1321d9899 100644 --- a/board/keymile/common/ivm.c +++ b/board/keymile/common/ivm.c @@ -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; diff --git a/board/keymile/km83xx/km83xx.c b/board/keymile/km83xx/km83xx.c index 8020c379fd..5e07faa818 100644 --- a/board/keymile/km83xx/km83xx.c +++ b/board/keymile/km83xx/km83xx.c @@ -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(); diff --git a/board/keymile/km_arm/km_arm.c b/board/keymile/km_arm/km_arm.c index 85785ffc02..af1ebc4101 100644 --- a/board/keymile/km_arm/km_arm.c +++ b/board/keymile/km_arm/km_arm.c @@ -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 diff --git a/board/keymile/kmp204x/kmp204x.c b/board/keymile/kmp204x/kmp204x.c index abb20196c5..8c9d6b167d 100644 --- a/board/keymile/kmp204x/kmp204x.c +++ b/board/keymile/kmp204x/kmp204x.c @@ -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); diff --git a/board/kosagi/novena/novena.c b/board/kosagi/novena/novena.c index 980cd6288c..f0ace03009 100644 --- a/board/kosagi/novena/novena.c +++ b/board/kosagi/novena/novena.c @@ -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; } diff --git a/board/lg/sniper/sniper.c b/board/lg/sniper/sniper.c index f924645dc0..a299f761f9 100644 --- a/board/lg/sniper/sniper.c +++ b/board/lg/sniper/sniper.c @@ -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(); diff --git a/board/liebherr/mccmon6/mccmon6.c b/board/liebherr/mccmon6/mccmon6.c index e265e2a732..4f7e018dea 100644 --- a/board/liebherr/mccmon6/mccmon6.c +++ b/board/liebherr/mccmon6/mccmon6.c @@ -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; diff --git a/board/logicpd/imx6/imx6logic.c b/board/logicpd/imx6/imx6logic.c index 0a7d4124a6..78fc5466b6 100644 --- a/board/logicpd/imx6/imx6logic.c +++ b/board/logicpd/imx6/imx6logic.c @@ -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; diff --git a/board/logicpd/omap3som/omap3logic.c b/board/logicpd/omap3som/omap3logic.c index f8b9f687fb..fe3f9e664f 100644 --- a/board/logicpd/omap3som/omap3logic.c +++ b/board/logicpd/omap3som/omap3logic.c @@ -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 */ diff --git a/board/logicpd/zoom1/zoom1.c b/board/logicpd/zoom1/zoom1.c index e91f874a2b..e6c2526ea1 100644 --- a/board/logicpd/zoom1/zoom1.c +++ b/board/logicpd/zoom1/zoom1.c @@ -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; diff --git a/board/micronas/vct/vct.c b/board/micronas/vct/vct.c index 8bf8d5f4e8..510746d35c 100644 --- a/board/micronas/vct/vct.c +++ b/board/micronas/vct/vct.c @@ -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 diff --git a/board/nokia/rx51/rx51.c b/board/nokia/rx51/rx51.c index 6a4427a42e..7764288811 100644 --- a/board/nokia/rx51/rx51.c +++ b/board/nokia/rx51/rx51.c @@ -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 *)¶ms->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(); diff --git a/board/overo/overo.c b/board/overo/overo.c index adf33cfd37..140e34d4dd 100644 --- a/board/overo/overo.c +++ b/board/overo/overo.c @@ -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; } diff --git a/board/phytec/pcm051/board.c b/board/phytec/pcm051/board.c index 4f3853ac42..52ad5b64de 100644 --- a/board/phytec/pcm051/board.c +++ b/board/phytec/pcm051/board.c @@ -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 index 0000000000..142a1222fc --- /dev/null +++ b/board/phytec/pfla02/Kconfig @@ -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 index 0000000000..4b069a90cd --- /dev/null +++ b/board/phytec/pfla02/MAINTAINERS @@ -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 index 0000000000..25af9a01e1 --- /dev/null +++ b/board/phytec/pfla02/Makefile @@ -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 index 0000000000..0f46ab8623 --- /dev/null +++ b/board/phytec/pfla02/README @@ -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 index 0000000000..8d2ce63e06 --- /dev/null +++ b/board/phytec/pfla02/pfla02.c @@ -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 diff --git a/board/qualcomm/dragonboard410c/dragonboard410c.c b/board/qualcomm/dragonboard410c/dragonboard410c.c index 37d0b85e0e..848e27848b 100644 --- a/board/qualcomm/dragonboard410c/dragonboard410c.c +++ b/board/qualcomm/dragonboard410c/dragonboard410c.c @@ -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"); } diff --git a/board/raspberrypi/rpi/rpi.c b/board/raspberrypi/rpi/rpi.c index d3c6ba580f..530f149617 100644 --- a/board/raspberrypi/rpi/rpi.c +++ b/board/raspberrypi/rpi/rpi.c @@ -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) diff --git a/board/renesas/alt/alt.c b/board/renesas/alt/alt.c index b35b6a3ad1..0bf8160f1f 100644 --- a/board/renesas/alt/alt.c +++ b/board/renesas/alt/alt.c @@ -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 */ diff --git a/board/renesas/blanche/blanche.c b/board/renesas/blanche/blanche.c index 5156eafeb4..574dcda01b 100644 --- a/board/renesas/blanche/blanche.c +++ b/board/renesas/blanche/blanche.c @@ -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; diff --git a/board/renesas/ecovec/ecovec.c b/board/renesas/ecovec/ecovec.c index 28b557a5b0..e4bb440d24 100644 --- a/board/renesas/ecovec/ecovec.c +++ b/board/renesas/ecovec/ecovec.c @@ -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); diff --git a/board/renesas/gose/gose.c b/board/renesas/gose/gose.c index 359f95e264..54e126985b 100644 --- a/board/renesas/gose/gose.c +++ b/board/renesas/gose/gose.c @@ -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 */ diff --git a/board/renesas/koelsch/koelsch.c b/board/renesas/koelsch/koelsch.c index dd62145ac9..8fa648e40a 100644 --- a/board/renesas/koelsch/koelsch.c +++ b/board/renesas/koelsch/koelsch.c @@ -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 */ diff --git a/board/renesas/lager/lager.c b/board/renesas/lager/lager.c index 2ada816006..562be04760 100644 --- a/board/renesas/lager/lager.c +++ b/board/renesas/lager/lager.c @@ -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 */ diff --git a/board/renesas/porter/porter.c b/board/renesas/porter/porter.c index 926a657511..5b1a167906 100644 --- a/board/renesas/porter/porter.c +++ b/board/renesas/porter/porter.c @@ -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 */ diff --git a/board/renesas/sh7752evb/sh7752evb.c b/board/renesas/sh7752evb/sh7752evb.c index 525d979724..4a76fb73ee 100644 --- a/board/renesas/sh7752evb/sh7752evb.c +++ b/board/renesas/sh7752evb/sh7752evb.c @@ -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); } diff --git a/board/renesas/sh7753evb/sh7753evb.c b/board/renesas/sh7753evb/sh7753evb.c index 3d1eedaa5f..ca9e144743 100644 --- a/board/renesas/sh7753evb/sh7753evb.c +++ b/board/renesas/sh7753evb/sh7753evb.c @@ -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); } diff --git a/board/renesas/sh7757lcr/sh7757lcr.c b/board/renesas/sh7757lcr/sh7757lcr.c index 0a04a9d39d..3f970fc401 100644 --- a/board/renesas/sh7757lcr/sh7757lcr.c +++ b/board/renesas/sh7757lcr/sh7757lcr.c @@ -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); } diff --git a/board/renesas/silk/silk.c b/board/renesas/silk/silk.c index e13a38f5ea..a8de402d20 100644 --- a/board/renesas/silk/silk.c +++ b/board/renesas/silk/silk.c @@ -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 */ diff --git a/board/renesas/stout/stout.c b/board/renesas/stout/stout.c index fe8dd3d952..d681148273 100644 --- a/board/renesas/stout/stout.c +++ b/board/renesas/stout/stout.c @@ -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 */ diff --git a/board/rockchip/kylin_rk3036/kylin_rk3036.c b/board/rockchip/kylin_rk3036/kylin_rk3036.c index 7e2edf4a56..9134994874 100644 --- a/board/rockchip/kylin_rk3036/kylin_rk3036.c +++ b/board/rockchip/kylin_rk3036/kylin_rk3036.c @@ -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; diff --git a/board/rockchip/tinker_rk3288/tinker-rk3288.c b/board/rockchip/tinker_rk3288/tinker-rk3288.c index c2872e7330..790a921515 100644 --- a/board/rockchip/tinker_rk3288/tinker-rk3288.c +++ b/board/rockchip/tinker_rk3288/tinker-rk3288.c @@ -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; } diff --git a/board/samsung/common/exynos5-dt.c b/board/samsung/common/exynos5-dt.c index 44f412db5d..ae2a6e6bfa 100644 --- a/board/samsung/common/exynos5-dt.c +++ b/board/samsung/common/exynos5-dt.c @@ -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) diff --git a/board/samsung/common/misc.c b/board/samsung/common/misc.c index b18eed2fac..4157349d02 100644 --- a/board/samsung/common/misc.c +++ b/board/samsung/common/misc.c @@ -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 */ diff --git a/board/samsung/odroid/odroid.c b/board/samsung/odroid/odroid.c index b4cb33240e..e40a2f6e3a 100644 --- a/board/samsung/odroid/odroid.c +++ b/board/samsung/odroid/odroid.c @@ -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) diff --git a/board/samsung/trats/trats.c b/board/samsung/trats/trats.c index 00059a1317..f0913383b9 100644 --- a/board/samsung/trats/trats.c +++ b/board/samsung/trats/trats.c @@ -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 diff --git a/board/samsung/universal_c210/universal.c b/board/samsung/universal_c210/universal.c index cc6eaf7ad0..549ac8b48a 100644 --- a/board/samsung/universal_c210/universal.c +++ b/board/samsung/universal_c210/universal.c @@ -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 diff --git a/board/samtec/vining_2000/vining_2000.c b/board/samtec/vining_2000/vining_2000.c index 5c8b436776..af1a3e75cb 100644 --- a/board/samtec/vining_2000/vining_2000.c +++ b/board/samtec/vining_2000/vining_2000.c @@ -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; } diff --git a/board/samtec/vining_fpga/socfpga.c b/board/samtec/vining_fpga/socfpga.c index f888ecbbc1..229b12f308 100644 --- a/board/samtec/vining_fpga/socfpga.c +++ b/board/samtec/vining_fpga/socfpga.c @@ -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; } diff --git a/board/siemens/common/board.c b/board/siemens/common/board.c index b967227411..65fa6af2d4 100644 --- a/board/siemens/common/board.c +++ b/board/siemens/common/board.c @@ -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; diff --git a/board/siemens/common/factoryset.c b/board/siemens/common/factoryset.c index 6c869ed2b0..b4f027af28 100644 --- a/board/siemens/common/factoryset.c +++ b/board/siemens/common/factoryset.c @@ -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; diff --git a/board/siemens/common/factoryset.h b/board/siemens/common/factoryset.h index 3f23d5ebf4..8602627d2e 100644 --- a/board/siemens/common/factoryset.h +++ b/board/siemens/common/factoryset.h @@ -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 */ diff --git a/board/siemens/draco/board.c b/board/siemens/draco/board.c index d8869a09dd..c705b5ab0f 100644 --- a/board/siemens/draco/board.c +++ b/board/siemens/draco/board.c @@ -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); diff --git a/board/siemens/pxm2/board.c b/board/siemens/pxm2/board.c index 750f338897..8bbb03561b 100644 --- a/board/siemens/pxm2/board.c +++ b/board/siemens/pxm2/board.c @@ -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"); } diff --git a/board/siemens/rut/board.c b/board/siemens/rut/board.c index b3c666c054..2a97414baf 100644 --- a/board/siemens/rut/board.c +++ b/board/siemens/rut/board.c @@ -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"); diff --git a/board/siemens/taurus/taurus.c b/board/siemens/taurus/taurus.c index 4aa8d64869..8390bdd5f8 100644 --- a/board/siemens/taurus/taurus.c +++ b/board/siemens/taurus/taurus.c @@ -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 diff --git a/board/silica/pengwyn/board.c b/board/silica/pengwyn/board.c index 1f5a5868cb..0429e6f0c7 100644 --- a/board/silica/pengwyn/board.c +++ b/board/silica/pengwyn/board.c @@ -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; } diff --git a/board/socrates/socrates.c b/board/socrates/socrates.c index fb691c22d9..004f37009a 100644 --- a/board/socrates/socrates.c +++ b/board/socrates/socrates.c @@ -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; diff --git a/board/solidrun/mx6cuboxi/mx6cuboxi.c b/board/solidrun/mx6cuboxi/mx6cuboxi.c index 1ccdfa8e05..7e59fb259e 100644 --- a/board/solidrun/mx6cuboxi/mx6cuboxi.c +++ b/board/solidrun/mx6cuboxi/mx6cuboxi.c @@ -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; diff --git a/board/spear/common/spr_misc.c b/board/spear/common/spr_misc.c index d6a84dba60..a02304f49e 100644 --- a/board/spear/common/spr_misc.c +++ b/board/spear/common/spr_misc.c @@ -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(); diff --git a/board/st/stm32f429-discovery/stm32f429-discovery.c b/board/st/stm32f429-discovery/stm32f429-discovery.c index 8c8abf6a06..d6763c306f 100644 --- a/board/st/stm32f429-discovery/stm32f429-discovery.c +++ b/board/st/stm32f429-discovery/stm32f429-discovery.c @@ -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; diff --git a/board/sunxi/MAINTAINERS b/board/sunxi/MAINTAINERS index e9f3e350d0..ff6eea24a5 100644 --- a/board/sunxi/MAINTAINERS +++ b/board/sunxi/MAINTAINERS @@ -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 diff --git a/board/sunxi/board.c b/board/sunxi/board.c index 800f412b38..70e01437c4 100644 --- a/board/sunxi/board.c +++ b/board/sunxi/board.c @@ -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); } diff --git a/board/syteco/zmx25/zmx25.c b/board/syteco/zmx25/zmx25.c index bdbf02a067..85fda13188 100644 --- a/board/syteco/zmx25/zmx25.c +++ b/board/syteco/zmx25/zmx25.c @@ -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"); } } diff --git a/board/tcl/sl50/board.c b/board/tcl/sl50/board.c index e89ee35d30..f79bb9dcdd 100644 --- a/board/tcl/sl50/board.c +++ b/board/tcl/sl50/board.c @@ -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) diff --git a/board/technexion/twister/twister.c b/board/technexion/twister/twister.c index 25aeebc8d0..8c38f14cde 100644 --- a/board/technexion/twister/twister.c +++ b/board/technexion/twister/twister.c @@ -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; diff --git a/board/technologic/ts4800/ts4800.c b/board/technologic/ts4800/ts4800.c index 94251c6d91..8fe26a75e8 100644 --- a/board/technologic/ts4800/ts4800.c +++ b/board/technologic/ts4800/ts4800.c @@ -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; } diff --git a/board/teejet/mt_ventoux/mt_ventoux.c b/board/teejet/mt_ventoux/mt_ventoux.c index 6e73ae114a..9eaae50f27 100644 --- a/board/teejet/mt_ventoux/mt_ventoux.c +++ b/board/teejet/mt_ventoux/mt_ventoux.c @@ -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)) diff --git a/board/theobroma-systems/puma_rk3399/puma-rk3399.c b/board/theobroma-systems/puma_rk3399/puma-rk3399.c index 9347329eac..c6f8eed0c9 100644 --- a/board/theobroma-systems/puma_rk3399/puma-rk3399.c +++ b/board/theobroma-systems/puma_rk3399/puma-rk3399.c @@ -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); diff --git a/board/ti/am335x/board.c b/board/ti/am335x/board.c index 0a16529b5f..1a52bffc00 100644 --- a/board/ti/am335x/board.c +++ b/board/ti/am335x/board.c @@ -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) diff --git a/board/ti/am43xx/board.c b/board/ti/am43xx/board.c index 933596d59c..2c417e7545 100644 --- a/board/ti/am43xx/board.c +++ b/board/ti/am43xx/board.c @@ -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()) { diff --git a/board/ti/am57xx/board.c b/board/ti/am57xx/board.c index 00a31a97fd..7e7056cf71 100644 --- a/board/ti/am57xx/board.c +++ b/board/ti/am57xx/board.c @@ -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); } } } diff --git a/board/ti/beagle/beagle.c b/board/ti/beagle/beagle.c index 887b577b6a..2f62fbec69 100644 --- a/board/ti/beagle/beagle.c +++ b/board/ti/beagle/beagle.c @@ -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()) { diff --git a/board/ti/common/Kconfig b/board/ti/common/Kconfig index c81baa12be..c21eb8c2d2 100644 --- a/board/ti/common/Kconfig +++ b/board/ti/common/Kconfig @@ -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 diff --git a/board/ti/common/board_detect.c b/board/ti/common/board_detect.c index 1da5ace923..6f07ec331a 100644 --- a/board/ti/common/board_detect.c +++ b/board/ti/common/board_detect.c @@ -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); } } } diff --git a/board/ti/dra7xx/evm.c b/board/ti/dra7xx/evm.c index 7d36f03fa1..93d3d0b54e 100644 --- a/board/ti/dra7xx/evm.c +++ b/board/ti/dra7xx/evm.c @@ -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); diff --git a/board/ti/evm/evm.c b/board/ti/evm/evm.c index 6f75bd16f8..6bf57f9269 100644 --- a/board/ti/evm/evm.c +++ b/board/ti/evm/evm.c @@ -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; diff --git a/board/ti/ks2_evm/board.c b/board/ti/ks2_evm/board.c index c61baeeb8c..ae86dfbe0a 100644 --- a/board/ti/ks2_evm/board.c +++ b/board/ti/ks2_evm/board.c @@ -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) { diff --git a/board/ti/ks2_evm/board_k2g.c b/board/ti/ks2_evm/board_k2g.c index 21605762ef..15f0f54af6 100644 --- a/board/ti/ks2_evm/board_k2g.c +++ b/board/ti/ks2_evm/board_k2g.c @@ -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; } diff --git a/board/ti/panda/panda.c b/board/ti/panda/panda.c index 6ffb53c4c6..c59e58a82a 100644 --- a/board/ti/panda/panda.c +++ b/board/ti/panda/panda.c @@ -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 } diff --git a/board/ti/ti814x/evm.c b/board/ti/ti814x/evm.c index 055a29d9c6..cdde6a8ca3 100644 --- a/board/ti/ti814x/evm.c +++ b/board/ti/ti814x/evm.c @@ -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"); } diff --git a/board/ti/ti816x/evm.c b/board/ti/ti816x/evm.c index 9d6c3d6b5d..cb40cc5f47 100644 --- a/board/ti/ti816x/evm.c +++ b/board/ti/ti816x/evm.c @@ -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"); } diff --git a/board/timll/devkit8000/devkit8000.c b/board/timll/devkit8000/devkit8000.c index d31eeb878a..741b3acce2 100644 --- a/board/timll/devkit8000/devkit8000.c +++ b/board/timll/devkit8000/devkit8000.c @@ -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 diff --git a/board/toradex/apalis_imx6/apalis_imx6.c b/board/toradex/apalis_imx6/apalis_imx6.c index 8e5613cb12..7a3e493faf 100644 --- a/board/toradex/apalis_imx6/apalis_imx6.c +++ b/board/toradex/apalis_imx6/apalis_imx6.c @@ -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 } } diff --git a/board/toradex/colibri_imx6/colibri_imx6.c b/board/toradex/colibri_imx6/colibri_imx6.c index cbf7aa952a..dbcd233782 100644 --- a/board/toradex/colibri_imx6/colibri_imx6.c +++ b/board/toradex/colibri_imx6/colibri_imx6.c @@ -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; diff --git a/board/toradex/colibri_vf/colibri_vf.c b/board/toradex/colibri_vf/colibri_vf.c index 46dd15bac8..3858af9c40 100644 --- a/board/toradex/colibri_vf/colibri_vf.c +++ b/board/toradex/colibri_vf/colibri_vf.c @@ -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; diff --git a/board/toradex/common/tdx-cfg-block.c b/board/toradex/common/tdx-cfg-block.c index 1bf8ca8f76..328c4c0200 100644 --- a/board/toradex/common/tdx-cfg-block.c +++ b/board/toradex/common/tdx-cfg-block.c @@ -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') diff --git a/board/toradex/common/tdx-common.c b/board/toradex/common/tdx-common.c index 0d267877fa..b4e4727e63 100644 --- a/board/toradex/common/tdx-common.c +++ b/board/toradex/common/tdx-common.c @@ -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 diff --git a/board/tqc/tqma6/tqma6.c b/board/tqc/tqma6/tqma6.c index fcdea34f05..14991fdb00 100644 --- a/board/tqc/tqma6/tqma6.c +++ b/board/tqc/tqma6/tqma6.c @@ -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(); diff --git a/board/udoo/neo/neo.c b/board/udoo/neo/neo.c index 276c625cfd..7fa1289de0 100644 --- a/board/udoo/neo/neo.c +++ b/board/udoo/neo/neo.c @@ -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; diff --git a/board/udoo/udoo.c b/board/udoo/udoo.c index 7534935dde..a359626b81 100644 --- a/board/udoo/udoo.c +++ b/board/udoo/udoo.c @@ -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; } diff --git a/board/varisys/common/sys_eeprom.c b/board/varisys/common/sys_eeprom.c index b55ab818e6..69f596a4cc 100644 --- a/board/varisys/common/sys_eeprom.c +++ b/board/varisys/common/sys_eeprom.c @@ -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); } } diff --git a/board/varisys/cyrus/cyrus.c b/board/varisys/cyrus/cyrus.c index 74f4473877..30f518abe8 100644 --- a/board/varisys/cyrus/cyrus.c +++ b/board/varisys/cyrus/cyrus.c @@ -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); diff --git a/board/vscom/baltos/board.c b/board/vscom/baltos/board.c index d3b1f1564f..cb39190c28 100644 --- a/board/vscom/baltos/board.c +++ b/board/vscom/baltos/board.c @@ -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 diff --git a/board/wandboard/wandboard.c b/board/wandboard/wandboard.c index 1dbc966b6e..adfcf48562 100644 --- a/board/wandboard/wandboard.c +++ b/board/wandboard/wandboard.c @@ -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; } diff --git a/board/work-microwave/work_92105/work_92105_display.c b/board/work-microwave/work_92105/work_92105_display.c index 37a736351c..c997cea6f0 100644 --- a/board/work-microwave/work_92105/work_92105_display.c +++ b/board/work-microwave/work_92105/work_92105_display.c @@ -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); diff --git a/board/xes/common/board.c b/board/xes/common/board.c index 4ed6f50e5c..b76eb948d5 100644 --- a/board/xes/common/board.c +++ b/board/xes/common/board.c @@ -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"); diff --git a/board/xilinx/zynq/board.c b/board/xilinx/zynq/board.c index b2fbecf6de..90ef542458 100644 --- a/board/xilinx/zynq/board.c +++ b/board/xilinx/zynq/board.c @@ -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; } diff --git a/board/xilinx/zynqmp/zynqmp.c b/board/xilinx/zynqmp/zynqmp.c index aebd3df8a9..d17868b0c2 100644 --- a/board/xilinx/zynqmp/zynqmp.c +++ b/board/xilinx/zynqmp/zynqmp.c @@ -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; } |