Nand Flash not found.
Dear list users,
I've adapted a hardware driver for our board, and compiled the new kernel successfully. But it doesn't find the NAND Flash. When loading the module I get:
insmod ./btutc1130.o
./btutc1130.o: init_module: No such device or address
Hint: insmod errors can be caused by incorrect module parameters, including invalid IO or IRQ parameters
in /var/log/messages:
Jan 1 19:25:15 10 daemon.warn klogd: No NAND device found!!!
Is there any possibility to test the 'connection' to the NAND or how can I check/debug the problem. I think that the HW functions are not properly configured, any idea how this can be checked.
Thanks in advance
Marcus
Hi Marcus,
Quoted 10 lines · Marcus Mikolaiczyk
Dear list users,
I've adapted a hardware driver for our board, and compiled the new kernel successfully. But it doesn't find the NAND Flash. When loading the module I get:
insmod ./btutc1130.o
./btutc1130.o:init_module: No such device or address
Hint: insmod errors can be caused by incorrect module parameters, including invalid IO or IRQ parameters
Quoted 6 lines
in
/var/log/messages:Jan 1 19:25:15 10 daemon.warn klogd: No NAND device found!!!Is there any possibility to test the 'connection' to the NAND or how can I check/debug the problem. I think that the HW functions are not properly configured, any idea how this can be checked.
I often have this problem if I don't have a good physical connection between the flash device and it's socket, so recheck your connection. Can you post your hardware function?
Signature · 2 lines
William J Beksi <[email protected]> GPG Key Fingerprint = ED4B 32C3 69E6 C2B7 705C 263F CB2F 3253 E7E1 DB3B
Hi William,
the connection should be ok, the hardware guys tested it - I hope so. They use a simple test appl. which I cannot use under Linux.
the hardware function (discussion "NAND connected with address lines based example" on this list around 31.03.2005):
...
static int BTU_NAND_BASE = 0xAE000000;
static int BTU_NAND_VIRT_BASE ;
static int BTU_NAND_RB = 0xF0000C00;
static int BTU_NAND_RB_RDY = (1<<5);
/*
* Define partitions for flash devices
*/
extern struct nand_oobinfo jffs2_oobinfo;
#define NUM_PARTITIONS256M 1
static struct mtd_partition partition_info256M[] = {
{ name: "BTU NAND flash partition 1",
offset: 0,
size: SZ_256M },
};/*
* hardware specific access to control-lines via address bus
*/
static void btutc1130_hwcontrol(struct mtd_info *mtd, int cmd)
{
struct nand_chip *this = (struct nand_chip *) mtd->priv;
switch(cmd){
//Command Latch Enable Settings
case NAND_CTL_SETCLE: this->IO_ADDR_W = BTU_NAND_BASE +
1; break;
case NAND_CTL_CLRCLE: this->IO_ADDR_W = BTU_NAND_BASE;
break;
//Address Latch Enable Settings
case NAND_CTL_SETALE: this->IO_ADDR_W = BTU_NAND_BASE +
2; break;
case NAND_CTL_CLRALE: this->IO_ADDR_W = BTU_NAND_BASE;
break;
}
}/*
* read device ready pin
*/
int btutc1130_device_ready(struct mtd_info *mtd)
{
// Gibt 0 zurueck, wenn P0.4_IN 0 ist ansonsten 1
return ( (*(volatile unsigned char *) (BTU_NAND_RB + 0x14)) &BTU_NAND_RB_RDY) ? 1 : 0;
}
....
....
I've got a seperate CS which is connect to the nand an too this CS the address range 0xAE000000 is 'connected'.
I'm looking for to write a small c-appl which does some inital tests on this.
Marcus
Hi,
I'm still on the way getting the Samsung NAND discovered, but a small step has been made.
I've got now a simple testapplication which can read out the NAND IDs with the readid cmd 0x90 . So I can definitely discover this NAND chip with this Linux app, but not with the 'derived' linux NAND driver. Samsung K9F2G08UOM:
Page Size: 2k (+64) Bytes
Block Size: 128k (+4k) Bytes
Organisation: 8 Bit
Code example for external READID cmd:
#define NANDF_DATA (*((unsigned int volatile *) 0xAE000000)) #define NANDF_COMM (*((unsigned int volatile *) 0xAE000004)) #define NANDF_ADDR (*((unsigned int volatile *) 0xAE000008))
...
value=0x90;
NANDF_COMM=value;
value=0x00; // not necessary
NANDF_ADDR=value;
va[0]=NANDF_DATA;
va[1]=NANDF_DATA;
va[2]=NANDF_DATA;
va[3]=NANDF_DATA;
printf("Maker Code: %x Device Type: %x DontCare: %x
Organisation: %x\n\r", va[0], va[1], va[2], v
a[3]);
...
Results:
Maker Code: ec Device Type: da DontCare: 80 Organisation: 15
SAMSUNG 3.3V See Above Values for Pages Size...
I changed the hardwarespecific part to this values but with no success. The module does not find the NAND.
static int BTU_NAND_BASE = 0xAE000000;
static int BTU_NAND_VIRT_BASE ;
static int BTU_NAND_RB = 0xF0000C00;
static int BTU_NAND_RB_RDY = (1<<5);
...
static void btutc1130_hwcontrol(struct mtd_info *mtd, int cmd)
{
struct nand_chip *this = (struct nand_chip *) mtd->priv;
switch(cmd){
//Command Latch Enable Settings
case NAND_CTL_SETCLE: this->IO_ADDR_W = BTU_NAND_BASE + 4; break;
case NAND_CTL_CLRCLE: this->IO_ADDR_W = BTU_NAND_BASE; break;
//Address Latch Enable Settings
case NAND_CTL_SETALE: this->IO_ADDR_W = BTU_NAND_BASE + 8; break;
case NAND_CTL_CLRALE: this->IO_ADDR_W = BTU_NAND_BASE; break;
}
}
...
/* map physical adress */
BTU_NAND_VIRT_BASE=(unsigned long)ioremap(BTU_NAND_BASE,SZ_4K);
...
/* Set address of NAND IO lines */
this->IO_ADDR_R = BTU_NAND_BASE;
this->IO_ADDR_W = BTU_NAND_BASE;
this->hwcontrol = btutc1130_hwcontrol;
this->dev_ready = btutc1130_device_ready;
/* 20 us command delay time */
this->chip_delay = 20;
this->eccmode = NAND_ECC_SOFT;...
What does the nand_scan function check ?
What else should be adapted (Chip ID list in nand_ids.c)? Someone any ideas.
Cheers Marcus
Quoted 1 line · Marcus Mikolaiczyk
value=0x90;
....
Quoted 1 line
va[3]=NANDF_DATA;
The code in nand_scan does exactly the same
Quoted 2 lines
Results:
Maker Code: ec Device Type: da
{"NAND 256MiB 3,3V 8-bit", 0xDA, 0, 256, 0, ..
Thats the entry from nand_ids.c
Quoted 5 lines
static int
BTU_NAND_BASE=0xAE000000;BTU_NAND_VIRT_BASE=(unsigned long)ioremap(BTU_NAND_BASE,SZ_4K);
this->IO_ADDR_R=BTU_NAND_BASE;this->IO_ADDR_W=BTU_NAND_BASE;
-------------------^^^^^^^^^^^^^^
Using the virtual address instead of the physical address might be helpful.
tglx
Quoted 3 lines
{"NAND 256MiB 3,3V 8-bit",
0xDA, 0, 256, 0, ..Thats the entry from
nand_ids.c
Thats related to the actual version. I know that it's not supported anymore, but I have to use kernel 2.4.19 cause the Linux for this microcontroller (Infineon tc1130) is ported only this kernel version. Comparing those structs there is a difference.
I didn't find the latest patch 2.4.27. The link on the website doesn't work cause the file doesn't exist:
ftp://ftp.uk.linux.org/pub/people/dwmw2/mtd/cvs/mtd-snapshot-20050304.tar.bz2 I suppose a type cause ther is a file ftp://ftp.uk.linux.org/pub/people/dwmw2/mtd/cvs/mtd-snapshot-20050403.tar.bz2 I'll try this one.
for the old structure I would propose something like:
{"NAND 256MiB 3,3V 8-bit", 0xDA, 0, 0x20000, 0),
erasesize=128K =0x20000
pagesize=0 (device pagesize = 2k != 256bytes)
chipshift???
Any mappings between the "new - old" structure which could help?
new - old
-------------------
name - name
id - id
pagesize- ?
chipsize- ?
? - chipshift
erasesize- erasesize
? - page256
options - ?
Quoted 2 lines
Using the virtual address instead of the physical address might be helpful.
Sorry - my mistake.
Thanks Marcus