hi3660_hkadc.h 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. /*
  2. * Copyright (c) 2017, ARM Limited and Contributors. All rights reserved.
  3. *
  4. * SPDX-License-Identifier: BSD-3-Clause
  5. */
  6. #ifndef HI3660_HKADC_H
  7. #define HI3660_HKADC_H
  8. #define HKADC_SSI_REG_BASE 0xE82B8000
  9. #define HKADC_DSP_START_REG (HKADC_SSI_REG_BASE + 0x000)
  10. #define HKADC_WR_NUM_REG (HKADC_SSI_REG_BASE + 0x008)
  11. #define HKADC_DSP_START_CLR_REG (HKADC_SSI_REG_BASE + 0x01C)
  12. #define HKADC_WR01_DATA_REG (HKADC_SSI_REG_BASE + 0x020)
  13. #define WR1_WRITE_MODE (1U << 31)
  14. #define WR1_READ_MODE (0 << 31)
  15. #define WR1_ADDR(x) (((x) & 0x7F) << 24)
  16. #define WR1_DATA(x) (((x) & 0xFF) << 16)
  17. #define WR0_WRITE_MODE (1 << 15)
  18. #define WR0_READ_MODE (0 << 15)
  19. #define WR0_ADDR(x) (((x) & 0x7F) << 8)
  20. #define WR0_DATA(x) ((x) & 0xFF)
  21. #define HKADC_WR23_DATA_REG (HKADC_SSI_REG_BASE + 0x024)
  22. #define HKADC_WR45_DATA_REG (HKADC_SSI_REG_BASE + 0x028)
  23. #define HKADC_DELAY01_REG (HKADC_SSI_REG_BASE + 0x030)
  24. #define HKADC_DELAY23_REG (HKADC_SSI_REG_BASE + 0x034)
  25. #define HKADC_DELAY45_REG (HKADC_SSI_REG_BASE + 0x038)
  26. #define HKADC_DSP_RD2_DATA_REG (HKADC_SSI_REG_BASE + 0x048)
  27. #define HKADC_DSP_RD3_DATA_REG (HKADC_SSI_REG_BASE + 0x04C)
  28. /* HKADC Internal Registers */
  29. #define HKADC_CTRL_ADDR 0x00
  30. #define HKADC_START_ADDR 0x01
  31. #define HKADC_DATA1_ADDR 0x03 /* high 8 bits */
  32. #define HKADC_DATA0_ADDR 0x04 /* low 8 bits */
  33. #define HKADC_MODE_CFG 0x0A
  34. #define HKADC_VALUE_HIGH 0x0FF0
  35. #define HKADC_VALUE_LOW 0x000F
  36. #define HKADC_VALID_VALUE 0x0FFF
  37. #define HKADC_CHANNEL_MAX 15
  38. #define HKADC_VREF_1V8 1800
  39. #define HKADC_ACCURACY 0x0FFF
  40. #define HKADC_WR01_VALUE ((HKADC_START_ADDR << 24) | \
  41. (0x1 << 16))
  42. #define HKADC_WR23_VALUE ((0x1u << 31) | \
  43. (HKADC_DATA0_ADDR << 24) | \
  44. (1 << 15) | \
  45. (HKADC_DATA1_ADDR << 8))
  46. #define HKADC_WR45_VALUE (0x80)
  47. #define HKADC_CHANNEL0_DELAY01_VALUE ((0x0700 << 16) | 0xFFFF)
  48. #define HKADC_DELAY01_VALUE ((0x0700 << 16) | 0x0200)
  49. #define HKADC_DELAY23_VALUE ((0x00C8 << 16) | 0x00C8)
  50. #define START_DELAY_TIMEOUT 2000
  51. #define HKADC_WR_NUM_VALUE 4
  52. #endif /* HI3660_HKADC_H */