u-boot-2014.10移植(3)识别NOR Flash

主要是将我们使用的nor flash 型号添加到jedec_table中
  File : drivers/mtd/jedec_flash.c

jz2440    :MX29LV160DB       2M  id= 0x2249, MX29LV160B 宏需要自己添加

#define MX29LV160B      0x2249

mini2440  :SST29LV1601 (AM29LV160DB)   35sectors   id = 0x2249

// for jz2440
                {
                    .mfr_id        = MT_MANUFACT,
                    .dev_id        = MX29LV160B,
                    .name        = "MXIC MX29LV160B",
                    .uaddr        = {
                        [0] = MTD_UADDR_0x0AAA_0x0555,  /* x8 */
                        [1] = MTD_UADDR_0x0555_0x02AA,  /* x16 */
                    },
                    .DevSize    = SIZE_2MiB,
                    .CmdSet        = P_ID_AMD_STD,
                    .NumEraseRegions= 4,
                    .regions    = {
                    ERASEINFO(0x04000,1),
                    ERASEINFO(0x02000,2),
                    ERASEINFO(0x08000,1),
                    ERASEINFO(0x10000,31)
                    }
                },
// for mini2440
                {
                    .mfr_id        = AMD_MANUFACT,
                    .dev_id        = AM29LV160DB,
                    .name        = "AMD AM29LV160DB",
                    .uaddr        = {
                        [0] = MTD_UADDR_0x0AAA_0x0555,  /* x8 */
                        [1] = MTD_UADDR_0x0555_0x02AA   /* x16 */
                    },
                    .DevSize    = SIZE_2MiB,
                    .CmdSet        = P_ID_AMD_STD,
                    .NumEraseRegions= 4,
                    .regions    = {
                        ERASEINFO(0x04000,1),
                        ERASEINFO(0x02000,2),
                        ERASEINFO(0x08000,1),
                        ERASEINFO(0x10000,31)
                    }
                }, 

在smdk2440.h里面把#define CONFIG_SYS_MAX_FLASH_SECT (19)   改成35
  
  再次编译并烧写:

U-Boot 2014.10 (Nov 01 2018 - 11:32:28)

        CPUID: 32440001
        FCLK:      400 MHz
        HCLK:      100 MHz
        PCLK:       50 MHz
        DRAM:  64 MiB
        WARNING: Caches not enabled
        Flash: 2 MiB
        *** Warning - bad CRC, using default environment
        
        In:    serial
        Out:   serial
        Err:   serial
        Net:   CS8900-0
        Error: CS8900-0 address not set.
        
        Warning: Your board does not use generic board. Please read
        doc/README.generic-board and take action. Boards not
        upgraded by the late 2014 may break or be removed.

可知, nor flash已经被正确识别,可以在smdk2440.h里面定义DEBUG宏看出更详细信息。
  
  去掉最后那个Warning, 在common/main.c  里面main_loop里面:

#ifndef CONFIG_SYS_GENERIC_BOARD
            puts("Warning: Your board does not use generic board. Please read\n");
            puts("doc/README.generic-board and take action. Boards not\n");
            puts("upgraded by the late 2014 may break or be removed.\n");
        #endif

 

posted on 2018-11-03 21:06  风_行者7  阅读(258)  评论(0编辑  收藏  举报

导航