<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii">
<META NAME="Generator" CONTENT="MS Exchange Server version 6.5.7653.29">
<TITLE>NAND access fail after MMU enabled when booting linux</TITLE>
</HEAD>
<BODY>
<!-- Converted from text/rtf format -->

<P><FONT FACE="GE Inspira">Dear all,</FONT>
</P>

<P><FONT FACE="GE Inspira">I am facing a MMU related problem when porting Linux to my custom board with Coldfire M5445x processor. The observation is that<B> the nand Bus chip select/WE/RE become 100 times longer than normal when MMU enabled</B>. I just can not understand this...</FONT></P>

<P><FONT FACE="GE Inspira">The NAND drivers and filesystem (JFFS2) worked fine in Uboot, as shown in below:</FONT>
</P>

<P><FONT COLOR="#0000FF" FACE="GE Inspira">I2C:&nbsp;&nbsp; ready</FONT>

<BR><FONT COLOR="#0000FF" FACE="GE Inspira">DRAM:&nbsp; 64 MB</FONT>

<BR><FONT COLOR="#0000FF" FACE="GE Inspira">In:&nbsp;&nbsp;&nbsp; serial</FONT>

<BR><FONT COLOR="#0000FF" FACE="GE Inspira">Out:&nbsp;&nbsp; serial</FONT>

<BR><FONT COLOR="#0000FF" FACE="GE Inspira">Err:&nbsp;&nbsp; serial</FONT>

<BR><FONT COLOR="#0000FF" FACE="GE Inspira">NAND:&nbsp; 256 MiB</FONT>

<BR><FONT COLOR="#0000FF" FACE="GE Inspira">-&gt; mtdparts</FONT>
</P>

<P><FONT COLOR="#0000FF" FACE="GE Inspira">device nand0 &lt;micron&gt;, # parts = 2</FONT>

<BR><FONT COLOR="#0000FF" FACE="GE Inspira">&nbsp;#: name&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; size&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; offset&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; mask_flags</FONT>

<BR><FONT COLOR="#0000FF" FACE="GE Inspira">&nbsp;0: kernel&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0x00300000&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0x00000000&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0</FONT>

<BR><FONT COLOR="#0000FF" FACE="GE Inspira">&nbsp;1: database&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0x0fc00000&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0x00300000&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0</FONT>
</P>

<P><FONT COLOR="#0000FF" FACE="GE Inspira">active partition: nand0,0 - (kernel) 0x00300000 @ 0x00000000</FONT>
</P>

<P><FONT COLOR="#0000FF" FACE="GE Inspira">defaults:</FONT>

<BR><FONT COLOR="#0000FF" FACE="GE Inspira">mtdids&nbsp; : nand0=micron</FONT>

<BR><FONT COLOR="#0000FF" FACE="GE Inspira">mtdparts: mtdparts=micron:3m(kernel),252m(database)</FONT>

<BR><FONT COLOR="#0000FF" FACE="GE Inspira">-&gt;</FONT>
</P>

<P><FONT FACE="GE Inspira">However, when booting linux, after the MMU enabled, accessing the NAND flash became fail, here is the screen dump:</FONT>
</P>

<P><FONT COLOR="#0000FF" FACE="GE Inspira">Calling initcall 0xc02d7d06: m54452poc_nand_init+0x0/0x1ba()</FONT>

<BR><FONT COLOR="#0000FF" FACE="GE Inspira">&nbsp;paddr=0x0,vaddr=0xe0000000,retaddr=0xe0000000</FONT>

<BR><FONT COLOR="#0000FF" FACE="GE Inspira">pa=0x1cb9 va=0xe0000000</FONT>

<BR><FONT COLOR="#0000FF" FACE="GE Inspira">Searching for NAND flash...</FONT>

<BR><FONT COLOR="#FF0000" FACE="GE Inspira">maf_id=ff dev_id=0x000000ff, &amp;type=00000000</FONT>

<BR><FONT COLOR="#FF0000" FACE="GE Inspira">No NAND device found!!!</FONT>

<BR><FONT COLOR="#0000FF" FACE="GE Inspira">ColdFire-eDMA: initialized successfully</FONT>

<BR><FONT COLOR="#0000FF" FACE="GE Inspira">Slab corruption: size-512 start=c3f702c8, len=512</FONT>

<BR><FONT COLOR="#0000FF" FACE="GE Inspira">000: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00</FONT>

<BR><FONT COLOR="#0000FF" FACE="GE Inspira">010: 00 00 00 00 00 00 00 00 00 00 00 01 c3 f7 02 e4</FONT>

<BR><FONT COLOR="#0000FF" FACE="GE Inspira">020: c3 f7 02 e4 00 00 00 00 00 00 00 00 c0 28 56 04</FONT>

<BR><FONT COLOR="#0000FF" FACE="GE Inspira">030: 00 00 00 00 c3 f7 02 fc c3 f7 02 fc 00 00 00 00</FONT>

<BR><FONT COLOR="#0000FF" FACE="GE Inspira">040: c0 2c 3e 44 c3 f7 03 0c c3 f7 03 0c 0f e0 00 01</FONT>

<BR><FONT COLOR="#0000FF" FACE="GE Inspira">050: 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00 00</FONT>

<BR><FONT COLOR="#0000FF" FACE="GE Inspira">Prev obj: start=c3f700c8, len=512</FONT>

<BR><FONT COLOR="#0000FF" FACE="GE Inspira">000: 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b</FONT>

<BR><FONT COLOR="#0000FF" FACE="GE Inspira">010: 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b</FONT>

<BR><FONT COLOR="#0000FF" FACE="GE Inspira">Next obj: start=c3f704c8, len=512</FONT>

<BR><FONT COLOR="#0000FF" FACE="GE Inspira">000: 00 00 00 07 00 00 00 00 00 00 00 00 00 00 00 00</FONT>

<BR><FONT COLOR="#0000FF" FACE="GE Inspira">010: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00</FONT>

<BR><FONT COLOR="#0000FF" FACE="GE Inspira">SPI: Coldfire master initialized</FONT>

<BR><FONT COLOR="#0000FF" FACE="GE Inspira">ssi_audio: Probed successfully</FONT>

<BR><FONT COLOR="#0000FF" FACE="GE Inspira">Initializing USB Mass Storage driver...</FONT>

<BR><FONT COLOR="#0000FF" FACE="GE Inspira">usbcore: registered new interface driver usb-storage</FONT>

<BR><FONT COLOR="#0000FF" FACE="GE Inspira">USB Mass Storage support registered.</FONT>

<BR><FONT COLOR="#0000FF" FACE="GE Inspira">mice: PS/2 mouse device common for all mice</FONT>

<BR><FONT COLOR="#0000FF" FACE="GE Inspira">DES &amp; 3DES ColdFire CAU driver v0.01 registered.</FONT>

<BR><FONT COLOR="#0000FF" FACE="GE Inspira">AES ColdFire CAU driver v0.01 registered.</FONT>

<BR><FONT COLOR="#0000FF" FACE="GE Inspira">MD5 ColdFire CAU driver v0.01 registered.</FONT>

<BR><FONT COLOR="#0000FF" FACE="GE Inspira">SHA1 ColdFire CAU driver v0.01 registered.</FONT>

<BR><FONT COLOR="#0000FF" FACE="GE Inspira">usbcore: registered new interface driver usbhid</FONT>

<BR><FONT COLOR="#0000FF" FACE="GE Inspira">drivers/hid/usbhid/hid-core.c: v2.6:USB HID core driver</FONT>

<BR><FONT COLOR="#0000FF" FACE="GE Inspira">TCP cubic registered</FONT>

<BR><FONT COLOR="#0000FF" FACE="GE Inspira">NET: Registered protocol family 1</FONT>

<BR><FONT COLOR="#0000FF" FACE="GE Inspira">NET: Registered protocol family 17</FONT>

<BR><FONT COLOR="#0000FF" FACE="GE Inspira">NET: Registered protocol family 15</FONT>

<BR><FONT COLOR="#0000FF" FACE="GE Inspira">do_initcalls() okay</FONT>

<BR><FONT COLOR="#0000FF" FACE="GE Inspira">Root-NFS: No NFS server available, giving up.</FONT>

<BR><FONT COLOR="#0000FF" FACE="GE Inspira">VFS: Unable to mount root fs via NFS, trying floppy.</FONT>

<BR><FONT COLOR="#0000FF" FACE="GE Inspira">List of all partitions:</FONT>

<BR><FONT COLOR="#0000FF" FACE="GE Inspira">No filesystem could mount root, tried:&nbsp; jffs2</FONT>

<BR><FONT COLOR="#FF0000" FACE="GE Inspira">Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(2,0)</FONT>
</P>

<P><FONT FACE="GE Inspira">With logic analyser, we see that Bus CS/WE/RE signals are as long as 1ms, and some address line is not as expected. (The clock is fine according to osscilliscope.)</FONT></P>

<P><FONT FACE="SimSun" SIZE=2 COLOR="#000000">
<IMG SRC="No%20AttachName" alt="Picture (Metafile)"></FONT>
</P>

<P><FONT FACE="GE Inspira">Look into my driver codes, I use the virtual address (0xe0000000) applied from ioremap() kernel function.</FONT>
</P>

<P><FONT FACE="GE Inspira">136&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /* map physical address */</FONT>

<BR><FONT FACE="GE Inspira">137&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; this-&gt;IO_ADDR_R = this-&gt;IO_ADDR_W = ioremap(0x00000000, 1024);</FONT>

<BR><FONT FACE="GE Inspira">138&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (!this-&gt;IO_ADDR_R) {</FONT>

<BR><FONT FACE="GE Inspira">139&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; printk(KERN_WARNING &quot;ioremap micron NAND @0x00000000 failed\n&quot;);</FONT>

<BR><FONT FACE="GE Inspira">140&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; err = -EIO;</FONT>

<BR><FONT FACE="GE Inspira">141&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; goto out_mtd;</FONT>

<BR><FONT FACE="GE Inspira">142&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</FONT>
</P>

<P><FONT FACE="GE Inspira">157&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /* write byte to flexbus */</FONT>

<BR><FONT FACE="GE Inspira">158&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; *((volatile u8 *)(this-&gt;IO_ADDR_W)) = 0xDD;</FONT>
</P>

<P><FONT FACE="GE Inspira">I printed the regs value for the MMU at line 158:</FONT>

<BR><FONT FACE="GE Inspira">MMUCR: 00000001</FONT>

<BR><FONT FACE="GE Inspira">MMUOR: 00240000</FONT>

<BR><FONT FACE="GE Inspira">MMUSR: 00000000</FONT>

<BR><FONT FACE="GE Inspira">MMUAR: E0000000</FONT>

<BR><FONT FACE="GE Inspira">MMUTR: E0000003</FONT>

<BR><FONT FACE="GE Inspira">MMUDR: 000002BC</FONT>
</P>

<P><FONT FACE="GE Inspira">Looking at the MMU regs, it looks right for read and write access pessmission. But CS signal should not be that long and ALE singal should be zero as it is the bit 0 of address (0x00000000)!!! </FONT></P>

<P><FONT FACE="GE Inspira">Anyone have an idea?</FONT>
</P>

<P><FONT FACE="GE Inspira">Thanks,</FONT>

<BR><B><SPAN LANG="en-gb"><FONT SIZE=2 FACE="Arial">Mike Qin</FONT></SPAN></B>
</P>
<BR>

</BODY>
</HTML>