summaryrefslogtreecommitdiff
path: root/bsp/ft2004/drivers/drv_qspi_flash.c
blob: 102cd5fc5b5226ffa2de0dbb3cbc4b7da997dd09 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
/*
 * Copyright (c) 2006-2021, RT-Thread Development Team
 *
 * SPDX-License-Identifier: Apache-2.0
 *
 * Change Logs:
 * Date           Author       Notes
 * 2021-04-08     Carl        the first version
 */

#include <board.h>
#include <drv_qspi.h>
#include <rtdevice.h>
#include <rthw.h>
#include <finsh.h>

#ifdef BSP_USE_QSPI

#include "spi_flash.h"
#include "spi_flash_sfud.h"
#define _QSPI_DEVICE_NAME "qspiflash"

static int
rt_hw_qspi_flash_with_sfud_init(void)
{
    ft2004_qspi_bus_attach_device(FT2004_QSPI_NAME, _QSPI_DEVICE_NAME, 1, RT_NULL, RT_NULL);

    /* init gd */
    rt_kprintf("start rt_sfud_flash_probe \r\n");
    if (RT_NULL == rt_sfud_flash_probe("GD25LQ256D", _QSPI_DEVICE_NAME))
    {
        return -RT_ERROR;
    }

    return RT_EOK;
}
INIT_COMPONENT_EXPORT(rt_hw_qspi_flash_with_sfud_init);

#endif /* BSP_USING_QSPI_FLASH */