1 /*
2  * Copyright (c) 2006-2021, RT-Thread Development Team
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  *
6  * Change Logs:
7  * Date           Author       Notes
8  * 2021-04-08     Carl        the first version
9  */
10 
11 #include <board.h>
12 #include <drv_qspi.h>
13 #include <rtdevice.h>
14 #include <rthw.h>
15 #include <finsh.h>
16 
17 #ifdef BSP_USE_QSPI
18 
19 #include "dev_spi_flash.h"
20 #include "dev_spi_flash_sfud.h"
21 #define _QSPI_DEVICE_NAME "qspiflash"
22 
23 static int
rt_hw_qspi_flash_with_sfud_init(void)24 rt_hw_qspi_flash_with_sfud_init(void)
25 {
26     ft2004_qspi_bus_attach_device(FT2004_QSPI_NAME, _QSPI_DEVICE_NAME, 1, RT_NULL, RT_NULL);
27 
28     /* init gd */
29     rt_kprintf("start rt_sfud_flash_probe \r\n");
30     if (RT_NULL == rt_sfud_flash_probe("GD25LQ256D", _QSPI_DEVICE_NAME))
31     {
32         return -RT_ERROR;
33     }
34 
35     return RT_EOK;
36 }
37 INIT_COMPONENT_EXPORT(rt_hw_qspi_flash_with_sfud_init);
38 
39 #endif /* BSP_USING_QSPI_FLASH */
40