Add common (with Linux) MTD partition scheme and "mtdparts" command

Old, obsolete and duplicated code was cleaned up and replace by the
new partitioning method. There are two possible approaches now:
* define a single, static partition
* use mtdparts command line option and dynamic partitioning
Default is static partitioning.
This commit is contained in:
Wolfgang Denk 2005-08-08 01:03:24 +02:00
parent 452e8e72ad
commit 700a0c648d
64 changed files with 3242 additions and 907 deletions

View File

@ -2,6 +2,30 @@
Changes for U-Boot 1.1.3:
======================================================================
* Add common (with Linux) MTD partition scheme and "mtdparts" command
Old, obsolete and duplicated code was cleaned up and replace by the
new partitioning method. There are two possible approaches now:
The first one is to define a single, static partition:
#undef CONFIG_JFFS2_CMDLINE
#define CONFIG_JFFS2_DEV "nor0"
#define CONFIG_JFFS2_PART_SIZE 0xFFFFFFFF /* use whole device */
#define CONFIG_JFFS2_PART_SIZE 0x00100000 /* use 1MB */
#define CONFIG_JFFS2_PART_OFFSET 0x00000000
The second method uses the mtdparts command line option and dynamic
partitioning:
/* mtdparts command line support */
#define CONFIG_JFFS2_CMDLINE
#define MTDIDS_DEFAULT "nor1=zuma-1,nor2=zuma-2"
#define MTDPARTS_DEFAULT "mtdparts=zuma-1:-(jffs2),zuma-2:-(user)"
Command line of course produces bigger images, and may be inappropriate
for some targets, so by default it's off.
* Fix build problems for PM856 Board
* Fix sign extension bug in 'fpga loadb' command;

View File

@ -21,4 +21,8 @@
# MA 02111-1307 USA
#
# Reserve 256 kB for Monitor
TEXT_BASE = 0xFFFC0000
# Reserve 320 kB for Monitor
#TEXT_BASE = 0xFFFB0000

View File

@ -24,6 +24,7 @@
*/
#include <config.h>
#include <asm/processor.h>
#include <74xx_7xx.h>
#include <mpc106.h>
#include <version.h>

View File

@ -27,6 +27,7 @@
#include <pci.h>
#include <mpc106.h>
#include <asm/processor.h>
/* defines L2CR register for MPC750 */

View File

@ -24,6 +24,7 @@
*/
#include <config.h>
#include <asm/processor.h>
#include <version.h>
#include <mpc106.h>

View File

@ -197,9 +197,25 @@
#define CFG_DIRECT_FLASH_TFTP
#if (CONFIG_COMMANDS & CFG_CMD_JFFS2)
#define CFG_JFFS2_FIRST_BANK 0
#define CFG_JFFS2_NUM_BANKS CFG_MAX_FLASH_BANKS
#define CFG_JFFS2_FIRST_SECTOR 4
/*
* JFFS2 partitions
*
*/
/* No command line, one static partition, whole device */
#undef CONFIG_JFFS2_CMDLINE
#define CONFIG_JFFS2_DEV "nor0"
#define CONFIG_JFFS2_PART_SIZE 0xFFFFFFFF
#define CONFIG_JFFS2_PART_OFFSET 0x00000000
/* mtdparts command line support */
/* Note: fake mtd_id used, no linux mtd map file */
/*
#define CONFIG_JFFS2_CMDLINE
#define MTDIDS_DEFAULT "nor0=fads0,nor1=fads-1,nor2=fads-2,nor3=fads-3"
#define MTDPARTS_DEFAULT "mtdparts=fads-0:-@1m(user1),fads-1:-(user2),fads-2:-(user3),fads-3:-(user4)"
*/
#define CFG_JFFS2_SORT_FRAGMENTS
#endif /* CFG_CMD_JFFS2 */

View File

@ -447,60 +447,3 @@ flash_real_protect(flash_info_t *info, long sector, int prot)
*addr = FLASH_CMD_RESET;
return (0);
}
/*-----------------------------------------------------------------------
* Support for flash file system (JFFS2)
*
* We use custom partition info function because we have to fit the
* file system image between first sector (containing hard reset
* configuration word) and the sector containing U-Boot image. Standard
* partition info function does not allow for last sector specification
* and assumes that the file system occupies flash bank up to and
* including bank's last sector.
*/
#if (CONFIG_COMMANDS & CFG_CMD_JFFS2) && defined(CFG_JFFS_CUSTOM_PART)
#error TODO
#ifndef CFG_JFFS2_FIRST_SECTOR
#define CFG_JFFS2_FIRST_SECTOR 0
#endif
#ifndef CFG_JFFS2_FIRST_BANK
#define CFG_JFFS2_FIRST_BANK 0
#endif
#ifndef CFG_JFFS2_NUM_BANKS
#define CFG_JFFS2_NUM_BANKS 1
#endif
#define CFG_JFFS2_LAST_BANK (CFG_JFFS2_FIRST_BANK + CFG_JFFS2_NUM_BANKS - 1)
#include <jffs2/jffs2.h>
static struct part_info partition;
struct part_info *jffs2_part_info(int part_num)
{
int i;
if (part_num == 0) {
if (partition.usr_priv == 0) {
partition.offset =
(unsigned char *) flash_info[CFG_JFFS2_FIRST_BANK].start[CFG_JFFS2_FIRST_SECTOR];
for (i = CFG_JFFS2_FIRST_BANK; i <= CFG_JFFS2_LAST_BANK; i++)
partition.size += flash_info[i].size;
partition.size -=
flash_info[CFG_JFFS2_FIRST_BANK].start[CFG_JFFS2_FIRST_SECTOR] -
flash_info[CFG_JFFS2_FIRST_BANK].start[0];
#ifdef CFG_JFFS2_LAST_SECTOR
i = flash_info[CFG_JFFS2_LAST_BANK].sector_count - 1;
partition.size -=
flash_info[CFG_JFFS2_LAST_BANK].start[i] -
flash_info[CFG_JFFS2_LAST_BANK].start[CFG_JFFS2_LAST_SECTOR];
#endif
partition.usr_priv = (void *)1;
}
return &partition;
}
return 0;
}
#endif /* JFFS2 */

View File

@ -35,10 +35,6 @@
#include <common.h>
#include <asm/arch/pxa-regs.h>
#if defined CFG_JFFS_CUSTOM_PART
#include <jffs2/jffs2.h>
#endif
/* Debugging macros ------------------------------------------------------ */
#undef FLASH_DEBUG
@ -78,179 +74,6 @@
flash_info_t flash_info[CFG_MAX_FLASH_BANKS];
#if defined CFG_JFFS_CUSTOM_PART
/**
* jffs2_part_info - get information about a JFFS2 partition
*
* @part_num: number of the partition you want to get info about
* @return: struct part_info* in case of success, 0 if failure
*/
static struct part_info part;
static int current_part = -1;
#ifdef CONFIG_MTD_INNOKOM_16MB
#ifdef CONFIG_MTD_INNOKOM_64MB
#error Please define only one CONFIG_MTD_INNOKOM_XXMB option.
#endif
struct part_info* jffs2_part_info(int part_num) {
void *jffs2_priv_saved = part.jffs2_priv;
PRINTK2("jffs2_part_info: part_num=%i\n",part_num);
if (current_part == part_num)
return &part;
/* u-boot partition */
if(part_num==0){
memset(&part, 0, sizeof(part));
part.offset=(char*)0x00000000;
part.size=256*1024;
/* Mark the struct as ready */
current_part = part_num;
PRINTK("part.offset = 0x%08x\n",(unsigned int)part.offset);
PRINTK("part.size = 0x%08x\n",(unsigned int)part.size);
}
/* primary OS+firmware partition */
if(part_num==1){
memset(&part, 0, sizeof(part));
part.offset=(char*)0x00040000;
part.size=768*1024;
/* Mark the struct as ready */
current_part = part_num;
PRINTK("part.offset = 0x%08x\n",(unsigned int)part.offset);
PRINTK("part.size = 0x%08x\n",(unsigned int)part.size);
}
/* secondary OS+firmware partition */
if(part_num==2){
memset(&part, 0, sizeof(part));
part.offset=(char*)0x00100000;
part.size=8*1024*1024;
/* Mark the struct as ready */
current_part = part_num;
PRINTK("part.offset = 0x%08x\n",(unsigned int)part.offset);
PRINTK("part.size = 0x%08x\n",(unsigned int)part.size);
}
/* data partition */
if(part_num==3){
memset(&part, 0, sizeof(part));
part.offset=(char*)0x00900000;
part.size=7*1024*1024;
/* Mark the struct as ready */
current_part = part_num;
PRINTK("part.offset = 0x%08x\n",(unsigned int)part.offset);
PRINTK("part.size = 0x%08x\n",(unsigned int)part.size);
}
if (current_part == part_num) {
part.usr_priv = &current_part;
part.jffs2_priv = jffs2_priv_saved;
return &part;
}
PRINTK("jffs2_part_info: end of partition table\n");
return 0;
}
#endif /* CONFIG_MTD_INNOKOM_16MB */
#ifdef CONFIG_MTD_INNOKOM_64MB
#ifdef CONFIG_MTD_INNOKOM_16MB
#error Please define only one CONFIG_MTD_INNOKOM_XXMB option.
#endif
struct part_info* jffs2_part_info(int part_num) {
void *jffs2_priv_saved = part.jffs2_priv;
PRINTK2("jffs2_part_info: part_num=%i\n",part_num);
if (current_part == part_num)
return &part;
/* u-boot partition */
if(part_num==0){
memset(&part, 0, sizeof(part));
part.offset=(char*)0x00000000;
part.size=256*1024;
/* Mark the struct as ready */
current_part = part_num;
PRINTK("part.offset = 0x%08x\n",(unsigned int)part.offset);
PRINTK("part.size = 0x%08x\n",(unsigned int)part.size);
}
/* primary OS+firmware partition */
if(part_num==1){
memset(&part, 0, sizeof(part));
part.offset=(char*)0x00040000;
part.size=16*1024*1024-128*1024;
/* Mark the struct as ready */
current_part = part_num;
PRINTK("part.offset = 0x%08x\n",(unsigned int)part.offset);
PRINTK("part.size = 0x%08x\n",(unsigned int)part.size);
}
/* secondary OS+firmware partition */
if(part_num==2){
memset(&part, 0, sizeof(part));
part.offset=(char*)0x01020000;
part.size=16*1024*1024-128*1024;
/* Mark the struct as ready */
current_part = part_num;
PRINTK("part.offset = 0x%08x\n",(unsigned int)part.offset);
PRINTK("part.size = 0x%08x\n",(unsigned int)part.size);
}
/* data partition */
if(part_num==3){
memset(&part, 0, sizeof(part));
part.offset=(char*)0x02000000;
part.size=32*1024*1024;
/* Mark the struct as ready */
current_part = part_num;
PRINTK("part.offset = 0x%08x\n",(unsigned int)part.offset);
PRINTK("part.size = 0x%08x\n",(unsigned int)part.size);
}
if (current_part == part_num) {
part.usr_priv = &current_part;
part.jffs2_priv = jffs2_priv_saved;
return &part;
}
PRINTK("jffs2_part_info: end of partition table\n");
return 0;
}
#endif /* CONFIG_MTD_INNOKOM_64MB */
#endif /* defined CFG_JFFS_CUSTOM_PART */
/**
* flash_init: - initialize data structures for flash chips
*

View File

@ -490,59 +490,3 @@ int flash_real_protect(flash_info_t *info, long sector, int prot)
return rc;
}
/*-----------------------------------------------------------------------
* Support for flash file system (JFFS2)
*
* We use custom partition info function because we have to fit the
* file system image between first sector (containing hard reset
* configuration word) and the sector containing U-Boot image. Standard
* partition info function does not allow for last sector specification
* and assumes that the file system occupies flash bank up to and
* including bank's last sector.
*/
#if (CONFIG_COMMANDS & CFG_CMD_JFFS2) && defined(CFG_JFFS_CUSTOM_PART)
#ifndef CFG_JFFS2_FIRST_SECTOR
#define CFG_JFFS2_FIRST_SECTOR 0
#endif
#ifndef CFG_JFFS2_FIRST_BANK
#define CFG_JFFS2_FIRST_BANK 0
#endif
#ifndef CFG_JFFS2_NUM_BANKS
#define CFG_JFFS2_NUM_BANKS 1
#endif
#define CFG_JFFS2_LAST_BANK (CFG_JFFS2_FIRST_BANK + CFG_JFFS2_NUM_BANKS - 1)
#include <jffs2/jffs2.h>
static struct part_info partition;
struct part_info *jffs2_part_info(int part_num)
{
int i;
if (part_num == 0) {
if (partition.usr_priv == 0) {
partition.offset =
(unsigned char *) flash_info[CFG_JFFS2_FIRST_BANK].start[CFG_JFFS2_FIRST_SECTOR];
for (i = CFG_JFFS2_FIRST_BANK; i <= CFG_JFFS2_LAST_BANK; i++)
partition.size += flash_info[i].size;
partition.size -=
flash_info[CFG_JFFS2_FIRST_BANK].start[CFG_JFFS2_FIRST_SECTOR] -
flash_info[CFG_JFFS2_FIRST_BANK].start[0];
#ifdef CFG_JFFS2_LAST_SECTOR
i = flash_info[CFG_JFFS2_LAST_BANK].sector_count - 1;
partition.size -=
flash_info[CFG_JFFS2_LAST_BANK].start[i] -
flash_info[CFG_JFFS2_LAST_BANK].start[CFG_JFFS2_LAST_SECTOR];
#endif
partition.usr_priv = (void *)1;
}
return &partition;
}
return 0;
}
#endif /* JFFS2 */

View File

@ -25,10 +25,6 @@
#include <common.h>
#if defined CFG_JFFS_CUSTOM_PART
#include <jffs2/jffs2.h>
#endif
#define FLASH_BANK_SIZE MX1FS2_FLASH_BANK_SIZE
#define MAIN_SECT_SIZE MX1FS2_FLASH_SECT_SIZE
@ -70,67 +66,6 @@ static int write_word_amd(flash_info_t * info, FPWV * dest, FPW data);
static void flash_sync_real_protect(flash_info_t * info);
#endif
#if defined CFG_JFFS_CUSTOM_PART
/**
* jffs2_part_info - get information about a JFFS2 partition
*
* @part_num: number of the partition you want to get info about
* @return: struct part_info* in case of success, 0 if failure
*/
static struct part_info part;
static int current_part = -1;
struct part_info *
jffs2_part_info(int part_num)
{
void *jffs2_priv_saved = part.jffs2_priv;
printf("jffs2_part_info: part_num=%i\n", part_num);
if (current_part == part_num)
return &part;
/* rootfs */
if (part_num == 0) {
memset(&part, 0, sizeof (part));
part.offset = (char *) MX1FS2_JFFS2_PART0_START;
part.size = MX1FS2_JFFS2_PART0_SIZE;
/* Mark the struct as ready */
current_part = part_num;
printf("part.offset = 0x%08x\n", (unsigned int) part.offset);
printf("part.size = 0x%08x\n", (unsigned int) part.size);
}
/* userfs */
if (part_num == 1) {
memset(&part, 0, sizeof (part));
part.offset = (char *) MX1FS2_JFFS2_PART1_START;
part.size = MX1FS2_JFFS2_PART1_SIZE;
/* Mark the struct as ready */
current_part = part_num;
printf("part.offset = 0x%08x\n", (unsigned int) part.offset);
printf("part.size = 0x%08x\n", (unsigned int) part.size);
}
if (current_part == part_num) {
part.usr_priv = &current_part;
part.jffs2_priv = jffs2_priv_saved;
return &part;
}
printf("jffs2_part_info: end of partition table\n");
return 0;
}
#endif /* CFG_JFFS_CUSTOM_PART */
/*-----------------------------------------------------------------------
* flash_init()
*

View File

@ -601,70 +601,3 @@ 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 &part; /* 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 &part;
}
#endif /* ifdef CFG_JFFS_CUSTOM_PART */

View File

@ -56,90 +56,10 @@ int dram_init(void)
return 0;
}
#ifndef VOICEBLUE_SMALL_FLASH
#include <jffs2/jffs2.h>
extern flash_info_t flash_info[];
static struct part_info partinfo;
static int current_part = -1;
/* Partition table (Linux MTD see it this way)
*
* 0 - U-Boot
* 1 - env
* 2 - redundant env
* 3 - data1 (jffs2)
* 4 - data2 (jffs2)
*/
static struct {
ulong offset;
ulong size;
} part[5];
static void partition_flash(flash_info_t *info)
{
char mtdparts[128];
int i, n, size, psize;
const ulong plen[3] = { CFG_MONITOR_LEN, CFG_ENV_SIZE, CFG_ENV_SIZE };
size = n = 0;
for (i = 0; i < 4; i++) {
part[i].offset = info->start[n];
psize = i < 3 ? plen[i] : (info->size - size) / 2;
while (part[i].size < psize) {
if (++n > info->sector_count) {
printf("Partitioning error. System halted.\n");
while (1) ;
}
part[i].size += info->start[n] - info->start[n - 1];
}
size += part[i].size;
}
part[4].offset = info->start[n];
part[4].size = info->start[info->sector_count - 1] - info->start[n];
sprintf(mtdparts, "omapflash.0:"
"%dk(U-Boot)ro,%dk(env),%dk(r_env),%dk(data1),-(data2)",
part[0].size >> 10, part[1].size >> 10,
part[2].size >> 10, part[3].size >> 10);
setenv ("mtdparts", mtdparts);
}
struct part_info* jffs2_part_info(int part_num)
{
void *jffs2_priv_saved = partinfo.jffs2_priv;
if (part_num != 3 && part_num != 4)
return NULL;
if (current_part != part_num) {
memset(&partinfo, 0, sizeof(partinfo));
current_part = part_num;
partinfo.offset = (char*) part[part_num].offset;
partinfo.size = part[part_num].size;
partinfo.usr_priv = &current_part;
partinfo.jffs2_priv = jffs2_priv_saved;
}
return &partinfo;
}
#endif
int misc_init_r(void)
{
*((volatile unsigned short *) VOICEBLUE_LED_REG) = 0x55;
#ifndef VOICEBLUE_SMALL_FLASH
if (flash_info[0].flash_id == FLASH_UNKNOWN) {
printf("Unknown flash. System halted.\n");
while (1) ;
}
partition_flash(&flash_info[0]);
#endif
return 0;
}

View File

@ -27,10 +27,6 @@
#include <common.h>
#include <linux/byteorder/swab.h>
#if defined CFG_JFFS_CUSTOM_PART
#include <jffs2/jffs2.h>
#endif
#define SWAP(x) __swab32(x)
flash_info_t flash_info[CFG_MAX_FLASH_BANKS]; /* info for FLASH chips */
@ -40,80 +36,6 @@ static ulong flash_get_size (vu_long *addr, flash_info_t *info);
static int write_word (flash_info_t *info, ulong dest, ulong data);
static void flash_get_offsets (ulong base, flash_info_t *info);
#if defined CFG_JFFS_CUSTOM_PART
/*
* jffs2_part_info - get information about a JFFS2 partition
*
* @part_num: number of the partition you want to get info about
* @return: struct part_info* in case of success, 0 if failure
*/
static struct part_info part;
static int current_part = -1;
struct part_info* jffs2_part_info(int part_num) {
void *jffs2_priv_saved = part.jffs2_priv;
printf("jffs2_part_info: part_num=%i\n",part_num);
if (current_part == part_num)
return &part;
/* u-boot partition */
if(part_num==0){
memset(&part, 0, sizeof(part));
part.offset=(char*)0x00000000;
part.size=256*1024;
/* Mark the struct as ready */
current_part = part_num;
printf("part.offset = 0x%08x\n",(unsigned int)part.offset);
printf("part.size = 0x%08x\n",(unsigned int)part.size);
}
/* primary OS+firmware partition */
if(part_num==1){
memset(&part, 0, sizeof(part));
part.offset=(char*)0x00040000;
part.size=1024*1024;
/* Mark the struct as ready */
current_part = part_num;
printf("part.offset = 0x%08x\n",(unsigned int)part.offset);
printf("part.size = 0x%08x\n",(unsigned int)part.size);
}
/* secondary OS+firmware partition */
if(part_num==2){
memset(&part, 0, sizeof(part));
part.offset=(char*)0x00140000;
part.size=8*1024*1024;
/* Mark the struct as ready */
current_part = part_num;
printf("part.offset = 0x%08x\n",(unsigned int)part.offset);
printf("part.size = 0x%08x\n",(unsigned int)part.size);
}
if (current_part == part_num) {
part.usr_priv = &current_part;
part.jffs2_priv = jffs2_priv_saved;
return &part;
}
printf("jffs2_part_info: end of partition table\n");
return 0;
}
#endif
/*-----------------------------------------------------------------------
*/
unsigned long flash_init (void)

View File

@ -27,13 +27,22 @@
#include <common.h>
#include <command.h>
#ifdef CONFIG_HAS_DATAFLASH
#include <dataflash.h>
#endif
#if (CONFIG_COMMANDS & CFG_CMD_FLASH)
#if (CONFIG_COMMANDS & CFG_CMD_JFFS2) && defined(CONFIG_JFFS2_CMDLINE)
#include <jffs2/jffs2.h>
/* parition handling routines */
int mtdparts_init(void);
int id_parse(const char *id, const char **ret_id, u8 *dev_type, u8 *dev_num);
int find_dev_and_part(const char *id, struct mtd_device **dev,
u8 *part_num, struct part_info **part);
#endif
extern flash_info_t flash_info[]; /* info for FLASH chips */
/*
@ -295,11 +304,17 @@ int do_flinfo ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
flash_print_info (&flash_info[bank-1]);
return 0;
}
int do_flerase (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
{
flash_info_t *info;
ulong bank, addr_first, addr_last;
int n, sect_first, sect_last;
#if (CONFIG_COMMANDS & CFG_CMD_JFFS2) && defined(CONFIG_JFFS2_CMDLINE)
struct mtd_device *dev;
struct part_info *part;
u8 dev_type, dev_num, pnum;
#endif
int rcode = 0;
if (argc < 2) {
@ -327,6 +342,32 @@ int do_flerase (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
return rcode;
}
#if (CONFIG_COMMANDS & CFG_CMD_JFFS2) && defined(CONFIG_JFFS2_CMDLINE)
/* erase <part-id> - erase partition */
if ((argc == 2) && (id_parse(argv[1], NULL, &dev_type, &dev_num) == 0)) {
mtdparts_init();
if (find_dev_and_part(argv[1], &dev, &pnum, &part) == 0) {
if (dev->id->type == MTD_DEV_TYPE_NOR) {
bank = dev->id->num;
info = &flash_info[bank];
addr_first = part->offset + info->start[0];
addr_last = addr_first + part->size - 1;
printf ("Erase Flash Parition %s, "
"bank %d, 0x%08lx - 0x%08lx ",
argv[1], bank, addr_first,
addr_last);
rcode = flash_sect_erase(addr_first, addr_last);
return rcode;
}
printf("cannot erase, not a NOR device\n");
return 1;
}
}
#endif
if (argc != 3) {
printf ("Usage:\n%s\n", cmdtp->usage);
return 1;
@ -401,6 +442,11 @@ int do_protect (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
flash_info_t *info;
ulong bank, addr_first, addr_last;
int i, p, n, sect_first, sect_last;
#if (CONFIG_COMMANDS & CFG_CMD_JFFS2) && defined(CONFIG_JFFS2_CMDLINE)
struct mtd_device *dev;
struct part_info *part;
u8 dev_type, dev_num, pnum;
#endif
int rcode = 0;
#ifdef CONFIG_HAS_DATAFLASH
int status;
@ -488,6 +534,33 @@ int do_protect (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
return rcode;
}
#if (CONFIG_COMMANDS & CFG_CMD_JFFS2) && defined(CONFIG_JFFS2_CMDLINE)
/* protect on/off <part-id> */
if ((argc == 3) && (id_parse(argv[2], NULL, &dev_type, &dev_num) == 0)) {
mtdparts_init();
if (find_dev_and_part(argv[2], &dev, &pnum, &part) == 0) {
if (dev->id->type == MTD_DEV_TYPE_NOR) {
bank = dev->id->num;
info = &flash_info[bank];
addr_first = part->offset + info->start[0];
addr_last = addr_first + part->size - 1;
printf ("%sProtect Flash Parition %s, "
"bank %d, 0x%08lx - 0x%08lx\n",
p ? "" : "Un", argv[1],
bank, addr_first, addr_last);
rcode = flash_sect_protect (p, addr_first, addr_last);
return rcode;
}
printf("cannot %sprotect, not a NOR device\n",
p ? "" : "un");
return 1;
}
}
#endif
if (argc != 4) {
printf ("Usage:\n%s\n", cmdtp->usage);
@ -609,6 +682,9 @@ U_BOOT_CMD(
"w/addr 'start'+'len'-1\n"
"erase N:SF[-SL]\n - erase sectors SF-SL in FLASH bank # N\n"
"erase bank N\n - erase FLASH bank # N\n"
#if (CONFIG_COMMANDS & CFG_CMD_JFFS2) && defined(CONFIG_JFFS2_CMDLINE)
"erase <part-id>\n - erase partition\n"
#endif
"erase all\n - erase all FLASH banks\n"
);
@ -623,6 +699,9 @@ U_BOOT_CMD(
"protect on N:SF[-SL]\n"
" - protect sectors SF-SL in FLASH bank # N\n"
"protect on bank N\n - protect FLASH bank # N\n"
#if (CONFIG_COMMANDS & CFG_CMD_JFFS2) && defined(CONFIG_JFFS2_CMDLINE)
"protect on <part-id>\n - protect partition\n"
#endif
"protect on all\n - protect all FLASH banks\n"
"protect off start end\n"
" - make FLASH from addr 'start' to addr 'end' writable\n"
@ -632,6 +711,9 @@ U_BOOT_CMD(
"protect off N:SF[-SL]\n"
" - make sectors SF-SL writable in FLASH bank # N\n"
"protect off bank N\n - make FLASH bank # N writable\n"
#if (CONFIG_COMMANDS & CFG_CMD_JFFS2) && defined(CONFIG_JFFS2_CMDLINE)
"protect off <part-id>\n - make partition writable\n"
#endif
"protect off all\n - make all FLASH banks writable\n"
);

File diff suppressed because it is too large Load Diff

View File

@ -42,17 +42,22 @@
struct cramfs_super super;
/* 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[CFG_MAX_FLASH_BANKS];
#define PART_OFFSET(x) (x->offset + flash_info[x->dev->id->num].start[0])
static int cramfs_read_super (struct part_info *info)
{
unsigned long root_offset;
/* Read the first block and get the superblock from it */
memcpy (&super, (void *) info->offset, sizeof (super));
memcpy (&super, (void *) PART_OFFSET(info), sizeof (super));
/* Do sanity checks on the superblock */
if (super.magic != CRAMFS_32 (CRAMFS_MAGIC)) {
/* check at 512 byte offset */
memcpy (&super, (void *) info->offset + 512, sizeof (super));
memcpy (&super, (void *) PART_OFFSET(info) + 512, sizeof (super));
if (super.magic != CRAMFS_32 (CRAMFS_MAGIC)) {
printf ("cramfs: wrong magic\n");
return -1;
@ -87,7 +92,7 @@ static int cramfs_read_super (struct part_info *info)
return 0;
}
static unsigned long cramfs_resolve (char *begin, unsigned long offset,
static unsigned long cramfs_resolve (unsigned long begin, unsigned long offset,
unsigned long size, int raw,
char *filename)
{
@ -150,7 +155,7 @@ static unsigned long cramfs_resolve (char *begin, unsigned long offset,
return 0;
}
static int cramfs_uncompress (char *begin, unsigned long offset,
static int cramfs_uncompress (unsigned long begin, unsigned long offset,
unsigned long loadoffset)
{
struct cramfs_inode *inode = (struct cramfs_inode *) (begin + offset);
@ -187,7 +192,7 @@ int cramfs_load (char *loadoffset, struct part_info *info, char *filename)
if (cramfs_read_super (info))
return -1;
offset = cramfs_resolve (info->offset,
offset = cramfs_resolve (PART_OFFSET(info),
CRAMFS_GET_OFFSET (&(super.root)) << 2,
CRAMFS_24 (super.root.size), 0,
strtok (filename, "/"));
@ -195,14 +200,14 @@ int cramfs_load (char *loadoffset, struct part_info *info, char *filename)
if (offset <= 0)
return offset;
return cramfs_uncompress (info->offset, offset,
return cramfs_uncompress (PART_OFFSET(info), offset,
(unsigned long) loadoffset);
}
static int cramfs_list_inode (struct part_info *info, unsigned long offset)
{
struct cramfs_inode *inode = (struct cramfs_inode *)
(info->offset + offset);
(PART_OFFSET(info) + offset);
char *name, str[20];
int namelen, nextoff;
@ -233,7 +238,7 @@ static int cramfs_list_inode (struct part_info *info, unsigned long offset)
unsigned long size = CRAMFS_24 (inode->size);
char *link = malloc (size);
if (link != NULL && cramfs_uncompress (info->offset, offset,
if (link != NULL && cramfs_uncompress (PART_OFFSET(info), offset,
(unsigned long) link)
== size)
printf (" -> %*.*s\n", (int) size, (int) size, link);
@ -262,7 +267,7 @@ int cramfs_ls (struct part_info *info, char *filename)
size = CRAMFS_24 (super.root.size);
} else {
/* Resolve the path */
offset = cramfs_resolve (info->offset,
offset = cramfs_resolve (PART_OFFSET(info),
CRAMFS_GET_OFFSET (&(super.root)) <<
2, CRAMFS_24 (super.root.size), 1,
strtok (filename, "/"));
@ -271,7 +276,7 @@ int cramfs_ls (struct part_info *info, char *filename)
return offset;
/* Resolving was successful. Examine the inode */
inode = (struct cramfs_inode *) (info->offset + offset);
inode = (struct cramfs_inode *) (PART_OFFSET(info) + offset);
if (!S_ISDIR (CRAMFS_16 (inode->mode))) {
/* It's not a directory - list it, and that's that */
return (cramfs_list_inode (info, offset) > 0);
@ -284,7 +289,7 @@ int cramfs_ls (struct part_info *info, char *filename)
/* List the given directory */
while (inodeoffset < size) {
inode = (struct cramfs_inode *) (info->offset + offset +
inode = (struct cramfs_inode *) (PART_OFFSET(info) + offset +
inodeoffset);
nextoffset = cramfs_list_inode (info, offset + inodeoffset);
@ -324,14 +329,17 @@ int cramfs_info (struct part_info *info)
int cramfs_check (struct part_info *info)
{
struct cramfs_super *sb = (struct cramfs_super *) info->offset;
struct cramfs_super *sb;
if (info->dev->id->type != MTD_DEV_TYPE_NOR)
return 0;
sb = (struct cramfs_super *) PART_OFFSET(info);
if (sb->magic != CRAMFS_32 (CRAMFS_MAGIC)) {
/* check at 512 byte offset */
sb = (struct cramfs_super *) (info->offset + 512);
if (sb->magic != CRAMFS_32 (CRAMFS_MAGIC)) {
sb = (struct cramfs_super *) (PART_OFFSET(info) + 512);
if (sb->magic != CRAMFS_32 (CRAMFS_MAGIC))
return 0;
}
}
return 1;
}

View File

@ -140,8 +140,10 @@
# define DEBUGF(fmt,args...)
#endif
#if defined(CONFIG_JFFS2_NAND) && (CONFIG_COMMANDS & CFG_CMD_NAND)
/* keeps pointer to currentlu processed partition */
static struct part_info *current_part;
#if defined(CONFIG_JFFS2_NAND) && (CONFIG_COMMANDS & CFG_CMD_NAND)
/*
* Support for jffs2 on top of NAND-flash
*
@ -167,10 +169,10 @@ int read_jffs2_nand(size_t start, size_t len,
static u8* nand_cache = NULL;
static u32 nand_cache_off = (u32)-1;
static int nanddev = 0; /* nand device of current partition */
static int read_nand_cached(u32 off, u32 size, u_char *buf)
{
struct mtdids *id = current_part->dev->id;
u32 bytes_read = 0;
size_t retlen;
int cpy_bytes;
@ -190,10 +192,10 @@ static int read_nand_cached(u32 off, u32 size, u_char *buf)
}
}
if (read_jffs2_nand(nand_cache_off, NAND_CACHE_SIZE,
&retlen, nand_cache, nanddev) < 0 ||
retlen != NAND_CACHE_SIZE) {
&retlen, nand_cache, id->num) < 0 ||
retlen != NAND_CACHE_SIZE) {
printf("read_nand_cached: error reading nand off %#x size %d bytes\n",
nand_cache_off, NAND_CACHE_SIZE);
nand_cache_off, NAND_CACHE_SIZE);
return -1;
}
}
@ -208,12 +210,12 @@ static int read_nand_cached(u32 off, u32 size, u_char *buf)
return bytes_read;
}
static void *get_fl_mem(u32 off, u32 size, void *ext_buf)
static void *get_fl_mem_nand(u32 off, u32 size, void *ext_buf)
{
u_char *buf = ext_buf ? (u_char*)ext_buf : (u_char*)malloc(size);
if (NULL == buf) {
printf("get_fl_mem: can't alloc %d bytes\n", size);
printf("get_fl_mem_nand: can't alloc %d bytes\n", size);
return NULL;
}
if (read_nand_cached(off, size, buf) < 0) {
@ -225,15 +227,15 @@ static void *get_fl_mem(u32 off, u32 size, void *ext_buf)
return buf;
}
static void *get_node_mem(u32 off)
static void *get_node_mem_nand(u32 off)
{
struct jffs2_unknown_node node;
void *ret = NULL;
if (NULL == get_fl_mem(off, sizeof(node), &node))
if (NULL == get_fl_mem_nand(off, sizeof(node), &node))
return NULL;
if (!(ret = get_fl_mem(off, node.magic ==
if (!(ret = get_fl_mem_nand(off, node.magic ==
JFFS2_MAGIC_BITMASK ? node.totlen : sizeof(node),
NULL))) {
printf("off = %#x magic %#x type %#x node.totlen = %d\n",
@ -242,30 +244,89 @@ static void *get_node_mem(u32 off)
return ret;
}
static void put_fl_mem(void *buf)
static void put_fl_mem_nand(void *buf)
{
free(buf);
}
#endif /* #if defined(CONFIG_JFFS2_NAND) && (CONFIG_COMMANDS & CFG_CMD_NAND) */
#else /* defined(CONFIG_JFFS2_NAND) && (CONFIG_COMMANDS & CFG_CMD_NAND) */
#if (CONFIG_COMMANDS & CFG_CMD_FLASH)
/*
* Support for jffs2 on top of NOR-flash
*
* NOR flash memory is mapped in processor's address space,
* just return address.
*/
static inline void *get_fl_mem_nor(u32 off)
{
u32 addr = off;
struct mtdids *id = current_part->dev->id;
extern flash_info_t flash_info[CFG_MAX_FLASH_BANKS];
flash_info_t *flash = &flash_info[id->num];
addr += flash->start[0];
return (void*)addr;
}
static inline void *get_node_mem_nor(u32 off)
{
return (void*)get_fl_mem_nor(off);
}
#endif /* #if (CONFIG_COMMANDS & CFG_CMD_FLASH) */
/*
* Generic jffs2 raw memory and node read routines.
*
*/
static inline void *get_fl_mem(u32 off, u32 size, void *ext_buf)
{
struct mtdids *id = current_part->dev->id;
#if (CONFIG_COMMANDS & CFG_CMD_FLASH)
if (id->type == MTD_DEV_TYPE_NOR)
return get_fl_mem_nor(off);
#endif
#if defined(CONFIG_JFFS2_NAND) && (CONFIG_COMMANDS & CFG_CMD_NAND)
if (id->type == MTD_DEV_TYPE_NAND)
return get_fl_mem_nand(off, size, ext_buf);
#endif
printf("get_fl_mem: unknown device type, using raw offset!\n");
return (void*)off;
}
static inline void *get_node_mem(u32 off)
{
struct mtdids *id = current_part->dev->id;
#if (CONFIG_COMMANDS & CFG_CMD_FLASH)
if (id->type == MTD_DEV_TYPE_NOR)
return get_node_mem_nor(off);
#endif
#if defined(CONFIG_JFFS2_NAND) && (CONFIG_COMMANDS & CFG_CMD_NAND)
if (id->type == MTD_DEV_TYPE_NAND)
return get_node_mem_nand(off);
#endif
printf("get_node_mem: unknown device type, using raw offset!\n");
return (void*)off;
}
static inline void put_fl_mem(void *buf)
{
#if defined(CONFIG_JFFS2_NAND) && (CONFIG_COMMANDS & CFG_CMD_NAND)
struct mtdids *id = current_part->dev->id;
if (id->type == MTD_DEV_TYPE_NAND)
return put_fl_mem_nand(buf);
#endif
}
#endif /* defined(CONFIG_JFFS2_NAND) && (CONFIG_COMMANDS & CFG_CMD_NAND) */
/* Compression names */
static char *compr_names[] = {
"NONE",
@ -457,8 +518,8 @@ static int compare_dirents(struct b_node *new, struct b_node *old)
static u32
jffs2_scan_empty(u32 start_offset, struct part_info *part)
{
char *max = part->offset + part->size - sizeof(struct jffs2_raw_inode);
char *offset = part->offset + start_offset;
char *max = (char *)(part->offset + part->size - sizeof(struct jffs2_raw_inode));
char *offset = (char *)(part->offset + start_offset);
u32 off;
while (offset < max &&
@ -468,11 +529,11 @@ jffs2_scan_empty(u32 start_offset, struct part_info *part)
if (((u32)offset & ((1 << SPIN_BLKSIZE)-1)) == 0) break;
}
return offset - part->offset;
return (u32)offset - part->offset;
}
static u32
jffs_init_1pass_list(struct part_info *part)
void
jffs2_free_cache(struct part_info *part)
{
struct b_lists *pL;
@ -482,6 +543,15 @@ jffs_init_1pass_list(struct part_info *part)
free_nodes(&pL->dir);
free(pL);
}
}
static u32
jffs_init_1pass_list(struct part_info *part)
{
struct b_lists *pL;
jffs2_free_cache(part);
if (NULL != (part->jffs2_priv = malloc(sizeof(struct b_lists)))) {
pL = (struct b_lists *)part->jffs2_priv;
@ -979,25 +1049,13 @@ jffs2_1pass_rescan_needed(struct part_info *part)
DEBUGF ("rescan: First time in use\n");
return 1;
}
/* if we have no list, we need to rescan */
if (pL->frag.listCount == 0) {
DEBUGF ("rescan: fraglist zero\n");
return 1;
}
/* or if we are scanning a new partition */
if (pL->partOffset != part->offset) {
DEBUGF ("rescan: different partition\n");
return 1;
}
#if defined(CONFIG_JFFS2_NAND) && (CONFIG_COMMANDS & CFG_CMD_NAND)
if (nanddev != (int)part->usr_priv - 1) {
DEBUGF ("rescan: nand device changed\n");
return -1;
}
#endif /* defined(CONFIG_JFFS2_NAND) && (CONFIG_COMMANDS & CFG_CMD_NAND) */
/* but suppose someone reflashed a partition at the same offset... */
b = pL->dir.listHead;
while (b) {
@ -1087,10 +1145,6 @@ jffs2_1pass_build_lists(struct part_info * part)
u32 counterF = 0;
u32 counterN = 0;
#if defined(CONFIG_JFFS2_NAND) && (CONFIG_COMMANDS & CFG_CMD_NAND)
nanddev = (int)part->usr_priv - 1;
#endif /* defined(CONFIG_JFFS2_NAND) && (CONFIG_COMMANDS & CFG_CMD_NAND) */
/* turn off the lcd. Refreshing the lcd adds 50% overhead to the */
/* jffs2 list building enterprise nope. in newer versions the overhead is */
/* only about 5 %. not enough to inconvenience people for. */
@ -1099,7 +1153,6 @@ jffs2_1pass_build_lists(struct part_info * part)
/* if we are building a list we need to refresh the cache. */
jffs_init_1pass_list(part);
pL = (struct b_lists *)part->jffs2_priv;
pL->partOffset = part->offset;
offset = 0;
puts ("Scanning JFFS2 FS: ");
@ -1217,6 +1270,9 @@ jffs2_1pass_fill_info(struct b_lists * pL, struct b_jffs2_info * piL)
static struct b_lists *
jffs2_get_list(struct part_info * part, const char *who)
{
/* copy requested part_info struct pointer to global location */
current_part = part;
if (jffs2_1pass_rescan_needed(part)) {
if (!jffs2_1pass_build_lists(part)) {
printf("%s: Failed to scan JFFSv2 file structure\n", who);

View File

@ -22,7 +22,6 @@ struct b_list {
};
struct b_lists {
char *partOffset;
struct b_list dir;
struct b_list frag;

View File

@ -674,5 +674,21 @@
#undef CFG_MEMTEST_END
#endif
/*
* JFFS2 partitions
*
*/
/* No command line, one static partition */
#undef CONFIG_JFFS2_CMDLINE
#define CONFIG_JFFS2_DEV "nor"
#define CONFIG_JFFS2_PART_SIZE 0xFFFFFFFF
#define CONFIG_JFFS2_PART_OFFSET 0x00000000
/* mtdparts command line support */
/*
#define CONFIG_JFFS2_CMDLINE
#define MTDIDS_DEFAULT ""
#define MTDPARTS_DEFAULT ""
*/
#endif /* __CONFIG_H */

View File

@ -229,17 +229,6 @@
#undef CFG_ENV_IS_IN_FLASH
#endif
#ifndef CFG_JFFS2_FIRST_SECTOR
#define CFG_JFFS2_FIRST_SECTOR 0
#endif
#ifndef CFG_JFFS2_FIRST_BANK
#define CFG_JFFS2_FIRST_BANK 0
#endif
#ifndef CFG_JFFS2_NUM_BANKS
#define CFG_JFFS2_NUM_BANKS 1
#endif
#define CFG_JFFS2_LAST_BANK (CFG_JFFS2_FIRST_BANK + CFG_JFFS2_NUM_BANKS - 1)
/*
* Memory map
*/
@ -314,4 +303,23 @@
#define CFG_HID0_INIT HID0_ICE | HID0_ICFI
#define CFG_HID0_FINAL HID0_ICE
/*
* JFFS2 partitions
*/
/* No command line, one static partition */
/*
#undef CONFIG_JFFS2_CMDLINE
#define CONFIG_JFFS2_DEV "nor0"
#define CONFIG_JFFS2_PART_SIZE 0x00400000
#define CONFIG_JFFS2_PART_OFFSET 0x00000000
*/
/* mtdparts command line support */
/*
#define CONFIG_JFFS2_CMDLINE
#define MTDIDS_DEFAULT "nor0=alaska-0"
#define MTDPARTS_DEFAULT "mtdparts=alaska-0:4m(user)"
*/
#endif /* __CONFIG_H */

View File

@ -28,8 +28,6 @@
#ifndef __CONFIG_H
#define __CONFIG_H
#include <asm/processor.h>
#undef DEBUG
#define GTREGREAD(x) 0xffffffff /* needed for debug */
@ -201,8 +199,25 @@
#define CFG_FLASH_ERASE_TOUT 120000 /* Timeout for Flash Erase (in ms) */
#define CFG_FLASH_WRITE_TOUT 500 /* Timeout for Flash Write (in ms) */
#define CFG_JFFS2_FIRST_BANK 0 /* use for JFFS2 */
#define CFG_JFFS2_NUM_BANKS 1 /* ! second bank contains U-Boot */
/*
* JFFS2 partitions
*
*/
/* No command line, one static partition */
#undef CONFIG_JFFS2_CMDLINE
#define CONFIG_JFFS2_DEV "nor"
#define CONFIG_JFFS2_PART_SIZE 0xFFFFFFFF
#define CONFIG_JFFS2_PART_OFFSET 0x00000000
/* mtdparts command line support
*
* Note: fake mtd_id used, no linux mtd map file
*/
/*
#define CONFIG_JFFS2_CMDLINE
#define MTDIDS_DEFAULT "nor0=bab7xx-0"
#define MTDPARTS_DEFAULT "mtdparts=bab7xx-0:-(jffs2)"
*/
#define CFG_MONITOR_BASE CFG_FLASH_BASE
#define CFG_MONITOR_LEN 0x40000 /* Reserve 256 kB for Monitor */

View File

@ -377,11 +377,6 @@
#define CFG_FLASH_EMPTY_INFO /* print 'E' for empty sector on flinfo */
#if 0 /* test-only */
#define CFG_JFFS2_FIRST_BANK 0 /* use for JFFS2 */
#define CFG_JFFS2_NUM_BANKS 1 /* ! second bank contains U-Boot */
#endif
/*-----------------------------------------------------------------------
* Environment Variable setup
*/
@ -767,9 +762,26 @@
#endif /* CONFIG_NO_SERIAL_EEPROM */
#define CONFIG_JFFS2_NAND 1 /* jffs2 on nand support */
#define CONFIG_JFFS2_NAND_DEV 0 /* nand device jffs2 lives on */
#define CONFIG_JFFS2_NAND_OFF 0 /* start of jffs2 partition */
#define CONFIG_JFFS2_NAND_SIZE 2*1024*1024 /* size of jffs2 partition */
#define NAND_CACHE_PAGES 16 /* size of nand cache in 512 bytes pages */
/*
* JFFS2 partitions
*
*/
/* No command line, one static partition */
#undef CONFIG_JFFS2_CMDLINE
#define CONFIG_JFFS2_DEV "nand"
#define CONFIG_JFFS2_PART_SIZE 0x00200000
#define CONFIG_JFFS2_PART_OFFSET 0x00000000
/* mtdparts command line support
*
* Note: fake mtd_id used, no linux mtd map file
*/
/*
#define CONFIG_JFFS2_CMDLINE
#define MTDIDS_DEFAULT "nand0=catcenter"
#define MTDPARTS_DEFAULT "mtdparts=catcenter:2m(nand)"
*/
#endif /* __CONFIG_H */

View File

@ -242,8 +242,28 @@
#define CFG_FLASH_EMPTY_INFO /* print 'E' for empty sector on flinfo */
#define CFG_JFFS2_FIRST_BANK 0 /* use for JFFS2 */
#define CFG_JFFS2_NUM_BANKS 1 /* ! second bank contains U-Boot */
/*
* JFFS2 partitions
*/
/* No command line, one static partition, use whole device */
#undef CONFIG_JFFS2_CMDLINE
#define CONFIG_JFFS2_DEV "nor0"
#define CONFIG_JFFS2_PART_SIZE 0xFFFFFFFF
#define CONFIG_JFFS2_PART_OFFSET 0x00000000
/* mtdparts command line support */
/* Use first bank for JFFS2, second bank contains U-Boot.
*
* Note: fake mtd_id's used, no linux mtd map file.
*/
/*
#define CONFIG_JFFS2_CMDLINE
#define MTDIDS_DEFAULT "nor0=cpci4052-0"
#define MTDPARTS_DEFAULT "mtdparts=cpci4052-0:-(jffs2)"
*/
#if 0 /* Use NVRAM for environment variables */
/*-----------------------------------------------------------------------

View File

@ -225,8 +225,26 @@
#define CFG_FLASH_EMPTY_INFO /* print 'E' for empty sector on flinfo */
#define CFG_JFFS2_FIRST_BANK 0 /* use for JFFS2 */
#define CFG_JFFS2_NUM_BANKS 1 /* ! second bank contains U-Boot */
/*
* JFFS2 partitions
*/
/* No command line, one static partition */
#undef CONFIG_JFFS2_CMDLINE
#define CONFIG_JFFS2_DEV "nor0"
#define CONFIG_JFFS2_PART_SIZE 0xFFFFFFFF
#define CONFIG_JFFS2_PART_OFFSET 0x00000000
/* mtdparts command line support */
/* Use first bank for JFFS2, second bank contains U-Boot.
*
* Note: fake mtd_id's used, no linux mtd map file.
*/
/*
#define CONFIG_JFFS2_CMDLINE
#define MTDIDS_DEFAULT "nor0=cpci405ab-0"
#define MTDPARTS_DEFAULT "mtdparts=cpci405ab-0:-(jffs2)"
*/
/*-----------------------------------------------------------------------
* I2C EEPROM (CAT24WC32) for environment

View File

@ -247,8 +247,26 @@
#define CFG_FLASH_EMPTY_INFO /* print 'E' for empty sector on flinfo */
#define CFG_JFFS2_FIRST_BANK 0 /* use for JFFS2 */
#define CFG_JFFS2_NUM_BANKS 1 /* ! second bank contains U-Boot */
/*
* JFFS2 partitions
*/
/* No command line, one static partition */
#undef CONFIG_JFFS2_CMDLINE
#define CONFIG_JFFS2_DEV "nor0"
#define CONFIG_JFFS2_PART_SIZE 0xFFFFFFFF
#define CONFIG_JFFS2_PART_OFFSET 0x00000000
/* mtdparts command line support */
/* Use first bank for JFFS2, second bank contains U-Boot.
*
* Note: fake mtd_id's used, no linux mtd map file.
*/
/*
#define CONFIG_JFFS2_CMDLINE
#define MTDIDS_DEFAULT "nor0=cpci405dt-0"
#define MTDPARTS_DEFAULT "mtdparts=cpci405dt-0:-(jffs2)"
*/
#if 0 /* Use NVRAM for environment variables */
/*-----------------------------------------------------------------------

View File

@ -38,8 +38,6 @@
#ifndef __CONFIG_H
#define __CONFIG_H
#include <asm/processor.h>
/* This define must be before the core.h include */
#define CONFIG_CPCI750 1 /* this is an CPCI750 board */

View File

@ -88,8 +88,6 @@
#ifndef __CONFIG_H
#define __CONFIG_H
#include <asm/processor.h>
/* This define must be before the core.h include */
#define CONFIG_DB64360 1 /* this is an DB64360 board */
@ -219,10 +217,27 @@ ip=$(ipaddr):$(serverip)$(bootargs_end); bootm 0x400000;\0"
#define CONFIG_BOOTP_MASK (CONFIG_BOOTP_DEFAULT | \
CONFIG_BOOTP_BOOTFILESIZE)
/*
* JFFS2 partitions
*
*/
/* No command line, one static partition, whole device */
#undef CONFIG_JFFS2_CMDLINE
#define CONFIG_JFFS2_DEV "nor1"
#define CONFIG_JFFS2_PART_SIZE 0xFFFFFFFF
#define CONFIG_JFFS2_PART_OFFSET 0x00000000
/* Flash banks JFFS2 should use */
#define CFG_JFFS2_FIRST_BANK 1
#define CFG_JFFS2_NUM_BANKS 1
/* mtdparts command line support */
/* Use first bank for JFFS2, second bank contains U-Boot.
*
* Note: fake mtd_id's used, no linux mtd map file.
*/
/*
#define CONFIG_JFFS2_CMDLINE
#define MTDIDS_DEFAULT "nor1=db64360-1"
#define MTDPARTS_DEFAULT "mtdparts=db64360-1:-(jffs2)"
*/
#define CONFIG_COMMANDS (CONFIG_CMD_DFL \
| CFG_CMD_ASKENV \

View File

@ -28,8 +28,6 @@
#ifndef __CONFIG_H
#define __CONFIG_H
#include <asm/processor.h>
/* This define must be before the core.h include */
#define CONFIG_DB64460 1 /* this is an DB64460 board */
@ -157,10 +155,27 @@ ip=$(ipaddr):$(serverip)$(bootargs_end); bootm 0x400000;\0"
#define CONFIG_BOOTP_MASK (CONFIG_BOOTP_DEFAULT | \
CONFIG_BOOTP_BOOTFILESIZE)
/*
* JFFS2 partitions
*
*/
/* No command line, one static partition, whole device */
#undef CONFIG_JFFS2_CMDLINE
#define CONFIG_JFFS2_DEV "nor1"
#define CONFIG_JFFS2_PART_SIZE 0xFFFFFFFF
#define CONFIG_JFFS2_PART_OFFSET 0x00000000
/* Flash banks JFFS2 should use */
#define CFG_JFFS2_FIRST_BANK 1
#define CFG_JFFS2_NUM_BANKS 1
/* mtdparts command line support */
/* Use first bank for JFFS2, second bank contains U-Boot.
*
* Note: fake mtd_id's used, no linux mtd map file.
*/
/*
#define CONFIG_JFFS2_CMDLINE
#define MTDIDS_DEFAULT "nor1=db64460-1"
#define MTDPARTS_DEFAULT "mtdparts=db64460-1:-(jffs2)"
*/
#define CONFIG_COMMANDS (CONFIG_CMD_DFL \
| CFG_CMD_ASKENV \

View File

@ -536,5 +536,21 @@
#undef CFG_MEMTEST_END
#endif
/*
* JFFS2 partitions
*
*/
/* No command line, one static partition, whole device */
#undef CONFIG_JFFS2_CMDLINE
#define CONFIG_JFFS2_DEV "nor0"
#define CONFIG_JFFS2_PART_SIZE 0xFFFFFFFF
#define CONFIG_JFFS2_PART_OFFSET 0x00000000
/* mtdparts command line support */
/*
#define CONFIG_JFFS2_CMDLINE
#define MTDIDS_DEFAULT ""
#define MTDPARTS_DEFAULT ""
*/
#endif /* __CONFIG_H */

View File

@ -545,5 +545,21 @@
#undef CFG_MEMTEST_END
#endif
/*
* JFFS2 partitions
*
*/
/* No command line, one static partition, whole device */
#undef CONFIG_JFFS2_CMDLINE
#define CONFIG_JFFS2_DEV "nor0"
#define CONFIG_JFFS2_PART_SIZE 0xFFFFFFFF
#define CONFIG_JFFS2_PART_OFFSET 0x00000000
/* mtdparts command line support */
/*
#define CONFIG_JFFS2_CMDLINE
#define MTDIDS_DEFAULT ""
#define MTDPARTS_DEFAULT ""
*/
#endif /* __CONFIG_H */

View File

@ -28,8 +28,6 @@
#ifndef __CONFIG_H
#define __CONFIG_H
#include <asm/processor.h>
#undef DEBUG
#define GTREGREAD(x) 0xffffffff /* needed for debug */
@ -181,8 +179,23 @@
#define CFG_FLASH_ERASE_TOUT 120000 /* Timeout for Flash Erase (in ms) */
#define CFG_FLASH_WRITE_TOUT 500 /* Timeout for Flash Write (in ms) */
#define CFG_JFFS2_FIRST_BANK 0 /* use for JFFS2 */
#define CFG_JFFS2_NUM_BANKS 2 /* ! second bank contains U-Boot */
/*
* JFFS2 partitions
*
*/
/* No command line, one static partition, whole device */
#undef CONFIG_JFFS2_CMDLINE
#define CONFIG_JFFS2_DEV "nor0"
#define CONFIG_JFFS2_PART_SIZE 0xFFFFFFFF
#define CONFIG_JFFS2_PART_OFFSET 0x00000000
/* mtdparts command line support */
/* Note: fake mtd_id used, no linux mtd map file */
/*
#define CONFIG_JFFS2_CMDLINE
#define MTDIDS_DEFAULT "nor0=elppc-0,nor1=elppc-1"
#define MTDPARTS_DEFAULT "mtdparts=elppc-0:-(jffs2),elppc-1:-(user)"
*/
#define CFG_MONITOR_BASE CFG_FLASH_BASE
#define CFG_MONITOR_LEN 0x40000 /* Reserve 256 kB for Monitor */

View File

@ -28,8 +28,6 @@
#ifndef __CONFIG_H
#define __CONFIG_H
#include <asm/processor.h>
#ifndef __ASSEMBLY__
#include <galileo/core.h>
#endif

View File

@ -356,4 +356,21 @@
#define BOOTFLAG_COLD 0x01 /* Normal Power-On: Boot from FLASH */
#define BOOTFLAG_WARM 0x02 /* Software reboot */
/*
* JFFS2 partitions
*
*/
/* No command line, one static partition, whole device */
#undef CONFIG_JFFS2_CMDLINE
#define CONFIG_JFFS2_DEV "nor0"
#define CONFIG_JFFS2_PART_SIZE 0xFFFFFFFF
#define CONFIG_JFFS2_PART_OFFSET 0x00000000
/* mtdparts command line support */
/*
#define CONFIG_JFFS2_CMDLINE
#define MTDIDS_DEFAULT ""
#define MTDPARTS_DEFAULT ""
*/
#endif /* __CONFIG_H */

View File

@ -184,8 +184,23 @@
#define CFG_MONITOR_BASE CFG_FLASH_BASE
#define CFG_MALLOC_LEN (128 << 10) /* Reserve 128 kB for malloc() */
#define CFG_JFFS2_FIRST_BANK 0 /* use for JFFS2 */
#define CFG_JFFS2_NUM_BANKS 1 /* one flash only */
/*
* JFFS2 partitions
*
*/
/* No command line, one static partition, whole device */
#undef CONFIG_JFFS2_CMDLINE
#define CONFIG_JFFS2_DEV "nor0"
#define CONFIG_JFFS2_PART_SIZE 0xFFFFFFFF
#define CONFIG_JFFS2_PART_OFFSET 0x00000000
/* mtdparts command line support */
/* Note: fake mtd_id used, no linux mtd map file */
/*
#define CONFIG_JFFS2_CMDLINE
#define MTDIDS_DEFAULT "nor0=mhpc-0"
#define MTDPARTS_DEFAULT "mtdparts=mhpc-0:-(jffs2)"
*/
/*
* For booting Linux, the board info and command line data

View File

@ -236,8 +236,23 @@
#define CFG_FLASH_ERASE_TOUT 120000 /* Timeout for Flash Erase (in ms) */
#define CFG_FLASH_WRITE_TOUT 500 /* Timeout for Flash Write (in ms) */
#define CFG_JFFS2_FIRST_BANK 0 /* use for JFFS2 */
#define CFG_JFFS2_NUM_BANKS 1 /* ! second bank contains U-Boot */
/*
* JFFS2 partitions
*
*/
/* No command line, one static partition, whole device */
#undef CONFIG_JFFS2_CMDLINE
#define CONFIG_JFFS2_DEV "nor0"
#define CONFIG_JFFS2_PART_SIZE 0xFFFFFFFF
#define CONFIG_JFFS2_PART_OFFSET 0x00000000
/* mtdparts command line support */
/* Note: fake mtd_id used, no linux mtd map file */
/*
#define CONFIG_JFFS2_CMDLINE
#define MTDIDS_DEFAULT "nor0=mip405-0"
#define MTDPARTS_DEFAULT "mtdparts=mip405-0:-(jffs2)"
*/
/*-----------------------------------------------------------------------
* Cache Configuration

View File

@ -241,9 +241,22 @@
#define CONFIG_KGDB_SER_INDEX 2 /* which serial port to use */
#endif
/* JFFS2 stuff */
/*
* JFFS2 partitions
*
*/
/* No command line, one static partition, whole device */
#undef CONFIG_JFFS2_CMDLINE
#define CONFIG_JFFS2_DEV "nor0"
#define CONFIG_JFFS2_PART_SIZE 0xFFFFFFFF
#define CONFIG_JFFS2_PART_OFFSET 0x00080000
/* mtdparts command line support */
/* Note: fake mtd_id used, no linux mtd map file */
/*
#define CONFIG_JFFS2_CMDLINE
#define MTDIDS_DEFAULT "nor0=ml2-0"
#define MTDPARTS_DEFAULT "mtdparts=ml2-0:-@512k(jffs2)"
*/
#define CFG_JFFS2_FIRST_BANK 0
#define CFG_JFFS2_NUM_BANKS 1
#define CFG_JFFS2_FIRST_SECTOR 1
#endif /* __CONFIG_H */

View File

@ -278,10 +278,14 @@
#define CFG_FLASH_UNLOCK_TOUT 10000 /* Timeout for Flash Clear Lock Bits (in ms) */
#define CFG_FLASH_PROTECTION /* "Real" (hardware) sectors protection */
#define CFG_JFFS2_FIRST_SECTOR 1
#define CFG_JFFS2_LAST_SECTOR 27
/*
* JFFS2 partitions
*
* Note: fake mtd_id used, no linux mtd map file
*/
#define MTDIDS_DEFAULT "nor0=mpc8260ads-0"
#define MTDPARTS_DEFAULT "mtdparts=mpc8260ads-0:-@1m(jffs2)"
#define CFG_JFFS2_SORT_FRAGMENTS
#define CFG_JFFS_CUSTOM_PART
/* this is stuff came out of the Motorola docs */
#ifndef CFG_LOWBOOT

View File

@ -573,5 +573,21 @@
#define CFG_PCI_MSTR_IO_SIZE 0x04000000 /* 64MB */
#define CFG_POCMR2_MASK_ATTRIB (POCMR_MASK_64MB | POCMR_ENABLE | POCMR_PCI_IO)
/*
* JFFS2 partitions
*
*/
/* No command line, one static partition, whole device */
#undef CONFIG_JFFS2_CMDLINE
#define CONFIG_JFFS2_DEV "nor0"
#define CONFIG_JFFS2_PART_SIZE 0xFFFFFFFF
#define CONFIG_JFFS2_PART_OFFSET 0x00000000
/* mtdparts command line support */
/*
#define CONFIG_JFFS2_CMDLINE
#define MTDIDS_DEFAULT ""
#define MTDPARTS_DEFAULT ""
*/
#endif /* __CONFIG_H */

View File

@ -400,9 +400,27 @@
#define BOOTFLAG_WARM 0x02 /* Software reboot */
#define CONFIG_JFFS2_NAND 1 /* jffs2 on nand support */
#define CONFIG_JFFS2_NAND_DEV 0 /* nand device jffs2 lives on */
#define CONFIG_JFFS2_NAND_OFF 0 /* start of jffs2 partition */
#define CONFIG_JFFS2_NAND_SIZE 4*1024*1024 /* size of jffs2 partition */
#define NAND_CACHE_PAGES 16 /* size of nand cache in 512 bytes pages */
/*
* JFFS2 partitions
*/
/* No command line, one static partition */
#undef CONFIG_JFFS2_CMDLINE
#define CONFIG_JFFS2_DEV "nand0"
#define CONFIG_JFFS2_PART_SIZE 0x00400000
#define CONFIG_JFFS2_PART_OFFSET 0x00000000
/* mtdparts command line support */
/*
#define CONFIG_JFFS2_CMDLINE
#define MTDIDS_DEFAULT "nor0=nc650-0,nand0=nc650-nand"
#define MTDPARTS_DEFAULT "mtdparts=nc650-0:1m(kernel1),1m(kernel2)," \
"2560k(cramfs1),2560k(cramfs2)," \
"256k(u-boot),256k(env);" \
"nc650-nand:4m(nand1),28m(nand2)"
*/
#endif /* __CONFIG_H */

View File

@ -685,11 +685,26 @@
((unsigned char)(*(volatile unsigned char *)(unsigned long)(adr)))
#define CONFIG_JFFS2_NAND 1 /* jffs2 on nand support */
#define CONFIG_JFFS2_NAND_DEV 0 /* nand device jffs2 lives on */
#define CONFIG_JFFS2_NAND_OFF (2 * 1024 * 1024) /* start of jffs2 partition */
#define CONFIG_JFFS2_NAND_SIZE (1*1024*1024) /* size of jffs2 partition */
#define NAND_CACHE_PAGES 16 /* size of nand cache in 512 bytes pages */
/*
* JFFS2 partitions
*
*/
/* No command line, one static partition, whole device */
#undef CONFIG_JFFS2_CMDLINE
#define CONFIG_JFFS2_DEV "nand0"
#define CONFIG_JFFS2_PART_SIZE 0x00100000
#define CONFIG_JFFS2_PART_OFFSET 0x00200000
/* mtdparts command line support */
/* Note: fake mtd_id used, no linux mtd map file */
/*
#define CONFIG_JFFS2_CMDLINE
#define MTDIDS_DEFAULT "nand0=netta-nand"
#define MTDPARTS_DEFAULT "mtdparts=netta-nand:1m@2m(jffs2)"
*/
/*****************************************************************************/
#define CFG_DIRECT_FLASH_TFTP

View File

@ -193,8 +193,23 @@
#define CFG_FLASH_EMPTY_INFO /* print 'E' for empty sector on flinfo */
#define CFG_JFFS2_FIRST_BANK 0 /* use for JFFS2 */
#define CFG_JFFS2_NUM_BANKS 1 /* ! second bank contains u-boot */
/*
* JFFS2 partitions - second bank contains u-boot
*
*/
/* No command line, one static partition, whole device */
#undef CONFIG_JFFS2_CMDLINE
#define CONFIG_JFFS2_DEV "nor0"
#define CONFIG_JFFS2_PART_SIZE 0xFFFFFFFF
#define CONFIG_JFFS2_PART_OFFSET 0x00000000
/* mtdparts command line support */
/* Note: fake mtd_id used, no linux mtd map file */
/*
#define CONFIG_JFFS2_CMDLINE
#define MTDIDS_DEFAULT "nor0=pmc405-0"
#define MTDPARTS_DEFAULT "mtdparts=pmc405-0:-(jffs2)"
*/
/*-----------------------------------------------------------------------
* Environment Variable setup

View File

@ -336,9 +336,19 @@
* Please note that CFG_SDRAM_BASE _must_ start at 0
*/
#define CFG_SDRAM_BASE 0x00000000
/* Reserve 256 kB for Monitor */
#define CFG_FLASH_BASE 0xFFFC0000
#define CFG_MONITOR_BASE CFG_FLASH_BASE
#define CFG_MONITOR_LEN (256 * 1024) /* Reserve 256 kB for Monitor */
#define CFG_MONITOR_LEN (256 * 1024)
/* Reserve 320 kB for Monitor */
/*
#define CFG_FLASH_BASE 0xFFFB0000
#define CFG_MONITOR_BASE CFG_FLASH_BASE
#define CFG_MONITOR_LEN (320 * 1024)
*/
#define CFG_MALLOC_LEN (256 * 1024) /* Reserve 256 kB for malloc() */
/*
@ -369,11 +379,6 @@
#define CFG_FLASH_EMPTY_INFO /* print 'E' for empty sector on flinfo */
#if 0 /* test-only */
#define CFG_JFFS2_FIRST_BANK 0 /* use for JFFS2 */
#define CFG_JFFS2_NUM_BANKS 1 /* ! second bank contains U-Boot */
#endif
/*-----------------------------------------------------------------------
* Environment Variable setup
*/
@ -770,9 +775,36 @@
#endif /* CONFIG_NO_SERIAL_EEPROM */
#define CONFIG_JFFS2_NAND 1 /* jffs2 on nand support */
#define CONFIG_JFFS2_NAND_DEV 0 /* nand device jffs2 lives on */
#define CONFIG_JFFS2_NAND_OFF 0 /* start of jffs2 partition */
#define CONFIG_JFFS2_NAND_SIZE 4*1024*1024 /* size of jffs2 partition */
#define NAND_CACHE_PAGES 16 /* size of nand cache in 512 bytes pages */
/*
* JFFS2 partitions
*/
/* No command line, one static partition */
#undef CONFIG_JFFS2_CMDLINE
#define CONFIG_JFFS2_DEV "nand0"
#define CONFIG_JFFS2_PART_SIZE 0x00400000
#define CONFIG_JFFS2_PART_OFFSET 0x00000000
/* mtdparts command line support */
/*
#define CONFIG_JFFS2_CMDLINE
#define MTDIDS_DEFAULT "nor0=PPChameleon-0,nand0=ppchameleonevb-nand"
*/
/* 256 kB U-boot image */
/*
#define MTDPARTS_DEFAULT "mtdparts=PPChameleon-0:1m(kernel1),1m(kernel2)," \
"1792k(user),256k(u-boot);" \
"ppchameleonevb-nand:-(nand)"
*/
/* 320 kB U-boot image */
/*
#define MTDPARTS_DEFAULT "mtdparts=PPChameleon-0:1m(kernel1),1m(kernel2)," \
"1728k(user),320k(u-boot);" \
"ppchameleonevb-nand:-(nand)"
*/
#endif /* __CONFIG_H */

View File

@ -152,10 +152,22 @@
#define CFG_BAUDRATE_TABLE { 9600, 19200, 38400, 57600, 115200 }
/* JFFS2 stuff */
#define CFG_JFFS2_FIRST_BANK 0
#define CFG_JFFS2_NUM_BANKS 1
#define CFG_JFFS2_FIRST_SECTOR 24
/*
* JFFS2 partitions
*/
/* No command line, one static partition
* use all the space starting at offset 3MB*/
#undef CONFIG_JFFS2_CMDLINE
#define CONFIG_JFFS2_DEV "nor0"
#define CONFIG_JFFS2_PART_SIZE 0xFFFFFFFF
#define CONFIG_JFFS2_PART_OFFSET 0x00300000
/* mtdparts command line support */
/*
#define CONFIG_JFFS2_CMDLINE
#define MTDIDS_DEFAULT "nor0=r360-0"
#define MTDPARTS_DEFAULT "mtdparts=r360-0:-@3m(user)"
*/
/*
* Low Level Configuration Settings

View File

@ -417,4 +417,22 @@
#define BOOTFLAG_COLD 0x01 /* Normal Power-On: Boot from FLASH */
#define BOOTFLAG_WARM 0x02 /* Software reboot */
/*
* JFFS2 partitions
*
*/
/* No command line, one static partition, whole device */
#undef CONFIG_JFFS2_CMDLINE
#define CONFIG_JFFS2_DEV "nor0"
#define CONFIG_JFFS2_PART_SIZE 0xFFFFFFFF
#define CONFIG_JFFS2_PART_OFFSET 0x00000000
/* mtdparts command line support */
/* Note: fake mtd_id used, no linux mtd map file */
/*
#define CONFIG_JFFS2_CMDLINE
#define MTDIDS_DEFAULT ""
#define MTDPARTS_DEFAULT ""
*/
#endif /* __CONFIG_H */

View File

@ -186,10 +186,26 @@
#define CFG_DIRECT_FLASH_TFTP
#if (CONFIG_COMMANDS & CFG_CMD_JFFS2)
#define CFG_JFFS2_FIRST_BANK 0
#define CFG_JFFS2_NUM_BANKS CFG_MAX_FLASH_BANKS
#define CFG_JFFS2_FIRST_SECTOR 16
#define CFG_JFFS2_SORT_FRAGMENTS
/*
* JFFS2 partitions
*
*/
/* No command line, one static partition */
#undef CONFIG_JFFS2_CMDLINE
#define CONFIG_JFFS2_DEV "nor0"
#define CONFIG_JFFS2_PART_SIZE 0xFFFFFFFF
#define CONFIG_JFFS2_PART_OFFSET 0x00100000
/* mtdparts command line support */
/* Note: fake mtd_id used, no linux mtd map file */
/*
#define CONFIG_JFFS2_CMDLINE
#define MTDIDS_DEFAULT "nor0=rattler-0"
#define MTDPARTS_DEFAULT "mtdparts=rattler-0:-@1m(jffs2)"
*/
#endif /* CFG_CMD_JFFS2 */
#define CFG_MONITOR_BASE TEXT_BASE

View File

@ -154,14 +154,32 @@
/* this must be included AFTER the definition of CONFIG_COMMANDS (if any) */
#include <cmd_confdefs.h>
#define CFG_JFFS_CUSTOM_PART
#define CFG_JFFS2_SORT_FRAGMENTS
/* JFFS2 location when using NOR flash */
#define CFG_JFFS2_BASE (CFG_FLASH_BASE + 0x80000)
#define CFG_JFFS2_SIZE (0x780000)
/* JFFS2 location (in RAM) when using NAND flash */
#define CFG_JFFS2_RAMBASE 0x400000
#define CFG_JFFS2_RAMSIZE 0x200000 /* NAND boot partition is 2MiB */
/*
* JFFS2 partitions
*
*/
/* No command line, one static partition */
#undef CONFIG_JFFS2_CMDLINE
/*
#define CONFIG_JFFS2_DEV "nor0"
#define CONFIG_JFFS2_PART_SIZE 0x00780000
#define CONFIG_JFFS2_PART_OFFSET 0x00080000
*/
#define CONFIG_JFFS2_DEV "nand0"
#define CONFIG_JFFS2_PART_SIZE 0x00200000
#define CONFIG_JFFS2_PART_OFFSET 0x00000000
/* mtdparts command line support */
/* Note: fake mtd_id used, no linux mtd map file */
/*
#define CONFIG_JFFS2_CMDLINE
#define MTDIDS_DEFAULT "nor0=sixnet-0,nand0=sixnet-nand"
#define MTDPARTS_DEFAULT "mtdparts=sixnet-0:7680k@512k();sixnet-nand:2m(jffs2-nand)"
*/
/* NAND flash support */
#define CONFIG_MTD_NAND_ECC_JFFS2

View File

@ -28,8 +28,6 @@
#ifndef __CONFIG_H
#define __CONFIG_H
#include <asm/processor.h>
#define CFG_GT_6426x GT_64260 /* with a 64260 system controller */
#define CONFIG_ETHER_PORT_MII /* use two MII ports */
#define CONFIG_INTEL_LXT97X /* Intel LXT97X phy */
@ -115,9 +113,23 @@
CFG_CMD_MII | \
CFG_CMD_DATE)
/* Flash banks JFFS2 should use */
#define CFG_JFFS2_FIRST_BANK 1
#define CFG_JFFS2_NUM_BANKS 2
/*
* JFFS2 partitions
*
*/
/* No command line, one static partition, whole device */
#undef CONFIG_JFFS2_CMDLINE
#define CONFIG_JFFS2_DEV "nor0"
#define CONFIG_JFFS2_PART_SIZE 0xFFFFFFFF
#define CONFIG_JFFS2_PART_OFFSET 0x00000000
/* mtdparts command line support */
/* Note: fake mtd_id used, no linux mtd map file */
/*
#define CONFIG_JFFS2_CMDLINE
#define MTDIDS_DEFAULT "nor1=zuma-1,nor2=zuma-2"
#define MTDPARTS_DEFAULT "mtdparts=zuma-1:-(jffs2),zuma-2:-(user)"
*/
/* this must be included AFTER the definition of CONFIG_COMMANDS (if any) */
#include <cmd_confdefs.h>

View File

@ -217,8 +217,27 @@
#define CFG_FLASH_RANGE_SIZE 0x01000000
#define FLASH_BASE0_PRELIM 0x7C000000 /* debris flash */
#define CFG_JFFS2_FIRST_BANK 0 /* use for JFFS2 */
#define CFG_JFFS2_NUM_BANKS 1
/*
* JFFS2 partitions
*
*/
/* No command line, one static partition, whole device */
#undef CONFIG_JFFS2_CMDLINE
#define CONFIG_JFFS2_DEV "nor0"
#define CONFIG_JFFS2_PART_SIZE 0xFFFFFFFF
#define CONFIG_JFFS2_PART_OFFSET 0x00000000
/* mtdparts command line support */
/* Use first bank for JFFS2, second bank contains U-Boot.
*
* Note: fake mtd_id's used, no linux mtd map file.
*/
/*
#define CONFIG_JFFS2_CMDLINE
#define MTDIDS_DEFAULT "nor0=debris-0"
#define MTDPARTS_DEFAULT "mtdparts=debris-0:-(jffs2)"
*/
#define CFG_ENV_IS_IN_NVRAM 1
#define CONFIG_ENV_OVERWRITE 1

View File

@ -142,9 +142,22 @@
#define CFG_ENV_ADDR (PHYS_FLASH_1 + 0x20000) /* Addr of Environment Sector */
#define CFG_ENV_SIZE 0x20000 /* Total Size of Environment Sector */
/* Flash banks JFFS2 should use */
#define CFG_JFFS2_FIRST_BANK 0
#define CFG_JFFS2_FIRST_SECTOR 2
#define CFG_JFFS2_NUM_BANKS 1
/*
* JFFS2 partitions
*
*/
/* No command line, one static partition, whole device */
#undef CONFIG_JFFS2_CMDLINE
#define CONFIG_JFFS2_DEV "nor0"
#define CONFIG_JFFS2_PART_SIZE 0xFFFFFFFF
#define CONFIG_JFFS2_PART_OFFSET 0x00000000
/* mtdparts command line support */
/* Note: fake mtd_id used, no linux mtd map file */
/*
#define CONFIG_JFFS2_CMDLINE
#define MTDIDS_DEFAULT "nor0=ep7312-0"
#define MTDPARTS_DEFAULT "mtdparts=ep7312-0:-(jffs2)"
*/
#endif /* __CONFIG_H */

View File

@ -744,4 +744,22 @@
#define BOOTFLAG_COLD 0x01 /* Normal Power-On: Boot from FLASH */
#define BOOTFLAG_WARM 0x02 /* Software reboot */
/*
* JFFS2 partitions
*
*/
/* No command line, one static partition, whole device */
#undef CONFIG_JFFS2_CMDLINE
#define CONFIG_JFFS2_DEV "nor0"
#define CONFIG_JFFS2_PART_SIZE 0xFFFFFFFF
#define CONFIG_JFFS2_PART_OFFSET 0x00000000
/* mtdparts command line support */
/* Note: fake mtd_id used, no linux mtd map file */
/*
#define CONFIG_JFFS2_CMDLINE
#define MTDIDS_DEFAULT ""
#define MTDPARTS_DEFAULT ""
*/
#endif /* __CONFIG_H */

View File

@ -712,4 +712,21 @@
#define BOOTFLAG_COLD 0x01 /* Normal Power-On: Boot from FLASH*/
#define BOOTFLAG_WARM 0x02 /* Software reboot */
/*
* JFFS2 partitions
*
*/
/* No command line, one static partition, whole device */
#undef CONFIG_JFFS2_CMDLINE
#define CONFIG_JFFS2_DEV "nor0"
#define CONFIG_JFFS2_PART_SIZE 0xFFFFFFFF
#define CONFIG_JFFS2_PART_OFFSET 0x00000000
/* mtdparts command line support */
/*
#define CONFIG_JFFS2_CMDLINE
#define MTDIDS_DEFAULT ""
#define MTDPARTS_DEFAULT ""
*/
#endif /* __CONFIG_H */

View File

@ -144,9 +144,21 @@
#define CFG_ENV_ADDR (PHYS_FLASH_1 + 0x1C000) /* Addr of Environment Sector */
#define CFG_ENV_SIZE 0x4000 /* Total Size of Environment Sector */
/* Flash banks JFFS2 should use */
#define CFG_JFFS2_FIRST_BANK 0
#define CFG_JFFS2_FIRST_SECTOR 8
#define CFG_JFFS2_NUM_BANKS 2
/*
* JFFS2 partitions
*
*/
/* No command line, one static partition, whole device */
#undef CONFIG_JFFS2_CMDLINE
#define CONFIG_JFFS2_DEV "nor0"
#define CONFIG_JFFS2_PART_SIZE 0xFFFFFFFF
#define CONFIG_JFFS2_PART_OFFSET 0x00020000
/* mtdparts command line support */
/*
#define CONFIG_JFFS2_CMDLINE
#define MTDIDS_DEFAULT "nor0=impA7 NOR Flash Bank #0,nor1=impA7 NOR Flash Bank #1"
#define MTDPARTS_DEFAULT "mtdparts=impA7 NOR Flash Bank #0:-(FileSystem1);impA7 NOR Flash Bank #1:-(FileSystem2)"
*/
#endif /* __CONFIG_H */

View File

@ -148,8 +148,26 @@
#define CONFIG_NET_MULTI
#define CONFIG_INCA_IP_SWITCH_AMDIX
#define CFG_JFFS2_FIRST_BANK 1
#define CFG_JFFS2_NUM_BANKS 1
/*
* JFFS2 partitions
*/
/* No command line, one static partition, use all space on the device */
#undef CONFIG_JFFS2_CMDLINE
#define CONFIG_JFFS2_DEV "nor1"
#define CONFIG_JFFS2_PART_SIZE 0xFFFFFFFF
#define CONFIG_JFFS2_PART_OFFSET 0x00000000
/* mtdparts command line support */
/*
#define CONFIG_JFFS2_CMDLINE
#define MTDIDS_DEFAULT "nor0=INCA-IP Bank 0"
#define MTDPARTS_DEFAULT "mtdparts=INCA-IP Bank 0:192k(uboot)," \
"64k(env)," \
"768k(linux)," \
"1m@3m(rootfs)," \
"768k(linux2)," \
"3m@5m(rootfs2)"
*/
/*-----------------------------------------------------------------------
* Cache Configuration

View File

@ -164,14 +164,42 @@
#define CFG_FLASH_BASE PHYS_FLASH_1
/*
* JFFS2 Partitions
* JFFS2 partitions
*
*/
#define CFG_JFFS_CUSTOM_PART 1 /* see board/innokom/flash.c */
#define CONFIG_MTD_INNOKOM_16MB 1 /* development flash */
#undef CONFIG_MTD_INNOKOM_64MB /* production flash */
/* development flash */
#define CONFIG_MTD_INNOKOM_16MB 1
#undef CONFIG_MTD_INNOKOM_64MB
/* production flash */
/*
#define CONFIG_MTD_INNOKOM_64MB 1
#undef CONFIG_MTD_INNOKOM_16MB
*/
/* No command line, one static partition, whole device */
#undef CONFIG_JFFS2_CMDLINE
#define CONFIG_JFFS2_DEV "nor0"
#define CONFIG_JFFS2_PART_SIZE 0xFFFFFFFF
#define CONFIG_JFFS2_PART_OFFSET 0x00000000
/* mtdparts command line support */
/* Note: fake mtd_id used, no linux mtd map file */
/*
#define CONFIG_JFFS2_CMDLINE
#define MTDIDS_DEFAULT "nor0=innokom-0"
*/
/* development flash */
/*
#define MTDPARTS_DEFAULT "mtdparts=innokom-0:256k(uboot),768k(kernel),8m(user),7m(data)"
*/
/* production flash */
/*
#define MTDPARTS_DEFAULT "mtdparts=innokom-0:256k(uboot),768k(kernel),16256k(user1),16256k(user2),32m(data)"
*/
/*
* GPIO settings

View File

@ -165,9 +165,22 @@
#define CFG_ENV_SECT_SIZE 0x10000 /* Total Size of Environment Sector */
#define CFG_ENV_SIZE 0x4000 /* max size for environment */
/* Flash banks JFFS2 should use */
#define CFG_JFFS2_FIRST_BANK 0
#define CFG_JFFS2_FIRST_SECTOR 8
#define CFG_JFFS2_NUM_BANKS 2
/*
* JFFS2 partitions
*
*/
/* No command line, one static partition, whole device */
#undef CONFIG_JFFS2_CMDLINE
#define CONFIG_JFFS2_DEV "nor0"
#define CONFIG_JFFS2_PART_SIZE 0xFFFFFFFF
#define CONFIG_JFFS2_PART_OFFSET 0x00080000
/* mtdparts command line support */
/* Note: fake mtd_id used, no linux mtd map file */
/*
#define CONFIG_JFFS2_CMDLINE
#define MTDIDS_DEFAULT "nor0=modnet50-0"
#define MTDPARTS_DEFAULT "mtdparts=modnet50-0:-@512k(jffs2)"
*/
#endif /* __CONFIG_H */

View File

@ -87,7 +87,6 @@
#define CONFIG_INITRD_TAG 1 /* send initrd params */
#undef CONFIG_VFD /* do not send framebuffer setup */
#define CFG_JFFS_CUSTOM_PART
/*
* Malloc pool need to host env + 128 Kb reserve for other allocations.
*/
@ -136,10 +135,6 @@
#define MX1FS2_FLASH_INTERLEAVE 2 /* ... made of 2 chips */
#define MX1FS2_FLASH_BANK_SIZE 0x02000000 /* size of one flash bank*/
#define MX1FS2_FLASH_SECT_SIZE 0x00020000 /* size of erase sector */
#define MX1FS2_JFFS2_PART0_START 0x10200000
#define MX1FS2_JFFS2_PART0_SIZE 0x00500000
#define MX1FS2_JFFS2_PART1_START 0x10700000
#define MX1FS2_JFFS2_PART1_SIZE 0x00900000
#else
#define MX1FS2_FLASH_BUS_WIDTH 2 /* we use 16 bit FLASH memory... */
#define MX1FS2_FLASH_INTERLEAVE 1 /* ... made of 1 chip */
@ -167,9 +162,28 @@
* footprint.
* NOTE: Enable CFG_CMD_JFFS2 for JFFS2 support.
*/
#define CFG_JFFS2_FIRST_BANK 0
#define CFG_JFFS2_FIRST_SECTOR 5
#define CFG_JFFS2_NUM_BANKS 1
/*
* JFFS2 partitions
*/
/* No command line, one static partition, whole device */
/*
#undef CONFIG_JFFS2_CMDLINE
#define CONFIG_JFFS2_DEV "nor0"
#define CONFIG_JFFS2_PART_SIZE 0xFFFFFFFF
#define CONFIG_JFFS2_PART_OFFSET 0x00050000
*/
/* mtdparts command line support */
/* Note: fake mtd_id used, no linux mtd map file */
#define CONFIG_JFFS2_CMDLINE
#define MTDIDS_DEFAULT "nor0=mx1fs2-0"
#ifdef BUS32BIT_VERSION
#define MTDPARTS_DEFAULT "mtdparts=mx1fs2-0:2m@5m(part0),5m@9m(part1)"
#else
#define MTDPARTS_DEFAULT "mtdparts=mx1fs2-0:-@320k(jffs2)"
#endif
/*
* Environment setup. Definitions of monitor location and size with

View File

@ -265,10 +265,23 @@
#define CFG_FLASH_ERASE_TOUT (30*75*CFG_HZ) /* Timeout for Flash Erase */
#define CFG_FLASH_WRITE_TOUT (30*75*CFG_HZ) /* Timeout for Flash Write */
/* Flash banks JFFS2 should use */
#define CFG_MAX_MTD_BANKS (CFG_MAX_FLASH_BANKS+CFG_MAX_NAND_DEVICE)
#define CFG_JFFS2_MEM_NAND
#define CFG_JFFS2_FIRST_BANK 1 /* use flash_info[1] */
#define CFG_JFFS2_NUM_BANKS 1
/*
* JFFS2 partitions
*/
/* No command line, one static partition, whole device */
#undef CONFIG_JFFS2_CMDLINE
#define CONFIG_JFFS2_DEV "nor1"
#define CONFIG_JFFS2_PART_SIZE 0xFFFFFFFF
#define CONFIG_JFFS2_PART_OFFSET 0x00000000
/* mtdparts command line support */
/* Note: fake mtd_id used, no linux mtd map file */
/*
#define CONFIG_JFFS2_CMDLINE
#define MTDIDS_DEFAULT "nor1=omap2420-1"
#define MTDPARTS_DEFAULT "mtdparts=omap2420-1:-(jffs2)"
*/
#endif /* __CONFIG_H */

View File

@ -138,8 +138,22 @@
#define CONFIG_SC520_CDP_USE_SPI /* Store configuration in the SPI part */
#undef CONFIG_SC520_CDP_USE_MW /* Store configuration in the MicroWire part */
#define CONFIG_SPI_X 1
#define CFG_JFFS2_FIRST_BANK 0 /* use for JFFS2 */
#define CFG_JFFS2_NUM_BANKS 1 /* */
/*
* JFFS2 partitions
*/
/* No command line, one static partition, whole device */
#undef CONFIG_JFFS2_CMDLINE
#define CONFIG_JFFS2_DEV "nor0"
#define CONFIG_JFFS2_PART_SIZE 0xFFFFFFFF
#define CONFIG_JFFS2_PART_OFFSET 0x00000000
/* mtdparts command line support */
/*
#define CONFIG_JFFS2_CMDLINE
#define MTDIDS_DEFAULT "nor0=SC520CDP Flash Bank #0"
#define MTDPARTS_DEFAULT "mtdparts=SC520CDP Flash Bank #0:-(jffs2)"
*/
/*-----------------------------------------------------------------------
* Device drivers

View File

@ -147,8 +147,23 @@
#endif
#define CFG_JFFS2_FIRST_BANK 0 /* use for JFFS2 */
#define CFG_JFFS2_NUM_BANKS 1 /* */
/*
* JFFS2 partitions
*
*/
/* No command line, one static partition, whole device */
#undef CONFIG_JFFS2_CMDLINE
#define CONFIG_JFFS2_DEV "nor0"
#define CONFIG_JFFS2_PART_SIZE 0xFFFFFFFF
#define CONFIG_JFFS2_PART_OFFSET 0x00000000
/* mtdparts command line support */
/* Note: fake mtd_id used, no linux mtd map file */
/*
#define CONFIG_JFFS2_CMDLINE
#define MTDIDS_DEFAULT "nor0=sc520_spunk-0"
#define MTDPARTS_DEFAULT "mtdparts=sc520_spunk-0:-(jffs2)"
*/
/*-----------------------------------------------------------------------
* Device drivers

View File

@ -87,10 +87,23 @@
CFG_CMD_JFFS2 | \
CFG_CMD_DATE )
/*
* JFFS2 partitions
*
*/
/* No command line, one static partition, whole device */
#undef CONFIG_JFFS2_CMDLINE
#define CONFIG_JFFS2_DEV "nor1"
#define CONFIG_JFFS2_PART_SIZE 0xFFFFFFFF
#define CONFIG_JFFS2_PART_OFFSET 0x00000000
/* Flash banks JFFS2 should use */
#define CFG_JFFS2_FIRST_BANK 1
#define CFG_JFFS2_NUM_BANKS 1
/* mtdparts command line support */
/* Note: fake mtd_id used, no linux mtd map file */
/*
#define CONFIG_JFFS2_CMDLINE
#define MTDIDS_DEFAULT "nor1=v37-1"
#define MTDPARTS_DEFAULT "mtdparts=v37-1:-(jffs2)"
*/
/* this must be included AFTER the definition of CONFIG_COMMANDS (if any) */
#include <cmd_confdefs.h>

View File

@ -247,4 +247,22 @@
#define VOICEBLUE_LED_REG 0x04030000
/*
* JFFS2 partitions
*
*/
/* No command line, one static partition */
#undef CONFIG_JFFS2_CMDLINE
#define CONFIG_JFFS2_DEV "nor0"
#define CONFIG_JFFS2_PART_SIZE 0xFFFFFFFF
#define CONFIG_JFFS2_PART_OFFSET 0x00040000
/* mtdparts command line support */
/* Note: fake mtd_id used, no linux mtd map file */
/*
#define CONFIG_JFFS2_CMDLINE
#define MTDIDS_DEFAULT "nor0=voiceblue-0"
#define MTDPARTS_DEFAULT "mtdparts=voiceblue-0:128k(uboot),64k(env),64k(renv),-(jffs2)"
*/
#endif /* __CONFIG_H */

View File

@ -59,9 +59,23 @@
#define PHYS_FLASH_2 0x00000000 /* Flash Bank #2 */
#define PHYS_FLASH_SECT_SIZE 0x00020000 /* 127 KB sectors */
#define CFG_FLASH_BASE PHYS_FLASH_1
#define CFG_JFFS2_NUM_BANKS 1
#define CFG_JFFS2_FIRST_BANK 0
#define CFG_JFFS_CUSTOM_PART 1
/*
* JFFS2 partitions
*/
/* No command line, one static partition, whole device */
#undef CONFIG_JFFS2_CMDLINE
#define CONFIG_JFFS2_DEV "nor0"
#define CONFIG_JFFS2_PART_SIZE 0xFFFFFFFF
#define CONFIG_JFFS2_PART_OFFSET 0x00000000
/* mtdparts command line support */
/* Note: fake mtd_id used, no linux mtd map file */
/*
#define CONFIG_JFFS2_CMDLINE
#define MTDIDS_DEFAULT "nor0=xsengine-0"
#define MTDPARTS_DEFAULT "mtdparts=xsengine-0:256k(uboot),1m(kernel1),8m(kernel2)"
*/
/* Environment settings */
#define CONFIG_ENV_OVERWRITE

View File

@ -25,40 +25,37 @@
*
*/
/* this struct is very similar to mtd_info */
struct part_info {
u32 size; /* Total size of the Partition */
#include <linux/list.h>
/* "Major" erase size for the device. Naïve users may take this
* to be the only erase size available, or may use the more detailed
* information below if they desire
*/
u32 erasesize;
/* mtd device types */
#define MTD_DEV_TYPE_NOR 0x0001
#define MTD_DEV_TYPE_NAND 0x0002
#define MTD_DEV_TYPE(type) ((type == MTD_DEV_TYPE_NAND) ? "nand" : "nor")
/* Where in memory does this partition start? */
char *offset;
/* used by jffs2 set to NULL */
void *jffs2_priv;
/* private filed used by user */
void *usr_priv;
struct mtd_device {
struct list_head link;
struct mtdids *id; /* parent mtd id entry */
u16 num_parts; /* number of partitions on this device */
struct list_head parts; /* partitions */
};
struct part_info*
jffs2_part_info(int part_num);
struct part_info {
struct list_head link;
char *name; /* partition name */
u8 auto_name; /* set to 1 for generated name */
u32 size; /* total size of the partition */
u32 offset; /* offset within device */
void *jffs2_priv; /* used internaly by jffs2 */
u32 mask_flags; /* kernel MTD mask flags */
struct mtd_device *dev; /* parent device */
};
struct kernel_loader {
/* Return true if there is a kernel contained at src */
int (* check_magic)(struct part_info *part);
/* load the kernel from the partition part to dst, return the number
* of bytes copied if successful, zero if not */
u32 (* load_kernel)(u32 *dst, struct part_info *part, const char *kernel_filename);
/* A brief description of the module (ie, "cramfs") */
char *name;
struct mtdids {
struct list_head link;
u8 type; /* device type */
u8 num; /* device number */
u32 size; /* device size */
char *mtd_id; /* linux kernel device id */
};
#define ldr_strlen strlen

258
include/linux/list.h Normal file
View File

@ -0,0 +1,258 @@
#ifndef _LINUX_LIST_H
#define _LINUX_LIST_H
#ifndef ARCH_HAS_PREFETCH
#define ARCH_HAS_PREFETCH
static inline void prefetch(const void *x) {;}
#endif
/*
* Simple doubly linked list implementation.
*
* Some of the internal functions ("__xxx") are useful when
* manipulating whole lists rather than single entries, as
* sometimes we already know the next/prev entries and we can
* generate better code by using them directly rather than
* using the generic single-entry routines.
*/
struct list_head {
struct list_head *next, *prev;
};
#define LIST_HEAD_INIT(name) { &(name), &(name) }
#define LIST_HEAD(name) \
struct list_head name = LIST_HEAD_INIT(name)
#define INIT_LIST_HEAD(ptr) do { \
(ptr)->next = (ptr); (ptr)->prev = (ptr); \
} while (0)
/*
* Insert a new entry between two known consecutive entries.
*
* This is only for internal list manipulation where we know
* the prev/next entries already!
*/
static inline void __list_add(struct list_head *new,
struct list_head *prev,
struct list_head *next)
{
next->prev = new;
new->next = next;
new->prev = prev;
prev->next = new;
}
/**
* list_add - add a new entry
* @new: new entry to be added
* @head: list head to add it after
*
* Insert a new entry after the specified head.
* This is good for implementing stacks.
*/
static inline void list_add(struct list_head *new, struct list_head *head)
{
__list_add(new, head, head->next);
}
/**
* list_add_tail - add a new entry
* @new: new entry to be added
* @head: list head to add it before
*
* Insert a new entry before the specified head.
* This is useful for implementing queues.
*/
static inline void list_add_tail(struct list_head *new, struct list_head *head)
{
__list_add(new, head->prev, head);
}
/*
* Delete a list entry by making the prev/next entries
* point to each other.
*
* This is only for internal list manipulation where we know
* the prev/next entries already!
*/
static inline void __list_del(struct list_head *prev, struct list_head *next)
{
next->prev = prev;
prev->next = next;
}
/**
* list_del - deletes entry from list.
* @entry: the element to delete from the list.
* Note: list_empty on entry does not return true after this, the entry is in an undefined state.
*/
static inline void list_del(struct list_head *entry)
{
__list_del(entry->prev, entry->next);
entry->next = (void *) 0;
entry->prev = (void *) 0;
}
/**
* list_del_init - deletes entry from list and reinitialize it.
* @entry: the element to delete from the list.
*/
static inline void list_del_init(struct list_head *entry)
{
__list_del(entry->prev, entry->next);
INIT_LIST_HEAD(entry);
}
/**
* list_move - delete from one list and add as another's head
* @list: the entry to move
* @head: the head that will precede our entry
*/
static inline void list_move(struct list_head *list, struct list_head *head)
{
__list_del(list->prev, list->next);
list_add(list, head);
}
/**
* list_move_tail - delete from one list and add as another's tail
* @list: the entry to move
* @head: the head that will follow our entry
*/
static inline void list_move_tail(struct list_head *list,
struct list_head *head)
{
__list_del(list->prev, list->next);
list_add_tail(list, head);
}
/**
* list_empty - tests whether a list is empty
* @head: the list to test.
*/
static inline int list_empty(struct list_head *head)
{
return head->next == head;
}
static inline void __list_splice(struct list_head *list,
struct list_head *head)
{
struct list_head *first = list->next;
struct list_head *last = list->prev;
struct list_head *at = head->next;
first->prev = head;
head->next = first;
last->next = at;
at->prev = last;
}
/**
* list_splice - join two lists
* @list: the new list to add.
* @head: the place to add it in the first list.
*/
static inline void list_splice(struct list_head *list, struct list_head *head)
{
if (!list_empty(list))
__list_splice(list, head);
}
/**
* list_splice_init - join two lists and reinitialise the emptied list.
* @list: the new list to add.
* @head: the place to add it in the first list.
*
* The list at @list is reinitialised
*/
static inline void list_splice_init(struct list_head *list,
struct list_head *head)
{
if (!list_empty(list)) {
__list_splice(list, head);
INIT_LIST_HEAD(list);
}
}
/**
* list_entry - get the struct for this entry
* @ptr: the &struct list_head pointer.
* @type: the type of the struct this is embedded in.
* @member: the name of the list_struct within the struct.
*/
#define list_entry(ptr, type, member) \
((type *)((char *)(ptr)-(unsigned long)(&((type *)0)->member)))
/**
* list_for_each - iterate over a list
* @pos: the &struct list_head to use as a loop counter.
* @head: the head for your list.
*/
#define list_for_each(pos, head) \
for (pos = (head)->next, prefetch(pos->next); pos != (head); \
pos = pos->next, prefetch(pos->next))
/**
* list_for_each_prev - iterate over a list backwards
* @pos: the &struct list_head to use as a loop counter.
* @head: the head for your list.
*/
#define list_for_each_prev(pos, head) \
for (pos = (head)->prev, prefetch(pos->prev); pos != (head); \
pos = pos->prev, prefetch(pos->prev))
/**
* list_for_each_safe - iterate over a list safe against removal of list entry
* @pos: the &struct list_head to use as a loop counter.
* @n: another &struct list_head to use as temporary storage
* @head: the head for your list.
*/
#define list_for_each_safe(pos, n, head) \
for (pos = (head)->next, n = pos->next; pos != (head); \
pos = n, n = pos->next)
/**
* list_for_each_entry - iterate over list of given type
* @pos: the type * to use as a loop counter.
* @head: the head for your list.
* @member: the name of the list_struct within the struct.
*/
#define list_for_each_entry(pos, head, member) \
for (pos = list_entry((head)->next, typeof(*pos), member), \
prefetch(pos->member.next); \
&pos->member != (head); \
pos = list_entry(pos->member.next, typeof(*pos), member), \
prefetch(pos->member.next))
/**
* list_for_each_entry_safe - iterate over list of given type safe against removal of list entry
* @pos: the type * to use as a loop counter.
* @n: another type * to use as temporary storage
* @head: the head for your list.
* @member: the name of the list_struct within the struct.
*/
#define list_for_each_entry_safe(pos, n, head, member) \
for (pos = list_entry((head)->next, typeof(*pos), member), \
n = list_entry(pos->member.next, typeof(*pos), member); \
&pos->member != (head); \
pos = n, n = list_entry(n->member.next, typeof(*n), member))
/**
* list_for_each_entry_continue - iterate over list of given type
* continuing after existing point
* @pos: the type * to use as a loop counter.
* @head: the head for your list.
* @member: the name of the list_struct within the struct.
*/
#define list_for_each_entry_continue(pos, head, member) \
for (pos = list_entry(pos->member.next, typeof(*pos), member), \
prefetch(pos->member.next); \
&pos->member != (head); \
pos = list_entry(pos->member.next, typeof(*pos), member), \
prefetch(pos->member.next))
#endif