1. 程式人生 > 實用技巧 >zynq u-boot啟動中提示SF: unrecognized JEDEC id bytes: c2, 20, 19

zynq u-boot啟動中提示SF: unrecognized JEDEC id bytes: c2, 20, 19

錯誤現象:

原因分析:

\u-boot-xlnx-xilinx-v2018.1\u-boot-xlnx-xilinx-v2018.1\drivers\mtd\spi\ spi_flash.c中

static const struct spi_flash_info *spi_flash_read_id(struct spi_flash *flash)
{
    int                tmp;
    u8                id[SPI_FLASH_MAX_ID_LEN];
    const struct spi_flash_info    *info;

#ifdef CONFIG_SPI_GENERIC
    
if (flash->spi->option & SF_DUAL_PARALLEL_FLASH) flash->spi->flags |= SPI_XFER_LOWER; #endif tmp = spi_flash_cmd(flash->spi, CMD_READ_ID, id, SPI_FLASH_MAX_ID_LEN); if (tmp < 0) { printf("SF: error %d reading JEDEC ID\n", tmp); return ERR_PTR(tmp); } info
= spi_flash_ids; for (; info->name != NULL; info++) { if (info->id_len) { if (!memcmp(info->id, id, info->id_len)) return info; } } printf("SF: unrecognized JEDEC id bytes: %02x, %02x, %02x\n", id[0], id[1], id[2]); return
ERR_PTR(-ENODEV); }

spi_flash_read_id(struct spi_flash *flash)函式中需要讀flashID,info = spi_flash_ids;對應的時ID列表,

u-boot-xlnx-xilinx-v2018.1\u-boot-xlnx-xilinx-v2018.1\drivers\mtd\spi\ spi_flash_ids.c中定義了

#ifdef CONFIG_SPI_FLASH_MACRONIX    /* MACRONIX */
    {"mx25l2006e",       INFO(0xc22012, 0x0, 64 * 1024,     4, 0) },
    {"mx25l4005",       INFO(0xc22013, 0x0, 64 * 1024,     8, 0) },
    {"mx25l8005",       INFO(0xc22014, 0x0, 64 * 1024,    16, 0) },
    {"mx25l1605d",       INFO(0xc22015, 0x0, 64 * 1024,    32, 0) },
    {"mx25l3205d",       INFO(0xc22016, 0x0, 64 * 1024,    64, 0) },
    {"mx25l6405d",       INFO(0xc22017, 0x0, 64 * 1024,   128, 0) },
    {"mx25l12805",       INFO(0xc22018, 0x0, 64 * 1024,   256, RD_FULL | WR_QPP) },
    {"mx25l25635f",       INFO(0xc22019, 0x0, 64 * 1024,   512, RD_FULL | WR_QPP) },
    {"mx25l51235f",       INFO(0xc2201a, 0x0, 64 * 1024,  1024, RD_FULL | WR_QPP) },
    {"mx25u6435f",       INFO(0xc22537, 0x0, 64 * 1024,   128, RD_FULL | WR_QPP) },
    {"mx25l12855e",       INFO(0xc22618, 0x0, 64 * 1024,   256, RD_FULL | WR_QPP) },
    {"mx25u1635e",     INFO(0xc22535, 0x0, 64 * 1024,  32, SECT_4K) },
    {"mx66u51235f",    INFO(0xc2253a, 0x0, 64 * 1024,  1024, RD_FULL | WR_QPP) },
    {"mx66l1g45g",     INFO(0xc2201b, 0x0, 64 * 1024,  2048, RD_FULL | WR_QPP) },
    {"mx66u1g45g",     INFO(0xc2253b, 0x0, 64 * 1024,  2048, RD_FULL | WR_QPP) },
#endif

因此生成u-boot的過程中,需要新增

CONFIG_SPI_FLASH_MACRONIX

解決方法:

在gedit configs/zynq_zed_defconfig 中新增

CONFIG_SPI_FLASH_MACRONIX=y

問題解決