[Letux-kernel] gta04 - reading nand from u-boot
Josua Mayer
josua.mayer at jm0.eu
Sat Jul 21 14:18:01 CEST 2018
Hi Nikolaus,
Am 21.07.2018 um 13:56 schrieb H. Nikolaus Schaller:
> Hi Josua,
> I have now applied your U-Boot patches and have not found any problems.
great!
>
> Then I tried to read the u-boot environment from Linux, but it fails:
>
> root at letux:~# fw_printenv
If u-boot uses 1-bit ham1 ecc scheme to save environment, and if linux
uses a different, namely bch8,
this won't work will it?
So I checked what the letux-4.17.3 dts does:
&gpmc {
nand at 0,0 {
ti,nand-ecc-opt = "bch8";
};
};
and then near the bottom:
&gpmc {
nand at 0,0 {
ti,nand-ecc-opt = "ham1"; /* stay compatible with our old u-boot
(does not support bch8) */
};
};
So it should work. I don't think we want to upstream setting this to
ham1 though.
I believe we can eventually get our u-boot to use bch8!
(I know SPL has to be written using ham1 for the Boot ROM to understand it)
BUT I noticed duplication!
The first nand section defines all 4 partitions, and then the second
section defines
kernel at 280000 <0x280000 0x600000>
filesystem at a80000 <0x880000 0>
These do *not* match what has been declared earlier!
> Warning: Bad CRC, using default environment
> bootargs=
> bootcmd=bootp; setenv bootargs root=/dev/nfs nfsroot=${serverip}:${rootpath} ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}:${hostname}::off; bootm
> bootdelay=3
> baudrate=115200
> stdin=serial,cros-ec-keyb
> stdout=serial,lcd
> stderr=serial,lcd
> root at letux:~#
>
> Config uses the mtd2 partition and defines the correct size.
>
> root at letux:~# more /etc/fw_env.config
> # Configuration file for fw_(printenv/setenv) utility.
> # Up to two entries are valid, in this case the redundant
> # environment sector is assumed present.
> # MTD device name Device offset Env. size Flash sector size
> /dev/mtd2 0x0000 0x40000 0x40000
> root at letux:~#
>
> And the kernel knows about the correct location:
>
> [ 2.506378] 5 ofpart partitions found on MTD device 4000000.onenand
> [ 2.512908] Creating 5 MTD partitions on "4000000.onenand":
> [ 2.518768] 0x000000000000-0x000000080000 : "X-Loader"
> [ 2.525787] 0x000000080000-0x000000240000 : "U-Boot"
> [ 2.532745] 0x000000240000-0x000000280000 : "U-Boot Env"
> [ 2.540161] 0x000000280000-0x000000880000 : "Kernel"
> [ 2.547332] 0x000000880000-0x000020000000 : "File System"
>
> Note: this is all on GTA04A5 wth OneNAND. And kernel:
>
> root at letux:~# uname -a
> Linux letux 4.16.17-letux+ #2514 SMP PREEMPT Tue Jun 26 00:37:53 CEST 2018 armv7l GNU/Linux
> root at letux:~#
>
> It looks as if reading NAND is completely broken - at least with letux-4.16.17.
>
> root at letux:~# xxd /dev/mtd2 | head -8
> 0000000: ffff ffff ffff ffff ffff ffff ffff ffff ................
> 0000010: ffff ffff ffff ffff ffff ffff ffff ffff ................
> 0000020: ffff ffff ffff ffff ffff ffff ffff ffff ................
> 0000030: ffff ffff ffff ffff ffff ffff ffff ffff ................
> 0000040: ffff ffff ffff ffff ffff ffff ffff ffff ................
> 0000050: ffff ffff ffff ffff ffff ffff ffff ffff ................
> 0000060: ffff ffff ffff ffff ffff ffff ffff ffff ................
> 0000070: ffff ffff ffff ffff ffff ffff ffff ffff ................
> root at letux:~#
>
> Next, I plan to do the same tests on GTA04A4 with NAND and other kernels.
>
> BR,
> Nikolaus
>
> _______________________________________________
> http://projects.goldelico.com/p/gta04-kernel/
> Letux-kernel mailing list
> Letux-kernel at openphoenux.org
> http://lists.goldelico.com/mailman/listinfo.cgi/letux-kernel
More information about the Letux-kernel
mailing list