aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/remoteproc/mtk_common.h
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2020-02-04 09:06:24 +0000
committerLinus Torvalds <torvalds@linux-foundation.org>2020-02-04 09:06:24 +0000
commita45ad71e8995eed2b95c6ef0f4c442da0c4f6677 (patch)
tree4710c9637d677385ee231a6c278917b1087d931b /drivers/remoteproc/mtk_common.h
parentMerge tag 'hwlock-v5.6' of git://git.kernel.org/pub/scm/linux/kernel/git/andersson/remoteproc (diff)
parentremoteproc: qcom: q6v5-mss: Improve readability of reset_assert (diff)
downloadlinux-dev-a45ad71e8995eed2b95c6ef0f4c442da0c4f6677.tar.xz
linux-dev-a45ad71e8995eed2b95c6ef0f4c442da0c4f6677.zip
Merge tag 'rproc-v5.6' of git://git.kernel.org/pub/scm/linux/kernel/git/andersson/remoteproc
Pull remoteproc updates from Bjorn Andersson: "This adds support for the Mediatek MT8183 SCP, modem remoteproc on Qualcomm SC7180 platform, audio and sensor remoteprocs on Qualcomm MSM8998 and audio, compute, modem and sensor remoteprocs on Qualcomm SM8150. It adds votes for necessary power-domains for all Qualcomm TrustZone based remoteproc instances are held, fixes a bug related to remoteproc drivers registering before the core has been initialized and does clean up the Qualcomm modem remoteproc driver" * tag 'rproc-v5.6' of git://git.kernel.org/pub/scm/linux/kernel/git/andersson/remoteproc: (21 commits) remoteproc: qcom: q6v5-mss: Improve readability of reset_assert remoteproc: qcom: q6v5-mss: Use regmap_read_poll_timeout remoteproc: qcom: q6v5-mss: Rename boot status timeout remoteproc: qcom: q6v5-mss: Improve readability across clk handling remoteproc: use struct_size() helper remoteproc: Initialize rproc_class before use rpmsg: add rpmsg support for mt8183 SCP. remoteproc/mediatek: add SCP support for mt8183 dt-bindings: Add a binding for Mediatek SCP remoteproc: mss: q6v5-mss: Add modem support on SC7180 dt-bindings: remoteproc: qcom: Add Q6V5 Modem PIL binding for SC7180 remoteproc: qcom: pas: Add MSM8998 ADSP and SLPI support dt-bindings: remoteproc: qcom: Add ADSP and SLPI support for MSM8998 SoC remoteproc: q6v5-mss: Remove mem clk from the active pool remoteproc: qcom: Remove unneeded semicolon remoteproc: qcom: pas: Add auto_boot flag remoteproc: qcom: pas: Add SM8150 ADSP, CDSP, Modem and SLPI support dt-bindings: remoteproc: qcom: SM8150 Add ADSP, CDSP, MPSS and SLPI support remoteproc: qcom: pas: Vote for active/proxy power domains dt-bindings: remoteproc: qcom: Add power-domain bindings for Q6V5 PAS ...
Diffstat (limited to 'drivers/remoteproc/mtk_common.h')
-rw-r--r--drivers/remoteproc/mtk_common.h94
1 files changed, 94 insertions, 0 deletions
diff --git a/drivers/remoteproc/mtk_common.h b/drivers/remoteproc/mtk_common.h
new file mode 100644
index 000000000000..deb20096146a
--- /dev/null
+++ b/drivers/remoteproc/mtk_common.h
@@ -0,0 +1,94 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Copyright (c) 2019 MediaTek Inc.
+ */
+
+#ifndef __RPROC_MTK_COMMON_H
+#define __RPROC_MTK_COMMON_H
+
+#include <linux/interrupt.h>
+#include <linux/kernel.h>
+#include <linux/platform_device.h>
+#include <linux/remoteproc.h>
+#include <linux/remoteproc/mtk_scp.h>
+
+#define MT8183_SW_RSTN 0x0
+#define MT8183_SW_RSTN_BIT BIT(0)
+#define MT8183_SCP_TO_HOST 0x1C
+#define MT8183_SCP_IPC_INT_BIT BIT(0)
+#define MT8183_SCP_WDT_INT_BIT BIT(8)
+#define MT8183_HOST_TO_SCP 0x28
+#define MT8183_HOST_IPC_INT_BIT BIT(0)
+#define MT8183_WDT_CFG 0x84
+#define MT8183_SCP_CLK_SW_SEL 0x4000
+#define MT8183_SCP_CLK_DIV_SEL 0x4024
+#define MT8183_SCP_SRAM_PDN 0x402C
+#define MT8183_SCP_L1_SRAM_PD 0x4080
+#define MT8183_SCP_TCM_TAIL_SRAM_PD 0x4094
+
+#define MT8183_SCP_CACHE_SEL(x) (0x14000 + (x) * 0x3000)
+#define MT8183_SCP_CACHE_CON MT8183_SCP_CACHE_SEL(0)
+#define MT8183_SCP_DCACHE_CON MT8183_SCP_CACHE_SEL(1)
+#define MT8183_SCP_CACHESIZE_8KB BIT(8)
+#define MT8183_SCP_CACHE_CON_WAYEN BIT(10)
+
+#define SCP_FW_VER_LEN 32
+#define SCP_SHARE_BUFFER_SIZE 288
+
+struct scp_run {
+ u32 signaled;
+ s8 fw_ver[SCP_FW_VER_LEN];
+ u32 dec_capability;
+ u32 enc_capability;
+ wait_queue_head_t wq;
+};
+
+struct scp_ipi_desc {
+ /* For protecting handler. */
+ struct mutex lock;
+ scp_ipi_handler_t handler;
+ void *priv;
+};
+
+struct mtk_scp {
+ struct device *dev;
+ struct rproc *rproc;
+ struct clk *clk;
+ void __iomem *reg_base;
+ void __iomem *sram_base;
+ size_t sram_size;
+
+ struct mtk_share_obj __iomem *recv_buf;
+ struct mtk_share_obj __iomem *send_buf;
+ struct scp_run run;
+ /* To prevent multiple ipi_send run concurrently. */
+ struct mutex send_lock;
+ struct scp_ipi_desc ipi_desc[SCP_IPI_MAX];
+ bool ipi_id_ack[SCP_IPI_MAX];
+ wait_queue_head_t ack_wq;
+
+ void __iomem *cpu_addr;
+ phys_addr_t phys_addr;
+ size_t dram_size;
+
+ struct rproc_subdev *rpmsg_subdev;
+};
+
+/**
+ * struct mtk_share_obj - SRAM buffer shared with AP and SCP
+ *
+ * @id: IPI id
+ * @len: share buffer length
+ * @share_buf: share buffer data
+ */
+struct mtk_share_obj {
+ u32 id;
+ u32 len;
+ u8 share_buf[SCP_SHARE_BUFFER_SIZE];
+};
+
+void scp_memcpy_aligned(void __iomem *dst, const void *src, unsigned int len);
+void scp_ipi_lock(struct mtk_scp *scp, u32 id);
+void scp_ipi_unlock(struct mtk_scp *scp, u32 id);
+
+#endif