summaryrefslogtreecommitdiff
path: root/sound/soc/sof/imx/imx8m.c
diff options
context:
space:
mode:
authorIulian Olaru <iulianolaru249@yahoo.com>2020-09-17 13:56:26 +0300
committerMark Brown <broonie@kernel.org>2020-09-17 17:53:15 +0300
commit18ebffe4d043bf5f3a9b669d8d91f855bde8f6b7 (patch)
treef3a997d4ad181819419c20f3e894efdb1619394c /sound/soc/sof/imx/imx8m.c
parentd70a4412e264cd8ff7a034505184c0b54876532a (diff)
downloadlinux-18ebffe4d043bf5f3a9b669d8d91f855bde8f6b7.tar.xz
ASoC: SOF: imx: Add debug support for imx platforms
This patch adds debug support for imx platforms. This is important in order to gather information about the state of the DSP in case of an oops and the reason for the oops. This is done by checking if a message with a panic code has been placed in the debug box, in the imx8_dsp_handle_request function from sof/imx. If positive, the function imx8_dump, added in common, will be called. The first step is to gather information about the registers, filename, line number and stack by calling the imx8_get_registers, added in common. Then the information will be printed to the console by calling the get_status function. Signed-off-by: Iulian Olaru <iulianolaru249@yahoo.com> Reviewed-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com> Reviewed-by: Daniel Baluta <daniel.baluta@gmail.com> Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com> Link: https://lore.kernel.org/r/20200917105633.2579047-2-kai.vehmanen@linux.intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound/soc/sof/imx/imx8m.c')
-rw-r--r--sound/soc/sof/imx/imx8m.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/sound/soc/sof/imx/imx8m.c b/sound/soc/sof/imx/imx8m.c
index ca23ac99a63d..cb822d953767 100644
--- a/sound/soc/sof/imx/imx8m.c
+++ b/sound/soc/sof/imx/imx8m.c
@@ -17,6 +17,7 @@
#include <linux/firmware/imx/dsp.h>
#include "../ops.h"
+#include "imx-common.h"
#define MBOX_OFFSET 0x800000
#define MBOX_SIZE 0x1000
@@ -88,8 +89,16 @@ static void imx8m_dsp_handle_reply(struct imx_dsp_ipc *ipc)
static void imx8m_dsp_handle_request(struct imx_dsp_ipc *ipc)
{
struct imx8m_priv *priv = imx_dsp_get_data(ipc);
+ u32 p; /* Panic code */
- snd_sof_ipc_msgs_rx(priv->sdev);
+ /* Read the message from the debug box. */
+ sof_mailbox_read(priv->sdev, priv->sdev->debug_box.offset + 4, &p, sizeof(p));
+
+ /* Check to see if the message is a panic code (0x0dead***) */
+ if ((p & SOF_IPC_PANIC_MAGIC_MASK) == SOF_IPC_PANIC_MAGIC)
+ snd_sof_dsp_panic(priv->sdev, p);
+ else
+ snd_sof_ipc_msgs_rx(priv->sdev);
}
static struct imx_dsp_ops imx8m_dsp_ops = {
@@ -262,6 +271,9 @@ struct snd_sof_dsp_ops sof_imx8m_ops = {
.block_read = sof_block_read,
.block_write = sof_block_write,
+ /* Module IO */
+ .read64 = sof_io_read64,
+
/* ipc */
.send_msg = imx8m_send_msg,
.fw_ready = sof_fw_ready,
@@ -277,6 +289,9 @@ struct snd_sof_dsp_ops sof_imx8m_ops = {
/* firmware loading */
.load_firmware = snd_sof_load_firmware_memcpy,
+ /* Debug information */
+ .dbg_dump = imx8_dump,
+
/* Firmware ops */
.arch_ops = &sof_xtensa_arch_ops,