Commit 92ceebf9 authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'mailbox-v5.20' of git://git.linaro.org/landing-teams/working/fujitsu/integration

Pull mailbox updates from Jassi Brar:

 - mtk:
     - use rx_callback instead of cmdq_task_cb

 - qcom:
     - add syscon const
     - add SM6375 compatible

 - imx:
     - enable RST channel
     - clear pending irqs

* tag 'mailbox-v5.20' of git://git.linaro.org/landing-teams/working/fujitsu/integration:
  mailbox: imx: clear pending interrupts
  dt-bindings: mailbox: qcom-ipcc: Add SM6375 compatible
  mailbox: imx: support RST channel
  dt-bindings: mailbox: imx-mu: add RST channel
  dt-bindings: mailbox: qcom,apcs-kpss-global: Add syscon const for relevant entries
  mailbox: mtk-cmdq: Remove proprietary cmdq_task_cb
parents df7a456e 8a8dc2b9
...@@ -72,14 +72,16 @@ properties: ...@@ -72,14 +72,16 @@ properties:
type : Channel type type : Channel type
channel : Channel number channel : Channel number
This MU support 4 type of unidirectional channels, each type This MU support 5 type of unidirectional channels, each type
has 4 channels. A total of 16 channels. Following types are has 4 channels except RST channel which only has 1 channel.
A total of 17 channels. Following types are
supported: supported:
0 - TX channel with 32bit transmit register and IRQ transmit 0 - TX channel with 32bit transmit register and IRQ transmit
acknowledgment support. acknowledgment support.
1 - RX channel with 32bit receive register and IRQ support 1 - RX channel with 32bit receive register and IRQ support
2 - TX doorbell channel. Without own register and no ACK support. 2 - TX doorbell channel. Without own register and no ACK support.
3 - RX doorbell channel. 3 - RX doorbell channel.
4 - RST channel
const: 2 const: 2
clocks: clocks:
......
...@@ -15,26 +15,30 @@ maintainers: ...@@ -15,26 +15,30 @@ maintainers:
properties: properties:
compatible: compatible:
enum: oneOf:
- qcom,ipq6018-apcs-apps-global - items:
- qcom,ipq8074-apcs-apps-global - enum:
- qcom,msm8916-apcs-kpss-global - qcom,ipq6018-apcs-apps-global
- qcom,msm8939-apcs-kpss-global - qcom,ipq8074-apcs-apps-global
- qcom,msm8953-apcs-kpss-global - qcom,msm8976-apcs-kpss-global
- qcom,msm8976-apcs-kpss-global - qcom,msm8996-apcs-hmss-global
- qcom,msm8994-apcs-kpss-global - qcom,msm8998-apcs-hmss-global
- qcom,msm8996-apcs-hmss-global - qcom,qcm2290-apcs-hmss-global
- qcom,msm8998-apcs-hmss-global - qcom,sc7180-apss-shared
- qcom,qcm2290-apcs-hmss-global - qcom,sc8180x-apss-shared
- qcom,qcs404-apcs-apps-global - qcom,sdm660-apcs-hmss-global
- qcom,sc7180-apss-shared - qcom,sdm845-apss-shared
- qcom,sc8180x-apss-shared - qcom,sm6125-apcs-hmss-global
- qcom,sdm660-apcs-hmss-global - qcom,sm6115-apcs-hmss-global
- qcom,sdm845-apss-shared - qcom,sm8150-apss-shared
- qcom,sm6125-apcs-hmss-global - items:
- qcom,sm6115-apcs-hmss-global - enum:
- qcom,sm8150-apss-shared - qcom,msm8916-apcs-kpss-global
- qcom,msm8939-apcs-kpss-global
- qcom,msm8953-apcs-kpss-global
- qcom,msm8994-apcs-kpss-global
- qcom,qcs404-apcs-apps-global
- const: syscon
reg: reg:
maxItems: 1 maxItems: 1
...@@ -121,7 +125,7 @@ examples: ...@@ -121,7 +125,7 @@ examples:
#define GCC_APSS_AHB_CLK_SRC 1 #define GCC_APSS_AHB_CLK_SRC 1
#define GCC_GPLL0_AO_OUT_MAIN 123 #define GCC_GPLL0_AO_OUT_MAIN 123
apcs: mailbox@b011000 { apcs: mailbox@b011000 {
compatible = "qcom,qcs404-apcs-apps-global"; compatible = "qcom,qcs404-apcs-apps-global", "syscon";
reg = <0x0b011000 0x1000>; reg = <0x0b011000 0x1000>;
#mbox-cells = <1>; #mbox-cells = <1>;
clocks = <&apcs_hfpll>, <&gcc GCC_GPLL0_AO_OUT_MAIN>; clocks = <&apcs_hfpll>, <&gcc GCC_GPLL0_AO_OUT_MAIN>;
......
...@@ -25,6 +25,7 @@ properties: ...@@ -25,6 +25,7 @@ properties:
items: items:
- enum: - enum:
- qcom,sm6350-ipcc - qcom,sm6350-ipcc
- qcom,sm6375-ipcc
- qcom,sm8250-ipcc - qcom,sm8250-ipcc
- qcom,sm8350-ipcc - qcom,sm8350-ipcc
- qcom,sm8450-ipcc - qcom,sm8450-ipcc
......
...@@ -19,13 +19,15 @@ ...@@ -19,13 +19,15 @@
#include <linux/suspend.h> #include <linux/suspend.h>
#include <linux/slab.h> #include <linux/slab.h>
#define IMX_MU_CHANS 16 #define IMX_MU_CHANS 17
/* TX0/RX0/RXDB[0-3] */ /* TX0/RX0/RXDB[0-3] */
#define IMX_MU_SCU_CHANS 6 #define IMX_MU_SCU_CHANS 6
/* TX0/RX0 */ /* TX0/RX0 */
#define IMX_MU_S4_CHANS 2 #define IMX_MU_S4_CHANS 2
#define IMX_MU_CHAN_NAME_SIZE 20 #define IMX_MU_CHAN_NAME_SIZE 20
#define IMX_MU_NUM_RR 4
#define IMX_MU_SECO_TX_TOUT (msecs_to_jiffies(3000)) #define IMX_MU_SECO_TX_TOUT (msecs_to_jiffies(3000))
#define IMX_MU_SECO_RX_TOUT (msecs_to_jiffies(3000)) #define IMX_MU_SECO_RX_TOUT (msecs_to_jiffies(3000))
...@@ -35,9 +37,11 @@ enum imx_mu_chan_type { ...@@ -35,9 +37,11 @@ enum imx_mu_chan_type {
IMX_MU_TYPE_RX = 1, /* Rx */ IMX_MU_TYPE_RX = 1, /* Rx */
IMX_MU_TYPE_TXDB = 2, /* Tx doorbell */ IMX_MU_TYPE_TXDB = 2, /* Tx doorbell */
IMX_MU_TYPE_RXDB = 3, /* Rx doorbell */ IMX_MU_TYPE_RXDB = 3, /* Rx doorbell */
IMX_MU_TYPE_RST = 4, /* Reset */
}; };
enum imx_mu_xcr { enum imx_mu_xcr {
IMX_MU_CR,
IMX_MU_GIER, IMX_MU_GIER,
IMX_MU_GCR, IMX_MU_GCR,
IMX_MU_TCR, IMX_MU_TCR,
...@@ -50,6 +54,7 @@ enum imx_mu_xsr { ...@@ -50,6 +54,7 @@ enum imx_mu_xsr {
IMX_MU_GSR, IMX_MU_GSR,
IMX_MU_TSR, IMX_MU_TSR,
IMX_MU_RSR, IMX_MU_RSR,
IMX_MU_xSR_MAX,
}; };
struct imx_sc_rpc_msg_max { struct imx_sc_rpc_msg_max {
...@@ -85,7 +90,7 @@ struct imx_mu_priv { ...@@ -85,7 +90,7 @@ struct imx_mu_priv {
int irq[IMX_MU_CHANS]; int irq[IMX_MU_CHANS];
bool suspend; bool suspend;
u32 xcr[4]; u32 xcr[IMX_MU_xCR_MAX];
bool side_b; bool side_b;
}; };
...@@ -105,8 +110,8 @@ struct imx_mu_dcfg { ...@@ -105,8 +110,8 @@ struct imx_mu_dcfg {
enum imx_mu_type type; enum imx_mu_type type;
u32 xTR; /* Transmit Register0 */ u32 xTR; /* Transmit Register0 */
u32 xRR; /* Receive Register0 */ u32 xRR; /* Receive Register0 */
u32 xSR[4]; /* Status Registers */ u32 xSR[IMX_MU_xSR_MAX]; /* Status Registers */
u32 xCR[4]; /* Control Registers */ u32 xCR[IMX_MU_xCR_MAX]; /* Control Registers */
}; };
#define IMX_MU_xSR_GIPn(type, x) (type & IMX_MU_V2 ? BIT(x) : BIT(28 + (3 - (x)))) #define IMX_MU_xSR_GIPn(type, x) (type & IMX_MU_V2 ? BIT(x) : BIT(28 + (3 - (x))))
...@@ -121,6 +126,9 @@ struct imx_mu_dcfg { ...@@ -121,6 +126,9 @@ struct imx_mu_dcfg {
#define IMX_MU_xCR_TIEn(type, x) (type & IMX_MU_V2 ? BIT(x) : BIT(20 + (3 - (x)))) #define IMX_MU_xCR_TIEn(type, x) (type & IMX_MU_V2 ? BIT(x) : BIT(20 + (3 - (x))))
/* General Purpose Interrupt Request */ /* General Purpose Interrupt Request */
#define IMX_MU_xCR_GIRn(type, x) (type & IMX_MU_V2 ? BIT(x) : BIT(16 + (3 - (x)))) #define IMX_MU_xCR_GIRn(type, x) (type & IMX_MU_V2 ? BIT(x) : BIT(16 + (3 - (x))))
/* MU reset */
#define IMX_MU_xCR_RST(type) (type & IMX_MU_V2 ? BIT(0) : BIT(5))
#define IMX_MU_xSR_RST(type) (type & IMX_MU_V2 ? BIT(0) : BIT(7))
static struct imx_mu_priv *to_imx_mu_priv(struct mbox_controller *mbox) static struct imx_mu_priv *to_imx_mu_priv(struct mbox_controller *mbox)
...@@ -497,6 +505,8 @@ static irqreturn_t imx_mu_isr(int irq, void *p) ...@@ -497,6 +505,8 @@ static irqreturn_t imx_mu_isr(int irq, void *p)
val &= IMX_MU_xSR_GIPn(priv->dcfg->type, cp->idx) & val &= IMX_MU_xSR_GIPn(priv->dcfg->type, cp->idx) &
(ctrl & IMX_MU_xCR_GIEn(priv->dcfg->type, cp->idx)); (ctrl & IMX_MU_xCR_GIEn(priv->dcfg->type, cp->idx));
break; break;
case IMX_MU_TYPE_RST:
return IRQ_NONE;
default: default:
dev_warn_ratelimited(priv->dev, "Unhandled channel type %d\n", dev_warn_ratelimited(priv->dev, "Unhandled channel type %d\n",
cp->type); cp->type);
...@@ -581,6 +591,8 @@ static void imx_mu_shutdown(struct mbox_chan *chan) ...@@ -581,6 +591,8 @@ static void imx_mu_shutdown(struct mbox_chan *chan)
{ {
struct imx_mu_priv *priv = to_imx_mu_priv(chan->mbox); struct imx_mu_priv *priv = to_imx_mu_priv(chan->mbox);
struct imx_mu_con_priv *cp = chan->con_priv; struct imx_mu_con_priv *cp = chan->con_priv;
int ret;
u32 sr;
if (cp->type == IMX_MU_TYPE_TXDB) { if (cp->type == IMX_MU_TYPE_TXDB) {
tasklet_kill(&cp->txdb_tasklet); tasklet_kill(&cp->txdb_tasklet);
...@@ -598,6 +610,13 @@ static void imx_mu_shutdown(struct mbox_chan *chan) ...@@ -598,6 +610,13 @@ static void imx_mu_shutdown(struct mbox_chan *chan)
case IMX_MU_TYPE_RXDB: case IMX_MU_TYPE_RXDB:
imx_mu_xcr_rmw(priv, IMX_MU_GIER, 0, IMX_MU_xCR_GIEn(priv->dcfg->type, cp->idx)); imx_mu_xcr_rmw(priv, IMX_MU_GIER, 0, IMX_MU_xCR_GIEn(priv->dcfg->type, cp->idx));
break; break;
case IMX_MU_TYPE_RST:
imx_mu_xcr_rmw(priv, IMX_MU_CR, IMX_MU_xCR_RST(priv->dcfg->type), 0);
ret = readl_poll_timeout(priv->base + priv->dcfg->xSR[IMX_MU_SR], sr,
!(sr & IMX_MU_xSR_RST(priv->dcfg->type)), 1, 5);
if (ret)
dev_warn(priv->dev, "RST channel timeout\n");
break;
default: default:
break; break;
} }
...@@ -694,6 +713,7 @@ static struct mbox_chan *imx_mu_seco_xlate(struct mbox_controller *mbox, ...@@ -694,6 +713,7 @@ static struct mbox_chan *imx_mu_seco_xlate(struct mbox_controller *mbox,
static void imx_mu_init_generic(struct imx_mu_priv *priv) static void imx_mu_init_generic(struct imx_mu_priv *priv)
{ {
unsigned int i; unsigned int i;
unsigned int val;
for (i = 0; i < IMX_MU_CHANS; i++) { for (i = 0; i < IMX_MU_CHANS; i++) {
struct imx_mu_con_priv *cp = &priv->con_priv[i]; struct imx_mu_con_priv *cp = &priv->con_priv[i];
...@@ -715,6 +735,14 @@ static void imx_mu_init_generic(struct imx_mu_priv *priv) ...@@ -715,6 +735,14 @@ static void imx_mu_init_generic(struct imx_mu_priv *priv)
/* Set default MU configuration */ /* Set default MU configuration */
for (i = 0; i < IMX_MU_xCR_MAX; i++) for (i = 0; i < IMX_MU_xCR_MAX; i++)
imx_mu_write(priv, 0, priv->dcfg->xCR[i]); imx_mu_write(priv, 0, priv->dcfg->xCR[i]);
/* Clear any pending GIP */
val = imx_mu_read(priv, priv->dcfg->xSR[IMX_MU_GSR]);
imx_mu_write(priv, val, priv->dcfg->xSR[IMX_MU_GSR]);
/* Clear any pending RSR */
for (i = 0; i < IMX_MU_NUM_RR; i++)
imx_mu_read(priv, priv->dcfg->xRR + (i % 4) * 4);
} }
static void imx_mu_init_specific(struct imx_mu_priv *priv) static void imx_mu_init_specific(struct imx_mu_priv *priv)
...@@ -865,7 +893,7 @@ static const struct imx_mu_dcfg imx_mu_cfg_imx6sx = { ...@@ -865,7 +893,7 @@ static const struct imx_mu_dcfg imx_mu_cfg_imx6sx = {
.xTR = 0x0, .xTR = 0x0,
.xRR = 0x10, .xRR = 0x10,
.xSR = {0x20, 0x20, 0x20, 0x20}, .xSR = {0x20, 0x20, 0x20, 0x20},
.xCR = {0x24, 0x24, 0x24, 0x24}, .xCR = {0x24, 0x24, 0x24, 0x24, 0x24},
}; };
static const struct imx_mu_dcfg imx_mu_cfg_imx7ulp = { static const struct imx_mu_dcfg imx_mu_cfg_imx7ulp = {
...@@ -888,7 +916,7 @@ static const struct imx_mu_dcfg imx_mu_cfg_imx8ulp = { ...@@ -888,7 +916,7 @@ static const struct imx_mu_dcfg imx_mu_cfg_imx8ulp = {
.xTR = 0x200, .xTR = 0x200,
.xRR = 0x280, .xRR = 0x280,
.xSR = {0xC, 0x118, 0x124, 0x12C}, .xSR = {0xC, 0x118, 0x124, 0x12C},
.xCR = {0x110, 0x114, 0x120, 0x128}, .xCR = {0x8, 0x110, 0x114, 0x120, 0x128},
}; };
static const struct imx_mu_dcfg imx_mu_cfg_imx8ulp_s4 = { static const struct imx_mu_dcfg imx_mu_cfg_imx8ulp_s4 = {
......
...@@ -192,15 +192,10 @@ static bool cmdq_thread_is_in_wfe(struct cmdq_thread *thread) ...@@ -192,15 +192,10 @@ static bool cmdq_thread_is_in_wfe(struct cmdq_thread *thread)
static void cmdq_task_exec_done(struct cmdq_task *task, int sta) static void cmdq_task_exec_done(struct cmdq_task *task, int sta)
{ {
struct cmdq_task_cb *cb = &task->pkt->async_cb;
struct cmdq_cb_data data; struct cmdq_cb_data data;
data.sta = sta; data.sta = sta;
data.data = cb->data;
data.pkt = task->pkt; data.pkt = task->pkt;
if (cb->cb)
cb->cb(data);
mbox_chan_received_data(task->thread->chan, &data); mbox_chan_received_data(task->thread->chan, &data);
list_del(&task->list_entry); list_del(&task->list_entry);
...@@ -448,7 +443,6 @@ static void cmdq_mbox_shutdown(struct mbox_chan *chan) ...@@ -448,7 +443,6 @@ static void cmdq_mbox_shutdown(struct mbox_chan *chan)
static int cmdq_mbox_flush(struct mbox_chan *chan, unsigned long timeout) static int cmdq_mbox_flush(struct mbox_chan *chan, unsigned long timeout)
{ {
struct cmdq_thread *thread = (struct cmdq_thread *)chan->con_priv; struct cmdq_thread *thread = (struct cmdq_thread *)chan->con_priv;
struct cmdq_task_cb *cb;
struct cmdq_cb_data data; struct cmdq_cb_data data;
struct cmdq *cmdq = dev_get_drvdata(chan->mbox->dev); struct cmdq *cmdq = dev_get_drvdata(chan->mbox->dev);
struct cmdq_task *task, *tmp; struct cmdq_task *task, *tmp;
...@@ -465,13 +459,8 @@ static int cmdq_mbox_flush(struct mbox_chan *chan, unsigned long timeout) ...@@ -465,13 +459,8 @@ static int cmdq_mbox_flush(struct mbox_chan *chan, unsigned long timeout)
list_for_each_entry_safe(task, tmp, &thread->task_busy_list, list_for_each_entry_safe(task, tmp, &thread->task_busy_list,
list_entry) { list_entry) {
cb = &task->pkt->async_cb;
data.sta = -ECONNABORTED; data.sta = -ECONNABORTED;
data.data = cb->data;
data.pkt = task->pkt; data.pkt = task->pkt;
if (cb->cb)
cb->cb(data);
mbox_chan_received_data(task->thread->chan, &data); mbox_chan_received_data(task->thread->chan, &data);
list_del(&task->list_entry); list_del(&task->list_entry);
kfree(task); kfree(task);
......
...@@ -67,24 +67,14 @@ enum cmdq_code { ...@@ -67,24 +67,14 @@ enum cmdq_code {
struct cmdq_cb_data { struct cmdq_cb_data {
int sta; int sta;
void *data;
struct cmdq_pkt *pkt; struct cmdq_pkt *pkt;
}; };
typedef void (*cmdq_async_flush_cb)(struct cmdq_cb_data data);
struct cmdq_task_cb {
cmdq_async_flush_cb cb;
void *data;
};
struct cmdq_pkt { struct cmdq_pkt {
void *va_base; void *va_base;
dma_addr_t pa_base; dma_addr_t pa_base;
size_t cmd_buf_size; /* command occupied size */ size_t cmd_buf_size; /* command occupied size */
size_t buf_size; /* real buffer size */ size_t buf_size; /* real buffer size */
struct cmdq_task_cb cb;
struct cmdq_task_cb async_cb;
void *cl; void *cl;
}; };
......
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