Hmm, that's still seems to be lots of work...
I think you have a good head start in the patch I've supplied. It's probably a day's work or so.
How could you do the porting without a schematic? Just looking to the sources? I tried to get one from Karo, but no chance!!
Ha - yes, we've asked about schematics before, but no luck which seems odd given that Karo probably just based their design on a Freescale reference.
Anyway, the RedBoot sources have everything you need in them, and the linux board file have some of the pin configurations, though these will be the same across the TX53 module I think. Specifically though I didn't actually reverse engineer the RedBoot code - I took the flash header in one chunk and made sure it was identical. This header sets up the essential peripheral pins, clocks and timings, so you don't have to do much after that.
Must the binary for the NAND flash have a defined format or header to work correctly?
To boot from NAND, yes. The format is given in the i.MX53 Reference Manual. Again though, I took flash_header.S from the RedBoot sources and patched it into uBoot, replacing the flash header provided by Freescale for their boards. If you compare flash_header.S from my patch to the similar file packages/hal/arm/mx53/karo/current/include/hal_platform_setup.h you'll see what I mean.
# U-Boot is executed from NAND or DDR? In other words, is u-boot copied from NAND to DDR and then executed from DDR?
DDR. It is copied from NAND into the DDR by the i.MX53 ROM boot loader which uses the header block on the NAND image to determine what and how much to copy, as well as the DDR controller register values to setup the RAM prior to that.
# If U-Boot is executed from NAND and the i.MX53 QSB boot loader uses the same UART as the TX53, shouldn't u-boot display at least some messages on the uart, even if no adoptations has been done? The i.MX53 QSB board seems to be very similar to the TX53-1331.
The NAND header block contains critical DDR timings and clock setup. So if the NAND header block is wrong/bad, you won't see anything. If you undefine CONFIG_FLASH_HEADER and define SKIP_LOW_LEVEL_INIT in uBoot, you can build a uBoot without the NAND header which you can load into memory and use 'go' from RedBoot to execute. If that doesn't display anything, your uBoot is definitely bad and needs fixing. That said, I think the TX53-1331 and 8020/30 are the same in this respect, so it might just work with my patch.
Checking over my changes again, to get the NAND header right, I think you probably need to start by updating include/configs/tx53.h, using TX53-1x31.ecc from the RedBoot sources for guidance. Specifically I think you need to change least these defines to these values:
- CPU_CLOCK 1000
- CONFIG_TX53_SDRAM_TYPE DDR3 /* same as 8030 */
- CONFIG_SYS_PLL2_FREQ 333 /* same as 8030 */
- PHYS_SDRAM_1_SIZE (1024 * 1024 * 1024)
After that, if you build uBoot.bin and open it in a hex editor (okteta is my favourite) you should see 'FCB' in bytes 4-6, followed by some magic numbers and lots of blanks. If you compare that to a RedBoot image for your module, it should be much the same. If it isn't, recheck the values you've configured.
It's also possible to use the hex editor to copy values from the RedBoot binary to the uBoot one, although beware that there are a couple of values that should differ e.g. image_len.
Mike