u-boot-2011.06在mini2440上的移植之Nor flash支持
2012-05-03 22:28
477 查看
转载请注明出处http://blog.csdn.net/cneozhang/article/details/6693764,如有任何疑问,欢迎交流学习。
源码可以到我的git仓库下载:
[plain]
view plaincopyprint?
git clone git://github.com/cneozhang/u-boot-2011.06-cneo.git
二、关于SST39LV1601 flash的一些特性:
重要需要了解的是,这款Nor flash兼容JEDEC接口方式,对于U-BOOT来说,如果直接定义成CFI接口方式的话,操作命令过程中,flash不能unlock。
FEATURES:
size: 1M x 16bit
sector:2KWord / sector
block: 32Kword / sector
Product identification
Software command sequence
三、更改代码:
1、更改include/configs/mini2440.h中关于nor flash的配置:
[cpp]
view plaincopyprint?
/*-----------------------------------------------------------------------
* FLASH and environment organization
*/
#define CONFIG_SYS_FLASH_CFI
#define CONFIG_FLASH_CFI_DRIVER
#define CONFIG_FLASH_CFI_LEGACY
#define CONFIG_SYS_FLASH_LEGACY_1024Kx16
#define CONFIG_FLASH_SHOW_PROGRESS 45
#define CONFIG_FLASH_CFI_MTD
#define CONFIG_SYS_MAX_FLASH_BANKS 1
#define CONFIG_SYS_FLASH_BANKS_LIST { CONFIG_SYS_FLASH_BASE }
#define CONFIG_SYS_MAX_FLASH_SECT (512)
#define CONFIG_ENV_ADDR (CONFIG_SYS_FLASH_BASE + 0x1f0000) /* at the end block */
#define CONFIG_ENV_IS_IN_FLASH
#define CONFIG_ENV_SIZE 0x10000
调用关系:
flash_init() -->flash_detect_legacy(cfi_flash_bank_addr(i), i) 去探测目标板中是否存在nor flash芯片
static int flash_detect_legacy(phys_addr_t base, int banknum) -->flash_read_jedec_ids(info)获取JEDEC接口标准flash芯片的信息,并填充info->manufacturer_id和info->device_id
static int flash_detect_legacy(phys_addr_t base, int banknum) -->jedec_flash_match(info, info->start[0])去匹配获取到的id号是否与jedec_table中定义的成员匹配,如果匹配,继续填充flash_info的其他信息,并返回1表示detect成功。
2、我们观察jedec_teble[]定义时发现,里边并未定义SST39LV1601芯片,所以要将其增加进去。
3、将SST39LV1601增加进jedec_table[]成员:
[cpp]
view plaincopyprint?
#ifdef CONFIG_SYS_FLASH_LEGACY_1024Kx16
{
.mfr_id = (u16)SST_MANUFACT,
.dev_id = SST39VF1601,
.name = "SST 39LV1601",
.uaddr = {
[1] = MTD_UADDR_0x5555_0x2AAA /* x16 */
},
.DevSize = SIZE_2MiB,
.CmdSet = P_ID_AMD_STD,
.NumEraseRegions= 4,
.regions = {
ERASEINFO(0x10000,6), /* 6 blocks */
ERASEINFO(0x10000,10), /* 10 blocks */
ERASEINFO(0x10000,15), /* 15 blocks */
ERASEINFO(0x10000,1), /* 1 blocks */
}
},
#endif
将u-boot.bin文件烧录进nor flash,启动,此时,串口打印信息已经可以正确识别到nor flash了:
试验:
[plain]
view plaincopyprint?
mini2440 # flinfo
mini2440 # flinfo
在执行flinfo命令时,可能会提示raise: Signal # 8 错误,请参考我转载的《u-boot-2011.06 raise: Signal # 8 错误修正》。
源码可以到我的git仓库下载:
[plain]
view plaincopyprint?
git clone git://github.com/cneozhang/u-boot-2011.06-cneo.git
[plain] view plaincopyprint? <pre class="plain" name="code">neo@neo-machine:~/u-boot-2-11.06$ make distclean <pre class="plain" name="code">neo@neo-machine:~/u-boot-2-11.06$ make distclean
二、关于SST39LV1601 flash的一些特性:
重要需要了解的是,这款Nor flash兼容JEDEC接口方式,对于U-BOOT来说,如果直接定义成CFI接口方式的话,操作命令过程中,flash不能unlock。
FEATURES:
size: 1M x 16bit
sector:2KWord / sector
block: 32Kword / sector
Product identification
Software command sequence
三、更改代码:
1、更改include/configs/mini2440.h中关于nor flash的配置:
[cpp]
view plaincopyprint?
/*-----------------------------------------------------------------------
* FLASH and environment organization
*/
#define CONFIG_SYS_FLASH_CFI
#define CONFIG_FLASH_CFI_DRIVER
#define CONFIG_FLASH_CFI_LEGACY
#define CONFIG_SYS_FLASH_LEGACY_1024Kx16
#define CONFIG_FLASH_SHOW_PROGRESS 45
#define CONFIG_FLASH_CFI_MTD
#define CONFIG_SYS_MAX_FLASH_BANKS 1
#define CONFIG_SYS_FLASH_BANKS_LIST { CONFIG_SYS_FLASH_BASE }
#define CONFIG_SYS_MAX_FLASH_SECT (512)
#define CONFIG_ENV_ADDR (CONFIG_SYS_FLASH_BASE + 0x1f0000) /* at the end block */
#define CONFIG_ENV_IS_IN_FLASH
#define CONFIG_ENV_SIZE 0x10000
[cpp] view plaincopyprint? *----------------------------------------------------------------------- * FLASH Info: contains chip specific data, per FLASH bank */ typedef struct { ulong size; /* total bank size in bytes */ ushort sector_count; /* number of erase units */ ulong flash_id; /* combined device & manufacturer code */ ulong start[CONFIG_SYS_MAX_FLASH_SECT]; /* virtual sector start address */ uchar protect[CONFIG_SYS_MAX_FLASH_SECT]; /* sector protection status */ #ifdef CONFIG_SYS_FLASH_CFI uchar portwidth; /* the width of the port */ uchar chipwidth; /* the width of the chip */ ushort buffer_size; /* # of bytes in write buffer */ ulong erase_blk_tout; /* maximum block erase timeout */ ulong write_tout; /* maximum write timeout */ ulong buffer_write_tout; /* maximum buffer write timeout */ ushort vendor; /* the primary vendor id */ ushort cmd_reset; /* vendor specific reset command */ ushort interface; /* used for x8/x16 adjustments */ ushort legacy_unlock; /* support Intel legacy (un)locking */ ushort manufacturer_id; /* manufacturer id */ ushort device_id; /* device id */ ushort device_id2; /* extended device id */ ushort ext_addr; /* extended query table address */ ushort cfi_version; /* cfi version */ ushort cfi_offset; /* offset for cfi query */ ulong addr_unlock1; /* unlock address 1 for AMD flash roms */ ulong addr_unlock2; /* unlock address 2 for AMD flash roms */ const char *name; /* human-readable name */ #endif } flash_info_t; *----------------------------------------------------------------------- * FLASH Info: contains chip specific data, per FLASH bank */ typedef struct { ulong size; /* total bank size in bytes */ ushort sector_count; /* number of erase units */ ulong flash_id; /* combined device & manufacturer code */ ulong start[CONFIG_SYS_MAX_FLASH_SECT]; /* virtual sector start address */ uchar protect[CONFIG_SYS_MAX_FLASH_SECT]; /* sector protection status */ #ifdef CONFIG_SYS_FLASH_CFI uchar portwidth; /* the width of the port */ uchar chipwidth; /* the width of the chip */ ushort buffer_size; /* # of bytes in write buffer */ ulong erase_blk_tout; /* maximum block erase timeout */ ulong write_tout; /* maximum write timeout */ ulong buffer_write_tout; /* maximum buffer write timeout */ ushort vendor; /* the primary vendor id */ ushort cmd_reset; /* vendor specific reset command */ ushort interface; /* used for x8/x16 adjustments */ ushort legacy_unlock; /* support Intel legacy (un)locking */ ushort manufacturer_id; /* manufacturer id */ ushort device_id; /* device id */ ushort device_id2; /* extended device id */ ushort ext_addr; /* extended query table address */ ushort cfi_version; /* cfi version */ ushort cfi_offset; /* offset for cfi query */ ulong addr_unlock1; /* unlock address 1 for AMD flash roms */ ulong addr_unlock2; /* unlock address 2 for AMD flash roms */ const char *name; /* human-readable name */ #endif } flash_info_t;
调用关系:
flash_init() -->flash_detect_legacy(cfi_flash_bank_addr(i), i) 去探测目标板中是否存在nor flash芯片
static int flash_detect_legacy(phys_addr_t base, int banknum) -->flash_read_jedec_ids(info)获取JEDEC接口标准flash芯片的信息,并填充info->manufacturer_id和info->device_id
static int flash_detect_legacy(phys_addr_t base, int banknum) -->jedec_flash_match(info, info->start[0])去匹配获取到的id号是否与jedec_table中定义的成员匹配,如果匹配,继续填充flash_info的其他信息,并返回1表示detect成功。
2、我们观察jedec_teble[]定义时发现,里边并未定义SST39LV1601芯片,所以要将其增加进去。
3、将SST39LV1601增加进jedec_table[]成员:
[cpp]
view plaincopyprint?
#ifdef CONFIG_SYS_FLASH_LEGACY_1024Kx16
{
.mfr_id = (u16)SST_MANUFACT,
.dev_id = SST39VF1601,
.name = "SST 39LV1601",
.uaddr = {
[1] = MTD_UADDR_0x5555_0x2AAA /* x16 */
},
.DevSize = SIZE_2MiB,
.CmdSet = P_ID_AMD_STD,
.NumEraseRegions= 4,
.regions = {
ERASEINFO(0x10000,6), /* 6 blocks */
ERASEINFO(0x10000,10), /* 10 blocks */
ERASEINFO(0x10000,15), /* 15 blocks */
ERASEINFO(0x10000,1), /* 1 blocks */
}
},
#endif
[plain] view plaincopyprint? neo@neo-machine:~/u-boot-2-11.06$ make mini2440_config neo@neo-machine:~/u-boot-2-11.06$ make neo@neo-machine:~/u-boot-2-11.06$ make mini2440_config neo@neo-machine:~/u-boot-2-11.06$ make
将u-boot.bin文件烧录进nor flash,启动,此时,串口打印信息已经可以正确识别到nor flash了:
试验:
[plain]
view plaincopyprint?
mini2440 # flinfo
mini2440 # flinfo
在执行flinfo命令时,可能会提示raise: Signal # 8 错误,请参考我转载的《u-boot-2011.06 raise: Signal # 8 错误修正》。
相关文章推荐
- u-boot-2011.06在mini2440上的移植之Nor flash支持
- U-boot-2014.04移植到MINI2440(5) Nor FLASH 读写支持移植
- U-boot-2009.08移植(三)支持Nor FLASH
- U-Boot在FL2440上移植(二)----支持NOR Flash
- TQ2440 u-boot-2012.04.01移植三支持NOR Flash
- 【Linux 移植 】——5、移植 u-boot-2012.04.01 之 支持Nor Flash
- 基于TQ2440的u-boot 1.1.6移植(二)(支持nor flash nand flash )
- u-boot-2011.06在基于s3c2440开发板的移植之支持YAFFS2
- U-boot移植 (v2012.04.1 S3C2440平台) (三) Nor flash Nand flash 驱动支持
- U-Boot移植FL2440--2--支持从Nor FLASH启动
- 2440超详细uboot移植笔记(十)------支持NOR FLASH
- u-boot2008.10非nand_leagcy移植mini2440,支持yaffs,附源码 ---转!!
- u-boot-2011.06-rc2移植到mini2440开发板(一)
- 看韦东山视频移植u-boot到mini2440支持烧写yaffs
- <2012 12 05> FL2440开发板的U-boot-2010.09版本移植(四)Nor Flash启动支持
- FL2440的U-boot-2009.08移植(三)支持Nor FLASH
- u-boot-2009.08在mini2440上的移植(二)---增加nor flash功能
- u-boot移植(十)---代码修改---支持nor flash
- 移植u-boot学习笔记6-----修改代码支持nor flash
- u-boot-2009.08在mini2440上的移植 增加nor flash功能