nand_port.h 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. /*
  2. * Copyright (C) 2022-2024, Xiaohua Semiconductor Co., Ltd.
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. *
  6. * Change Logs:
  7. * Date Author Notes
  8. * 2023-03-01 CDT first version
  9. */
  10. #ifndef __NAND_PORT_H__
  11. #define __NAND_PORT_H__
  12. /******************** NAND chip information ***********************************/
  13. #define NAND_BYTES_PER_PAGE 2048UL
  14. #define NAND_SPARE_AREA_SIZE 64UL
  15. #define NAND_PAGES_PER_BLOCK 64UL
  16. #define NAND_BYTES_PER_BLOCK (NAND_PAGES_PER_BLOCK * NAND_BYTES_PER_PAGE)
  17. #define NAND_BLOCKS_PER_PLANE 1024UL
  18. #define NAND_PLANE_PER_DEVICE 2UL
  19. #define NAND_DEVICE_BLOCKS (NAND_BLOCKS_PER_PLANE * NAND_PLANE_PER_DEVICE)
  20. #define NAND_DEVICE_PAGES (NAND_DEVICE_BLOCKS * NAND_PAGES_PER_BLOCK)
  21. /******************** EXMC_NFC configure **************************************/
  22. /* chip: EXMC_NFC_BANK0~7 */
  23. #define NAND_EXMC_NFC_BANK EXMC_NFC_BANK0
  24. /* density:2Gbit */
  25. #define NAND_EXMC_NFC_BANK_CAPACITY EXMC_NFC_BANK_CAPACITY_2GBIT
  26. /* device width: 8-bit */
  27. #define NAND_EXMC_NFC_MEMORY_WIDTH EXMC_NFC_MEMORY_WIDTH_8BIT
  28. /* page size: 2KByte */
  29. #define NAND_EXMC_NFC_PAGE_SIZE EXMC_NFC_PAGE_SIZE_2KBYTE
  30. /* row address cycle: 3 */
  31. #define NAND_EXMC_NFC_ROW_ADDR_CYCLE EXMC_NFC_3_ROW_ADDR_CYCLE
  32. /* ECC mode */
  33. #define NAND_EXMC_NFC_ECC_MD EXMC_NFC_1BIT_ECC
  34. /* timing configuration(EXCLK clock frequency: 60MHz@3.3V) for MT29F2G08AB */
  35. /* TS: ALE/CLE/CE setup time(min=10ns) */
  36. #define NAND_TS 1U
  37. /* TWP: WE# pulse width (min=10ns) */
  38. #define NAND_TWP 1U
  39. /* TRP: RE# pulse width (MT29F2G08AB min=10ns and EXMC t_data_s min=24ns) */
  40. #define NAND_TRP 2U
  41. /* TTH: ALE/CLE/CE hold time (min=5ns) */
  42. #define NAND_TH 1U
  43. /* TWH: WE# pulse width HIGH (min=10ns) */
  44. #define NAND_TWH 1U
  45. /* TRH: RE# pulse width HIGH (min=7ns) */
  46. #define NAND_TRH 1U
  47. /* TRR: Ready to RE# LOW (min=20ns) */
  48. #define NAND_TRR 2U
  49. /* TWB: WE# HIGH to busy (max=100ns) */
  50. #define NAND_TWB 1U
  51. /* TWB: WE# HIGH to busy (max=100ns) */
  52. #define NAND_TRB 1U
  53. /* TCCS: Change read column and Change write column delay */
  54. #define NAND_TCCS 5U
  55. /* TWTR: WE# HIGH to RE# LOW (min=60ns) */
  56. #define NAND_TWTR 4U
  57. /* TRTW: RE# HIGH to WE# LOW (min=100ns) */
  58. #define NAND_TRTW 7U
  59. /* TADL: ALE to data start (min=70ns) */
  60. #define NAND_TADL 5U
  61. #endif