#include <malloc.h>
#include <search.h>
#include <errno.h>
+#include <onenand_uboot.h>
-#include <linux/mtd/compat.h>
+#include <linux/compat.h>
#include <linux/mtd/mtd.h>
#include <linux/mtd/onenand.h>
-extern struct mtd_info onenand_mtd;
-extern struct onenand_chip onenand_chip;
-
char *env_name_spec = "OneNAND";
#define ONENAND_MAX_ENV_SIZE 4096
#define ONENAND_ENV_SIZE(mtd) (ONENAND_MAX_ENV_SIZE - ENV_HEADER_SIZE)
-#ifdef ENV_IS_EMBEDDED
-extern uchar environment[];
-#endif /* ENV_IS_EMBEDDED */
-
DECLARE_GLOBAL_DATA_PTR;
-uchar env_get_char_spec(int index)
-{
- return (*((uchar *)(gd->env_addr + index)));
-}
-
void env_relocate_spec(void)
{
struct mtd_info *mtd = &onenand_mtd;
int rc;
size_t retlen;
#ifdef ENV_IS_EMBEDDED
- char *buf = (char *)&environment[0];
+ char *buf = (char *)&environment;
#else
loff_t env_addr = CONFIG_ENV_ADDR;
char onenand_env[ONENAND_MAX_ENV_SIZE];
if (mtd->writesize)
/* Ignore read fail */
mtd->read(mtd, env_addr, ONENAND_MAX_ENV_SIZE,
- &retlen, (u_char *)buf);
+ &retlen, (u_char *)buf);
else
mtd->writesize = MAX_ONENAND_PAGESIZE;
#endif /* !ENV_IS_EMBEDDED */
}
if (mtd->write(mtd, env_addr, ONENAND_MAX_ENV_SIZE, &retlen,
- (u_char *)&env_new)) {
+ (u_char *)&env_new)) {
printf("OneNAND: write failed at 0x%llx\n", instr.addr);
return 2;
}
int env_init(void)
{
/* use default */
- gd->env_addr = (ulong) & default_environment[0];
+ gd->env_addr = (ulong)&default_environment[0];
gd->env_valid = 1;
return 0;