]> git.ipfire.org Git - people/ms/u-boot.git/blame - common/env_remote.c
board: axs10x: Flush entire cache after programming reset vector
[people/ms/u-boot.git] / common / env_remote.c
CommitLineData
0a85a9e7
LG
1/*
2 * (C) Copyright 2011-2012 Freescale Semiconductor, Inc.
3 *
3765b3e7 4 * SPDX-License-Identifier: GPL-2.0+
0a85a9e7
LG
5 */
6
7/* #define DEBUG */
8
9#include <common.h>
10#include <command.h>
11#include <environment.h>
12#include <linux/stddef.h>
13
14char *env_name_spec = "Remote";
15
16#ifdef ENV_IS_EMBEDDED
17env_t *env_ptr = &environment;
18#else /* ! ENV_IS_EMBEDDED */
19env_t *env_ptr = (env_t *)CONFIG_ENV_ADDR;
20#endif /* ENV_IS_EMBEDDED */
21
22DECLARE_GLOBAL_DATA_PTR;
23
24#if !defined(CONFIG_ENV_OFFSET)
25#define CONFIG_ENV_OFFSET 0
26#endif
27
0a85a9e7
LG
28int env_init(void)
29{
30 if (crc32(0, env_ptr->data, ENV_SIZE) == env_ptr->crc) {
31 gd->env_addr = (ulong)&(env_ptr->data);
32 gd->env_valid = 1;
33 return 0;
34 }
35
36 gd->env_addr = (ulong)default_environment;
37 gd->env_valid = 0;
38 return 0;
39}
40
41#ifdef CONFIG_CMD_SAVEENV
42int saveenv(void)
43{
461632bd
LG
44#ifdef CONFIG_SRIO_PCIE_BOOT_SLAVE
45 printf("Can not support the 'saveenv' when boot from SRIO or PCIE!\n");
0a85a9e7
LG
46 return 1;
47#else
48 return 0;
49#endif
50}
51#endif /* CONFIG_CMD_SAVEENV */
52
53void env_relocate_spec(void)
54{
55#ifndef ENV_IS_EMBEDDED
56 env_import((char *)env_ptr, 1);
57#endif
58}