read NAND / enable serial debugging

Andy Green andy at openmoko.com
Thu Jul 3 10:55:12 CEST 2008


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Somebody in the thread at some point said:
| I write code like this:(can not compile.error message "start_kboot.c:32:
| undefined reference to `ADDR' ")
|
|  >unsigned char buf[824];
|  >#define ADDR  (*(volatile unsigned *)buf)

Thinking about what you're trying to do here, executing code from NAND
will be hard to debug.  If it got the wrong code, you will just crash.

It will be easier to understand what the NAND code is doing if you set
up console serial port now and you can "debug with printf".

I found the minimum low level initialization for s3c24xx serial port in
a patch I wrote a few weeks ago.

First you must enable UART clocks in CLKCON so UARTs can work.  Then
this shows the steps to configure and transmit:

+       /* 8 N 1 */
+       wr_regl(port, S3C2410_ULCON, (rd_regl(port, S3C2410_ULCON)) | 3);
+       /* polling mode */
+       wr_regl(port, S3C2410_UCON, (rd_regl(port, S3C2410_UCON) &
~0xc0f) | 5);
+       /* disable FIFO */
+       wr_regl(port, S3C2410_UFCON, (rd_regl(port, S3C2410_UFCON) &
~0x01));
+       /* fix baud rate */
+       wr_regl(port, S3C2410_UBRDIV, 26);
+
+       while (*sz) {
+               int timeout = 10000000;
+
+               /* spin on it being busy */
+               while ((!(rd_regl(port, S3C2410_UTRSTAT) & 2)) && timeout--)
+                       ;
+
+               /* transmit register */
+               wr_regl(port, S3C2410_UTXH, *sz);
+
+               sz++;
+       }

- -Andy
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org

iEYEARECAAYFAkhsk+kACgkQOjLpvpq7dMrrSwCfSe3a7UDBz4GAdDbXkBYpXWqh
V5oAn1hnA7aM3Eex5kCkmBUeqnEIwb0P
=OR+l
-----END PGP SIGNATURE-----




More information about the openmoko-kernel mailing list