[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CABb+yY2MJ-1i0K7XVkPT3+6ac1XR9-3zf-GDNeswOMp6Zn_Ufw@mail.gmail.com>
Date: Wed, 12 Feb 2020 20:02:26 -0600
From: Jassi Brar <jassisinghbrar@...il.com>
To: Samuel Holland <samuel@...lland.org>
Cc: Maxime Ripard <mripard@...nel.org>, Chen-Yu Tsai <wens@...e.org>,
Rob Herring <robh+dt@...nel.org>,
Mark Rutland <mark.rutland@....com>,
Philipp Zabel <p.zabel@...gutronix.de>,
Ondrej Jirman <megous@...ous.com>,
Vasily Khoruzhick <anarsoul@...il.com>,
Devicetree List <devicetree@...r.kernel.org>,
linux-arm-kernel <linux-arm-kernel@...ts.infradead.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
linux-sunxi@...glegroups.com
Subject: Re: [PATCH v6 2/6] mailbox: sun6i-msgbox: Add a new mailbox driver
On Sun, Jan 12, 2020 at 11:18 PM Samuel Holland <samuel@...lland.org> wrote:
>
> +static int sun6i_msgbox_send_data(struct mbox_chan *chan, void *data)
> +{
> + struct sun6i_msgbox *mbox = to_sun6i_msgbox(chan);
> + int n = channel_number(chan);
> + uint32_t msg = *(uint32_t *)data;
> +
> + /* Using a channel backwards gets the hardware into a bad state. */
> + if (WARN_ON_ONCE(!(readl(mbox->regs + CTRL_REG(n)) & CTRL_TX(n))))
> + return 0;
> +
> + /* We cannot post a new message if the FIFO is full. */
> + if (readl(mbox->regs + FIFO_STAT_REG(n)) & FIFO_STAT_MASK) {
> + mbox_dbg(mbox, "Channel %d busy sending 0x%08x\n", n, msg);
> + return -EBUSY;
> + }
> +
This check should go into sun6i_msgbox_last_tx_done().
send_data() assumes all is clear to send next packet.
.....
> +
> + mbox->controller.dev = dev;
> + mbox->controller.ops = &sun6i_msgbox_chan_ops;
> + mbox->controller.chans = chans;
> + mbox->controller.num_chans = NUM_CHANS;
> + mbox->controller.txdone_irq = false;
> + mbox->controller.txdone_poll = true;
> + mbox->controller.txpoll_period = 5;
> +
nit: just a single space should do too.
Sorry, for some reason I thought I had replied to this patch, but
apparently not. My mistake. Do you want to revise this submission or
send another patch on top?
thanks
Powered by blists - more mailing lists