spimem.h 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. /*
  2. * Copyright (c) 2017 Actions Semiconductor Co., Ltd
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. */
  6. /**
  7. * @file
  8. * @brief common code for SPI memory (NOR & NAND & PSRAM)
  9. */
  10. #ifndef __SPIMEM_H__
  11. #define __SPIMEM_H__
  12. #define SPIMEM_TFLAG_MIO_DATA 0x01
  13. #define SPIMEM_TFLAG_MIO_ADDR_DATA 0x02
  14. #define SPIMEM_TFLAG_MIO_CMD_ADDR_DATA 0x04
  15. #define SPIMEM_TFLAG_MIO_MASK 0x07
  16. #define SPIMEM_TFLAG_WRITE_DATA 0x08
  17. #define SPIMEM_TFLAG_ENABLE_RANDOMIZE 0x10
  18. #define SPIMEM_TFLAG_PAUSE_RANDOMIZE 0x20
  19. #define SPIMEM_TFLAG_RESUME_RANDOMIZE 0x40
  20. void spimem_read_chipid(struct spi_info *si, void *chipid, int len);
  21. unsigned char spimem_read_status(struct spi_info *si, unsigned char cmd);
  22. void spimem_read_page(struct spi_info *si,
  23. unsigned int addr, int addr_len,
  24. void *buf, int len);
  25. void spimem_continuous_read_reset(struct spi_info *si);
  26. void spimem_set_write_protect(struct spi_info *si, int protect);
  27. int spimem_erase_block(struct spi_info *si, unsigned int page);
  28. int spimem_transfer(struct spi_info *si, unsigned char cmd, unsigned int addr,
  29. int addr_len, void *buf, int length,
  30. unsigned char dummy_len, unsigned int flag);
  31. int spimem_write_cmd_addr(struct spi_info *si, unsigned char cmd,
  32. unsigned int addr, int addr_len);
  33. int spimem_write_cmd(struct spi_info *si, unsigned char cmd);
  34. #endif /* __SPIMEM_H__ */