From: Jim Zeus <zeusj@firstlinux.net>
To: David Woodhouse <dwmw2@infradead.org>,
"David Woodhouse" <dwmw2@infradead.org>
Cc: all in MTD mailinglist <linux-mtd@lists.infradead.org>
Subject: Re: (no subject)
Date: Fri, 15 Mar 2002 01:55:22 -0800 (PST) [thread overview]
Message-ID: <20020315095523.2AAD73ED3@sitemail.everyone.net> (raw)
Hi, David
>Show me.
#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>
#define WINDOW_ADDR 0x00000000
#define WINDOW_SIZE 0x01000000
#define BUSWIDTH 2
static struct mtd_info *mymtd;
static __u8 perseus_read8(struct map_info *map,unsigned long ofs)
{
return __raw_readb(map->map_priv_1 + ofs);
}
static __u16 perseus_read16(struct map_info *map,unsigned long ofs)
{
return __raw_readw(map->map_priv_1 + ofs);
}
static __u32 perseus_read32(struct map_info *map, unsigned long ofs)
{
return __raw_readl(map->map_priv_1 + ofs);
}
static void perseus_copy_from(struct map_info *map, void *to, unsigned long from, ssize_t len)
{
memcpy(to, (void *)(map->map_priv_1 + from), len);
}
static void perseus_write8(struct map_info *map, __u8 d, unsigned long adr)
{
*(__u8 *)(map->map_priv_1 + adr) = d;
}
static void perseus_write16(struct map_info *map, __u16 d, unsigned long adr)
{
*(__u16 *)(map->map_priv_1 + adr) = d;
}
static void perseus_write32(struct map_info *map, __u32 d, unsigned long adr)
{
*(__u32 *)(map->map_priv_1 + adr) = d;
}
static void perseus_copy_to(struct map_info *map, unsigned long to, const void *from, ssize_t len)
{
memcpy((void *)(map->map_priv_1 + to), from, len);
}
static struct mtd_partition perseus_partition[]={
{
name: "Perseus Bootloader",
offset: 0,
size: 0x20000,
},
{
name:"Perseus Kernel",
offset:0x20000,
size:0x7e0000,
},
{
name: "Perseus RamDisk", /////
offset: 0x800000,
size:0x800000,
}
};
#define NUM_PARTITIONS (sizeof(perseus_partition)/sizeof(perseus_partition[0]))
struct map_info perseus_map = {
name: "Perseus StrataFlash map",
size: WINDOW_SIZE,
buswidth: BUSWIDTH,
read8: perseus_read8,
read16: perseus_read16,
read32: perseus_read32,
copy_from: perseus_copy_from,
write8: perseus_write8,
write16: perseus_write16,
write32: perseus_write32,
copy_to: perseus_copy_to,
};
static int __init init_perseus(void)
{
printk(KERN_NOTICE "Perseus Strataflash mapping:size %x at %x\n", WINDOW_SIZE, WINDOW_ADDR);
perseus_map.map_priv_1 = (unsigned long)ioremap(WINDOW_ADDR, WINDOW_SIZE);
printk("ZEUS:perseus_map.map_priv_1=%x\n",perseus_map.map_priv_1);
if (!perseus_map.map_priv_1) {
printk("Failed to ioremap\n");
return -EIO;
}
mymtd = do_map_probe("cfi_probe", &perseus_map);
if (mymtd) {
mymtd->module = THIS_MODULE;
add_mtd_partitions( mymtd, perseus_partition, NUM_PARTITIONS );
add_mtd_device(mymtd);
printk("ZEUS:right end of init_perseus(I mean flash)\n");
return 0;
}
iounmap((void *)perseus_map.map_priv_1);
printk("ZEUS:so its the wrong end of init_perseus(flash)\n");
return -ENXIO;
}
mod_exit_t cleanup_perseus(void)
{
if (mymtd) {
del_mtd_device(mymtd);
map_destroy(mymtd);
}
if (perseus_map.map_priv_1) {
iounmap((void *)perseus_map.map_priv_1);
perseus_map.map_priv_1 = 0;
}
}
module_init(init_perseus);
module_exit(cleanup_perseus);
>Why JFFS not JFFS2?
sure I can use jffs2 too, but for more insurance , I use jffs:)
AND, after some modification, the phenomena I showed you in last mail has been disappeared .
now, if i use "cp somefile /dev/mtd0", it said£º
MTD_open
MTD_ioctl
Invalid ioctl 5401 (MEMGETINFO = 80204d01)
MTD_write
Chip not ready for buffer write. Xstatus = 18, status = 98
cp: write: Input/output error
MTD_close
I think I have make the mtd up,but why I cant write?
and if I "mount /dev/mtdblock0 /jffs -t jffs",the kernel tell me mount failed and said"Invalid argument"
BTW:
in my opinion, the "mtd_info" struct should be to describe a mtd device.
the "map_info" struct should be to describe a mapping area in memory which mapping to the mtd device(?) and WINDOW_ADDR is the PA of the mtd device(in my file) and map_info.map_priv_1 is a pointer to the VA of the mtd device.
Is that right? to be honest , I am really confused by these.I cant find any documentation to explain it .
thank you for your help!
Jim Zeus
_____________________________________________________________
Want a new web-based email account ? ---> http://www.firstlinux.net
_____________________________________________________________
Run a small business? Then you need professional email like you@yourbiz.com from Everyone.net http://www.everyone.net?tag
next reply other threads:[~2002-03-15 9:43 UTC|newest]
Thread overview: 61+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-03-15 9:55 Jim Zeus [this message]
2002-03-15 10:15 ` (no subject) David Woodhouse
-- strict thread matches above, loose matches on Subject: below --
2009-06-01 11:20 Mnl
2009-05-18 15:18 Mnl
2009-05-18 12:20 Mnl
2006-03-10 13:57 Selmeci, Tamas
2005-10-20 16:05 Korolev, Alexey
2005-09-15 13:22 Konstantin Kletschke
2005-07-23 4:50 Mr.Derrick Tanner.
2005-07-18 12:06 murasfdg sjhfsd
2005-07-03 2:47 Amit Sharma
2005-07-03 12:04 ` Artem B. Bityuckiy
2005-06-21 14:48 David L
2004-11-16 13:48 Artem B. Bityuckiy
2004-11-16 13:55 ` David Woodhouse
2004-11-16 11:42 Artem B. Bityuckiy
2002-11-19 21:13 BBRAM Jörn Engel
2002-11-20 2:01 ` (no subject) Taeil Um
2002-11-20 7:20 ` David Woodhouse
2002-11-21 8:40 ` Taeil Um
2002-11-15 20:58 Wauviel
2002-07-15 10:25 Valls Pellicer,Joan
2002-07-02 17:00 Roy Lauer
2002-06-19 2:24 Áº²¨
2002-05-03 11:46 victor.martin
2002-04-29 14:19 Jim Zeus
2002-04-19 3:23 swimming_fisher
2002-04-11 6:13 Jim Zeus
2002-03-27 8:01 Jim Zeus
2002-03-27 8:06 ` David Woodhouse
2002-03-19 7:59 Jim Zeus
2002-03-18 7:42 Jim Zeus
2002-03-18 8:38 ` David Woodhouse
2002-03-17 10:21 Jim Zeus
2002-03-17 10:32 ` David Woodhouse
2002-03-15 4:15 Jim Zeus
2002-03-15 9:27 ` David Woodhouse
2002-01-03 15:46 Allen Curtis
2001-12-28 23:48 Sheela Kashyap
2001-12-28 23:52 ` David Woodhouse
2002-01-02 23:57 ` Sheela Kashyap
2002-01-03 0:06 ` David Woodhouse
2002-01-03 0:27 ` Sheela Kashyap
2002-01-03 9:26 ` David Woodhouse
2002-01-03 18:57 ` Sheela Kashyap
2001-12-19 19:01 ilatypov
2001-09-14 20:11 Siders, Keith
2001-09-14 16:25 Siders, Keith
2001-09-14 16:32 ` David Woodhouse
2001-05-02 15:59 zud sdf
2001-05-02 15:29 zud sdf
2001-05-02 15:24 zud sdf
2001-05-02 15:32 ` David Woodhouse
2001-05-02 15:17 Zydla Tsui
2001-04-24 11:29 (No Subject) simon.munton
2001-04-24 14:46 ` David Woodhouse
2001-04-25 9:51 ` Masami Komiya
2001-04-25 10:26 ` David Woodhouse
2001-04-25 12:19 ` Masami Komiya
2001-04-25 12:26 ` David Woodhouse
2001-04-25 12:55 ` Masami Komiya
2001-04-25 13:30 ` David Woodhouse
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20020315095523.2AAD73ED3@sitemail.everyone.net \
--to=zeusj@firstlinux.net \
--cc=dwmw2@infradead.org \
--cc=linux-mtd@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox