ok6410 uboot nandflash移植
2015-07-07 15:22
435 查看
1.4 Nandflash移植
先解决上面的错误,修改arch/arm/cpu/arm1176/s3c64xx/timer.cstatic ulong timer_load_val;修改为 DECLARE_GLOBAL_DATA_PTR;
删除下面的两个定义:
/* Internal tick units */
/* Last decremneter snapshot */
static unsigned long lastdec;
/* Monotonic incrementing timer */
static unsigned long long timestamp;
接着把:
timers->TCFG0 =PRESCALER << 8;
if (timer_load_val == 0) {
timer_load_val =get_PCLK() / PRESCALER * (100 / 4); /* 100s */
timers->TCFG1 =(timers->TCFG1 & ~0xf0000) | 0x20000;
}
修改为:
timers->TCFG0 =PRESCALER << 8;
gd->timer_rate_hz =get_PCLK() / PRESCALER * (100 / 4); /* 100s */
timers->TCFG1 = (timers->TCFG1& ~0xf0000) | 0x20000;
将lastdec = timers->TCNTB4 = timer_load_val;修改为:
gd->lastinc = timers->TCNTB4 = gd->timer_rate_hz;
将timestamp = 0;修改为gd->timer_reset_value = 0;
将unsigned long 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;
}
修改为:
unsigned long 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;
}
将ulong get_tbclk(void)
{
/* We overrun in 100s */
return(ulong)(timer_load_val / 100);
}
ulong get_timer_masked(void)
{
unsigned long long res =get_ticks();
do_div (res,(timer_load_val / (100 * CONFIG_SYS_HZ)));
return res;
}
修改为:
ulong get_tbclk(void)
{
/* We overrun in 100s */
return(ulong)(gd->timer_rate_hz / 100);
}
ulong get_timer_masked(void)
{
unsigned long long res =get_ticks();
//do_div (res,(timer_load_val / (100 * CONFIG_SYS_HZ)));
return res;
}
修改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);
}
改为:
void board_init_f(unsigned long bootflag)
{
relocate_code(8*1024,NULL,
CONFIG_SYS_TEXT_BASE);
}
修改bl1的配置大小:nand_spl/board/samsung/ok6410/config.mk
# PAD_TO used to generate a 4kByte binary needed for the combined image
# -> PAD_TO = CONFIG_SYS_TEXT_BASE + 4096
PAD_TO := $(shell expr$$[$(CONFIG_SYS_TEXT_BASE) + 4096])
修改为
# PAD_TO used to generate a 8kByte binary needed for the combined image
# -> PAD_TO = CONFIG_SYS_TEXT_BASE + 8192
PAD_TO := $(shell expr$(CONFIG_SYS_TEXT_BASE) + 8192)
重新编译烧写:
Nandflash的初始化过程如下:
board_init_rànand_initànand_init_chipàboard_nand_initànand_scanà
nand_scan_identànand_scan_tailànand_register
在drivers/mtd/nand/nand_ids.c文件中定义了连个数组:nand_flash_ids[]和nand_manuf_ids[]。
添加ok6410 nandflash型号:
/* 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, 4096, 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},
每个字段的含义如下:注意 IDcode需要自己测。
Name. ID code, pagesize, chipsize in MegaByte, eraseblock size, options
重新编译烧写:
这里nandflash是使用的4位ecc校验,有兴趣的可以自己实现8位ecc校验,6410是支持8位ecc的。
相关文章推荐
- 【Java】编写一个方法,将字符串中的空格全部替换为“ ”
- flex 跨域访问 #2048: 安全沙箱冲突 问题解决方法
- C语言学习笔记:19_数组-字符数组与字符串(常用字符串函数)
- MySQL详解-------数据库备份和还原
- tomcat 与 WebLogic 的区别
- 开发者关心的那些事
- STL(标准模板库)理论基础,容器,迭代器,算法
- STL(标准模板库)理论基础,容器,迭代器,算法
- linux系统中ffmpeg安装配置步骤
- The import javax.servlet cannot be resolved
- CentOS6.5安装VMwareTools
- Dubbo管理员指南
- 总结群里讨论的关于浮点数,如何四舍五入保留两位小数的处理方式
- Null Pointer --设计模式
- 【FaceBook】程序猿提高工作效率的15点技巧
- leetcode 203:Remove Linked List Elements
- Big Event in HDU
- 如何做一个快速运转的大规模网络开发公司
- java取得合并单元格的属性
- Null Pointer --设计模式