From patchwork Tue Nov 11 18:33:01 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sudeep Holla X-Patchwork-Id: 40611 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f199.google.com (mail-wi0-f199.google.com [209.85.212.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id CFDF4205DF for ; Tue, 11 Nov 2014 18:33:00 +0000 (UTC) Received: by mail-wi0-f199.google.com with SMTP id r20sf1050058wiv.2 for ; Tue, 11 Nov 2014 10:33:00 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe; bh=+cjw9DT2BKXyfAbNtzo7Uep1t5uOKPtF/zJFHtc+K2g=; b=T8uMXh/w3u8aGm8IvU+10VFDBao+n8/xmGeYw+nrzL/Z5pxVyTQipA+c2xm3emqqTL XdMKOFLPHYjbkcIJhaf2oJxXgFtxhbrTnR39lx3/YrmUjIaKxndbh4R8pz5ISkOA1iST chE3f2yXyW4SFUmqr7JET4Srtjp4PTDS+OP9x1QWcpi8D546Zl7S+zsoGunbzgGA1XJX /l/diwFlfkSJ5nwn2jZBy9E/fBKx6g1J2zJMnBqoK+JDh/Ebm41oE2m4Lo9w4RqEy2Ru SvW6/hUW5D5xBH3wV1FsMO6w/yoIQmc97pzxOH8zELGVPS96Dpz5ftQwZxGzQ7ypEBkc ZVRQ== X-Gm-Message-State: ALoCoQn6Fx9XIaDK/0qP/+2XceiLZSZ7BhMNWIckN/BM88mvhKK1fRYLkNPfBK1SeFMAi+RqyAiu X-Received: by 10.152.27.38 with SMTP id q6mr900730lag.5.1415730780059; Tue, 11 Nov 2014 10:33:00 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.228.140 with SMTP id si12ls592176lac.25.gmail; Tue, 11 Nov 2014 10:32:59 -0800 (PST) X-Received: by 10.152.2.74 with SMTP id 10mr37738961las.22.1415730779745; Tue, 11 Nov 2014 10:32:59 -0800 (PST) Received: from mail-la0-f44.google.com (mail-la0-f44.google.com. [209.85.215.44]) by mx.google.com with ESMTPS id as7si32312815lbc.94.2014.11.11.10.32.59 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 11 Nov 2014 10:32:59 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.44 as permitted sender) client-ip=209.85.215.44; Received: by mail-la0-f44.google.com with SMTP id gf13so10020191lab.31 for ; Tue, 11 Nov 2014 10:32:59 -0800 (PST) X-Received: by 10.152.87.100 with SMTP id w4mr37107619laz.27.1415730779665; Tue, 11 Nov 2014 10:32:59 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.184.201 with SMTP id ew9csp305414lbc; Tue, 11 Nov 2014 10:32:58 -0800 (PST) X-Received: by 10.66.139.106 with SMTP id qx10mr13740336pab.138.1415730777282; Tue, 11 Nov 2014 10:32:57 -0800 (PST) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k5si9874312pdl.27.2014.11.11.10.32.56 for ; Tue, 11 Nov 2014 10:32:57 -0800 (PST) Received-SPF: none (google.com: linux-kernel-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751946AbaKKScy (ORCPT + 25 others); Tue, 11 Nov 2014 13:32:54 -0500 Received: from fw-tnat.cambridge.arm.com ([217.140.96.21]:50704 "EHLO cam-smtp0.cambridge.arm.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751883AbaKKScx (ORCPT ); Tue, 11 Nov 2014 13:32:53 -0500 Received: from e103737-lin.cambridge.arm.com (e103737-lin.cambridge.arm.com [10.1.207.30]) by cam-smtp0.cambridge.arm.com (8.13.8/8.13.8) with ESMTP id sABIWm00024353; Tue, 11 Nov 2014 18:32:48 GMT From: Sudeep Holla To: linux-kernel@vger.kernel.org Cc: Sudeep Holla , Jassi Brar , Arnd Bergmann Subject: [PATCH v2] mailbox: add tx_prepare client callback Date: Tue, 11 Nov 2014 18:33:01 +0000 Message-Id: <1415730781-17819-1-git-send-email-sudeep.holla@arm.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1415721852-10193-1-git-send-email-sudeep.holla@arm.com> References: <1415721852-10193-1-git-send-email-sudeep.holla@arm.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: sudeep.holla@arm.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.44 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , If the mailbox controller expects the payload is in place before initiating the transmit, then it's impossible to reuse the list maintained by core mailbox code currently. Maintaining another list for sending the message in the controller seems totally unnecessary as core mailbox library already provides that feature. This patch introduces tx_prepare callback in mbox_client which can be used by the core mailbox library before initiating the transaction through mbox->ops->send_data. The client driver can implement this callback to ensure the payload is copied to the shared memory. Signed-off-by: Sudeep Holla Cc: Jassi Brar Cc: Arnd Bergmann --- drivers/mailbox/mailbox.c | 2 ++ include/linux/mailbox_client.h | 3 +++ 2 files changed, 5 insertions(+) v1->v2: Added missing documentation for tx_prepare callback diff --git a/drivers/mailbox/mailbox.c b/drivers/mailbox/mailbox.c index 17e9e4afc528..06b27e2854a3 100644 --- a/drivers/mailbox/mailbox.c +++ b/drivers/mailbox/mailbox.c @@ -74,6 +74,8 @@ static void msg_submit(struct mbox_chan *chan) data = chan->msg_data[idx]; + if (chan->cl->tx_prepare) + chan->cl->tx_prepare(chan->cl, data); /* Try to submit a message to the MBOX controller */ err = chan->mbox->ops->send_data(chan, data); if (!err) { diff --git a/include/linux/mailbox_client.h b/include/linux/mailbox_client.h index 307d9cab2026..1726ccbd8009 100644 --- a/include/linux/mailbox_client.h +++ b/include/linux/mailbox_client.h @@ -25,6 +25,8 @@ struct mbox_chan; * if the client receives some ACK packet for transmission. * Unused if the controller already has TX_Done/RTR IRQ. * @rx_callback: Atomic callback to provide client the data received + * @tx_prepare: Atomic callback to ask client to prepare the payload + * before initiating the transmission if required. * @tx_done: Atomic callback to tell client of data transmission */ struct mbox_client { @@ -34,6 +36,7 @@ struct mbox_client { bool knows_txdone; void (*rx_callback)(struct mbox_client *cl, void *mssg); + void (*tx_prepare)(struct mbox_client *cl, void *mssg); void (*tx_done)(struct mbox_client *cl, void *mssg, int r); };