summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/_exports.h4
-rw-r--r--include/asm-generic/global_data.h4
-rw-r--r--include/common.h94
-rw-r--r--include/configs/M5208EVBE.h4
-rw-r--r--include/configs/M5235EVB.h2
-rw-r--r--include/configs/M5249EVB.h4
-rw-r--r--include/configs/M5253DEMO.h4
-rw-r--r--include/configs/M5253EVBE.h2
-rw-r--r--include/configs/M5272C3.h4
-rw-r--r--include/configs/M5275EVB.h4
-rw-r--r--include/configs/M5282EVB.h2
-rw-r--r--include/configs/M53017EVB.h2
-rw-r--r--include/configs/M5329EVB.h4
-rw-r--r--include/configs/M5373EVB.h4
-rw-r--r--include/configs/amcore.h4
-rw-r--r--include/configs/astro_mcf5373l.h2
-rw-r--r--include/configs/cobra5272.h4
-rw-r--r--include/configs/edison.h1
-rw-r--r--include/configs/pfla02.h174
-rw-r--r--include/configs/tam3517-common.h2
-rw-r--r--include/configs/ulcb.h1
-rw-r--r--include/configs/wandboard.h1
-rw-r--r--include/dataflash.h2
-rw-r--r--include/environment.h133
-rw-r--r--include/exports.h4
-rw-r--r--include/image.h8
-rw-r--r--include/net.h12
-rw-r--r--include/netdev.h5
-rw-r--r--include/search.h2
29 files changed, 416 insertions, 77 deletions
diff --git a/include/_exports.h b/include/_exports.h
index 6ff4364e44..5416041243 100644
--- a/include/_exports.h
+++ b/include/_exports.h
@@ -31,8 +31,8 @@
EXPORT_FUNC(vprintf, int, vprintf, const char *, va_list)
EXPORT_FUNC(do_reset, int, do_reset, cmd_tbl_t *,
int , int , char * const [])
- EXPORT_FUNC(getenv, char *, getenv, const char*)
- EXPORT_FUNC(setenv, int, setenv, const char *, const char *)
+ EXPORT_FUNC(env_get, char *, env_get, const char*)
+ EXPORT_FUNC(env_set, int, env_set, const char *, const char *)
EXPORT_FUNC(simple_strtoul, unsigned long, simple_strtoul,
const char *, char **, unsigned int)
EXPORT_FUNC(strict_strtoul, int, strict_strtoul,
diff --git a/include/asm-generic/global_data.h b/include/asm-generic/global_data.h
index 86bf6565f6..944f58195c 100644
--- a/include/asm-generic/global_data.h
+++ b/include/asm-generic/global_data.h
@@ -49,7 +49,7 @@ typedef struct global_data {
unsigned long precon_buf_idx; /* Pre-Console buffer index */
#endif
unsigned long env_addr; /* Address of Environment struct */
- unsigned long env_valid; /* Checksum of Environment valid? */
+ unsigned long env_valid; /* Environment valid? enum env_valid */
unsigned long ram_top; /* Top address of RAM used by U-Boot */
unsigned long relocaddr; /* Start address of U-Boot in RAM */
@@ -76,7 +76,7 @@ typedef struct global_data {
struct device_node *of_root;
#endif
struct jt_funcs *jt; /* jump table */
- char env_buf[32]; /* buffer for getenv() before reloc. */
+ char env_buf[32]; /* buffer for env_get() before reloc. */
#ifdef CONFIG_TRACE
void *trace_buff; /* The trace buffer */
#endif
diff --git a/include/common.h b/include/common.h
index c8fb277cde..aaed131671 100644
--- a/include/common.h
+++ b/include/common.h
@@ -311,16 +311,45 @@ int env_init (void);
void env_relocate (void);
int envmatch (uchar *, int);
-/* Avoid unfortunate conflict with libc's getenv() */
-#ifdef CONFIG_SANDBOX
-#define getenv uboot_getenv
-#endif
-char *getenv (const char *);
-int getenv_f (const char *name, char *buf, unsigned len);
-ulong getenv_ulong(const char *name, int base, ulong default_val);
+/**
+ * env_get() - Look up the value of an environment variable
+ *
+ * In U-Boot proper this can be called before relocation (which is when the
+ * environment is loaded from storage, i.e. GD_FLG_ENV_READY is 0). In that
+ * case this function calls env_get_f().
+ *
+ * @varname: Variable to look up
+ * @return value of variable, or NULL if not found
+ */
+char *env_get(const char *varname);
+
+/**
+ * env_get_f() - Look up the value of an environment variable (early)
+ *
+ * This function is called from env_get() if the environment has not been
+ * loaded yet (GD_FLG_ENV_READY flag is 0). Some environment locations will
+ * support reading the value (slowly) and some will not.
+ *
+ * @varname: Variable to look up
+ * @return value of variable, or NULL if not found
+ */
+int env_get_f(const char *name, char *buf, unsigned len);
+
+/**
+ * env_get_ulong() - Return an environment variable as an integer value
+ *
+ * Most U-Boot environment variables store hex values. For those which store
+ * (e.g.) base-10 integers, this function can be used to read the value.
+ *
+ * @name: Variable to look up
+ * @base: Base to use (e.g. 10 for base 10, 2 for binary)
+ * @default_val: Default value to return if no value is found
+ * @return the value found, or @default_val if none
+ */
+ulong env_get_ulong(const char *name, int base, ulong default_val);
/**
- * getenv_hex() - Return an environment variable as a hex value
+ * env_get_hex() - Return an environment variable as a hex value
*
* Decode an environment as a hex number (it may or may not have a 0x
* prefix). If the environment variable cannot be found, or does not start
@@ -329,27 +358,54 @@ ulong getenv_ulong(const char *name, int base, ulong default_val);
* @varname: Variable to decode
* @default_val: Value to return on error
*/
-ulong getenv_hex(const char *varname, ulong default_val);
+ulong env_get_hex(const char *varname, ulong default_val);
/*
* Read an environment variable as a boolean
* Return -1 if variable does not exist (default to true)
*/
-int getenv_yesno(const char *var);
-int saveenv (void);
-int setenv (const char *, const char *);
-int setenv_ulong(const char *varname, ulong value);
-int setenv_hex(const char *varname, ulong value);
+int env_get_yesno(const char *var);
+
+/**
+ * env_set() - set an environment variable
+ *
+ * This sets or deletes the value of an environment variable. For setting the
+ * value the variable is created if it does not already exist.
+ *
+ * @varname: Variable to adjust
+ * @value: Value to set for the variable, or NULL or "" to delete the variable
+ * @return 0 if OK, 1 on error
+ */
+int env_set(const char *varname, const char *value);
+
+/**
+ * env_set_ulong() - set an environment variable to an integer
+ *
+ * @varname: Variable to adjust
+ * @value: Value to set for the variable (will be converted to a string)
+ * @return 0 if OK, 1 on error
+ */
+int env_set_ulong(const char *varname, ulong value);
+
+/**
+ * env_set_hex() - set an environment variable to a hex value
+ *
+ * @varname: Variable to adjust
+ * @value: Value to set for the variable (will be converted to a hex string)
+ * @return 0 if OK, 1 on error
+ */
+int env_set_hex(const char *varname, ulong value);
+
/**
- * setenv_addr - Set an environment variable to an address in hex
+ * env_set_addr - Set an environment variable to an address in hex
*
* @varname: Environment variable to set
* @addr: Value to set it to
* @return 0 if ok, 1 on error
*/
-static inline int setenv_addr(const char *varname, const void *addr)
+static inline int env_set_addr(const char *varname, const void *addr)
{
- return setenv_hex(varname, (ulong)addr);
+ return env_set_hex(varname, (ulong)addr);
}
#ifdef CONFIG_AUTO_COMPLETE
@@ -693,9 +749,9 @@ int zzip(void *dst, unsigned long *lenp, unsigned char *src,
/* lib/net_utils.c */
#include <net.h>
-static inline struct in_addr getenv_ip(char *var)
+static inline struct in_addr env_get_ip(char *var)
{
- return string_to_ip(getenv(var));
+ return string_to_ip(env_get(var));
}
int pcmcia_init (void);
diff --git a/include/configs/M5208EVBE.h b/include/configs/M5208EVBE.h
index 0fbf457cdc..c56cbd9f54 100644
--- a/include/configs/M5208EVBE.h
+++ b/include/configs/M5208EVBE.h
@@ -161,8 +161,8 @@
#define CONFIG_ENV_SECT_SIZE 0x2000
#define LDS_BOARD_TEXT \
- . = DEFINED(env_offset) ? env_offset : .; \
- common/env_embedded.o (.text*);
+ . = DEFINED(env_offset) ? env_offset : .; \
+ env/embedded.o(.text*);
/* Cache Configuration */
#define CONFIG_SYS_CACHELINE_SIZE 16
diff --git a/include/configs/M5235EVB.h b/include/configs/M5235EVB.h
index dac2a32383..57bc57817d 100644
--- a/include/configs/M5235EVB.h
+++ b/include/configs/M5235EVB.h
@@ -176,7 +176,7 @@
#define LDS_BOARD_TEXT \
. = DEFINED(env_offset) ? env_offset : .; \
- common/env_embedded.o (.text);
+ env/embedded.o(.text);
#ifdef NORFLASH_PS32BIT
# define CONFIG_ENV_OFFSET (0x8000)
diff --git a/include/configs/M5249EVB.h b/include/configs/M5249EVB.h
index f6027e231f..df0733e6c2 100644
--- a/include/configs/M5249EVB.h
+++ b/include/configs/M5249EVB.h
@@ -85,8 +85,8 @@
#define CONFIG_SYS_INIT_SP_OFFSET CONFIG_SYS_GBL_DATA_OFFSET
#define LDS_BOARD_TEXT \
- . = DEFINED(env_offset) ? env_offset : .; \
- common/env_embedded.o (.text);
+ . = DEFINED(env_offset) ? env_offset : .; \
+ env/embedded.o(.text);
#define CONFIG_ENV_OFFSET 0x4000 /* Address of Environment Sector*/
#define CONFIG_ENV_SIZE 0x2000 /* Total Size of Environment Sector */
diff --git a/include/configs/M5253DEMO.h b/include/configs/M5253DEMO.h
index 2bdfe80ef5..da8333ac6f 100644
--- a/include/configs/M5253DEMO.h
+++ b/include/configs/M5253DEMO.h
@@ -29,8 +29,8 @@
#endif
#define LDS_BOARD_TEXT \
- . = DEFINED(env_offset) ? env_offset : .; \
- common/env_embedded.o (.text*);
+ . = DEFINED(env_offset) ? env_offset : .; \
+ env/embedded.o(.text*);
/*
* Command line configuration.
diff --git a/include/configs/M5253EVBE.h b/include/configs/M5253EVBE.h
index 0722ea19e3..5a2f0e204f 100644
--- a/include/configs/M5253EVBE.h
+++ b/include/configs/M5253EVBE.h
@@ -31,7 +31,7 @@
#define LDS_BOARD_TEXT \
. = DEFINED(env_offset) ? env_offset : .; \
- common/env_embedded.o (.text)
+ env/embedded.o(.text)
/*
* BOOTP options
diff --git a/include/configs/M5272C3.h b/include/configs/M5272C3.h
index e6bd7f3609..f5693d8178 100644
--- a/include/configs/M5272C3.h
+++ b/include/configs/M5272C3.h
@@ -39,8 +39,8 @@
#endif
#define LDS_BOARD_TEXT \
- . = DEFINED(env_offset) ? env_offset : .; \
- common/env_embedded.o (.text);
+ . = DEFINED(env_offset) ? env_offset : .; \
+ env/embedded.o(.text);
/*
* BOOTP options
diff --git a/include/configs/M5275EVB.h b/include/configs/M5275EVB.h
index 6bcd6b6f2e..339a03c7b1 100644
--- a/include/configs/M5275EVB.h
+++ b/include/configs/M5275EVB.h
@@ -40,8 +40,8 @@
#endif
#define LDS_BOARD_TEXT \
- . = DEFINED(env_offset) ? env_offset : .; \
- common/env_embedded.o (.text);
+ . = DEFINED(env_offset) ? env_offset : .; \
+ env/embedded.o(.text);
/*
* BOOTP options
diff --git a/include/configs/M5282EVB.h b/include/configs/M5282EVB.h
index cc703aac19..3f2d9a9bac 100644
--- a/include/configs/M5282EVB.h
+++ b/include/configs/M5282EVB.h
@@ -32,7 +32,7 @@
#define LDS_BOARD_TEXT \
. = DEFINED(env_offset) ? env_offset : .; \
- common/env_embedded.o (.text*);
+ env/embedded.o(.text*);
/*
* BOOTP options
diff --git a/include/configs/M53017EVB.h b/include/configs/M53017EVB.h
index f7812468af..45e4be2f01 100644
--- a/include/configs/M53017EVB.h
+++ b/include/configs/M53017EVB.h
@@ -183,7 +183,7 @@
#define LDS_BOARD_TEXT \
. = DEFINED(env_offset) ? env_offset : .; \
- common/env_embedded.o (.text*)
+ env/embedded.o(.text*)
/*-----------------------------------------------------------------------
* Cache Configuration
diff --git a/include/configs/M5329EVB.h b/include/configs/M5329EVB.h
index f7b284fda8..1b5cae2dfe 100644
--- a/include/configs/M5329EVB.h
+++ b/include/configs/M5329EVB.h
@@ -185,8 +185,8 @@
#define CONFIG_ENV_SECT_SIZE 0x2000
#define LDS_BOARD_TEXT \
- . = DEFINED(env_offset) ? env_offset : .; \
- common/env_embedded.o (.text*);
+ . = DEFINED(env_offset) ? env_offset : .; \
+ env/embedded.o(.text*);
/*-----------------------------------------------------------------------
* Cache Configuration
diff --git a/include/configs/M5373EVB.h b/include/configs/M5373EVB.h
index b85e0f088f..a0e582e2b8 100644
--- a/include/configs/M5373EVB.h
+++ b/include/configs/M5373EVB.h
@@ -185,8 +185,8 @@
#define CONFIG_ENV_SECT_SIZE 0x2000
#define LDS_BOARD_TEXT \
- . = DEFINED(env_offset) ? env_offset : .; \
- common/env_embedded.o (.text*);
+ . = DEFINED(env_offset) ? env_offset : .; \
+ env/embedded.o(.text*);
/*-----------------------------------------------------------------------
* Cache Configuration
diff --git a/include/configs/amcore.h b/include/configs/amcore.h
index 0a40746112..5f8b6c5518 100644
--- a/include/configs/amcore.h
+++ b/include/configs/amcore.h
@@ -93,8 +93,8 @@
#define CONFIG_ENV_SECT_SIZE 0x1000
#define LDS_BOARD_TEXT \
- . = DEFINED(env_offset) ? env_offset : .; \
- common/env_embedded.o (.text*);
+ . = DEFINED(env_offset) ? env_offset : .; \
+ env/embedded.o(.text*);
/* memory map space for linux boot data */
#define CONFIG_SYS_BOOTMAPSZ (8 << 20)
diff --git a/include/configs/astro_mcf5373l.h b/include/configs/astro_mcf5373l.h
index af03b303c4..563732a5c4 100644
--- a/include/configs/astro_mcf5373l.h
+++ b/include/configs/astro_mcf5373l.h
@@ -296,7 +296,7 @@
#define LDS_BOARD_TEXT \
. = DEFINED(env_offset) ? env_offset : .; \
- common/env_embedded.o (.text*)
+ env/embedded.o(.text*)
#if ENABLE_JFFS
/* JFFS Partition offset set */
diff --git a/include/configs/cobra5272.h b/include/configs/cobra5272.h
index c44c6cae58..9adf7a35f0 100644
--- a/include/configs/cobra5272.h
+++ b/include/configs/cobra5272.h
@@ -102,8 +102,8 @@
#endif
#define LDS_BOARD_TEXT \
- . = DEFINED(env_offset) ? env_offset : .; \
- common/env_embedded.o (.text);
+ . = DEFINED(env_offset) ? env_offset : .; \
+ env/embedded.o(.text);
/*
* BOOTP options
diff --git a/include/configs/edison.h b/include/configs/edison.h
index dfac340c2f..399fbc7d9c 100644
--- a/include/configs/edison.h
+++ b/include/configs/edison.h
@@ -42,7 +42,6 @@
#define CONFIG_SYS_MEMTEST_END 0x01000000
/* Environment */
-#define CONFIG_ENV_IS_IN_MMC
#define CONFIG_SYS_MMC_ENV_DEV 0
#define CONFIG_SYS_MMC_ENV_PART 0
#define CONFIG_ENV_SIZE (64 * 1024)
diff --git a/include/configs/pfla02.h b/include/configs/pfla02.h
new file mode 100644
index 0000000000..be90ce9bff
--- /dev/null
+++ b/include/configs/pfla02.h
@@ -0,0 +1,174 @@
+/*
+ * Copyright (C) Stefano Babic <sbabic@denx.de>
+ *
+ * SPDX-License-Identifier: GPL-2.0+
+ */
+
+
+#ifndef __PCM058_CONFIG_H
+#define __PCM058_CONFIG_H
+
+#include <config_distro_defaults.h>
+
+#ifdef CONFIG_SPL
+#define CONFIG_SPL_SPI_LOAD
+#define CONFIG_SYS_SPI_U_BOOT_OFFS (64 * 1024)
+#include "imx6_spl.h"
+#endif
+
+#include "mx6_common.h"
+
+/* Thermal */
+#define CONFIG_IMX_THERMAL
+
+/* Serial */
+#define CONFIG_MXC_UART
+#define CONFIG_MXC_UART_BASE UART4_BASE
+#define CONSOLE_DEV "ttymxc3"
+
+/* Early setup */
+#define CONFIG_DISPLAY_BOARDINFO_LATE
+
+
+/* Size of malloc() pool */
+#define CONFIG_SYS_MALLOC_LEN (8 * SZ_1M)
+
+/* Ethernet */
+#define CONFIG_MII
+#define IMX_FEC_BASE ENET_BASE_ADDR
+#define CONFIG_FEC_XCV_TYPE RGMII
+#define CONFIG_ETHPRIME "FEC"
+#define CONFIG_FEC_MXC_PHYADDR 3
+
+/* SPI Flash */
+#define CONFIG_MXC_SPI
+#define CONFIG_SF_DEFAULT_BUS 2
+#define CONFIG_SF_DEFAULT_CS 0
+#define CONFIG_SF_DEFAULT_SPEED 20000000
+#define CONFIG_SF_DEFAULT_MODE SPI_MODE_0
+
+/* I2C Configs */
+#define CONFIG_SYS_I2C
+#define CONFIG_SYS_I2C_MXC
+#define CONFIG_SYS_I2C_MXC_I2C1 /* enable I2C bus 0 */
+#define CONFIG_SYS_I2C_SPEED 100000
+
+#ifndef CONFIG_SPL_BUILD
+#define CONFIG_CMD_NAND
+/* Enable NAND support */
+#define CONFIG_CMD_NAND_TRIMFFS
+#define CONFIG_NAND_MXS
+#define CONFIG_SYS_MAX_NAND_DEVICE 1
+#define CONFIG_SYS_NAND_BASE 0x40000000
+#define CONFIG_SYS_NAND_5_ADDR_CYCLE
+#define CONFIG_SYS_NAND_ONFI_DETECTION
+#endif
+
+/* DMA stuff, needed for GPMI/MXS NAND support */
+#define CONFIG_APBH_DMA
+#define CONFIG_APBH_DMA_BURST
+#define CONFIG_APBH_DMA_BURST8
+
+/* Filesystem support */
+#define CONFIG_MTD_PARTITIONS
+#define CONFIG_MTD_DEVICE
+#define MTDIDS_DEFAULT "nand0=gpmi-nand"
+#define MTDPARTS_DEFAULT "mtdparts=gpmi-nand:-(nand);" \
+ "spi2.0:1024k(bootloader),64k(env1),64k(env2),-(rescue)"
+
+/* Various command support */
+
+/* Physical Memory Map */
+#define CONFIG_NR_DRAM_BANKS 1
+#define PHYS_SDRAM MMDC0_ARB_BASE_ADDR
+
+#define CONFIG_SYS_SDRAM_BASE PHYS_SDRAM
+#define CONFIG_SYS_INIT_RAM_ADDR IRAM_BASE_ADDR
+#define CONFIG_SYS_INIT_RAM_SIZE IRAM_SIZE
+
+#define CONFIG_SYS_INIT_SP_OFFSET \
+ (CONFIG_SYS_INIT_RAM_SIZE - GENERATED_GBL_DATA_SIZE)
+#define CONFIG_SYS_INIT_SP_ADDR \
+ (CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_SP_OFFSET)
+
+/* MMC Configs */
+#define CONFIG_SYS_FSL_ESDHC_ADDR 0
+#define CONFIG_SYS_FSL_USDHC_NUM 2
+
+/* Environment organization */
+#define CONFIG_ENV_IS_IN_SPI_FLASH
+#define CONFIG_ENV_SIZE (16 * 1024)
+#define CONFIG_ENV_OFFSET (1024 * SZ_1K)
+#define CONFIG_ENV_SECT_SIZE (64 * SZ_1K)
+#define CONFIG_ENV_SPI_BUS CONFIG_SF_DEFAULT_BUS
+#define CONFIG_ENV_SPI_CS CONFIG_SF_DEFAULT_CS
+#define CONFIG_ENV_SPI_MODE CONFIG_SF_DEFAULT_MODE
+#define CONFIG_ENV_SPI_MAX_HZ CONFIG_SF_DEFAULT_SPEED
+#define CONFIG_SYS_REDUNDAND_ENVIRONMENT
+#define CONFIG_ENV_OFFSET_REDUND (CONFIG_ENV_OFFSET + \
+ CONFIG_ENV_SECT_SIZE)
+#define CONFIG_ENV_SIZE_REDUND CONFIG_ENV_SIZE
+
+#ifdef CONFIG_ENV_IS_IN_NAND
+#define CONFIG_ENV_OFFSET (0x1E0000)
+#define CONFIG_ENV_SECT_SIZE (128 * SZ_1K)
+#endif
+
+/* Default environment */
+#define CONFIG_EXTRA_ENV_SETTINGS \
+ "addcons=setenv bootargs ${bootargs} " \
+ "console=${console},${baudrate}\0" \
+ "addip=setenv bootargs ${bootargs} " \
+ "ip=${ipaddr}:${serverip}:${gatewayip}:" \
+ "${netmask}:${hostname}:${netdev}:off\0" \
+ "addmisc=setenv bootargs ${bootargs} ${miscargs}\0" \
+ "addmtd=run mtdnand;run mtdspi;" \
+ "setenv bootargs ${bootargs} ${mtdparts}\0" \
+ "mtdnand=setenv mtdparts mtdparts=gpmi-nand:" \
+ "40m(Kernels),400m(root),-(nand)\0" \
+ "mtdspi=setenv mtdparts ${mtdparts}" \
+ "';spi2.0:1024k(bootloader)," \
+ "64k(env1),64k(env2),-(rescue)'\0" \
+ "bootcmd=if test -n ${rescue};" \
+ "then run swupdate;fi;run nandboot;run swupdate\0" \
+ "bootfile=uImage\0" \
+ "bootimage=uImage\0" \
+ "console=ttymxc3\0" \
+ "fdt_addr_r=0x18000000\0" \
+ "fdt_file=pfla02.dtb\0" \
+ "fdt_high=0xffffffff\0" \
+ "initrd_high=0xffffffff\0" \
+ "kernel_addr_r=" __stringify(CONFIG_LOADADDR) "\0" \
+ "miscargs=panic=1 quiet\0" \
+ "mmcargs=setenv bootargs root=${mmcroot} rw rootwait\0" \
+ "mmcboot=if run mmcload;then " \
+ "run mmcargs addcons addmisc;" \
+ "bootm;fi\0" \
+ "mmcload=mmc rescan;" \
+ "load mmc 0:${mmcpart} ${kernel_addr_r} boot/fitImage\0"\
+ "mmcpart=1\0" \
+ "mmcroot=/dev/mmcblk0p1\0" \
+ "ubiroot=1\0" \
+ "nandargs=setenv bootargs ubi.mtd=1 " \
+ "root=ubi0:rootfs${ubiroot} rootfstype=ubifs\0" \
+ "nandboot=run mtdnand;ubi part nand0,0;" \
+ "ubi readvol ${kernel_addr_r} kernel${ubiroot};" \
+ "run nandargs addip addcons addmtd addmisc;" \
+ "bootm ${kernel_addr_r}\0" \
+ "net_nfs=tftp ${kernel_addr_r} ${board_name}/${bootfile};" \
+ "tftp ${fdt_addr_r} ${board_name}/${fdt_file};" \
+ "run nfsargs addip addcons addmtd addmisc;" \
+ "bootm ${kernel_addr_r} - ${fdt_addr_r}\0" \
+ "net_nfs_fit=tftp ${kernel_addr_r} ${board_name}/${fitfile};" \
+ "run nfsargs addip addcons addmtd addmisc;" \
+ "bootm ${kernel_addr_r}\0" \
+ "nfsargs=setenv bootargs root=/dev/nfs" \
+ " nfsroot=${serverip}:${nfsroot},v3 panic=1\0" \
+ "swupdate=setenv bootargs root=/dev/ram;" \
+ "run addip addcons addmtd addmisc;" \
+ "sf probe;" \
+ "sf read ${kernel_addr_r} 120000 600000;" \
+ "sf read 14000000 730000 800000;" \
+ "bootm ${kernel_addr_r} 14000000\0"
+
+#endif
diff --git a/include/configs/tam3517-common.h b/include/configs/tam3517-common.h
index 54223c475a..433625105a 100644
--- a/include/configs/tam3517-common.h
+++ b/include/configs/tam3517-common.h
@@ -334,7 +334,7 @@ do { \
else \
strcpy(ethname, "ethaddr"); \
printf("Setting %s from EEPROM with %s\n", ethname, buf);\
- setenv(ethname, buf); \
+ env_set(ethname, buf); \
} \
} while (0)
diff --git a/include/configs/ulcb.h b/include/configs/ulcb.h
index 921b9e5ec6..cce245613d 100644
--- a/include/configs/ulcb.h
+++ b/include/configs/ulcb.h
@@ -93,7 +93,6 @@ unsigned char ulcb_softspi_read(void);
#define CONFIG_SH_SDHI_FREQ 200000000
/* Environment in eMMC, at the end of 2nd "boot sector" */
-#define CONFIG_ENV_IS_IN_MMC
#define CONFIG_ENV_OFFSET (-CONFIG_ENV_SIZE)
#define CONFIG_SYS_MMC_ENV_DEV 1
#define CONFIG_SYS_MMC_ENV_PART 2
diff --git a/include/configs/wandboard.h b/include/configs/wandboard.h
index ed25f420d0..d9237d7b81 100644
--- a/include/configs/wandboard.h
+++ b/include/configs/wandboard.h
@@ -123,6 +123,7 @@
#define BOOT_TARGET_DEVICES(func) \
func(MMC, mmc, 0) \
func(MMC, mmc, 1) \
+ func(SATA, sata, 0) \
func(USB, usb, 0) \
func(PXE, pxe, na) \
func(DHCP, dhcp, na)
diff --git a/include/dataflash.h b/include/dataflash.h
index 84a56c30ce..c9f22200cf 100644
--- a/include/dataflash.h
+++ b/include/dataflash.h
@@ -197,7 +197,7 @@ extern int AT91F_DataflashInit(void);
extern void dataflash_print_info (void);
extern void dataflash_perror (int err);
-extern void AT91F_DataflashSetEnv (void);
+extern void AT91F_Dataflashenv_set(void);
extern struct dataflash_addr cs[CONFIG_SYS_MAX_DATAFLASH_BANKS];
extern dataflash_protect_t area_list[NB_DATAFLASH_AREA];
diff --git a/include/environment.h b/include/environment.h
index d86230a2e9..03b41e0c51 100644
--- a/include/environment.h
+++ b/include/environment.h
@@ -143,10 +143,6 @@ extern unsigned long nand_env_oob_offset;
# define ENV_HEADER_SIZE (sizeof(uint32_t))
#endif
-#if defined(CONFIG_CMD_SAVEENV) && !defined(CONFIG_ENV_IS_NOWHERE)
-extern char *env_name_spec;
-#endif
-
#ifdef CONFIG_ENV_AES
/* Make sure the payload is multiple of AES block size */
#define ENV_SIZE ((CONFIG_ENV_SIZE - ENV_HEADER_SIZE) & ~(16 - 1))
@@ -174,9 +170,6 @@ extern env_t environment;
extern const unsigned char default_environment[];
extern env_t *env_ptr;
-extern void env_relocate_spec(void);
-extern unsigned char env_get_char_spec(int);
-
#if defined(CONFIG_NEEDS_MANUAL_RELOC)
extern void env_reloc(void);
#endif
@@ -197,20 +190,101 @@ extern uint mmc_get_env_part(struct mmc *mmc);
#include <env_flags.h>
#include <search.h>
-extern struct hsearch_data env_htab;
+/* Value for environment validity */
+enum env_valid {
+ ENV_INVALID, /* No valid environment */
+ ENV_VALID, /* First or only environment is valid */
+ ENV_REDUND, /* Redundant environment is valid */
+};
+
+enum env_location {
+ ENVL_DATAFLASH,
+ ENVL_EEPROM,
+ ENVL_EXT4,
+ ENVL_FAT,
+ ENVL_FLASH,
+ ENVL_MMC,
+ ENVL_NAND,
+ ENVL_NVRAM,
+ ENVL_ONENAND,
+ ENVL_REMOTE,
+ ENVL_SPI_FLASH,
+ ENVL_UBI,
+ ENVL_NOWHERE,
+
+ ENVL_COUNT,
+ ENVL_UNKNOWN,
+};
+
+struct env_driver {
+ const char *name;
+ enum env_location location;
+
+ /**
+ * get_char() - Read a character from the environment
+ *
+ * This method is optional. If not provided, a default implementation
+ * will read from gd->env_addr.
+ *
+ * @index: Index of character to read (0=first)
+ * @return character read, or -ve on error
+ */
+ int (*get_char)(int index);
+
+ /**
+ * load() - Load the environment from storage
+ *
+ * This method is optional. If not provided, no environment will be
+ * loaded.
+ *
+ * @return 0 if OK, -ve on error
+ */
+ int (*load)(void);
+
+ /**
+ * save() - Save the environment to storage
+ *
+ * This method is required for 'saveenv' to work.
+ *
+ * @return 0 if OK, -ve on error
+ */
+ int (*save)(void);
+
+ /**
+ * init() - Set up the initial pre-relocation environment
+ *
+ * This method is optional.
+ *
+ * @return 0 if OK, -ENOENT if no initial environment could be found,
+ * other -ve on error
+ */
+ int (*init)(void);
+};
+
+/* Declare a new environment location driver */
+#define U_BOOT_ENV_LOCATION(__name) \
+ ll_entry_declare(struct env_driver, __name, env_driver)
+
+/* Declare the name of a location */
+#ifdef CONFIG_CMD_SAVEENV
+#define ENV_NAME(_name) .name = _name,
+#else
+#define ENV_NAME(_name)
+#endif
-/* Function that returns a character from the environment */
-unsigned char env_get_char(int);
+#ifdef CONFIG_CMD_SAVEENV
+#define env_save_ptr(x) x
+#else
+#define env_save_ptr(x) NULL
+#endif
-/* Function that returns a pointer to a value from the environment */
-const unsigned char *env_get_addr(int);
-unsigned char env_get_char_memory(int index);
+extern struct hsearch_data env_htab;
/* Function that updates CRC of the enironment */
void env_crc_update(void);
/* Look up the variable from the default environment */
-char *getenv_default(const char *name);
+char *env_get_default(const char *name);
/* [re]set to the default environment */
void set_default_env(const char *s);
@@ -229,6 +303,37 @@ int env_export(env_t *env_out);
int env_import_redund(const char *buf1, const char *buf2);
#endif
+/**
+ * env_driver_lookup_default() - Look up the default environment driver
+ *
+ * @return pointer to driver, or NULL if none (which should not happen)
+ */
+struct env_driver *env_driver_lookup_default(void);
+
+/**
+ * env_get_char() - Get a character from the early environment
+ *
+ * This reads from the pre-relocation environemnt
+ *
+ * @index: Index of character to read (0 = first)
+ * @return character read, or -ve on error
+ */
+int env_get_char(int index);
+
+/**
+ * env_load() - Load the environment from storage
+ *
+ * @return 0 if OK, -ve on error
+ */
+int env_load(void);
+
+/**
+ * env_save() - Save the environment to storage
+ *
+ * @return 0 if OK, -ve on error
+ */
+int env_save(void);
+
#endif /* DO_DEPS_ONLY */
#endif /* _ENVIRONMENT_H_ */
diff --git a/include/exports.h b/include/exports.h
index 1d81bc4b28..ebe81d914c 100644
--- a/include/exports.h
+++ b/include/exports.h
@@ -27,8 +27,8 @@ unsigned long get_timer(unsigned long);
int vprintf(const char *, va_list);
unsigned long simple_strtoul(const char *cp, char **endp, unsigned int base);
int strict_strtoul(const char *cp, unsigned int base, unsigned long *res);
-char *getenv (const char *name);
-int setenv (const char *varname, const char *varvalue);
+char *env_get(const char *name);
+int env_set(const char *varname, const char *value);
long simple_strtol(const char *cp, char **endp, unsigned int base);
int strcmp(const char *cs, const char *ct);
unsigned long ustrtoul(const char *cp, char **endp, unsigned int base);
diff --git a/include/image.h b/include/image.h
index c6f1513220..1f4bfda2f3 100644
--- a/include/image.h
+++ b/include/image.h
@@ -373,7 +373,7 @@ typedef struct bootm_headers {
bd_t *kbd;
#endif
- int verify; /* getenv("verify")[0] != 'n' */
+ int verify; /* env_get("verify")[0] != 'n' */
#define BOOTM_STATE_START (0x00000001)
#define BOOTM_STATE_FINDOS (0x00000002)
@@ -769,9 +769,9 @@ static inline void image_set_name(image_header_t *hdr, const char *name)
int image_check_hcrc(const image_header_t *hdr);
int image_check_dcrc(const image_header_t *hdr);
#ifndef USE_HOSTCC
-ulong getenv_bootm_low(void);
-phys_size_t getenv_bootm_size(void);
-phys_size_t getenv_bootm_mapsize(void);
+ulong env_get_bootm_low(void);
+phys_size_t env_get_bootm_size(void);
+phys_size_t env_get_bootm_mapsize(void);
#endif
void memmove_wd(void *to, void *from, size_t len, ulong chunksz);
diff --git a/include/net.h b/include/net.h
index e1269486ad..455b48f6c7 100644
--- a/include/net.h
+++ b/include/net.h
@@ -239,11 +239,11 @@ void eth_set_current(void); /* set nterface to ethcur var */
int eth_get_dev_index(void); /* get the device index */
void eth_parse_enetaddr(const char *addr, uchar *enetaddr);
-int eth_getenv_enetaddr(const char *name, uchar *enetaddr);
-int eth_setenv_enetaddr(const char *name, const uchar *enetaddr);
+int eth_env_get_enetaddr(const char *name, uchar *enetaddr);
+int eth_env_set_enetaddr(const char *name, const uchar *enetaddr);
/**
- * eth_setenv_enetaddr_by_index() - set the MAC address environment variable
+ * eth_env_set_enetaddr_by_index() - set the MAC address environment variable
*
* This sets up an environment variable with the given MAC address (@enetaddr).
* The environment variable to be set is defined by <@base_name><@index>addr.
@@ -255,7 +255,7 @@ int eth_setenv_enetaddr(const char *name, const uchar *enetaddr);
* @enetaddr: Pointer to MAC address to put into the variable
* @return 0 if OK, other value on error
*/
-int eth_setenv_enetaddr_by_index(const char *base_name, int index,
+int eth_env_set_enetaddr_by_index(const char *base_name, int index,
uchar *enetaddr);
@@ -275,7 +275,7 @@ int usb_ether_init(void);
* Returns:
* Return true if the address is valid.
*/
-int eth_getenv_enetaddr_by_index(const char *base_name, int index,
+int eth_env_get_enetaddr_by_index(const char *base_name, int index,
uchar *enetaddr);
int eth_init(void); /* Initialize the device */
@@ -834,7 +834,7 @@ void vlan_to_string(ushort x, char *s);
ushort string_to_vlan(const char *s);
/* read a VLAN id from an environment variable */
-ushort getenv_vlan(char *);
+ushort env_get_vlan(char *);
/* copy a filename (allow for "..." notation, limit length) */
void copy_filename(char *dst, const char *src, int size);
diff --git a/include/netdev.h b/include/netdev.h
index c06b90886b..b9bfebac67 100644
--- a/include/netdev.h
+++ b/include/netdev.h
@@ -130,7 +130,12 @@ static inline int pci_eth_init(bd_t *bis)
return num;
}
+#ifdef CONFIG_DM_ETH
+struct mii_dev *fec_get_miibus(struct udevice *dev, int dev_id);
+#else
struct mii_dev *fec_get_miibus(uint32_t base_addr, int dev_id);
+#endif
+
#ifdef CONFIG_PHYLIB
struct phy_device;
int fec_probe(bd_t *bd, int dev_id, uint32_t base_addr,
diff --git a/include/search.h b/include/search.h
index 402dfd84fb..df5d61c2eb 100644
--- a/include/search.h
+++ b/include/search.h
@@ -118,7 +118,7 @@ extern int hwalk_r(struct hsearch_data *__htab, int (*callback)(ENTRY *));
#define H_MATCH_SUBSTR (1 << 7) /* search for substring matches */
#define H_MATCH_REGEX (1 << 8) /* search for regular expression matches */
#define H_MATCH_METHOD (H_MATCH_IDENT | H_MATCH_SUBSTR | H_MATCH_REGEX)
-#define H_PROGRAMMATIC (1 << 9) /* indicate that an import is from setenv() */
+#define H_PROGRAMMATIC (1 << 9) /* indicate that an import is from env_set() */
#define H_ORIGIN_FLAGS (H_INTERACTIVE | H_PROGRAMMATIC)
#endif /* _SEARCH_H_ */