Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1210501

Re: [PATCH v2 2/3] mailbox: Hi6220: add mailbox driver

From Leo Yan <leo.yan@linaro.org>
Newsgroups linux.kernel
Subject Re: [PATCH v2 2/3] mailbox: Hi6220: add mailbox driver
Date 2015-08-20 15:50 +0200
Message-ID <pZyoe-6xg-97@gated-at.bofh.it> (permalink)
References <pZof8-8up-9@gated-at.bofh.it> <pZof8-8up-11@gated-at.bofh.it> <pZr3k-4jD-11@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Hi Yiping,

Thanks for review, please see below comments.

On Thu, Aug 20, 2015 at 01:42:58PM +0800, YiPing Xu wrote:
> On 2015/8/20 10:53, Leo Yan wrote:
> >Add driver for Hi6220 mailbox, the mailbox communicates with MCU; for
> >sending data, it can support two methods for low level implementation:
> >one is to use interrupt as acknowledge, another is automatic mode which
> >without any acknowledge. These two methods have been supported in the
> >driver. For receiving data, it will depend on the interrupt to notify
> >the channel has incoming message; enhance rx channel's message queue,
> >which is based on the code in drivers/mailbox/omap-mailbox.c.
> >
> >Now mailbox driver is used to send message to MCU to control dynamic
> >voltage and frequency scaling for CPU, GPU and DDR.
> >
> >Signed-off-by: Leo Yan <leo.yan@linaro.org>

[...]

> >+static int hi6220_mbox_send_data(struct mbox_chan *chan, void *msg)
> >+{
> >+	struct hi6220_mbox_chan *mchan = chan->con_priv;
> >+	struct hi6220_mbox *mbox = mchan->parent;
> >+	int irq = mchan->remote_irq;
> >+	u32 *buf = msg;
> >+	unsigned long flags;
> >+	int i;
> >+
> >+	hi6220_mbox_set_status(mchan, HI6220_MBOX_STATUS_TX);
> 
> 	hi6220_mbox_set_status is called in send_data context, and it is
> also called in hi6220_mbox_rx_interrupt and
> hi6220_mbox_tx_interrupt.
> 
> 	no race condition here?

Have thought this question yet when writing code; it will _NOT_
introduce race condition according to below implementation details:

- Every channel have its own slot, so there have no race condition
  between channels;
- The channel is unidirectional; so it will be only for tx or rx at
  the same time;
- The channel operation is sequential, so it have the sequence as:
  For tx: startup -> send_data -> tx_irq (for ack);
  For rx: startup -> rx_irq -> recv_data;

Thanks,
Leo Yan
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

[PATCH v2 0/3] mailbox: hisilicon: add Hi6220 mailbox driver Leo Yan <leo.yan@linaro.org> - 2015-08-20 05:00 +0200
  [PATCH v2 1/3] dt-bindings: mailbox: Document Hi6220 mailbox driver Leo Yan <leo.yan@linaro.org> - 2015-08-20 05:00 +0200
  [PATCH v2 3/3] arm64: dts: add Hi6220 mailbox node Leo Yan <leo.yan@linaro.org> - 2015-08-20 05:00 +0200
    Re: [PATCH v2 3/3] arm64: dts: add Hi6220 mailbox node Mark Rutland <mark.rutland@arm.com> - 2015-08-24 12:10 +0200
  [PATCH v2 2/3] mailbox: Hi6220: add mailbox driver Leo Yan <leo.yan@linaro.org> - 2015-08-20 05:00 +0200
    Re: [PATCH v2 2/3] mailbox: Hi6220: add mailbox driver YiPing Xu <xuyiping@hisilicon.com> - 2015-08-20 08:00 +0200
      Re: [PATCH v2 2/3] mailbox: Hi6220: add mailbox driver Leo Yan <leo.yan@linaro.org> - 2015-08-20 15:50 +0200

csiph-web