[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAJe_ZhdTvZZqERttAM_o6U6MZCOjk=oXpWFPf8W=DdW1j=Nx=g@mail.gmail.com>
Date: Mon, 24 Nov 2014 14:04:49 +0530
From: Jassi Brar <jaswinder.singh@...aro.org>
To: Andrew Bresticker <abrestic@...omium.org>
Cc: Stephen Warren <swarren@...dotorg.org>,
Thierry Reding <thierry.reding@...il.com>,
Alexandre Courbot <gnurou@...il.com>,
"linux-tegra@...r.kernel.org" <linux-tegra@...r.kernel.org>,
Mark Rutland <mark.rutland@....com>,
Devicetree List <devicetree@...r.kernel.org>,
Linux USB list <linux-usb@...r.kernel.org>,
Russell King <linux@....linux.org.uk>,
Mathias Nyman <mathias.nyman@...el.com>,
Pawel Moll <pawel.moll@....com>,
Ian Campbell <ijc+devicetree@...lion.org.uk>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Linus Walleij <linus.walleij@...aro.org>,
Jassi Brar <jassisinghbrar@...il.com>,
lkml <linux-kernel@...r.kernel.org>,
Kishon Vijay Abraham I <kishon@...com>,
Olof Johansson <olof@...om.net>,
Rob Herring <robh+dt@...nel.org>,
Alan Stern <stern@...land.harvard.edu>,
"linux-arm-kernel@...ts.infradead.org"
<linux-arm-kernel@...ts.infradead.org>,
Kumar Gala <galak@...eaurora.org>,
Grant Likely <grant.likely@...aro.org>,
Arnd Bergmann <arnd@...db.de>
Subject: Re: [PATCH V5 05/12] mailbox: Add NVIDIA Tegra XUSB mailbox driver
On 18 November 2014 at 04:11, Andrew Bresticker <abrestic@...omium.org> wrote:
> +
> +static int tegra_xusb_mbox_send_data(struct mbox_chan *chan, void *data)
> +{
> + struct tegra_xusb_mbox *mbox = to_tegra_mbox(chan->mbox);
> + struct tegra_xusb_mbox_msg *msg = data;
> + unsigned long flags;
> + u32 reg, owner;
> +
> + dev_dbg(mbox->mbox.dev, "TX message %#x:%#x\n", msg->cmd, msg->data);
> +
> + /* ACK/NAK must be sent with the controller as the mailbox owner */
> + if (msg->cmd == MBOX_CMD_ACK || msg->cmd == MBOX_CMD_NAK)
> + owner = MBOX_OWNER_FW;
> + else
> + owner = MBOX_OWNER_SW;
> +
> + spin_lock_irqsave(&mbox->lock, flags);
> +
> + /* Acquire mailbox */
> + if (mbox_readl(mbox, XUSB_CFG_ARU_MBOX_OWNER) != MBOX_OWNER_NONE) {
> + dev_err(mbox->mbox.dev, "Mailbox not idle\n");
> + goto busy;
> + }
> + mbox_writel(mbox, owner, XUSB_CFG_ARU_MBOX_OWNER);
> + if (mbox_readl(mbox, XUSB_CFG_ARU_MBOX_OWNER) != owner) {
> + dev_err(mbox->mbox.dev, "Failed to acquire mailbox");
> + goto busy;
> + }
> +
> + mbox_writel(mbox, mbox_pack_msg(msg), XUSB_CFG_ARU_MBOX_DATA_IN);
> + reg = mbox_readl(mbox, XUSB_CFG_ARU_MBOX_CMD);
> + reg |= MBOX_INT_EN | MBOX_DEST_FALC;
> + mbox_writel(mbox, reg, XUSB_CFG_ARU_MBOX_CMD);
> +
> + spin_unlock_irqrestore(&mbox->lock, flags);
> +
> + return 0;
> +busy:
> + spin_unlock_irqrestore(&mbox->lock, flags);
> + return -EBUSY;
> +}
> +
> +static int tegra_xusb_mbox_startup(struct mbox_chan *chan)
> +{
> + return 0;
> +}
> +
> +static void tegra_xusb_mbox_shutdown(struct mbox_chan *chan)
> +{
> +}
> +
> +static bool tegra_xusb_mbox_last_tx_done(struct mbox_chan *chan)
> +{
> + /*
> + * Transmissions are assumed to be completed as soon as they are
> + * written to the mailbox.
> + */
> + return true;
>
In .send_data() you you mark the channel busy by setting the
XUSB_CFG_ARU_MBOX_OWNER to !MBOX_OWNER_NONE, which remains so until
you get an IRQ. So maybe you should check for the OWNER_NONE flag in
.last_tx_done()?
-Jassi
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists