xref: /rk3399_rockchip-uboot/board/davinci/da8xxevm/README.da850 (revision daa483debea9596f23f5869f7623cec1ef761718)
195a372b8STom RiniSummary
295a372b8STom Rini=======
395a372b8STom RiniThe README is for the boot procedure used for various DA850 (or compatible
495a372b8STom Riniparts such as the AM1808) based boards.
595a372b8STom Rini
695a372b8STom RiniIn the context of U-Boot, the board is booted in three stages. The initial
795a372b8STom Rinibootloader which executes upon reset is the ROM Boot Loader (RBL) and sits
895a372b8STom Riniin the internal ROM. The RBL initializes the internal memory and then
995a372b8STom Rinidepending on the exact board and pin configurations will initialize another
1095a372b8STom Rinicontroller (such as SPI or NAND) to continue the boot process by loading
1195a372b8STom Rinithe secondary program loader (SPL).  The SPL will initialize the system
1295a372b8STom Rinifurther (some clocks, SDRAM) and then load the full u-boot from a
1395a372b8STom Rinipredefined location in persistent storage to DDR and jumps to the u-boot
1495a372b8STom Rinientry point.
1595a372b8STom Rini
1695a372b8STom RiniAIS is an image format defined by TI for the images that are to be loaded
1795a372b8STom Rinito memory by the RBL. The image is divided into a series of sections and
1895a372b8STom Rinithe image's entry point is specified. Each section comes with meta data
1995a372b8STom Rinilike the target address the section is to be copied to and the size of the
2095a372b8STom Rinisection, which is used by the RBL to load the image. At the end of the
2195a372b8STom Riniimage the RBL jumps to the image entry point.  The AIS format allows for
2295a372b8STom Riniother things such as programming the clocks and SDRAM if the header is
2395a372b8STom Riniprogrammed for it.  We do not take advantage of this and instead use SPL as
2495a372b8STom Riniit allows for additional flexibility (run-time detect of board revision,
2595a372b8STom Riniloading the next image from a different media, etc).
2695a372b8STom Rini
2795a372b8STom Rini
2895a372b8STom RiniCompilation
2995a372b8STom Rini===========
3095a372b8STom RiniThe exact build target you need will depend on the board you have.  For
3195a372b8STom RiniLogic PD boards, or other boards which store the ethernet MAC address at
3295a372b8STom Rinithe end of SPI flash, run 'make da850evm'.  For boards which store the
3395a372b8STom Riniethernet MAC address in the i2c EEPROM located at 0x50, run
3495a372b8STom Rini'make da850_am18xxevm'.  Once this build completes you will have a
3595a372b8STom Riniu-boot.ais file that needs to be written to the correct persistent
3695a372b8STom Rinistorage.
3795a372b8STom Rini
3895a372b8STom Rini
3995a372b8STom RiniFlashing the images to SPI
4095a372b8STom Rini==========================
4195a372b8STom RiniThe AIS image can be written to SPI flash using the following commands.
4295a372b8STom RiniAssuming that the network is configured and enabled and the u-boot.ais file
4395a372b8STom Riniis tftp'able.
4495a372b8STom Rini
4595a372b8STom RiniU-Boot > sf probe 0
4695a372b8STom RiniU-Boot > sf erase 0 +320000
4795a372b8STom RiniU-Boot > tftp u-boot.ais
4895a372b8STom RiniU-Boot > sf write c0700000 0 $filesize
4995a372b8STom Rini
50*daa483deSahaslam@baylibre.comFlashing the images to NAND
51*daa483deSahaslam@baylibre.com===========================
52*daa483deSahaslam@baylibre.comThe AIS image can be written to NAND using the u-boot "nand" commands.
53*daa483deSahaslam@baylibre.com
54*daa483deSahaslam@baylibre.comExample:
55*daa483deSahaslam@baylibre.com
56*daa483deSahaslam@baylibre.comOMAPL138_LCDK requires the AIS image to be written to the second block of
57*daa483deSahaslam@baylibre.comthe NAND flash.
58*daa483deSahaslam@baylibre.com
59*daa483deSahaslam@baylibre.comFrom the "nand info" command we see that the second block would start at
60*daa483deSahaslam@baylibre.comoffset 0x20000:
61*daa483deSahaslam@baylibre.com
62*daa483deSahaslam@baylibre.com  U-Boot > nand info
63*daa483deSahaslam@baylibre.com      sector size      128 KiB (0x20000)
64*daa483deSahaslam@baylibre.com      Page size       2048 b
65*daa483deSahaslam@baylibre.com
66*daa483deSahaslam@baylibre.comFrom the tftp command we see that we need to copy 0x74908 bytes from
67*daa483deSahaslam@baylibre.commemory address 0xc0700000 (0x75000 if we align a page of 2048):
68*daa483deSahaslam@baylibre.com
69*daa483deSahaslam@baylibre.com  U-Boot > tftp u-boot.ais
70*daa483deSahaslam@baylibre.com      Load address: 0xc0700000
71*daa483deSahaslam@baylibre.com      Bytes transferred = 477448 (74908 hex)
72*daa483deSahaslam@baylibre.com
73*daa483deSahaslam@baylibre.comThe commands to write the image from memory to NAND would be:
74*daa483deSahaslam@baylibre.com
75*daa483deSahaslam@baylibre.com  U-Boot > nand erase 0x20000 0x75000
76*daa483deSahaslam@baylibre.com  U-Boot > nand write 0xc0700000 0x20000 0x75000
77*daa483deSahaslam@baylibre.com
78*daa483deSahaslam@baylibre.comAlternatively, MTD partitions may be defined. Using "mtdparts" to
79*daa483deSahaslam@baylibre.comconveniently have a bootloader partition starting at the second block
80*daa483deSahaslam@baylibre.com(offset 0x20000):
81*daa483deSahaslam@baylibre.com
82*daa483deSahaslam@baylibre.com  setenv mtdids nand0=davinci_nand.0
83*daa483deSahaslam@baylibre.com  setenv mtdparts mtdparts=davinci_nand.0:128k(bootenv),2m(bootloader)
84*daa483deSahaslam@baylibre.com
85*daa483deSahaslam@baylibre.comIn this case the commands would be simplified to:
86*daa483deSahaslam@baylibre.com
87*daa483deSahaslam@baylibre.com  U-Boot > tftp u-boot.ais
88*daa483deSahaslam@baylibre.com  U-Boot > nand erase.part bootloader
89*daa483deSahaslam@baylibre.com  U-Boot > nand write 0xc0700000 bootloader
90*daa483deSahaslam@baylibre.com
914aac44beSahaslam@baylibre.comFlashing the images to MMC
924aac44beSahaslam@baylibre.com==========================
934aac44beSahaslam@baylibre.comIf the boot pins are set to boot from mmc, the RBL will try to load the
944aac44beSahaslam@baylibre.comnext boot stage form the first couple of sectors of an external mmc card.
954aac44beSahaslam@baylibre.comAs sector 0 is usually used for storing the partition information, the
964aac44beSahaslam@baylibre.comAIS image should be written at least after the first sector, but before the
974aac44beSahaslam@baylibre.comfirst partition begins. (e.g: make sure to leave at least 500KB of unallocated
984aac44beSahaslam@baylibre.comspace at the start of the mmc when creating the partitions)
994aac44beSahaslam@baylibre.com
1004aac44beSahaslam@baylibre.comCONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR is used by SPL, and should
1014aac44beSahaslam@baylibre.compoint to the sector were the u-boot image is located. (eg. After SPL)
1024aac44beSahaslam@baylibre.com
1034aac44beSahaslam@baylibre.comThere are 2 ways to copy the AIS image to the mmc card:
1044aac44beSahaslam@baylibre.com
1054aac44beSahaslam@baylibre.com 1 - Using the TI tool "uflash"
1064aac44beSahaslam@baylibre.com	$ uflash -d /dev/mmcblk0  -b ./u-boot.ais -p OMAPL138  -vv
1074aac44beSahaslam@baylibre.com
1084aac44beSahaslam@baylibre.com 2 - using the "dd" command
1094aac44beSahaslam@baylibre.com	$ dd if=u-boot.ais of=/dev/mmcblk0 seek=117 bs=512 conv=fsync
1104aac44beSahaslam@baylibre.com
1114aac44beSahaslam@baylibre.comuflash writes the AIS image at offset 117. For compatibility with uflash,
1124aac44beSahaslam@baylibre.comCONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR is set to take into account this
1134aac44beSahaslam@baylibre.comoffset, and the dd command is adjusted accordingly.
11495a372b8STom Rini
11595a372b8STom RiniRecovery
11695a372b8STom Rini========
11795a372b8STom Rini
11895a372b8STom RiniIn the case of a "bricked" board, you need to use the TI tools found
11995a372b8STom Rinihere[1] to write the u-boot.ais file.  An example of recovering to the SPI
12095a372b8STom Riniflash of an AM1808 would be:
12195a372b8STom Rini
12295a372b8STom Rini$ mono sfh_OMAP-L138.exe -targetType AM1808 -p /dev/ttyUSB0 \
12395a372b8STom Rini	-flash_noubl /path/to/u-boot.ais
12495a372b8STom Rini
12595a372b8STom RiniFor other target types and flash locations:
12695a372b8STom Rini
12795a372b8STom Rini$ mono sfh_OMAP-L138.exe -h
12895a372b8STom Rini
12995a372b8STom RiniLinks
13095a372b8STom Rini=====
13195a372b8STom Rini[1]
13295a372b8STom Rini http://processors.wiki.ti.com/index.php/Serial_Boot_and_Flash_Loading_Utility_for_OMAP-L138
133