diff options
author | wdenk <wdenk> | 2003-09-10 22:30:53 +0000 |
---|---|---|
committer | wdenk <wdenk> | 2003-09-10 22:30:53 +0000 |
commit | 7205e4075d8b50e4dd89fe39ed03860b23cbb704 (patch) | |
tree | 0dfa865e7087ff4ee07967a2531c91ff5645a802 /board/sixnet/sixnet.c | |
parent | 149dded2b178bc0fb62cb6f61b87968d914b580a (diff) | |
download | u-boot-imx-7205e4075d8b50e4dd89fe39ed03860b23cbb704.zip u-boot-imx-7205e4075d8b50e4dd89fe39ed03860b23cbb704.tar.gz u-boot-imx-7205e4075d8b50e4dd89fe39ed03860b23cbb704.tar.bz2 |
* Patches by Denis Peter, 9 Sep 2003:
add FAT support for IDE, SCSI and USB
* Patches by Gleb Natapov, 2 Sep 2003:
- cleanup of POST code for unsupported architectures
- MPC824x locks way0 of data cache for use as initial RAM;
this patch unlocks it after relocation to RAM and invalidates
the locked entries.
* Patch by Gleb Natapov, 30 Aug 2003:
new I2C driver for mpc107 bridge. Now works from flash.
* Patch by Dave Ellis, 11 Aug 2003:
- JFFS2: fix typo in common/cmd_jffs2.c
- JFFS2: fix CFG_JFFS2_SORT_FRAGMENTS option
- JFFS2: remove node version 0 warning
- JFFS2: accept JFFS2 PADDING nodes
- SXNI855T: add AM29LV800 support
- SXNI855T: move environment from EEPROM to flash
- SXNI855T: boot from JFFS2 in NOR or NAND flash
* Patch by Bill Hargen, 11 Aug 2003:
fixes for I2C on MPC8240
- fix i2c_write routine
- fix iprobe command
- eliminates use of global variables, plus dead code, cleanup.
Diffstat (limited to 'board/sixnet/sixnet.c')
-rw-r--r-- | board/sixnet/sixnet.c | 68 |
1 files changed, 68 insertions, 0 deletions
diff --git a/board/sixnet/sixnet.c b/board/sixnet/sixnet.c index e33925c..4025b47 100644 --- a/board/sixnet/sixnet.c +++ b/board/sixnet/sixnet.c @@ -24,6 +24,7 @@ #include <common.h> #include <config.h> +#include <jffs2/jffs2.h> #include <mpc8xx.h> #include <net.h> /* for eth_init() */ #include <rtc.h> @@ -602,3 +603,70 @@ long int initdram(int board_type) return (size_sdram); } + +#ifdef CFG_JFFS_CUSTOM_PART + +static struct part_info part; + +#define jffs2_block(i) \ + ((struct jffs2_unknown_node*)(CFG_JFFS2_BASE + (i) * 65536)) + +struct part_info* jffs2_part_info(int part_num) +{ + DECLARE_GLOBAL_DATA_PTR; + bd_t *bd = gd->bd; + char* s; + int i; + int bootnor = 0; /* assume booting from NAND flash */ + + if (part_num != 0) + return 0; /* only support one partition */ + + if (part.usr_priv == (void*)1) + return ∂ /* already have part info */ + + memset(&part, 0, sizeof(part)); + + if (nand_dev_desc[0].ChipID == NAND_ChipID_UNKNOWN) + bootnor = 1; + else if (bd->bi_flashsize < 0x800000) + bootnor = 0; + else for (i = 0; !bootnor && i < 4; ++i) { + /* boot from NOR if JFFS2 info in any of + * first 4 erase blocks + */ + + if (jffs2_block(i)->magic == JFFS2_MAGIC_BITMASK) + bootnor = 1; + } + + if (bootnor) { + /* no NAND flash or boot in NOR, use NOR flash */ + part.offset = (unsigned char *)CFG_JFFS2_BASE; + part.size = CFG_JFFS2_SIZE; + } + else { + char readcmd[60]; + + /* boot info in NAND flash, get and use copy in RAM */ + + /* override info from environment if present */ + s = getenv("fsaddr"); + part.offset = s ? (void *)simple_strtoul(s, NULL, 16) + : (void *)CFG_JFFS2_RAMBASE; + s = getenv("fssize"); + part.size = s ? simple_strtoul(s, NULL, 16) + : CFG_JFFS2_RAMSIZE; + + /* read from nand flash */ + sprintf(readcmd, "nand read.jffs2 %x 0 %x", + (uint32_t)part.offset, part.size); + run_command(readcmd, 0); + } + + part.erasesize = 0; /* unused */ + part.usr_priv=(void*)1; /* ready */ + + return ∂ +} +#endif /* ifdef CFG_JFFS_CUSTOM_PART */ |