20
20
#include <linux/suspend.h>
21
21
#include <linux/slab.h>
22
22
23
- #define IMX_MU_CHANS 17
23
+ #include "mailbox.h"
24
+
25
+ #define IMX_MU_CHANS 24
24
26
/* TX0/RX0/RXDB[0-3] */
25
27
#define IMX_MU_SCU_CHANS 6
26
28
/* TX0/RX0 */
@@ -39,6 +41,7 @@ enum imx_mu_chan_type {
39
41
IMX_MU_TYPE_TXDB = 2 , /* Tx doorbell */
40
42
IMX_MU_TYPE_RXDB = 3 , /* Rx doorbell */
41
43
IMX_MU_TYPE_RST = 4 , /* Reset */
44
+ IMX_MU_TYPE_TXDB_V2 = 5 , /* Tx doorbell with S/W ACK */
42
45
};
43
46
44
47
enum imx_mu_xcr {
@@ -226,6 +229,9 @@ static int imx_mu_generic_tx(struct imx_mu_priv *priv,
226
229
imx_mu_xcr_rmw (priv , IMX_MU_GCR , IMX_MU_xCR_GIRn (priv -> dcfg -> type , cp -> idx ), 0 );
227
230
tasklet_schedule (& cp -> txdb_tasklet );
228
231
break ;
232
+ case IMX_MU_TYPE_TXDB_V2 :
233
+ imx_mu_xcr_rmw (priv , IMX_MU_GCR , IMX_MU_xCR_GIRn (priv -> dcfg -> type , cp -> idx ), 0 );
234
+ break ;
229
235
default :
230
236
dev_warn_ratelimited (priv -> dev , "Send data on wrong channel type: %d\n" , cp -> type );
231
237
return - EINVAL ;
@@ -554,6 +560,9 @@ static int imx_mu_startup(struct mbox_chan *chan)
554
560
int ret ;
555
561
556
562
pm_runtime_get_sync (priv -> dev );
563
+ if (cp -> type == IMX_MU_TYPE_TXDB_V2 )
564
+ return 0 ;
565
+
557
566
if (cp -> type == IMX_MU_TYPE_TXDB ) {
558
567
/* Tx doorbell don't have ACK support */
559
568
tasklet_init (& cp -> txdb_tasklet , imx_mu_txdb_tasklet ,
@@ -595,6 +604,11 @@ static void imx_mu_shutdown(struct mbox_chan *chan)
595
604
int ret ;
596
605
u32 sr ;
597
606
607
+ if (cp -> type == IMX_MU_TYPE_TXDB_V2 ) {
608
+ pm_runtime_put_sync (priv -> dev );
609
+ return ;
610
+ }
611
+
598
612
if (cp -> type == IMX_MU_TYPE_TXDB ) {
599
613
tasklet_kill (& cp -> txdb_tasklet );
600
614
pm_runtime_put_sync (priv -> dev );
@@ -671,6 +685,7 @@ static struct mbox_chan *imx_mu_specific_xlate(struct mbox_controller *mbox,
671
685
static struct mbox_chan * imx_mu_xlate (struct mbox_controller * mbox ,
672
686
const struct of_phandle_args * sp )
673
687
{
688
+ struct mbox_chan * p_chan ;
674
689
u32 type , idx , chan ;
675
690
676
691
if (sp -> args_count != 2 ) {
@@ -680,14 +695,25 @@ static struct mbox_chan * imx_mu_xlate(struct mbox_controller *mbox,
680
695
681
696
type = sp -> args [0 ]; /* channel type */
682
697
idx = sp -> args [1 ]; /* index */
683
- chan = type * 4 + idx ;
684
698
699
+ /* RST only supports 1 channel */
700
+ if ((type == IMX_MU_TYPE_RST ) && idx ) {
701
+ dev_err (mbox -> dev , "Invalid RST channel %d\n" , idx );
702
+ return ERR_PTR (- EINVAL );
703
+ }
704
+
705
+ chan = type * 4 + idx ;
685
706
if (chan >= mbox -> num_chans ) {
686
707
dev_err (mbox -> dev , "Not supported channel number: %d. (type: %d, idx: %d)\n" , chan , type , idx );
687
708
return ERR_PTR (- EINVAL );
688
709
}
689
710
690
- return & mbox -> chans [chan ];
711
+ p_chan = & mbox -> chans [chan ];
712
+
713
+ if (type == IMX_MU_TYPE_TXDB_V2 )
714
+ p_chan -> txdone_method = TXDONE_BY_ACK ;
715
+
716
+ return p_chan ;
691
717
}
692
718
693
719
static struct mbox_chan * imx_mu_seco_xlate (struct mbox_controller * mbox ,
0 commit comments