quec_spi_nand_flash_prop.c 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. /** @file
  2. quec_spi_nand_flash_prop.h
  3. @brief
  4. This file is used to define spi NAND FLASH property for open Quectel Project.
  5. */
  6. /*================================================================
  7. Copyright (c) 2020 Quectel Wireless Solution, Co., Ltd. All Rights Reserved.
  8. Quectel Wireless Solution Proprietary and Confidential.
  9. =================================================================*/
  10. /*=================================================================
  11. EDIT HISTORY FOR MODULE
  12. This section contains comments describing changes made to the module.
  13. Notice that changes are listed in reverse chronological order.
  14. WHEN WHO WHAT, WHERE, WHY
  15. ------------ ------- -------------------------------------------------------------------------------
  16. =================================================================*/
  17. #include "quec_spi_nand_flash_prop.h"
  18. /* 4-line SPI NAND Flash supported model list,can add by yourself*/
  19. static quec_spi_nand_flash_info_s quec_spi_nand_flash_props[] =
  20. {
  21. //You can cut out it by defining macros
  22. //#define DISABLE_W25N02JWXXIF
  23. #ifndef DISABLE_W25N02JWXXIF
  24. {
  25. // W25N02JWxxIF/IC MID=EFBF22,2--2G
  26. .page_totalsize = 2112,
  27. .page_mainsize = 2048,
  28. .page_sparesize = 64,
  29. .block_pagenum = 64,
  30. .block_totalnum = 2048,
  31. .cache_blocknum = 5,
  32. {
  33. .page_spare_shift = 0 ,//=page_mainsize = 2048
  34. .block_postion_shift = 2 ,//2050
  35. .block_type_shift = 3 ,//2051
  36. .logic_addr_shift = 16,//2064
  37. .page_used_shift = 32,//2080
  38. .page_garbage_shift = 33,//2081
  39. .page_num_shift = 34,//2082
  40. },
  41. .nand_id = 0xEF0F, //bit[7:4]don't compare,should be 0
  42. .nand_id_type = QUEC_NAND_FLASH_ID_24BIT,
  43. },
  44. #endif
  45. #ifndef DISABLE_GD5F1GQ5XEXXG
  46. {
  47. // GD5F1GQ5xExxG MID=C841/C851,1--1G
  48. .page_totalsize = 2112,
  49. .page_mainsize = 2048,
  50. .page_sparesize = 64,
  51. .block_pagenum = 64,
  52. .block_totalnum = 1024,
  53. .cache_blocknum = 5,
  54. {
  55. .page_spare_shift = 0 ,//=page_mainsize = 2048
  56. .block_postion_shift = 2 ,//2050
  57. .block_type_shift = 3 ,//2051
  58. .logic_addr_shift = 16,//2064
  59. .page_used_shift = 32,//2080
  60. .page_garbage_shift = 33,//2081
  61. .page_num_shift = 34,//2082
  62. },
  63. .nand_id = 0xC801, //bit[7:4]don't compare,should be 0
  64. .nand_id_type = QUEC_NAND_FLASH_ID_16BIT,
  65. }
  66. #endif
  67. };
  68. static unsigned int quec_spi_nand_flash_prop_len = sizeof(quec_spi_nand_flash_props)/sizeof(quec_spi_nand_flash_props[0]);
  69. bool quec_spi_nand_props_init(quec_spi_nand_flash_info_s **props_ptr,unsigned int *props_len)
  70. {
  71. if(props_ptr == NULL || props_len == NULL)
  72. {
  73. return false;
  74. }
  75. *props_ptr = quec_spi_nand_flash_props;
  76. *props_len = quec_spi_nand_flash_prop_len;
  77. return true;
  78. }