mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-09 20:32:04 +09:00
mbox: g12a: add m4 mbox driver [1/3]
PD#SWPL-12873 Problem: add m4 mailbox driver Solution: add m4 mailbox driver Verify: test pass on sm1 skt Change-Id: Ied77949482179014d9e695ffc606f2ac939c82ca Signed-off-by: Shunzhou Jiang <shunzhou.jiang@amlogic.com>
This commit is contained in:
@@ -35,6 +35,8 @@
|
||||
#include "meson_mhu.h"
|
||||
|
||||
struct device *the_scpi_device;
|
||||
u32 num_scp_chans;
|
||||
|
||||
|
||||
#define DRIVER_NAME "meson_mhu"
|
||||
|
||||
@@ -59,15 +61,15 @@ struct device *the_scpi_device;
|
||||
* | CPU_INTR_H_CLEAR | 0x048 | TX_CLEAR(H) |
|
||||
* +--------------------+-------+---------------+
|
||||
*/
|
||||
#define RX_OFFSET(chan) (0x10 + (idx) * 0xc)
|
||||
#define RX_STATUS(chan) (RX_OFFSET(chan) + 0x4)
|
||||
#define RX_SET(chan) RX_OFFSET(chan)
|
||||
#define RX_CLEAR(chan) (RX_OFFSET(chan) + 0x8)
|
||||
#define RX_OFFSET(chan) (0x10 + (chan) * 0xc)
|
||||
#define RX_STATUS(chan) (RX_OFFSET(chan) + 0x4)
|
||||
#define RX_SET(chan) RX_OFFSET(chan)
|
||||
#define RX_CLEAR(chan) (RX_OFFSET(chan) + 0x8)
|
||||
|
||||
#define TX_OFFSET(chan) (0x34 + (idx) * 0xc)
|
||||
#define TX_STATUS(chan) (TX_OFFSET(chan) + 0x4)
|
||||
#define TX_SET(chan) TX_OFFSET(chan)
|
||||
#define TX_CLEAR(chan) (TX_OFFSET(chan) + 0x8)
|
||||
#define TX_OFFSET(chan) (0x34 + (chan) * 0xc)
|
||||
#define TX_STATUS(chan) (TX_OFFSET(chan) + 0x4)
|
||||
#define TX_SET(chan) TX_OFFSET(chan)
|
||||
#define TX_CLEAR(chan) (TX_OFFSET(chan) + 0x8)
|
||||
|
||||
/*
|
||||
* +---------------+-------+----------------+
|
||||
@@ -221,6 +223,11 @@ static int mhu_probe(struct platform_device *pdev)
|
||||
ctlr->dev = dev;
|
||||
platform_set_drvdata(pdev, ctlr);
|
||||
|
||||
num_scp_chans = 0;
|
||||
of_property_read_u32(dev->of_node, "num-chans-to-scp", &num_scp_chans);
|
||||
if (num_scp_chans == 0 || num_scp_chans > 2)
|
||||
num_scp_chans = CHANNEL_MAX;
|
||||
|
||||
l = devm_kzalloc(dev, sizeof(*l) * CHANNEL_MAX, GFP_KERNEL);
|
||||
if (!l)
|
||||
return -ENOMEM;
|
||||
|
||||
@@ -31,3 +31,4 @@ struct mhu_data_buf {
|
||||
};
|
||||
|
||||
extern struct device *the_scpi_device;
|
||||
extern u32 num_scp_chans;
|
||||
|
||||
@@ -123,6 +123,8 @@ static int high_priority_cmds[] = {
|
||||
SCPI_CMD_INIT_DSP,
|
||||
};
|
||||
|
||||
static int m4_cmds[] = {-1};
|
||||
|
||||
static struct scpi_dvfs_info *scpi_opps[MAX_DVFS_DOMAINS];
|
||||
|
||||
static int scpi_linux_errmap[SCPI_ERR_MAX] = {
|
||||
@@ -140,11 +142,17 @@ static inline int scpi_to_linux_errno(int errno)
|
||||
|
||||
static bool high_priority_chan_supported(int cmd)
|
||||
{
|
||||
int idx;
|
||||
unsigned int idx;
|
||||
|
||||
for (idx = 0; idx < ARRAY_SIZE(high_priority_cmds); idx++)
|
||||
if (cmd == high_priority_cmds[idx])
|
||||
return true;
|
||||
if (num_scp_chans == CHANNEL_MAX) {
|
||||
for (idx = 0; idx < ARRAY_SIZE(high_priority_cmds); idx++)
|
||||
if (cmd == high_priority_cmds[idx])
|
||||
return true;
|
||||
} else {
|
||||
for (idx = 0; idx < ARRAY_SIZE(m4_cmds); idx++)
|
||||
if (cmd == m4_cmds[idx])
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user