Files
luban-lite/bsp/artinchip/drv/spinor/spinor_sfud.c
刘可亮 564e22b32f v0.7.5
2023-08-28 09:48:01 +08:00

40 lines
939 B
C

/*
* Copyright (c) 2023, Artinchip Technology Co., Ltd
*
* SPDX-License-Identifier: Apache-2.0
*
* Authors: xuan.wen <xuan.wen@artinchip.com>
*/
#include <rtdevice.h>
#include <drv_qspi.h>
#include <aic_log.h>
#if defined(RT_USING_SFUD)
#define SPI_FLASH_DEVICE_NAME "qspi01"
#define USING_NOR_FLASH_DEV_NAME "norflash0"
#include "spi_flash_sfud.h"
int rt_hw_spi_flash_with_sfud_init(void)
{
rt_err_t ret;
ret = aic_qspi_bus_attach_device("qspi0", SPI_FLASH_DEVICE_NAME, 0, 4,
RT_NULL, RT_NULL);
if (ret < 0) {
pr_err("attach qspi device failed.\n");
return RT_ERROR;
}
if (RT_NULL == rt_sfud_flash_probe(USING_NOR_FLASH_DEV_NAME,
SPI_FLASH_DEVICE_NAME)) {
pr_err("sfud flash probe failed.\n");
return RT_ERROR;
};
return RT_EOK;
}
INIT_PREV_EXPORT(rt_hw_spi_flash_with_sfud_init);
#endif