strataflash size and partitioning problem
From: Amin Farajian <hidden>
Date: 2007-10-24 13:07:00
<p><br />Hi there,</p><p>We are working on an embedded platform which has 2=
56MB DDR and 64MB strataflash(<span>TE28F64J3C-120</span>) and our da=
tabus is 32 bits. </p><p>we have used the following MAP driver for our=
strata flash as the start of our work:</p><p>-----------------------------=
------------- </p><p><p>#include <linux/module.h><br />#include =
<linux/types.h><br />#include <linux/kernel.h><br />#include &l=
t;asm/io.h><br />#include <linux/mtd/mtd.h><br />#include <linu=
x/mtd/map.h><br />#include <linux/mtd/partitions.h><br />#include =
<linux/delay.h><br /></p></p><p><p>struct map_info sdp_map =3D<br />{=
<br /> .name=3D "=
;SDP Flash",<br /> .size=3D &=
nbsp; 8 * 1024 * 1024, /* Overwritten by cfi_probe */<br /> &nbs=
p; .bankwidth=3D 2,<br /> .phys=3DNO_XI=
P <br /><br /> /*<br /> &nbs=
p; read: sdp_read,<br />&n=
bsp; write: sdp_write,<br />  =
; copy_from: sdp_copy_from,<br /> */ &nb=
sp; <br />};<br /><br />static struct mtd_partition sdp_f=
lash_partition[] =3D<br />{<br /> /*<br /> &nb=
sp; * Flash map in the <br /> * &n=
bsp; KERNEL AND BOOTLOADER AND ROOT : 20000000-24000000<br /> &n=
bsp; */<br /> {<br /> name: =
"data",<br /> &nb=
sp; size: 0x80=
0000,<br /> offset: &n=
bsp; 0x00000000<br /> },<br />};=
<br />static struct mtd_partition *sdp_partitions;<br />#define NB_OF(x)&nb=
sp; (sizeof(x)/sizeof(x[0]))<br />static struct mtd_info &=
nbsp; *mymtds;<br />static int __init sdp_init_mtd (void)<br />{<br /= <br /> int &nb=
sp; =
nb_parts;<br /> char =
&nb=
sp; *part_type =3D "static";<br /> &=
nbsp; int =
i;<br /> =
unsigned int &n=
bsp; flash_addresses =3D 0x20000000;<br /> <br /> &nb=
sp; /* Determine flash partitioning */<br /> sdp_partitio=
ns =3D sdp_flash_partition;<br /> nb_parts =3D NB_OF(sdp_=
flash_partition);<br /> sdp_map.virt =3D ioremap (flash_a=
ddresses, sdp_map.size);<br /> mymtds =3D do_map_probe(&q=
uot;cfi_probe", &sdp_map);<br /> &nbs=
p; if (!mymtds){<br />  =
; iounmap ((void *) sdp_map.map_p=
riv_1);<br /> &n=
bsp; return -ENXIO;<br /> &n=
bsp; }<br /><br /> &nb=
sp; printk (KERN_NOTICE "SDP flash device: %08xMB at=
0x%08x\n",<br />  =
; (mymtds->size), flash_addresses);<=
br /><br /> sdp_map.size =3D mymt=
ds->size;<br /> mymtds->own=
er =3D THIS_MODULE;<br /> printk =
(KERN_NOTICE "Using %s partition definition\n", part_type);<br />=
add_mtd_partitions (mymtds, sdp_=
partitions, nb_parts);<br /> return 0;<br />}<br =
/><br />static void __exit sdp_cleanup_mtd(void)<br />{<br /> &n=
bsp; printk("sdp_cleanup_mtd\n");<br /> return;=
<br />}<br /><br />module_init(sdp_init_mtd);<br />module_exit(sdp_cleanup_=
mtd); <br /></p></p><p>-----------------------------------------------<br /==0D
</p><p>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 mapp= ing in kernel. </p><p>So, </p><p> 1- What we can do= now if we want to map all of flash?</p><p> 2- Does it re= late 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 fl= ash itself or data bandwidth or number of flashes on the board?)</p><p>&nbs= p;</p><p>Any help will be greatly appretiated. </p><p> </p><BR>=