Port ok6410 uboot nandflash

Source: Internet
Author: User

Port ok6410 uboot nandflash
1.4 Nandflash Port

First, solve the preceding error and modify arch/arm/cpu/arm1176/cloud64xx/timer. c.

Static ulong timer_load_val; change to DECLARE_GLOBAL_DATA_PTR;

Delete the following two definitions:

/* Internal tick units */

/* Last decremneter snapshot */

Static unsigned long lastdec;

/* Monotonic incrementing timer */

Static unsigned long timestamp;

Next we will:

Timers-> Tsung 0 = PRESCALER <8;

If (timer_load_val = 0 ){

Timer_load_val = get_PCLK ()/PRESCALER * (100/4);/* 100 s */

Timers-> TCFG1 = (timers-> TCFG1 &~ 0xf0000) | 0x20000;

}

To:

Timers-> Tsung 0 = PRESCALER <8;

 

Gd-> timer_rate_hz = get_PCLK ()/PRESCALER * (100/4);/* 100 s */

Timers-> TCFG1 = (timers-> TCFG1 &~ 0xf0000) | 0x20000;

Change lastdec = timers-> TCNTB4 = timer_load_val;:

Gd-> lastinc = timers-> TCNTB4 = gd-> timer_rate_hz;

Change timestamp = 0; to gd-> timer_reset_value = 0;

Unsigned long get_ticks (void)

{

Ulong now = read_timer ();

 

If (lastdec> = now ){

/* Normal mode */

Timestamp + = lastdec-now;

} Else {

/* We have anoverflow ...*/

Timestamp + = lastdec + timer_load_val-now;

}

Lastdec = now;

 

Return timestamp;

}

To:

Unsigned long get_ticks (void)

{

Ulong now = read_timer ();

 

If (gd-> lastinc> = now ){

/* Normal mode */

Gd-> timer_reset_value + = gd-> lastinc-now;

} Else {

/* We have anoverflow ...*/

Gd-> timer_reset_value + = gd-> lastinc + gd-> timer_rate_hz-now;

}

Gd-> lastinc = now;

 

Returngd-> timer_reset_value;

}

Convert ulong get_tbclk (void)

{

/* We overwriting in 100 s */

Return (ulong) (timer_load_val/100 );

}

 

Ulong get_timer_masked (void)

{

Unsigned long res = get_ticks ();

Do_div (res, (timer_load_val/(100 * CONFIG_SYS_HZ )));

Return res;

}

To:

Ulong get_tbclk (void)

{

/* We overwriting in 100 s */

Return (ulong) (gd-> timer_rate_hz/100 );

}

 

Ulong get_timer_masked (void)

{

Unsigned long res = get_ticks ();

// Do_div (res, (timer_load_val/(100 * CONFIG_SYS_HZ )));

Return res;

}

Modify nand_spl/board/samsung/ok6410/ok6410_nand_spl.c

Void board_init_f (unsigned long bootflag)

{

Relocate_code (CONFIG_SYS_TEXT_BASE-TOTAL_MALLOC_LEN, NULL,

CONFIG_SYS_TEXT_BASE );

}

Changed:

Void board_init_f (unsigned long bootflag)

{

Relocate_code (8*1024, NULL,

CONFIG_SYS_TEXT_BASE );

}

Modify the configuration size of bl1: nand_spl/board/samsung/ok6410/config. mk

# PAD_TO used to generate a 4 kByte binary needed for the combined image

#-> PAD_TO = maid + 4096

PAD_TO: = $ (shell expr $ [$ (CONFIG_SYS_TEXT_BASE) + 4096])

Change

# PAD_TO used to generate a 8 kByte binary needed for the combined image

#-> PAD_TO = maid + 8192

PAD_TO: = $ (shell expr $ (CONFIG_SYS_TEXT_BASE) + 8192)

Re-compile and burn:

 

The Nandflash initialization process is as follows:

Board_init_r à nand _ init à nand _ init_chip à board _ nand_init à nand _ scan à

Nand_scan_ident à nand _ scan_tail à nand _ register

The connected arrays nand_flash_ids [] and nand_manuf_ids [] are defined in the drivers/mtd/nand/nand_ids.c file.

Add the ok6410 nandflash model:

/* 16 Gigabit */

{NAND 2GiB 1, 8V8-bit, 0xA5, 0, 2048, 0, LP_OPTIONS },

{NAND 2GiB 3, 3V8-bit, 0xD5, 0, 2048, 0, LP_OPTIONS },

{NAND 2GiB 3, 3V8-bit, 0x38,409 6, 2048,4096*128, LP_OPTIONS },

{NAND 2GiB 1, 8V16-bit, 0xB5, 0, 2048, 0, LP_OPTIONS16 },

{NAND 2GiB 3, 3V16-bit, 0xC5, 0, 2048, 0, LP_OPTIONS16 },

The meaning of each field is as follows: note that IDcode needs to be tested by yourself.

Name. ID code, pagesize, chipsize in MegaByte, eraseblock size, options

Re-compile and burn:


Here nandflash uses 4-bit ecc verification. If you are interested, you can implement 8-bit ecc verification by yourself. 6410 supports 8-bit ecc.

 

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.