Commit 9ea16669 authored by Tinghan Shen's avatar Tinghan Shen Committed by Mathieu Poirier

remoteproc: mediatek: Extract SCP common registers

This is the 1st preliminary steps for probing multi-core SCP.
The registers of config and l1tcm are common on single-core SCP
and multi-core SCP. Extract these registers out to reduce duplicated
fields in mtk_scp when multiple SCP instances are created.
Signed-off-by: default avatarTinghan Shen <tinghan.shen@mediatek.com>
Reviewed-by: default avatarAngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Tested-by: default avatarAngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Link: https://lore.kernel.org/r/20230901080935.14571-6-tinghan.shen@mediatek.comSigned-off-by: default avatarMathieu Poirier <mathieu.poirier@linaro.org>
parent 6a1c9aaf
...@@ -100,17 +100,20 @@ struct mtk_scp_of_data { ...@@ -100,17 +100,20 @@ struct mtk_scp_of_data {
size_t ipi_buf_offset; size_t ipi_buf_offset;
}; };
struct mtk_scp_of_cluster {
void __iomem *reg_base;
void __iomem *l1tcm_base;
size_t l1tcm_size;
phys_addr_t l1tcm_phys;
};
struct mtk_scp { struct mtk_scp {
struct device *dev; struct device *dev;
struct rproc *rproc; struct rproc *rproc;
struct clk *clk; struct clk *clk;
void __iomem *reg_base;
void __iomem *sram_base; void __iomem *sram_base;
size_t sram_size; size_t sram_size;
phys_addr_t sram_phys; phys_addr_t sram_phys;
void __iomem *l1tcm_base;
size_t l1tcm_size;
phys_addr_t l1tcm_phys;
const struct mtk_scp_of_data *data; const struct mtk_scp_of_data *data;
...@@ -128,6 +131,8 @@ struct mtk_scp { ...@@ -128,6 +131,8 @@ struct mtk_scp {
size_t dram_size; size_t dram_size;
struct rproc_subdev *rpmsg_subdev; struct rproc_subdev *rpmsg_subdev;
struct mtk_scp_of_cluster *cluster;
}; };
/** /**
......
This diff is collapsed.
...@@ -177,7 +177,7 @@ int scp_ipi_send(struct mtk_scp *scp, u32 id, void *buf, unsigned int len, ...@@ -177,7 +177,7 @@ int scp_ipi_send(struct mtk_scp *scp, u32 id, void *buf, unsigned int len,
mutex_lock(&scp->send_lock); mutex_lock(&scp->send_lock);
/* Wait until SCP receives the last command */ /* Wait until SCP receives the last command */
ret = readl_poll_timeout_atomic(scp->reg_base + scp->data->host_to_scp_reg, ret = readl_poll_timeout_atomic(scp->cluster->reg_base + scp->data->host_to_scp_reg,
val, !val, 0, SCP_TIMEOUT_US); val, !val, 0, SCP_TIMEOUT_US);
if (ret) { if (ret) {
dev_err(scp->dev, "%s: IPI timeout!\n", __func__); dev_err(scp->dev, "%s: IPI timeout!\n", __func__);
...@@ -192,7 +192,7 @@ int scp_ipi_send(struct mtk_scp *scp, u32 id, void *buf, unsigned int len, ...@@ -192,7 +192,7 @@ int scp_ipi_send(struct mtk_scp *scp, u32 id, void *buf, unsigned int len,
scp->ipi_id_ack[id] = false; scp->ipi_id_ack[id] = false;
/* send the command to SCP */ /* send the command to SCP */
writel(scp->data->host_to_scp_int_bit, writel(scp->data->host_to_scp_int_bit,
scp->reg_base + scp->data->host_to_scp_reg); scp->cluster->reg_base + scp->data->host_to_scp_reg);
if (wait) { if (wait) {
/* wait for SCP's ACK */ /* wait for SCP's ACK */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment