drv_qspi_flash.c 858 B

123456789101112131415161718192021222324252627282930313233343536373839
  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. #include <board.h>
  11. #include <drv_qspi.h>
  12. #include <rtdevice.h>
  13. #include <rthw.h>
  14. #include <finsh.h>
  15. #ifdef BSP_USE_QSPI
  16. #include "spi_flash.h"
  17. #include "spi_flash_sfud.h"
  18. #define _QSPI_DEVICE_NAME "qspiflash"
  19. static int
  20. rt_hw_qspi_flash_with_sfud_init(void)
  21. {
  22. ft2004_qspi_bus_attach_device(FT2004_QSPI_NAME, _QSPI_DEVICE_NAME, 1, RT_NULL, RT_NULL);
  23. /* init gd */
  24. rt_kprintf("start rt_sfud_flash_probe \r\n");
  25. if (RT_NULL == rt_sfud_flash_probe("GD25LQ256D", _QSPI_DEVICE_NAME))
  26. {
  27. return -RT_ERROR;
  28. }
  29. return RT_EOK;
  30. }
  31. INIT_COMPONENT_EXPORT(rt_hw_qspi_flash_with_sfud_init);
  32. #endif /* BSP_USING_QSPI_FLASH */