qca_7k.h 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. /* SPDX-License-Identifier: GPL-2.0 OR BSD-2-Clause */
  2. /*
  3. * Copyright (c) 2011, 2012, Qualcomm Atheros Communications Inc.
  4. * Copyright (c) 2014, I2SE GmbH
  5. */
  6. /* Qualcomm Atheros SPI register definition.
  7. *
  8. * This module is designed to define the Qualcomm Atheros SPI
  9. * register placeholders.
  10. */
  11. #ifndef _QCA_7K_H
  12. #define _QCA_7K_H
  13. #include <linux/types.h>
  14. #include "qca_spi.h"
  15. #define QCA7K_SPI_READ (1 << 15)
  16. #define QCA7K_SPI_WRITE (0 << 15)
  17. #define QCA7K_SPI_INTERNAL (1 << 14)
  18. #define QCA7K_SPI_EXTERNAL (0 << 14)
  19. #define QCASPI_CMD_LEN 2
  20. #define QCASPI_HW_PKT_LEN 4
  21. #define QCASPI_HW_BUF_LEN 0xC5B
  22. /* SPI registers; */
  23. #define SPI_REG_BFR_SIZE 0x0100
  24. #define SPI_REG_WRBUF_SPC_AVA 0x0200
  25. #define SPI_REG_RDBUF_BYTE_AVA 0x0300
  26. #define SPI_REG_SPI_CONFIG 0x0400
  27. #define SPI_REG_SPI_STATUS 0x0500
  28. #define SPI_REG_INTR_CAUSE 0x0C00
  29. #define SPI_REG_INTR_ENABLE 0x0D00
  30. #define SPI_REG_RDBUF_WATERMARK 0x1200
  31. #define SPI_REG_WRBUF_WATERMARK 0x1300
  32. #define SPI_REG_SIGNATURE 0x1A00
  33. #define SPI_REG_ACTION_CTRL 0x1B00
  34. /* SPI_CONFIG register definition; */
  35. #define QCASPI_SLAVE_RESET_BIT BIT(6)
  36. /* INTR_CAUSE/ENABLE register definition. */
  37. #define SPI_INT_WRBUF_BELOW_WM BIT(10)
  38. #define SPI_INT_CPU_ON BIT(6)
  39. #define SPI_INT_ADDR_ERR BIT(3)
  40. #define SPI_INT_WRBUF_ERR BIT(2)
  41. #define SPI_INT_RDBUF_ERR BIT(1)
  42. #define SPI_INT_PKT_AVLBL BIT(0)
  43. void qcaspi_spi_error(struct qcaspi *qca);
  44. int qcaspi_read_register(struct qcaspi *qca, u16 reg, u16 *result);
  45. int qcaspi_write_register(struct qcaspi *qca, u16 reg, u16 value, int retry);
  46. #endif /* _QCA_7K_H */