Lines Matching +full:mhuv2 +full:- +full:rx
1 // SPDX-License-Identifier: GPL-2.0
3 * ARM Message Handling Unit Version 2 (MHUv2) driver.
8 * An MHUv2 mailbox controller can provide up to 124 channel windows (each 32
10 * protocol modes: data-transfer and doorbell, to be used on those channel
16 * device tree bindings of the ARM MHUv2 controller for more details.
19 * hardware - mainly the number of channel windows implemented by the platform,
22 * The MHUv2 controller can work both as a sender and receiver, but the driver
36 /* ====== MHUv2 Registers ====== */
45 #define LSB_MASK(n) ((1 << (n * __CHAR_BIT__)) - 1)
46 #define MHUV2_PROTOCOL_PROP "arm,mhuv2-protocols"
94 u8 pad1[0x0C - 0x04];
99 u8 pad2[0x20 - 0x1C];
114 u8 pad[0xFC8 - 0xFB0];
124 u8 reserved0[0x10 - 0x0C];
128 u8 pad[0x20 - 0x1C];
135 u8 reserved0[0xF90 - 0xF84];
141 u8 reserved2[0xFC8 - 0xFB0];
147 /* ====== MHUv2 data structures ====== */
160 * struct mhuv2 - MHUv2 mailbox controller data
174 struct mhuv2 { struct
190 #define mhu_from_mbox(_mbox) container_of(_mbox, struct mhuv2, mbox) argument
193 * struct mhuv2_protocol_ops - MHUv2 operations
207 int (*rx_startup)(struct mhuv2 *mhu, struct mbox_chan *chan);
208 void (*rx_shutdown)(struct mhuv2 *mhu, struct mbox_chan *chan);
209 void *(*read_data)(struct mhuv2 *mhu, struct mbox_chan *chan);
211 void (*tx_startup)(struct mhuv2 *mhu, struct mbox_chan *chan);
212 void (*tx_shutdown)(struct mhuv2 *mhu, struct mbox_chan *chan);
213 int (*last_tx_done)(struct mhuv2 *mhu, struct mbox_chan *chan);
214 int (*send_data)(struct mhuv2 *mhu, struct mbox_chan *chan, void *arg);
218 * MHUv2 mailbox channel's private information
261 static int mhuv2_doorbell_rx_startup(struct mhuv2 *mhu, struct mbox_chan *chan) in mhuv2_doorbell_rx_startup()
263 struct mhuv2_mbox_chan_priv *priv = chan->con_priv; in mhuv2_doorbell_rx_startup()
265 writel_relaxed(BIT(priv->doorbell), in mhuv2_doorbell_rx_startup()
266 &mhu->recv->ch_wn[priv->ch_wn_idx].mask_clear); in mhuv2_doorbell_rx_startup()
270 static void mhuv2_doorbell_rx_shutdown(struct mhuv2 *mhu, in mhuv2_doorbell_rx_shutdown()
273 struct mhuv2_mbox_chan_priv *priv = chan->con_priv; in mhuv2_doorbell_rx_shutdown()
275 writel_relaxed(BIT(priv->doorbell), in mhuv2_doorbell_rx_shutdown()
276 &mhu->recv->ch_wn[priv->ch_wn_idx].mask_set); in mhuv2_doorbell_rx_shutdown()
279 static void *mhuv2_doorbell_read_data(struct mhuv2 *mhu, struct mbox_chan *chan) in mhuv2_doorbell_read_data()
281 struct mhuv2_mbox_chan_priv *priv = chan->con_priv; in mhuv2_doorbell_read_data()
283 writel_relaxed(BIT(priv->doorbell), in mhuv2_doorbell_read_data()
284 &mhu->recv->ch_wn[priv->ch_wn_idx].stat_clear); in mhuv2_doorbell_read_data()
288 static int mhuv2_doorbell_last_tx_done(struct mhuv2 *mhu, in mhuv2_doorbell_last_tx_done()
291 struct mhuv2_mbox_chan_priv *priv = chan->con_priv; in mhuv2_doorbell_last_tx_done()
293 return !(readl_relaxed(&mhu->send->ch_wn[priv->ch_wn_idx].stat) & in mhuv2_doorbell_last_tx_done()
294 BIT(priv->doorbell)); in mhuv2_doorbell_last_tx_done()
297 static int mhuv2_doorbell_send_data(struct mhuv2 *mhu, struct mbox_chan *chan, in mhuv2_doorbell_send_data()
300 struct mhuv2_mbox_chan_priv *priv = chan->con_priv; in mhuv2_doorbell_send_data()
303 spin_lock_irqsave(&mhu->doorbell_pending_lock, flags); in mhuv2_doorbell_send_data()
305 priv->pending = 1; in mhuv2_doorbell_send_data()
306 writel_relaxed(BIT(priv->doorbell), in mhuv2_doorbell_send_data()
307 &mhu->send->ch_wn[priv->ch_wn_idx].stat_set); in mhuv2_doorbell_send_data()
309 spin_unlock_irqrestore(&mhu->doorbell_pending_lock, flags); in mhuv2_doorbell_send_data()
321 #define IS_PROTOCOL_DOORBELL(_priv) (_priv->ops == &mhuv2_doorbell_ops)
325 static int mhuv2_data_transfer_rx_startup(struct mhuv2 *mhu, in mhuv2_data_transfer_rx_startup()
328 struct mhuv2_mbox_chan_priv *priv = chan->con_priv; in mhuv2_data_transfer_rx_startup()
329 int i = priv->ch_wn_idx + priv->windows - 1; in mhuv2_data_transfer_rx_startup()
335 writel_relaxed(0xFFFFFFFF, &mhu->recv->ch_wn[i].mask_clear); in mhuv2_data_transfer_rx_startup()
339 static void mhuv2_data_transfer_rx_shutdown(struct mhuv2 *mhu, in mhuv2_data_transfer_rx_shutdown()
342 struct mhuv2_mbox_chan_priv *priv = chan->con_priv; in mhuv2_data_transfer_rx_shutdown()
343 int i = priv->ch_wn_idx + priv->windows - 1; in mhuv2_data_transfer_rx_shutdown()
345 writel_relaxed(0xFFFFFFFF, &mhu->recv->ch_wn[i].mask_set); in mhuv2_data_transfer_rx_shutdown()
348 static void *mhuv2_data_transfer_read_data(struct mhuv2 *mhu, in mhuv2_data_transfer_read_data()
351 struct mhuv2_mbox_chan_priv *priv = chan->con_priv; in mhuv2_data_transfer_read_data()
352 const int windows = priv->windows; in mhuv2_data_transfer_read_data()
359 return ERR_PTR(-ENOMEM); in mhuv2_data_transfer_read_data()
361 data = msg->data = msg + 1; in mhuv2_data_transfer_read_data()
362 msg->len = windows * MHUV2_STAT_BYTES; in mhuv2_data_transfer_read_data()
374 * data-transfer protocol, the interrupt is de-asserted. in mhuv2_data_transfer_read_data()
377 idx = priv->ch_wn_idx + i; in mhuv2_data_transfer_read_data()
378 data[windows - 1 - i] = readl_relaxed(&mhu->recv->ch_wn[idx].stat); in mhuv2_data_transfer_read_data()
379 writel_relaxed(0xFFFFFFFF, &mhu->recv->ch_wn[idx].stat_clear); in mhuv2_data_transfer_read_data()
385 static void mhuv2_data_transfer_tx_startup(struct mhuv2 *mhu, in mhuv2_data_transfer_tx_startup()
388 struct mhuv2_mbox_chan_priv *priv = chan->con_priv; in mhuv2_data_transfer_tx_startup()
389 int i = priv->ch_wn_idx + priv->windows - 1; in mhuv2_data_transfer_tx_startup()
392 if (mhu->minor) { in mhuv2_data_transfer_tx_startup()
393 writel_relaxed(0x1, &mhu->send->ch_wn[i].int_clr); in mhuv2_data_transfer_tx_startup()
394 writel_relaxed(0x1, &mhu->send->ch_wn[i].int_en); in mhuv2_data_transfer_tx_startup()
398 static void mhuv2_data_transfer_tx_shutdown(struct mhuv2 *mhu, in mhuv2_data_transfer_tx_shutdown()
401 struct mhuv2_mbox_chan_priv *priv = chan->con_priv; in mhuv2_data_transfer_tx_shutdown()
402 int i = priv->ch_wn_idx + priv->windows - 1; in mhuv2_data_transfer_tx_shutdown()
404 if (mhu->minor) in mhuv2_data_transfer_tx_shutdown()
405 writel_relaxed(0x0, &mhu->send->ch_wn[i].int_en); in mhuv2_data_transfer_tx_shutdown()
408 static int mhuv2_data_transfer_last_tx_done(struct mhuv2 *mhu, in mhuv2_data_transfer_last_tx_done()
411 struct mhuv2_mbox_chan_priv *priv = chan->con_priv; in mhuv2_data_transfer_last_tx_done()
412 int i = priv->ch_wn_idx + priv->windows - 1; in mhuv2_data_transfer_last_tx_done()
415 return !readl_relaxed(&mhu->send->ch_wn[i].stat); in mhuv2_data_transfer_last_tx_done()
422 * written. As an example, a 6-word message is to be written on a 4-channel MHU
431 * [ stat 3 ] <- [0x00000001] 4 <- triggers interrupt on receiver
432 * [ stat 2 ] <- [0x00000002] 3
433 * [ stat 1 ] <- [0x00000003] 2
434 * [ stat 0 ] <- [0x00000004] 1
440 * [ stat 3 ] <- [0x00000005] 2 <- triggers interrupt on receiver
441 * [ stat 2 ] <- [0x00000006] 1
442 * [ stat 1 ] <- [0x00000000]
443 * [ stat 0 ] <- [0x00000000]
445 static int mhuv2_data_transfer_send_data(struct mhuv2 *mhu, in mhuv2_data_transfer_send_data()
449 int bytes_left = msg->len, bytes_to_send, bytes_in_round, i; in mhuv2_data_transfer_send_data()
450 struct mhuv2_mbox_chan_priv *priv = chan->con_priv; in mhuv2_data_transfer_send_data()
451 int windows = priv->windows; in mhuv2_data_transfer_send_data()
452 u32 *data = msg->data, word; in mhuv2_data_transfer_send_data()
456 …dev_err(mhu->mbox.dev, "Data aligned at first window can't be zero to guarantee interrupt generati… in mhuv2_data_transfer_send_data()
457 return -EINVAL; in mhuv2_data_transfer_send_data()
465 for (i = windows - 1; i >= 0; i--) { in mhuv2_data_transfer_send_data()
471 bytes_to_send = bytes_in_round & (MHUV2_STAT_BYTES - 1); in mhuv2_data_transfer_send_data()
477 writel_relaxed(word, &mhu->send->ch_wn[priv->ch_wn_idx + windows - 1 - i].stat_set); in mhuv2_data_transfer_send_data()
478 bytes_left -= bytes_to_send; in mhuv2_data_transfer_send_data()
479 bytes_in_round -= bytes_to_send; in mhuv2_data_transfer_send_data()
500 static struct mbox_chan *get_irq_chan_comb(struct mhuv2 *mhu, u32 __iomem *reg) in get_irq_chan_comb()
502 struct mbox_chan *chans = mhu->mbox.chans; in get_irq_chan_comb()
513 for (i = 0; i < mhu->length; i += 2) { in get_irq_chan_comb()
514 protocol = mhu->protocols[i]; in get_irq_chan_comb()
515 windows = mhu->protocols[i + 1]; in get_irq_chan_comb()
529 channel += MHUV2_STAT_BITS * (ch_wn - offset); in get_irq_chan_comb()
535 return ERR_PTR(-EIO); in get_irq_chan_comb()
540 struct mhuv2 *mhu = data; in mhuv2_sender_interrupt()
541 struct device *dev = mhu->mbox.dev; in mhuv2_sender_interrupt()
548 chan = get_irq_chan_comb(mhu, mhu->send->chcomb_int_st); in mhuv2_sender_interrupt()
553 priv = chan->con_priv; in mhuv2_sender_interrupt()
556 writel_relaxed(1, &mhu->send->ch_wn[priv->ch_wn_idx + priv->windows - 1].int_clr); in mhuv2_sender_interrupt()
558 if (chan->cl) { in mhuv2_sender_interrupt()
564 priv->ch_wn_idx); in mhuv2_sender_interrupt()
569 writel_relaxed(1, &mhu->send->ch_wn[priv->ch_wn_idx].int_clr); in mhuv2_sender_interrupt()
577 spin_lock_irqsave(&mhu->doorbell_pending_lock, flags); in mhuv2_sender_interrupt()
583 stat = readl_relaxed(&mhu->send->ch_wn[priv->ch_wn_idx].stat); in mhuv2_sender_interrupt()
589 if (priv->pending ^ ((stat >> i) & 0x1)) { in mhuv2_sender_interrupt()
590 BUG_ON(!priv->pending); in mhuv2_sender_interrupt()
592 if (!chan->cl) { in mhuv2_sender_interrupt()
594 priv->ch_wn_idx, i); in mhuv2_sender_interrupt()
599 priv->pending = 0; in mhuv2_sender_interrupt()
604 spin_unlock_irqrestore(&mhu->doorbell_pending_lock, flags); in mhuv2_sender_interrupt()
613 priv->ch_wn_idx); in mhuv2_sender_interrupt()
620 static struct mbox_chan *get_irq_chan_comb_rx(struct mhuv2 *mhu) in get_irq_chan_comb_rx()
626 chan = get_irq_chan_comb(mhu, mhu->recv->chcomb_int_st); in get_irq_chan_comb_rx()
630 priv = chan->con_priv; in get_irq_chan_comb_rx()
638 stat = readl_relaxed(&mhu->recv->ch_wn[priv->ch_wn_idx].stat_masked); in get_irq_chan_comb_rx()
644 static struct mbox_chan *get_irq_chan_stat_rx(struct mhuv2 *mhu) in get_irq_chan_stat_rx()
646 struct mbox_chan *chans = mhu->mbox.chans; in get_irq_chan_stat_rx()
651 while (i < mhu->mbox.num_chans) { in get_irq_chan_stat_rx()
653 stat = readl_relaxed(&mhu->recv->ch_wn[priv->ch_wn_idx].stat_masked); in get_irq_chan_stat_rx()
664 return ERR_PTR(-EIO); in get_irq_chan_stat_rx()
667 static struct mbox_chan *get_irq_chan_rx(struct mhuv2 *mhu) in get_irq_chan_rx()
669 if (!mhu->minor) in get_irq_chan_rx()
677 struct mhuv2 *mhu = arg; in mhuv2_receiver_interrupt()
679 struct device *dev = mhu->mbox.dev; in mhuv2_receiver_interrupt()
685 dev_warn(dev, "Failed to find channel for the rx interrupt\n"); in mhuv2_receiver_interrupt()
688 priv = chan->con_priv; in mhuv2_receiver_interrupt()
691 data = priv->ops->read_data(mhu, chan); in mhuv2_receiver_interrupt()
693 if (!chan->cl) { in mhuv2_receiver_interrupt()
695 priv->ch_wn_idx); in mhuv2_receiver_interrupt()
712 struct mhuv2 *mhu = mhu_from_mbox(chan->mbox); in mhuv2_sender_last_tx_done()
713 struct mhuv2_mbox_chan_priv *priv = chan->con_priv; in mhuv2_sender_last_tx_done()
715 return priv->ops->last_tx_done(mhu, chan); in mhuv2_sender_last_tx_done()
720 struct mhuv2 *mhu = mhu_from_mbox(chan->mbox); in mhuv2_sender_send_data()
721 struct mhuv2_mbox_chan_priv *priv = chan->con_priv; in mhuv2_sender_send_data()
723 if (!priv->ops->last_tx_done(mhu, chan)) in mhuv2_sender_send_data()
724 return -EBUSY; in mhuv2_sender_send_data()
726 return priv->ops->send_data(mhu, chan, data); in mhuv2_sender_send_data()
731 struct mhuv2 *mhu = mhu_from_mbox(chan->mbox); in mhuv2_sender_startup()
732 struct mhuv2_mbox_chan_priv *priv = chan->con_priv; in mhuv2_sender_startup()
734 if (priv->ops->tx_startup) in mhuv2_sender_startup()
735 priv->ops->tx_startup(mhu, chan); in mhuv2_sender_startup()
741 struct mhuv2 *mhu = mhu_from_mbox(chan->mbox); in mhuv2_sender_shutdown()
742 struct mhuv2_mbox_chan_priv *priv = chan->con_priv; in mhuv2_sender_shutdown()
744 if (priv->ops->tx_shutdown) in mhuv2_sender_shutdown()
745 priv->ops->tx_shutdown(mhu, chan); in mhuv2_sender_shutdown()
757 struct mhuv2 *mhu = mhu_from_mbox(chan->mbox); in mhuv2_receiver_startup()
758 struct mhuv2_mbox_chan_priv *priv = chan->con_priv; in mhuv2_receiver_startup()
760 return priv->ops->rx_startup(mhu, chan); in mhuv2_receiver_startup()
765 struct mhuv2 *mhu = mhu_from_mbox(chan->mbox); in mhuv2_receiver_shutdown()
766 struct mhuv2_mbox_chan_priv *priv = chan->con_priv; in mhuv2_receiver_shutdown()
768 priv->ops->rx_shutdown(mhu, chan); in mhuv2_receiver_shutdown()
773 dev_err(chan->mbox->dev, in mhuv2_receiver_send_data()
775 return -EIO; in mhuv2_receiver_send_data()
780 dev_err(chan->mbox->dev, "Trying to Tx poll on a receiver MHU frame\n"); in mhuv2_receiver_last_tx_done()
794 struct mhuv2 *mhu = mhu_from_mbox(mbox); in mhuv2_mbox_of_xlate()
795 struct mbox_chan *chans = mbox->chans; in mhuv2_mbox_of_xlate()
798 if (pa->args_count != 2) in mhuv2_mbox_of_xlate()
799 return ERR_PTR(-EINVAL); in mhuv2_mbox_of_xlate()
801 offset = pa->args[0]; in mhuv2_mbox_of_xlate()
802 doorbell = pa->args[1]; in mhuv2_mbox_of_xlate()
806 for (i = 0; i < mhu->length; i += 2) { in mhuv2_mbox_of_xlate()
807 protocol = mhu->protocols[i]; in mhuv2_mbox_of_xlate()
808 windows = mhu->protocols[i + 1]; in mhuv2_mbox_of_xlate()
815 offset -= windows; in mhuv2_mbox_of_xlate()
825 offset--; in mhuv2_mbox_of_xlate()
830 dev_err(mbox->dev, "Couldn't xlate to a valid channel (%d: %d)\n", in mhuv2_mbox_of_xlate()
831 pa->args[0], doorbell); in mhuv2_mbox_of_xlate()
832 return ERR_PTR(-ENODEV); in mhuv2_mbox_of_xlate()
835 static int mhuv2_verify_protocol(struct mhuv2 *mhu) in mhuv2_verify_protocol()
837 struct device *dev = mhu->mbox.dev; in mhuv2_verify_protocol()
840 for (i = 0; i < mhu->length; i += 2) { in mhuv2_verify_protocol()
841 protocol = mhu->protocols[i]; in mhuv2_verify_protocol()
842 windows = mhu->protocols[i + 1]; in mhuv2_verify_protocol()
846 return -EINVAL; in mhuv2_verify_protocol()
857 return -EINVAL; in mhuv2_verify_protocol()
861 if (total_windows > mhu->windows) { in mhuv2_verify_protocol()
863 total_windows, mhu->windows); in mhuv2_verify_protocol()
864 return -EINVAL; in mhuv2_verify_protocol()
867 mhu->mbox.num_chans = channels; in mhuv2_verify_protocol()
871 static int mhuv2_allocate_channels(struct mhuv2 *mhu) in mhuv2_allocate_channels()
873 struct mbox_controller *mbox = &mhu->mbox; in mhuv2_allocate_channels()
875 struct device *dev = mbox->dev; in mhuv2_allocate_channels()
879 chans = devm_kcalloc(dev, mbox->num_chans, sizeof(*chans), GFP_KERNEL); in mhuv2_allocate_channels()
881 return -ENOMEM; in mhuv2_allocate_channels()
883 mbox->chans = chans; in mhuv2_allocate_channels()
885 for (i = 0; i < mhu->length; i += 2) { in mhuv2_allocate_channels()
888 protocol = mhu->protocols[i]; in mhuv2_allocate_channels()
889 windows = mhu->protocols[i + 1]; in mhuv2_allocate_channels()
894 return -ENOMEM; in mhuv2_allocate_channels()
896 priv->ch_wn_idx = next_window; in mhuv2_allocate_channels()
897 priv->ops = &mhuv2_data_transfer_ops; in mhuv2_allocate_channels()
898 priv->windows = windows; in mhuv2_allocate_channels()
899 chans++->con_priv = priv; in mhuv2_allocate_channels()
907 return -ENOMEM; in mhuv2_allocate_channels()
909 priv->ch_wn_idx = next_window + j; in mhuv2_allocate_channels()
910 priv->ops = &mhuv2_doorbell_ops; in mhuv2_allocate_channels()
911 priv->doorbell = k; in mhuv2_allocate_channels()
912 chans++->con_priv = priv; in mhuv2_allocate_channels()
919 if (mhu->frame == SENDER_FRAME && mhu->minor) in mhuv2_allocate_channels()
920 writel_relaxed(0x1, &mhu->send->ch_wn[priv->ch_wn_idx].int_en); in mhuv2_allocate_channels()
925 BUG_ON(chans - mbox->chans != mbox->num_chans); in mhuv2_allocate_channels()
930 static int mhuv2_parse_channels(struct mhuv2 *mhu) in mhuv2_parse_channels()
932 struct device *dev = mhu->mbox.dev; in mhuv2_parse_channels()
933 const struct device_node *np = dev->of_node; in mhuv2_parse_channels()
941 return -EINVAL; in mhuv2_parse_channels()
946 return -ENOMEM; in mhuv2_parse_channels()
955 mhu->protocols = protocols; in mhuv2_parse_channels()
956 mhu->length = count; in mhuv2_parse_channels()
965 static int mhuv2_tx_init(struct amba_device *adev, struct mhuv2 *mhu, in mhuv2_tx_init()
968 struct device *dev = mhu->mbox.dev; in mhuv2_tx_init()
971 mhu->frame = SENDER_FRAME; in mhuv2_tx_init()
972 mhu->mbox.ops = &mhuv2_sender_ops; in mhuv2_tx_init()
973 mhu->send = reg; in mhuv2_tx_init()
975 mhu->windows = readl_relaxed_bitfield(&mhu->send->mhu_cfg, struct mhu_cfg_t, num_ch); in mhuv2_tx_init()
976 mhu->minor = readl_relaxed_bitfield(&mhu->send->aidr, struct aidr_t, arch_minor_rev); in mhuv2_tx_init()
978 spin_lock_init(&mhu->doorbell_pending_lock); in mhuv2_tx_init()
984 if (mhu->minor && adev->irq[0]) { in mhuv2_tx_init()
985 ret = devm_request_threaded_irq(dev, adev->irq[0], NULL, in mhuv2_tx_init()
987 IRQF_ONESHOT, "mhuv2-tx", mhu); in mhuv2_tx_init()
992 mhu->mbox.txdone_irq = true; in mhuv2_tx_init()
993 mhu->mbox.txdone_poll = false; in mhuv2_tx_init()
994 mhu->irq = adev->irq[0]; in mhuv2_tx_init()
996 writel_relaxed_bitfield(1, &mhu->send->int_en, struct int_en_t, chcomb); in mhuv2_tx_init()
999 for (i = 0; i < mhu->windows; i++) in mhuv2_tx_init()
1000 writel_relaxed(0x0, &mhu->send->ch_wn[i].int_en); in mhuv2_tx_init()
1006 mhu->mbox.txdone_irq = false; in mhuv2_tx_init()
1007 mhu->mbox.txdone_poll = true; in mhuv2_tx_init()
1008 mhu->mbox.txpoll_period = 1; in mhuv2_tx_init()
1012 writel_relaxed(0x1, &mhu->send->access_request); in mhuv2_tx_init()
1013 while (!readl_relaxed(&mhu->send->access_ready)) in mhuv2_tx_init()
1019 static int mhuv2_rx_init(struct amba_device *adev, struct mhuv2 *mhu, in mhuv2_rx_init()
1022 struct device *dev = mhu->mbox.dev; in mhuv2_rx_init()
1025 mhu->frame = RECEIVER_FRAME; in mhuv2_rx_init()
1026 mhu->mbox.ops = &mhuv2_receiver_ops; in mhuv2_rx_init()
1027 mhu->recv = reg; in mhuv2_rx_init()
1029 mhu->windows = readl_relaxed_bitfield(&mhu->recv->mhu_cfg, struct mhu_cfg_t, num_ch); in mhuv2_rx_init()
1030 mhu->minor = readl_relaxed_bitfield(&mhu->recv->aidr, struct aidr_t, arch_minor_rev); in mhuv2_rx_init()
1032 mhu->irq = adev->irq[0]; in mhuv2_rx_init()
1033 if (!mhu->irq) { in mhuv2_rx_init()
1035 return -EINVAL; in mhuv2_rx_init()
1038 ret = devm_request_threaded_irq(dev, mhu->irq, NULL, in mhuv2_rx_init()
1040 "mhuv2-rx", mhu); in mhuv2_rx_init()
1042 dev_err(dev, "Failed to request rx IRQ\n"); in mhuv2_rx_init()
1047 for (i = 0; i < mhu->windows; i++) in mhuv2_rx_init()
1048 writel_relaxed(0xFFFFFFFF, &mhu->recv->ch_wn[i].mask_set); in mhuv2_rx_init()
1050 if (mhu->minor) in mhuv2_rx_init()
1051 writel_relaxed_bitfield(1, &mhu->recv->int_en, struct int_en_t, chcomb); in mhuv2_rx_init()
1058 struct device *dev = &adev->dev; in mhuv2_probe()
1059 const struct device_node *np = dev->of_node; in mhuv2_probe()
1060 struct mhuv2 *mhu; in mhuv2_probe()
1062 int ret = -EINVAL; in mhuv2_probe()
1064 reg = devm_of_iomap(dev, dev->of_node, 0, NULL); in mhuv2_probe()
1066 return -ENOMEM; in mhuv2_probe()
1070 return -ENOMEM; in mhuv2_probe()
1072 mhu->mbox.dev = dev; in mhuv2_probe()
1073 mhu->mbox.of_xlate = mhuv2_mbox_of_xlate; in mhuv2_probe()
1075 if (of_device_is_compatible(np, "arm,mhuv2-tx")) in mhuv2_probe()
1077 else if (of_device_is_compatible(np, "arm,mhuv2-rx")) in mhuv2_probe()
1086 BUG_ON(!mhu->windows); in mhuv2_probe()
1094 ret = devm_mbox_controller_register(dev, &mhu->mbox); in mhuv2_probe()
1096 dev_err(dev, "failed to register ARM MHUv2 driver %d\n", ret); in mhuv2_probe()
1103 struct mhuv2 *mhu = amba_get_drvdata(adev); in mhuv2_remove()
1105 if (mhu->frame == SENDER_FRAME) in mhuv2_remove()
1106 writel_relaxed(0x0, &mhu->send->access_request); in mhuv2_remove()
1126 .name = "arm-mhuv2",
1135 MODULE_DESCRIPTION("ARM MHUv2 Driver");