cnl-sst-dsp.h 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. /*
  2. * Cannonlake SST DSP Support
  3. *
  4. * Copyright (C) 2016-17, Intel Corporation.
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as version 2, as
  8. * published by the Free Software Foundation.
  9. *
  10. * This program is distributed in the hope that it will be useful, but
  11. * WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  13. * General Public License for more details.
  14. */
  15. #ifndef __CNL_SST_DSP_H__
  16. #define __CNL_SST_DSP_H__
  17. struct sst_dsp;
  18. struct skl_sst;
  19. struct sst_dsp_device;
  20. struct sst_generic_ipc;
  21. /* Intel HD Audio General DSP Registers */
  22. #define CNL_ADSP_GEN_BASE 0x0
  23. #define CNL_ADSP_REG_ADSPCS (CNL_ADSP_GEN_BASE + 0x04)
  24. #define CNL_ADSP_REG_ADSPIC (CNL_ADSP_GEN_BASE + 0x08)
  25. #define CNL_ADSP_REG_ADSPIS (CNL_ADSP_GEN_BASE + 0x0c)
  26. /* Intel HD Audio Inter-Processor Communication Registers */
  27. #define CNL_ADSP_IPC_BASE 0xc0
  28. #define CNL_ADSP_REG_HIPCTDR (CNL_ADSP_IPC_BASE + 0x00)
  29. #define CNL_ADSP_REG_HIPCTDA (CNL_ADSP_IPC_BASE + 0x04)
  30. #define CNL_ADSP_REG_HIPCTDD (CNL_ADSP_IPC_BASE + 0x08)
  31. #define CNL_ADSP_REG_HIPCIDR (CNL_ADSP_IPC_BASE + 0x10)
  32. #define CNL_ADSP_REG_HIPCIDA (CNL_ADSP_IPC_BASE + 0x14)
  33. #define CNL_ADSP_REG_HIPCIDD (CNL_ADSP_IPC_BASE + 0x18)
  34. #define CNL_ADSP_REG_HIPCCTL (CNL_ADSP_IPC_BASE + 0x28)
  35. /* HIPCTDR */
  36. #define CNL_ADSP_REG_HIPCTDR_BUSY BIT(31)
  37. /* HIPCTDA */
  38. #define CNL_ADSP_REG_HIPCTDA_DONE BIT(31)
  39. /* HIPCIDR */
  40. #define CNL_ADSP_REG_HIPCIDR_BUSY BIT(31)
  41. /* HIPCIDA */
  42. #define CNL_ADSP_REG_HIPCIDA_DONE BIT(31)
  43. /* CNL HIPCCTL */
  44. #define CNL_ADSP_REG_HIPCCTL_DONE BIT(1)
  45. #define CNL_ADSP_REG_HIPCCTL_BUSY BIT(0)
  46. /* CNL HIPCT */
  47. #define CNL_ADSP_REG_HIPCT_BUSY BIT(31)
  48. /* Intel HD Audio SRAM Window 1 */
  49. #define CNL_ADSP_SRAM1_BASE 0xa0000
  50. #define CNL_ADSP_MMIO_LEN 0x10000
  51. #define CNL_ADSP_W0_STAT_SZ 0x1000
  52. #define CNL_ADSP_W0_UP_SZ 0x1000
  53. #define CNL_ADSP_W1_SZ 0x1000
  54. #define CNL_FW_STS_MASK 0xf
  55. #define CNL_ADSPIC_IPC 0x1
  56. #define CNL_ADSPIS_IPC 0x1
  57. #define CNL_DSP_CORES 4
  58. #define CNL_DSP_CORES_MASK ((1 << CNL_DSP_CORES) - 1)
  59. /* core reset - asserted high */
  60. #define CNL_ADSPCS_CRST_SHIFT 0
  61. #define CNL_ADSPCS_CRST(x) (x << CNL_ADSPCS_CRST_SHIFT)
  62. /* core run/stall - when set to 1 core is stalled */
  63. #define CNL_ADSPCS_CSTALL_SHIFT 8
  64. #define CNL_ADSPCS_CSTALL(x) (x << CNL_ADSPCS_CSTALL_SHIFT)
  65. /* set power active - when set to 1 turn core on */
  66. #define CNL_ADSPCS_SPA_SHIFT 16
  67. #define CNL_ADSPCS_SPA(x) (x << CNL_ADSPCS_SPA_SHIFT)
  68. /* current power active - power status of cores, set by hardware */
  69. #define CNL_ADSPCS_CPA_SHIFT 24
  70. #define CNL_ADSPCS_CPA(x) (x << CNL_ADSPCS_CPA_SHIFT)
  71. int cnl_dsp_enable_core(struct sst_dsp *ctx, unsigned int core);
  72. int cnl_dsp_disable_core(struct sst_dsp *ctx, unsigned int core);
  73. irqreturn_t cnl_dsp_sst_interrupt(int irq, void *dev_id);
  74. void cnl_dsp_free(struct sst_dsp *dsp);
  75. void cnl_ipc_int_enable(struct sst_dsp *ctx);
  76. void cnl_ipc_int_disable(struct sst_dsp *ctx);
  77. void cnl_ipc_op_int_enable(struct sst_dsp *ctx);
  78. void cnl_ipc_op_int_disable(struct sst_dsp *ctx);
  79. bool cnl_ipc_int_status(struct sst_dsp *ctx);
  80. void cnl_ipc_free(struct sst_generic_ipc *ipc);
  81. int cnl_sst_dsp_init(struct device *dev, void __iomem *mmio_base, int irq,
  82. const char *fw_name, struct skl_dsp_loader_ops dsp_ops,
  83. struct skl_sst **dsp);
  84. int cnl_sst_init_fw(struct device *dev, struct skl_sst *ctx);
  85. void cnl_sst_dsp_cleanup(struct device *dev, struct skl_sst *ctx);
  86. #endif /*__CNL_SST_DSP_H__*/