From: Manuel Lauss <mano@roarinelk.homelinux.net>
To: "maowy" <maowy@avit.org.cn>
Cc: borasah@netone.com.tr <borasah@netone.com.tr>,
L-M-O <linux-mips@linux-mips.org>,
linux-mips@linux-mips.org <linux-mips@linux-mips.org>
Subject: Re: Au1550 Nandflash
Date: Thu, 7 Aug 2008 08:45:47 +0200 [thread overview]
Message-ID: <20080807084547.243d803a@scarran> (raw)
In-Reply-To: <S20023167AbYHGETq/20080807041946Z+558223@ftp.linux-mips.org>
On Thu, 7 Aug 2008 12:16:19 +0800
"maowy" <maowy@avit.org.cn> wrote:
> borasah____________
> I have the same problem with you when using nandflash.
> Our kernel can recognize nandflash but it seems to be all bad block.
> How dou you successfully solve this problem of nandflash .
> Can you tell how to solve this problem.
> Hope to receive your letter as soon as possible.Thanks.
>
>
> our platform:AU1550
> OS:linux-2.6.13
Please give the "gen_nand" driver a try. I ran into identical problems
on Au1200; the in-kernel au1550nd.c code seems to be explicitly
tailored for small-page nands on the PB1550/DB1200 boards and doesn't
seem to work anywhere else.
FWIW, here's a snippet I use on Au1200 which you can paste into your
board setup code; it should work on Au1550 too since the NAND parts are
identical.
---------- 8< --------------------- 8< -----------------
#include <linux/mtd/mtd.h>
#include <linux/mtd/map.h>
#include <linux/mtd/nand.h>
#include <linux/mtd/partitions.h>
#include <asm/mach-au1x00/au1000.h>
static void au1200_nand_cmd_ctrl(struct mtd_info *mtd, int cmd,
unsigned int ctrl)
{
struct nand_chip *this = mtd->priv;
unsigned long ioaddr = (unsigned long)this->IO_ADDR_W;
ioaddr &= 0xffffff00;
if (ctrl & NAND_CLE) {
ioaddr += MEM_STNAND_CMD;
} else if (ctrl & NAND_ALE) {
ioaddr += MEM_STNAND_ADDR;
} else {
/* assume we want to r/w real data by default */
ioaddr += MEM_STNAND_DATA;
}
this->IO_ADDR_R = this->IO_ADDR_W = (void __iomem *)ioaddr;
if (cmd != NAND_CMD_NONE) {
au_writeb(cmd, ioaddr);
au_sync();
}
}
static int au1200_nand_device_ready(struct mtd_info *mtd)
{
int ret = (au_readl(MEM_STSTAT) & 1);
au_sync();
return ret;
}
static const char *au1200_part_probes[] = { "cmdlinepart", NULL };
static struct mtd_partition au1200_nand_parts[] = {
[0] = {
.name = "NAND FS 0",
.offset = 0,
.size = MTDPART_SIZ_FULL,
},
};
struct platform_nand_data au1200_nand_platdata = {
.chip = {
.nr_chips = 1,
.chip_offset = 0,
.nr_partitions = ARRAY_SIZE(au1200_nand_parts),
.partitions = au1200_nand_parts,
.chip_delay = 20,
.part_probe_types = au1200_part_probes,
},
.ctrl = {
.hwcontrol = 0,
.dev_ready = au1200_nand_device_ready,
.select_chip = 0,
.cmd_ctrl = au1200_nand_cmd_ctrl,
},
};
static struct resource au1200_nand_res[] = {
[0] = {
.start = 0x20000000,
.end = 0x200000ff,
.flags = IORESOURCE_MEM,
},
};
static struct platform_device au1200_nand_dev = {
.name = "gen_nand",
.num_resources = ARRAY_SIZE(au1200_nand_res),
.resource = au1200_nand_res,
.id = -1,
.dev = {
.platform_data = &au1200_nand_platdata,
}
};
---------- 8< --------------------- 8< -----------------
Best regards,
Manuel Lauss
WARNING: multiple messages have this Message-ID (diff)
From: Manuel Lauss <mano@roarinelk.homelinux.net>
To: maowy <maowy@avit.org.cn>
Cc: borasah@netone.com.trborasah@netone.com.tr,
L-M-O
<linux-mips@linux-mips.org>linux-mips@linux-mips.orglinux-mips@linux-mips.org
Subject: Re: Au1550 Nandflash
Date: Thu, 7 Aug 2008 08:45:47 +0200 [thread overview]
Message-ID: <20080807084547.243d803a@scarran> (raw)
Message-ID: <20080807064547.FLUKLm1Voq3rAbDm8CWpLEKvgm3dyKXzMoxMxWLgswo@z> (raw)
In-Reply-To: <S20023167AbYHGETq/20080807041946Z+558223@ftp.linux-mips.org>
On Thu, 7 Aug 2008 12:16:19 +0800
"maowy" <maowy@avit.org.cn> wrote:
> borasah____________
> I have the same problem with you when using nandflash.
> Our kernel can recognize nandflash but it seems to be all bad block.
> How dou you successfully solve this problem of nandflash .
> Can you tell how to solve this problem.
> Hope to receive your letter as soon as possible.Thanks.
>
>
> our platform:AU1550
> OS:linux-2.6.13
Please give the "gen_nand" driver a try. I ran into identical problems
on Au1200; the in-kernel au1550nd.c code seems to be explicitly
tailored for small-page nands on the PB1550/DB1200 boards and doesn't
seem to work anywhere else.
FWIW, here's a snippet I use on Au1200 which you can paste into your
board setup code; it should work on Au1550 too since the NAND parts are
identical.
---------- 8< --------------------- 8< -----------------
#include <linux/mtd/mtd.h>
#include <linux/mtd/map.h>
#include <linux/mtd/nand.h>
#include <linux/mtd/partitions.h>
#include <asm/mach-au1x00/au1000.h>
static void au1200_nand_cmd_ctrl(struct mtd_info *mtd, int cmd,
unsigned int ctrl)
{
struct nand_chip *this = mtd->priv;
unsigned long ioaddr = (unsigned long)this->IO_ADDR_W;
ioaddr &= 0xffffff00;
if (ctrl & NAND_CLE) {
ioaddr += MEM_STNAND_CMD;
} else if (ctrl & NAND_ALE) {
ioaddr += MEM_STNAND_ADDR;
} else {
/* assume we want to r/w real data by default */
ioaddr += MEM_STNAND_DATA;
}
this->IO_ADDR_R = this->IO_ADDR_W = (void __iomem *)ioaddr;
if (cmd != NAND_CMD_NONE) {
au_writeb(cmd, ioaddr);
au_sync();
}
}
static int au1200_nand_device_ready(struct mtd_info *mtd)
{
int ret = (au_readl(MEM_STSTAT) & 1);
au_sync();
return ret;
}
static const char *au1200_part_probes[] = { "cmdlinepart", NULL };
static struct mtd_partition au1200_nand_parts[] = {
[0] = {
.name = "NAND FS 0",
.offset = 0,
.size = MTDPART_SIZ_FULL,
},
};
struct platform_nand_data au1200_nand_platdata = {
.chip = {
.nr_chips = 1,
.chip_offset = 0,
.nr_partitions = ARRAY_SIZE(au1200_nand_parts),
.partitions = au1200_nand_parts,
.chip_delay = 20,
.part_probe_types = au1200_part_probes,
},
.ctrl = {
.hwcontrol = 0,
.dev_ready = au1200_nand_device_ready,
.select_chip = 0,
.cmd_ctrl = au1200_nand_cmd_ctrl,
},
};
static struct resource au1200_nand_res[] = {
[0] = {
.start = 0x20000000,
.end = 0x200000ff,
.flags = IORESOURCE_MEM,
},
};
static struct platform_device au1200_nand_dev = {
.name = "gen_nand",
.num_resources = ARRAY_SIZE(au1200_nand_res),
.resource = au1200_nand_res,
.id = -1,
.dev = {
.platform_data = &au1200_nand_platdata,
}
};
---------- 8< --------------------- 8< -----------------
Best regards,
Manuel Lauss
next prev parent reply other threads:[~2008-08-07 6:45 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-08-07 4:16 Au1550 Nandflash maowy
2008-08-07 4:16 ` maowy
2008-08-07 6:45 ` Manuel Lauss [this message]
2008-08-07 6:45 ` Manuel Lauss
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=20080807084547.243d803a@scarran \
--to=mano@roarinelk.homelinux.net \
--cc=borasah@netone.com.tr \
--cc=maowy@avit.org.cn \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.