nand.h 3.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. /*
  2. * uffs/flash/nand.h
  3. *
  4. * COPYRIGHT (C) 2006 - 2011, RT-Thread Development Team
  5. *
  6. * The license and distribution terms for this file may be
  7. * found in the file LICENSE in this distribution or at
  8. * http://www.rt-thread.org/license/LICENSE
  9. *
  10. * Info:
  11. * Contains standard defines and IDs for NAND flash devices
  12. */
  13. #ifndef __RTT_DFS_NAND_H__
  14. #define __RTT_DFS_NAND_H__
  15. /*
  16. * Standard NAND flash commands
  17. */
  18. #define NAND_CMD_READ0 0 /* Read0 */
  19. #define NAND_CMD_READ1 1 /* Read1 */
  20. #define NAND_CMD_RNDOUT 5 /* Random data output */
  21. #define NAND_CMD_PAGEPROG 0x10 /* Write phase 2 */
  22. #define NAND_CMD_READOOB 0x50 /* Read oob */
  23. #define NAND_CMD_ERASE1 0x60 /* Erase phase 1 */
  24. #define NAND_CMD_STATUS 0x70 /* Status read */
  25. #define NAND_CMD_STATUS_MULTI 0x71
  26. #define NAND_CMD_SEQIN 0x80 /* Write phase 1 */
  27. #define NAND_CMD_RNDIN 0x85 /* Random data input */
  28. #define NAND_CMD_READID 0x90 /* ReadID,all-purpose command */
  29. #define NAND_CMD_ERASE2 0xd0 /* Erase phase 2 */
  30. #define NAND_CMD_RESET 0xff /* Reset */
  31. /* Extended commands for large page devices */
  32. #define NAND_CMD_READSTART 0x30
  33. #define NAND_CMD_RNDOUTSTART 0xE0
  34. #define NAND_CMD_CACHEDPROG 0x15
  35. #define NAND_CMD_READ_EDC 0x7b
  36. /* define low accessing value */
  37. #define TOTAL_BLOCKS 2048 /* total block of whole chip */
  38. #define PAGE_DATA_SIZE 2048 /* max size of page data */
  39. #define PAGE_SPARE_SIZE 64 /* max size of extended partition */
  40. #define PAGES_PER_BLOCK 64 /* max pages per block' */
  41. #define PAGE_SIZE (PAGE_DATA_SIZE+PAGE_SPARE_SIZE)/* max size per whole page */
  42. #define BLOCK_DATA_SIZE (PAGE_DATA_SIZE*PAGES_PER_BLOCK)/* max size per block' */
  43. /* bad flags offset in the oob area. */
  44. #define NAND_SMALL_BADBLOCK_POS 5 /* small page FLASH */
  45. #define NAND_LARGE_BADBLOCK_POS 0 /* large page FLASH */
  46. /* Option constants for bizarre disfunctionality and real
  47. * features
  48. */
  49. /* Chip can not auto increment pages */
  50. #define NAND_NO_AUTOINCR 0x00000001
  51. /* Buswitdh is 16 bit */
  52. #define NAND_BUSWIDTH_16 0x00000002
  53. /* Device supports partial programming without padding */
  54. #define NAND_NO_PADDING 0x00000004
  55. /* Chip has cache program function */
  56. #define NAND_CACHEPRG 0x00000008
  57. /* Chip has copy back function */
  58. #define NAND_COPYBACK 0x00000010
  59. /* AND Chip which has 4 banks and a confusing page / block
  60. * assignment. See Renesas datasheet for further information */
  61. #define NAND_IS_AND 0x00000020
  62. /* Chip has a array of 4 pages which can be read without
  63. * additional ready /busy waits */
  64. #define NAND_4PAGE_ARRAY 0x00000040
  65. /* Options valid for Samsung large page devices */
  66. #define NAND_SAMSUNG_LP_OPTIONS \
  67. (NAND_NO_PADDING | NAND_CACHEPRG | NAND_COPYBACK)
  68. struct nand_flash_dev
  69. {
  70. char *name; /* chip name */
  71. int id; /* chip ID */
  72. unsigned long pagesize; /* max pages */
  73. unsigned long chipsize; /* size of whole chip iMB */
  74. unsigned long blocksize;/* size of block */
  75. unsigned long options; /* option */
  76. };
  77. struct nand_manufacturers
  78. {
  79. int id;
  80. char * name;
  81. };
  82. #endif /*__RTT_DFS_NAND_H__*/