Failed to implent MTD on uclinux(kernel version 2.4.20-uc0)
****When I boot a kenel compileded with MTD support, error messages below are printed:
s3c2410 flash device: 200000 at 1000000
writew called, but not implemented<2>kernel BUG at traps.c:505! writew called, but not implemented<2>kernel BUG at traps.c:505! readw called, but not implemented<2>kernel BUG at traps.c:505!
CFI: Found no s3c2410 flash device device at location zeroinit_mtdchar: allocated major number 90.init_mtdchar: allocated major number 90.
****Don`t know why this happen,somebody may give me some advice,thanks ****kernel version 2.4.20-uc0
****SoC:s3c4510b
****Flash chip:am29lv160DB
****CONFIG informations are:
[redhat@arim-linux uClinux-dist]$ grep -v '^#' linux-2.4.x/.config | uniq CONFIG_ARM=yCONFIG_UID16=yCONFIG_RWSEM_GENERIC_SPINLOCK=yCONFIG_UCLINUX=y
MAGIC_ROM_PTR=y
CONFIG_MODULES=yCONFIG_KMOD=y
CONFIG_ARCH_SAMSUNG=yCONFIG_ROMKERNEL=yCONFIG_BOARD_SNDS100=yCONFIG_NO_PGT_CACHE=yCONFIG_CPU_32=yCONFIG_CPU_S3C4510=yCONFIG_CPU_ARM710=yCONFIG_CPU_WITH_CACHE=yCONFIG_SERIAL_SAMSUNG=y
DRAM_BASE=0x00000000
DRAM_SIZE=0x01000000
FLASH_MEM_BASE=0x01000000
FLASH_SIZE=0x00200000
CONFIG_NET=yCONFIG_KCORE_ELF=yCONFIG_BINFMT_FLAT=yCONFIG_KERNEL_ELF=y
CONFIG_PACKET=yCONFIG_INET=y
CONFIG_NETDEVICES=y
CONFIG_NET_ETHERNET=yCONFIG_ETH_S3C4510=y
CONFIG_MTD=yCONFIG_MTD_DEBUG=yCONFIG_MTD_DEBUG_VERBOSE=3CONFIG_MTD_PARTITIONS=yCONFIG_MTD_CONCAT=yCONFIG_MTD_CHAR=yCONFIG_MTD_BLOCK=y
CONFIG_MTD_CFI=yCONFIG_MTD_GEN_PROBE=yCONFIG_MTD_CFI_ADV_OPTIONS=yCONFIG_MTD_CFI_NOSWAP=yCONFIG_MTD_CFI_GEOMETRY=yCONFIG_MTD_CFI_B2=yCONFIG_MTD_CFI_I1=yCONFIG_MTD_CFI_AMDSTD=y
CONFIG_MTD_S3C4510B=y
CONFIG_BLK_DEV_RAM=yCONFIG_BLK_DEV_RAM_SIZE=1024CONFIG_BLK_DEV_BLKMEM=yCONFIG_NOFLASH=y
CONFIG_JFFS2_FS=yCONFIG_JFFS2_FS_DEBUG=2CONFIG_RAMFS=yCONFIG_JFS_FS=yCONFIG_PROC_FS=yCONFIG_ROMFS_FS=yCONFIG_EXT2_FS=y
CONFIG_NLS=y
CONFIG_NLS_DEFAULT="iso8859-1"
CONFIG_SERIAL_SAMSUNG=yCONFIG_SERIAL_SAMSUNG_CONSOLE=yCONFIG_SERIAL_NONSTANDARD=y
CONFIG_FRAME_POINTER=yCONFIG_DEBUG_ERRORS=yCONFIG_DEBUG_INFO=y
CONFIG_ZLIB_INFLATE=yCONFIG_ZLIB_DEFLATE=y
[redhat@arim-linux uClinux-dist]$
****the map file i wrote is also attached.
Signature · 1 line
wanG:)
/*
* Normal mappings of chips on Samsung s3c2410 in physical memory */
#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/config.h>
#define WINDOW_ADDR 0x01000000 //Base addr
#define WINDOW_SIZE 0x00200000 //Flash length 2M
#define BUSWIDTH 2
static struct mtd_info *mymtd;
__u8 s3c2410_read8(struct map_info *map, unsigned long ofs)
{
return readb(map->map_priv_1 + ofs);
}__u16 s3c2410_read16(struct map_info *map, unsigned long ofs)
{
return readw(map->map_priv_1 + ofs);
}__u32 s3c2410_read32(struct map_info *map, unsigned long ofs)
{
return readl(map->map_priv_1 + ofs);
}void s3c2410_copy_from(struct map_info *map, void *to, unsigned long from, ssize_t len)
{
memcpy(to, (void *)(map->map_priv_1 + from), len);
}void s3c2410_write8(struct map_info *map, __u8 d, unsigned long adr)
{
writeb(d, map->map_priv_1 + adr);
}void s3c2410_write16(struct map_info *map, __u16 d, unsigned long adr)
{
writew(d, map->map_priv_1 + adr);
}void s3c2410_write32(struct map_info *map, __u32 d, unsigned long adr)
{
writel(d, map->map_priv_1 + adr);
}void s3c2410_copy_to(struct map_info *map, unsigned long to, const void *from, ssize_t len)
{
memcpy((void *)(map->map_priv_1 + to), from, len);
}struct map_info s3c2410_map = {
name: "s3c2410 flash device",
size: WINDOW_SIZE,
buswidth: BUSWIDTH,
read8: s3c2410_read8,
read16: s3c2410_read16,
read32: s3c2410_read32,
copy_from: s3c2410_copy_from,
write8: s3c2410_write8,
write16: s3c2410_write16,
write32: s3c2410_write32,
copy_to: s3c2410_copy_to,
map_priv_1: WINDOW_ADDR,
map_priv_2: -1,
};
//division
static struct mtd_partition s3c2410_partitions[] = {
{
name: "reserved for kernel",
size: 0x0100000,
offset: 0x0,
mask_flags: MTD_WRITEABLE,
},
{
name: "jffs2(8M)",
size: 0x0100000,
offset: 0x0100000,
}
};int __init init_s3c2410(void)
{
printk(KERN_NOTICE "s3c2410 flash device: %x at %x\n", WINDOW_SIZE, WINDOW_ADDR);
s3c2410_map.map_priv_1 = (unsigned long)ioremap(WINDOW_ADDR, WINDOW_SIZE);
// printk("0\n");
if (!s3c2410_map.map_priv_1) {
printk("Failed to ioremap/n");
return -EIO;
}
// printk("1\n");
// mymtd = do_map_probe("jedec_probe", &s3c2410_map);
// if (!mymtd)
mymtd = do_map_probe("cfi_probe", &s3c2410_map);
// printk("2\n");
// if (!mymtd)
// mymtd = do_map_probe("amd_flash", &s3c2410_map);
// printk("3\n");
if (mymtd) {
mymtd->module = THIS_MODULE;
mymtd->erasesize = 0x10000; //erase volume INTEL E28F128J3A-150 64kb
return add_mtd_partitions(mymtd, s3c2410_partitions, sizeof(s3c2410_partitions) / sizeof(struct mtd_partition));
}
// printk("4\n");
iounmap((void *)s3c2410_map.map_priv_1);
return -ENXIO;
}static void __exit cleanup_s3c2410(void)
{
if (mymtd) {
del_mtd_partitions(mymtd);
map_destroy(mymtd);
}
if (s3c2410_map.map_priv_1) {
iounmap((void *)s3c2410_map.map_priv_1);
s3c2410_map.map_priv_1 = 0;
}
}module_init(init_s3c2410);module_exit(cleanup_s3c2410);
Quoted 4 lines · Wang JinFeng
****Don`t know why this happen,somebody may give me some advice,thanks ****kernel version 2.4.20-uc0
****SoC:s3c4510b
****Flash chip:am29lv160DB
I'm led to believe that 2.4.20-uc0 on smdk2410 means a commercial port which is of fairly low quality. You'd probably do better to use a 2.6 kernel instead. You may still need to do a little bit of work on it, but at least you'll be working from a sane starting point.
Signature · 1 line
dwmw2
Quoted 10 lines · David Woodhouse
Quoted 4 lines · Wang JinFeng
****Don`t know why this happen,somebody may give me some advice,thanks ****kernel version 2.4.20-uc0
****SoC:s3c4510b
****Flash chip:am29lv160DBI'm led to believe that 2.4.20-uc0 on smdk2410 means a commercial port which is of fairly low quality. You'd probably do better to use a 2.6 kernel instead. You may still need to do a little bit of work on it, but at least you'll be working from a sane starting point.
Why the hell would you be running uClinux on an s3c2410 anyway? It's an ARM920T and has a real MMU. It is very capable (and fast!) at running real Linux.
-J.
Quoted 1 line · [email protected] wrote:
Why the hell would you be running uClinux on an s3c2410 anyway? It's an ARM920T and has a real MMU. It is very capable (and fast!) at running real Linux.
Context switch time for processors with virtually indexed virtually tagged caches that require cache and TLB flushes at each context switch in Linux can be a good reason: http://opensrc.sec.samsung.com/document/uc-linux-04_sait.pdf
Signature · 1 line
Todd