1 /*
2  * Copyright (c) 2006-2018, RT-Thread Development Team
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  *
6  * Change Logs:
7  * Date           Author       Notes
8  * 2018-11-27     SummerGift   add spi flash port file
9  */
10 
11 #include <rtthread.h>
12 
13 #if defined(BSP_USING_SPI_FLASH)
14 
15 #include "dev_spi_flash.h"
16 #include "dev_spi_flash_sfud.h"
17 #include "drv_spi.h"
18 #include "drv_gpio.h"
19 
20 #define CS_PIN   GET_PIN(1,4)     /*  P104,GPIO_AD_B0_04 */
21 
rt_hw_spi_flash_init(void)22 static int rt_hw_spi_flash_init(void)
23 {
24     rt_hw_spi_device_attach("spi3", "spi30", CS_PIN);
25 
26     if (RT_NULL == rt_sfud_flash_probe("W25Q256", "spi30"))
27     {
28         return -RT_ERROR;
29     }
30 
31     return RT_EOK;
32 }
33 INIT_COMPONENT_EXPORT(rt_hw_spi_flash_init);
34 #endif
35 
36