[U-Boot-Users] Running w/o flash
Dave Ellis
DGE at sixnetio.com
Wed Mar 28 19:35:55 CEST 2007
Matt Gessner wrote:
> Subject: Re: [U-Boot-Users] Running w/o flash
>
> When I do that [set CFG_NO_FLASH], cramfs fails to build.
>
> I'm using JFFS2, if that helps.
Here's a patch I developed to allow JFFS2 to work with
CFG_NO_FLASH (which really seems to mean CFG_NO_NOR_FLASH).
It works as part of a board port I'm working on, but I haven't
even tried building the official tree with it after
cherrypicking it.
It works with this configuration:
#define CONFIG_COMMANDS \
((CONFIG_CMD_DFL | /* start with default */ \
CFG_CMD_PING | /* ping is handy */ \
CFG_CMD_USB | /* we have USB on some */ \
CFG_CMD_NAND | /* NAND support */ \
CFG_CMD_MII | /* MII for PHY setup */ \
CFG_CMD_JFFS2 ) & /* JFFS2 for boot */ \
~(CFG_CMD_FLASH | /* have no NOR flash */ \
CFG_CMD_IMLS | /* needs NOR flash */ \
CFG_CMD_FPGA )) /* have no FPGA */
/* this must be included AFTER the definition of CONFIG_COMMANDS (if any) */
#include <cmd_confdefs.h>
#define CONFIG_JFFS2_CMDLINE
#define CONFIG_JFFS2_NAND 1 /* jffs2 on nand support */
#define CFG_NO_FLASH /* no NOR flash */
#define CONFIG_HAS_DATAFLASH /* has Atmel data flash */
Dave
--
Dave Ellis
___________________________________________________
SIXNET - Truly Open Industrial Automation Solutions
PO Box 767, 331 Ushers Road, Clifton Park, NY 12065
Phone: +1(518)877-5173, Facsimile: +1(518)877-8346
E-mail: mailto:dge at sixnetio.com
Get product details at http://www.sixnetio.com
>From eb6e0d3fdcb5692dfecedac859fd5f1aa1ab432b Mon Sep 17 00:00:00 2001
From: Dave Ellis <dge at sixnetio.com>
Date: Wed, 28 Mar 2007 12:08:07 -0400
Subject: [PATCH] make CFG_NO_FLASH work with jffs2 and dataflash
For some reason jffs2 support also brings in cramfs, which was
hard-coded to require nor flash.
cmd_mem.c dataflash support also required it to detect copies
involving nor flash. This check is now removed if configured
for no nor flash.
some flash.h info is needed even when nor flash is not used, so
this info is now included as needed.
Signed-off-by: Dave Ellis <dge at sixnetio.com>
---
common/cmd_mem.c | 6 +++++-
fs/cramfs/cramfs.c | 14 ++++++++++++--
include/flash.h | 4 +++-
3 files changed, 20 insertions(+), 4 deletions(-)
diff --git a/common/cmd_mem.c b/common/cmd_mem.c
index fcbb023..c559ad4 100644
--- a/common/cmd_mem.c
+++ b/common/cmd_mem.c
@@ -461,7 +461,11 @@ int do_mem_cp ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
}
/* Check if we are copying from DataFlash to RAM */
- if (addr_dataflash(addr) && !addr_dataflash(dest) && (addr2info(dest)==NULL) ){
+ if (addr_dataflash(addr) && !addr_dataflash(dest)
+#ifndef CFG_NO_FLASH
+ && (addr2info(dest)==NULL)
+#endif
+ ) {
int rc;
rc = read_dataflash(addr, count * size, (char *) dest);
if (rc != 1) {
diff --git a/fs/cramfs/cramfs.c b/fs/cramfs/cramfs.c
index 48e7f63..52a79ab 100644
--- a/fs/cramfs/cramfs.c
+++ b/fs/cramfs/cramfs.c
@@ -42,10 +42,20 @@
struct cramfs_super super;
+static uint32_t get_part_mem(struct part_info *info)
+{
+#ifndef CFG_NO_FLASH
+ if (id->type == MTD_DEV_TYPE_NOR)
+ return info->offset + flash_info[info->dev->id->num].start[0];
+#endif
+
+ puts("get_part_mem: unknown device type, using raw offset!\n");
+ return info->offset;
+}
+
/* CPU address space offset calculation macro, struct part_info offset is
* device address space offset, so we need to shift it by a device start address. */
-extern flash_info_t flash_info[];
-#define PART_OFFSET(x) (x->offset + flash_info[x->dev->id->num].start[0])
+#define PART_OFFSET(x) get_part_mem(x)
static int cramfs_read_super (struct part_info *info)
{
diff --git a/include/flash.h b/include/flash.h
index 43b9c6b..0e36226 100644
--- a/include/flash.h
+++ b/include/flash.h
@@ -24,11 +24,12 @@
#ifndef _FLASH_H_
#define _FLASH_H_
-#ifndef CFG_NO_FLASH
+#if !defined(CFG_NO_FLASH) || defined(CONFIG_HAS_DATAFLASH)
/*-----------------------------------------------------------------------
* FLASH Info: contains chip specific data, per FLASH bank
*/
+#ifndef CFG_NO_FLASH
typedef struct {
ulong size; /* total bank size in bytes */
ushort sector_count; /* number of erase units */
@@ -100,6 +101,7 @@ extern int flash_real_protect(flash_info_t *info, long sector, int prot);
extern void flash_read_user_serial(flash_info_t * info, void * buffer, int offset, int len);
extern void flash_read_factory_serial(flash_info_t * info, void * buffer, int offset, int len);
#endif /* CFG_FLASH_PROTECTION */
+#endif /* !CFG_NO_FLASH */
/*-----------------------------------------------------------------------
* return codes from flash_write():
--
1.5.0.5
More information about the U-Boot
mailing list