Tiny210 (s5pv210) Port U-boot (based on version 2014.4) -- NAND boot

Source: Internet
Author: User
Tags spl

We know that s5pv210 can be started in many ways. SD card and NAND flash can be started in two ways. The previous steps are based on SD card boot. In this section, we start to start from nand flash:

To start U-boot from NAND, BL1 needs to initialize the NAND controller, and then copy bl2 to DDR memory from NAND. Here BL1 is our transplanted u-boot-spl.bin, bl2 is our transplanted u-boot.bin. The NAND driver in the u-boot.bin is relatively large, it contains a lot of functionality, and the u-boot-spl.bin only needs to copy from the NAND bl2 to DDR on the line, so we can initialize the simple NAND controller in the u-boot-spl.bin, and then use the NAND copy function provided by Samsung with 8-bit hardware ECC to copy the u-boot.bin to the DDR memory. We modify the copy_bl2_to_ram function in board/Samsung/tiny210/tiny210.c. In this function, we first determine whether to start from the SD card or from the NAND. If the function is to start from the NAND, We Will initialize the NAND, then copy bl2 to DDR memory from NAND. If it is started from the SD card, copy bl2 to DDR memory from the SD card. We can read the OMR register to determine the device from which s5pv210 is currently started. Refer to Table 6-3. The OM Register address is not mentioned in the manual. I am referring to the U-Boot Code of Samsung manufacturer. Detailed comments are provided in the Code. For details, see the code:

Void copy_bl2_to_ram (void) {/*** CH: Channel ** SB: starting block ** BS: block size ** DST: Destination ** I: initialize */# define copysdmmctomem (CH, Sb, BS, DST, I) (u8 (*) (INT, u32, unsigned short, u32 *, u8 )) (* (u32 *) 0xd0037f98) (CH, Sb, BS, DST, I) # define mp0_1con (* (volatile u32 *) 0xe02002e0) # definemp0_3con (* (volatile u32 *) 0xe0200320) # define (* (volatile u32 *) 0xe0200380) # define nf8_readpage_adv (A, B, C) (INT (*) (u32, u32, U8 *) (* (u32 *) 0xd0037f90) (a, B, c) u32 bl2size = 250*1024; // 250ku32 om = * (volatile u32 *) (0xe0000004); // om registerom & = 0x1f; // lower 5-bit if (OM = 0x2) // NAND 2 kb, 5 cycle 8-bit ECC {u32 CFG = 0; struct s5pv210_nand * nand_reg = (struct s5pv210_nand *) (struct s5pv210_nand *) samsung_get_base_nand (); /* initialize hardware * // * hclk_psys = 133 MHz (7.5ns) */CFG = (0x1 <23) |/* disable 1-bit and 4-bit EC C * // * the following three time parameters are slightly larger than the calculated values (I add 1 here), otherwise the read/write is unstable */(0x3 <12) |/* 7.5ns * 2> 12ns TALs tcls */(0x2 <8) |/* (1 + 1) * 7.5ns> 12ns (TWP) */(0x1 <4) |/* (0 + 1) * 7.5> 5ns (tclh/talh) */(0x0 <3) |/* slc nand Flash */(0x0 <2) |/* 2 Kbytes/page */(0x1 <1 ); /* 5 address cycle */writel (CFG, & nand_reg-> nfconf); writel (0x1 <1) | (0x1 <0 ), & nand_reg-> nfcont);/* disable chip select and enable NAND F Lash controller * // * config gpio */mp0_1con & = ~ (0 xFFFF <8); mp0_1con | = (0x3333 <8); mp0_3con = 0x22222222; mp0_6con = 0x22222222; int I = 0; int pages = bl2size/2048; // Number of pages int offset = 0X4000/2048; // u-boot.bin offset address in NAND (page address) u8 * P = (u8 *) config_sys_sdram_base; for (; I <pages; I ++, P ++ = 2048, offset + = 1) nf8_readpage_adv (offset/64, offset % 64, p );} else if (OM = 0xc) // SD/MMC {u32 v210_sdmmc_base = * (volatile u32 *) (0xd0037488); // v210_sdmmc_baseu8 CH = 0; /* refer to s5pv210 manual 7.9.1 SD/MMC register map */If (v210_sdmmc_base = 0xeb000000) // channel 0ch = 0; else if (v210_sdmmc_base = 0xeb200000) // channel 2ch = 2; copysdmmctomem (CH, 32, bl2size/512, (u32 *) config_sys_sdram_base, 0 );}}

Recompile, but before compile, add the header file for NAND: # include <ASM/ARCH/nand_reg.h> successfully generated SPL/tiny210-spl.bin and u-boot.bin, copy them all to the TFTP Server Directory, then you can use the transplanted U-boot in the previous section to burn the latest U-boot to NAND Flash.

Start the development board from the SD card and erase the entire nand flash:


Use tftpboot to download the tiny210-spl.bin to the DDR starting address 0x20000000


Burn write tiny210-spl.bin to NAND 0 address:


Use tftpboot to download the u-boot.bin to the DDR starting address 0x20000000


Burn the u-boot.bin to the 0X4000 address of NAND Flash (0x0 ~ 0x3 fff reserved for tiny210-spl.bin)


The dial switch is switched. From the NAND boot Development Board, we can see that U-boot is started normally. Now our U-boot function is basically implemented. I put the code here, interested friends can look at: tiny210_u-boot_201404_v2.0, then we will be able to complete the code and functions.



Tiny210 (s5pv210) Port U-boot (based on version 2014.4) -- NAND boot

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.