HI3516a w25q128 spi flash无法启动问题

海思HI3516a开发套件上spi flash硬件默认3 addr模式,需要更改u-boot代码才能正确支持3 addr模式,具体操作如下:

更改u-boot代码osdrv/opensource/uboot/u-boot/include/configs/hi3516a.h第65行后面添加宏定义#define CONFIG_CLOSE_SPI_8PIN_4IO;

更改u-boot代码osdrv/opensource/uboot/u-boot-2010.06/drivers/mtd/spi/hisfc350/hisfc350_spi_w25q256fv.c如下:

static int spi_w25q256fv_entry_4addr(struct hisfc_spi *spi, int enable)
{
        struct hisfc_host *host = (struct hisfc_host *)spi->host;

        if (spi->addrcycle != SPI_4BYTE_ADDR_LEN)
                return 0;
        /* This chip should not enable write here,
         * we have confirmed with the WINBOND */
        /* spi->driver->write_enable(spi); */
        
spi->driver->write_enable(spi);


        enable=1;

hisfc_write(host, HISFC350_CMD_INS, SPI_CMD_FIRST_RESET_4ADDR);
                hisfc_write(host, HISFC350_CMD_CONFIG,
                        HISFC350_CMD_CONFIG_SEL_CS(spi->chipselect)
                        | HISFC350_CMD_CONFIG_START);


                HISFC350_CMD_WAIT_CPU_FINISH(host);


                hisfc_write(host, HISFC350_CMD_INS, SPI_CMD_SECOND_RESET_4ADDR);
                hisfc_write(host, HISFC350_CMD_CONFIG,
                        HISFC350_CMD_CONFIG_SEL_CS(spi->chipselect)
                        | HISFC350_CMD_CONFIG_START);

                HISFC350_CMD_WAIT_CPU_FINISH(host);
                //if (DEBUG_SPI)
                        printf("now W25Q256FV 6699 cmd\n");
        
        if (enable) {
                hisfc_write(host, HISFC350_CMD_INS, SPI_CMD_EN4B);
                //if (DEBUG_SPI)
                        printf("now w25q256fv is 4-byte address mode\n");

                hisfc_write(host, HISFC350_CMD_CONFIG,
                        HISFC350_CMD_CONFIG_SEL_CS(spi->chipselect)
                        | HISFC350_CMD_CONFIG_START);

                HISFC350_CMD_WAIT_CPU_FINISH(host);
        }
//ngs
         else

        {
/* reset cmd */
                hisfc_write(host, HISFC350_CMD_INS, SPI_CMD_FIRST_RESET_4ADDR);
                hisfc_write(host, HISFC350_CMD_CONFIG,
                        HISFC350_CMD_CONFIG_SEL_CS(spi->chipselect)
                        | HISFC350_CMD_CONFIG_START);


                HISFC350_CMD_WAIT_CPU_FINISH(host);


                hisfc_write(host, HISFC350_CMD_INS, SPI_CMD_SECOND_RESET_4ADDR);
                hisfc_write(host, HISFC350_CMD_CONFIG,
                        HISFC350_CMD_CONFIG_SEL_CS(spi->chipselect)
                        | HISFC350_CMD_CONFIG_START);

                HISFC350_CMD_WAIT_CPU_FINISH(host);
                //if (DEBUG_SPI)
                        printf("now W25Q256FV 6699 cmd\n");
        }


        
        hisfc_write(host, HISFC350_CMD_CONFIG,
                HISFC350_CMD_CONFIG_SEL_CS(spi->chipselect)
                | HISFC350_CMD_CONFIG_DATA_CNT(1)
                | HISFC350_CMD_CONFIG_DATA_EN
                | HISFC350_CMD_CONFIG_START);

        HISFC350_CMD_WAIT_CPU_FINISH(host);

        
        host->set_host_addr_mode(host, enable);

        return 0;
}
实际测试对于w25q128 spi flash可用。 

本文来自网络整理,参考链接如下:

http://bbs.ebaina.com/thread-13621-2-1.html

http://bbs.ebaina.com/thread-9713-1-1.html

  • 1
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值