Subject: strataflash size and partitioning problem

From: Amin Farajian <[email-masked]>
Date: Wed, 24 Oct 2007 09:00:08 -0400

Hi there,

We are working on an embedded platform which has 256MB DDR and 64MB strataflash(TE28F64J3C-120) and  our databus is 32 bits.

we have used the following MAP driver for our strata flash as the start of our work:

------------------------------------------

#include <linux/module.h>
#include <linux/types.h>
#include <linux/kernel.h>
#include <asm/io.h>
#include <linux/mtd/mtd.h>
#include <linux/mtd/map.h>
#include <linux/mtd/partitions.h>
#include <linux/delay.h>

struct map_info sdp_map =
{
.name=       "SDP Flash",
.size=       8 * 1024 * 1024, /* Overwritten by cfi_probe */
.bankwidth=   2,
.phys=NO_XIP

/*
read:      sdp_read,
write:     sdp_write,
copy_from:  sdp_copy_from,
*/
};

static struct mtd_partition sdp_flash_partition[] =
{
/*
* Flash map in the
*    KERNEL AND BOOTLOADER AND ROOT : 20000000-24000000
*/
{
name:        "data",
size:         0x800000,
offset:         0x00000000
},
};
static struct mtd_partition *sdp_partitions;
#define NB_OF(x)    (sizeof(x)/sizeof(x[0]))
static struct mtd_info    *mymtds;
static int __init sdp_init_mtd (void)
{

int                     nb_parts;
char                    *part_type = "static";
int                     i;
unsigned int            flash_addresses = 0x20000000;

/* Determine flash partitioning */
sdp_partitions = sdp_flash_partition;
nb_parts = NB_OF(sdp_flash_partition);
sdp_map.virt = ioremap (flash_addresses, sdp_map.size);
mymtds = do_map_probe("cfi_probe", &sdp_map);
if (!mymtds){
iounmap ((void *) sdp_map.map_priv_1);
return -ENXIO;
}

printk (KERN_NOTICE "SDP flash device: %08xMB at 0x%08x\n",
(mymtds->size), flash_addresses);

sdp_map.size = mymtds->size;
mymtds->owner = THIS_MODULE;
printk (KERN_NOTICE "Using %s partition definition\n", part_type);
add_mtd_partitions (mymtds, sdp_partitions, nb_parts);
return 0;
}

static void __exit sdp_cleanup_mtd(void)
{
printk("sdp_cleanup_mtd\n");
return;
}

module_init(sdp_init_mtd);
module_exit(sdp_cleanup_mtd);

-----------------------------------------------

But unfortunately we were not able to map upper than 8MB of flash , and we found that the problem was related the range of Virtual address mapping in kernel.

So,

1- What we can do now if we want to map all of flash?

2- Does it relate to bankwidth parameter in map_info structure? ( if we set that to 1 ,4, and the system will hangup..So what is that parameter?is it related to flash itself or data bandwidth or number of flashes on the board?)

Any help will be greatly appretiated.