From 998eaaecd46ee5f00550e30e606cb5556e0b9345 Mon Sep 17 00:00:00 2001 From: wdenk Date: Sun, 18 Apr 2004 19:43:36 +0000 Subject: * Configure PPChameleon board to use redundand environment in flash * Configure PPChameleon board to use JFFS2 NAND support. * Added support for JFFS2 filesystem (read-only) on top of NAND flash --- common/cmd_jffs2.c | 29 +++++++++++++++++++++++++++++ common/cmd_nand.c | 15 ++++++++++++++- common/environment.c | 3 ++- 3 files changed, 45 insertions(+), 2 deletions(-) (limited to 'common') diff --git a/common/cmd_jffs2.c b/common/cmd_jffs2.c index c4f5a9715..3cf00b8e2 100644 --- a/common/cmd_jffs2.c +++ b/common/cmd_jffs2.c @@ -49,6 +49,8 @@ static int part_num=0; static struct part_info part; +#ifndef CONFIG_JFFS2_NAND + struct part_info* jffs2_part_info(int part_num) { @@ -88,6 +90,33 @@ jffs2_part_info(int part_num) } return 0; } + +#else /* CONFIG_JFFS2_NAND */ + +struct part_info* +jffs2_part_info(int part_num) +{ + if(part_num==0){ + + if(part.usr_priv==(void*)1) + return ∂ + + memset(&part, 0, sizeof(part)); + + part.offset = CONFIG_JFFS2_NAND_OFF; + part.size = CONFIG_JFFS2_NAND_SIZE; /* the bigger size the slower jffs2 */ + +#ifndef CONFIG_JFFS2_NAND_DEV +#define CONFIG_JFFS2_NAND_DEV 0 +#endif + /* nand device with the JFFS2 parition plus 1 */ + part.usr_priv = (void*)(CONFIG_JFFS2_NAND_DEV+1); + return ∂ + } + return 0; +} + +#endif /* CONFIG_JFFS2_NAND */ #endif /* ifndef CFG_JFFS_CUSTOM_PART */ int diff --git a/common/cmd_nand.c b/common/cmd_nand.c index c2e67abed..4b693a999 100644 --- a/common/cmd_nand.c +++ b/common/cmd_nand.c @@ -232,7 +232,7 @@ int do_nand (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) &total, (u_char*)addr); printf (" %d bytes %s: %s\n", total, - (cmd & NANDRW_READ) ? "read" : "write", + (cmd & NANDRW_READ) ? "read" : "written", ret ? "ERROR" : "OK"); return ret; @@ -1669,4 +1669,17 @@ static int nand_correct_data (u_char *dat, u_char *read_ecc, u_char *calc_ecc) } #endif + +#ifdef CONFIG_JFFS2_NAND + +int read_jffs2_nand(size_t start, size_t len, + size_t * retlen, u_char * buf, int nanddev) +{ + return nand_rw(nand_dev_desc + nanddev, NANDRW_READ | NANDRW_JFFS2, + start, len, retlen, buf); +} + +#endif /* CONFIG_JFFS2_NAND */ + + #endif /* (CONFIG_COMMANDS & CFG_CMD_NAND) */ diff --git a/common/environment.c b/common/environment.c index a868dccbd..3d8493a50 100644 --- a/common/environment.c +++ b/common/environment.c @@ -53,7 +53,8 @@ defined(CONFIG_R360MPI) || \ defined(CONFIG_TQM8xxL) || \ defined(CONFIG_RRVISION) || \ - defined(CONFIG_TRAB) ) && \ + defined(CONFIG_TRAB) || \ + defined(CONFIG_PPCHAMELEONEVB) ) && \ defined(ENV_CRC) /* Environment embedded in U-Boot .ppcenv section */ /* XXX - This only works with GNU C */ # define __PPCENV__ __attribute__ ((section(".ppcenv"))) -- cgit v1.2.3