cnl-sst-dsp.h 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * Cannonlake SST DSP Support
  4. *
  5. * Copyright (C) 2016-17, Intel Corporation.
  6. */
  7. #ifndef __CNL_SST_DSP_H__
  8. #define __CNL_SST_DSP_H__
  9. struct sst_dsp;
  10. struct sst_dsp_device;
  11. struct sst_generic_ipc;
  12. /* Intel HD Audio General DSP Registers */
  13. #define CNL_ADSP_GEN_BASE 0x0
  14. #define CNL_ADSP_REG_ADSPCS (CNL_ADSP_GEN_BASE + 0x04)
  15. #define CNL_ADSP_REG_ADSPIC (CNL_ADSP_GEN_BASE + 0x08)
  16. #define CNL_ADSP_REG_ADSPIS (CNL_ADSP_GEN_BASE + 0x0c)
  17. /* Intel HD Audio Inter-Processor Communication Registers */
  18. #define CNL_ADSP_IPC_BASE 0xc0
  19. #define CNL_ADSP_REG_HIPCTDR (CNL_ADSP_IPC_BASE + 0x00)
  20. #define CNL_ADSP_REG_HIPCTDA (CNL_ADSP_IPC_BASE + 0x04)
  21. #define CNL_ADSP_REG_HIPCTDD (CNL_ADSP_IPC_BASE + 0x08)
  22. #define CNL_ADSP_REG_HIPCIDR (CNL_ADSP_IPC_BASE + 0x10)
  23. #define CNL_ADSP_REG_HIPCIDA (CNL_ADSP_IPC_BASE + 0x14)
  24. #define CNL_ADSP_REG_HIPCIDD (CNL_ADSP_IPC_BASE + 0x18)
  25. #define CNL_ADSP_REG_HIPCCTL (CNL_ADSP_IPC_BASE + 0x28)
  26. /* HIPCTDR */
  27. #define CNL_ADSP_REG_HIPCTDR_BUSY BIT(31)
  28. /* HIPCTDA */
  29. #define CNL_ADSP_REG_HIPCTDA_DONE BIT(31)
  30. /* HIPCIDR */
  31. #define CNL_ADSP_REG_HIPCIDR_BUSY BIT(31)
  32. /* HIPCIDA */
  33. #define CNL_ADSP_REG_HIPCIDA_DONE BIT(31)
  34. /* CNL HIPCCTL */
  35. #define CNL_ADSP_REG_HIPCCTL_DONE BIT(1)
  36. #define CNL_ADSP_REG_HIPCCTL_BUSY BIT(0)
  37. /* CNL HIPCT */
  38. #define CNL_ADSP_REG_HIPCT_BUSY BIT(31)
  39. /* Intel HD Audio SRAM Window 1 */
  40. #define CNL_ADSP_SRAM1_BASE 0xa0000
  41. #define CNL_ADSP_MMIO_LEN 0x10000
  42. #define CNL_ADSP_W0_STAT_SZ 0x1000
  43. #define CNL_ADSP_W0_UP_SZ 0x1000
  44. #define CNL_ADSP_W1_SZ 0x1000
  45. #define CNL_FW_STS_MASK 0xf
  46. #define CNL_ADSPIC_IPC 0x1
  47. #define CNL_ADSPIS_IPC 0x1
  48. #define CNL_DSP_CORES 4
  49. #define CNL_DSP_CORES_MASK ((1 << CNL_DSP_CORES) - 1)
  50. /* core reset - asserted high */
  51. #define CNL_ADSPCS_CRST_SHIFT 0
  52. #define CNL_ADSPCS_CRST(x) (x << CNL_ADSPCS_CRST_SHIFT)
  53. /* core run/stall - when set to 1 core is stalled */
  54. #define CNL_ADSPCS_CSTALL_SHIFT 8
  55. #define CNL_ADSPCS_CSTALL(x) (x << CNL_ADSPCS_CSTALL_SHIFT)
  56. /* set power active - when set to 1 turn core on */
  57. #define CNL_ADSPCS_SPA_SHIFT 16
  58. #define CNL_ADSPCS_SPA(x) (x << CNL_ADSPCS_SPA_SHIFT)
  59. /* current power active - power status of cores, set by hardware */
  60. #define CNL_ADSPCS_CPA_SHIFT 24
  61. #define CNL_ADSPCS_CPA(x) (x << CNL_ADSPCS_CPA_SHIFT)
  62. int cnl_dsp_enable_core(struct sst_dsp *ctx, unsigned int core_mask);
  63. int cnl_dsp_disable_core(struct sst_dsp *ctx, unsigned int core_mask);
  64. irqreturn_t cnl_dsp_sst_interrupt(int irq, void *dev_id);
  65. void cnl_dsp_free(struct sst_dsp *dsp);
  66. void cnl_ipc_int_enable(struct sst_dsp *ctx);
  67. void cnl_ipc_int_disable(struct sst_dsp *ctx);
  68. void cnl_ipc_op_int_enable(struct sst_dsp *ctx);
  69. void cnl_ipc_op_int_disable(struct sst_dsp *ctx);
  70. bool cnl_ipc_int_status(struct sst_dsp *ctx);
  71. void cnl_ipc_free(struct sst_generic_ipc *ipc);
  72. int cnl_sst_dsp_init(struct device *dev, void __iomem *mmio_base, int irq,
  73. const char *fw_name, struct skl_dsp_loader_ops dsp_ops,
  74. struct skl_dev **dsp);
  75. int cnl_sst_init_fw(struct device *dev, struct skl_dev *skl);
  76. void cnl_sst_dsp_cleanup(struct device *dev, struct skl_dev *skl);
  77. #endif /*__CNL_SST_DSP_H__*/