From patchwork Tue May 9 19:47:01 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Andersson X-Patchwork-Id: 9718931 X-Patchwork-Delegate: agross@codeaurora.org Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 98C8960236 for ; Tue, 9 May 2017 19:48:04 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 872A122701 for ; Tue, 9 May 2017 19:48:04 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7BBC928481; Tue, 9 May 2017 19:48:04 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.3 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2FBDB22701 for ; Tue, 9 May 2017 19:48:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754318AbdEITrw (ORCPT ); Tue, 9 May 2017 15:47:52 -0400 Received: from mail-pg0-f52.google.com ([74.125.83.52]:36444 "EHLO mail-pg0-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751423AbdEITrI (ORCPT ); Tue, 9 May 2017 15:47:08 -0400 Received: by mail-pg0-f52.google.com with SMTP id 64so4717419pgb.3 for ; Tue, 09 May 2017 12:47:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=/vaA+sfDIzHZsDYgB70gHBpVIvIUeezmcA2N5c4V4t0=; b=iApMSVr1xF63jdX3t6XeAkk52smOB8bhoN3N2JWtylNddtAKA3sLGyeu/SC0u30b+p 5dzLEwVI/EbUmUEN7M02yx9QyIG4OkWHJElzBqwnisSqLeiFvebND1ZjF2S3ArgLuOrZ dfylPpnjinHPJUFSNEiBxA/DQpOSfNrZmK7RI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=/vaA+sfDIzHZsDYgB70gHBpVIvIUeezmcA2N5c4V4t0=; b=Eoime5Ts8ZkmLNPgCFhLsG32UmQldtICfj+RuQgn2Fsmbnl8FySJe8n1Z1lEOB3gc1 v24/QlACd/tVTC5dUVMS1r2FzjYNR5wHT9yxeFJNpSTQhO1aW3bnuh+1c/7O0zwo55xg flExdTyloNvL+lUTTlBwt9WP9mUpxeUzGSAqE1/I2GNulduIVXyXXKavFKdhJ8hkTTw/ lvybJDcx2bitJBj21lFZmixI6AasZ0aUDKgNCPYp9em2EJcR26d7qXt9wm1Y8PAuWeFV PkjziTV6tCt31diKaq/ZZZG3qzVY2YVoH/dbX0/eX5kOA6Umdxf+H6iREkk9lJEj7ZSO 1qBQ== X-Gm-Message-State: AODbwcAsxFeygd/N4TOJI6vRmgkCQnYaJeOQKPYlNuaUG/jIWfhRKkEH XtGI6eFA9ZyFlk3b X-Received: by 10.84.237.8 with SMTP id s8mr2521949plk.163.1494359228188; Tue, 09 May 2017 12:47:08 -0700 (PDT) Received: from localhost.localdomain (ip68-111-223-48.sd.sd.cox.net. [68.111.223.48]) by smtp.gmail.com with ESMTPSA id x2sm1279236pfi.80.2017.05.09.12.47.07 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 09 May 2017 12:47:07 -0700 (PDT) From: Bjorn Andersson To: Jassi Brar Cc: Rob Herring , Mark Rutland , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-soc@vger.kernel.org Subject: [PATCH v6 2/4] mailbox: Support stateless mailboxes without txdone Date: Tue, 9 May 2017 12:47:01 -0700 Message-Id: <20170509194703.28871-2-bjorn.andersson@linaro.org> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20170509194703.28871-1-bjorn.andersson@linaro.org> References: <20170509194703.28871-1-bjorn.andersson@linaro.org> Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP For some types of doorbell-like mailbox hardware there is no mechanism for delivery notification and the only possible message is an identity element; i.e. the mailbox is stateless and writing any number of messages to the mailbox is equivalent to writing a single message. Support this type of mailbox hardware by introducing the "none" tx done method, which means that neither the hardware nor the client is expected to tick the mailbox state machine. Signed-off-by: Bjorn Andersson --- Changes since v5: - New patch drivers/mailbox/mailbox.c | 2 ++ drivers/mailbox/mailbox.h | 1 + include/linux/mailbox_controller.h | 2 ++ 3 files changed, 5 insertions(+) diff --git a/drivers/mailbox/mailbox.c b/drivers/mailbox/mailbox.c index 505651ce9dcc..bf224c7c8f58 100644 --- a/drivers/mailbox/mailbox.c +++ b/drivers/mailbox/mailbox.c @@ -453,6 +453,8 @@ int mbox_controller_register(struct mbox_controller *mbox) txdone = TXDONE_BY_IRQ; else if (mbox->txdone_poll) txdone = TXDONE_BY_POLL; + else if (mbox->txdone_none) + txdone = TXDONE_NONE; else /* It has to be ACK then */ txdone = TXDONE_BY_ACK; diff --git a/drivers/mailbox/mailbox.h b/drivers/mailbox/mailbox.h index 456ba68513bb..708c8bb822fe 100644 --- a/drivers/mailbox/mailbox.h +++ b/drivers/mailbox/mailbox.h @@ -7,6 +7,7 @@ #ifndef __MAILBOX_H #define __MAILBOX_H +#define TXDONE_NONE 0 /* mailbox provides no means of flow control */ #define TXDONE_BY_IRQ BIT(0) /* controller has remote RTR irq */ #define TXDONE_BY_POLL BIT(1) /* controller can read status of last TX */ #define TXDONE_BY_ACK BIT(2) /* S/W ACK recevied by Client ticks the TX */ diff --git a/include/linux/mailbox_controller.h b/include/linux/mailbox_controller.h index 74deadb42d76..43fa4ab9b3e1 100644 --- a/include/linux/mailbox_controller.h +++ b/include/linux/mailbox_controller.h @@ -58,6 +58,7 @@ struct mbox_chan_ops { * @ops: Operators that work on each communication chan * @chans: Array of channels * @num_chans: Number of channels in the 'chans' array. + * @txdone_none: The controller has no sense of TX done * @txdone_irq: Indicates if the controller can report to API when * the last transmitted data was read by the remote. * Eg, if it has some TX ACK irq. @@ -78,6 +79,7 @@ struct mbox_controller { int num_chans; bool txdone_irq; bool txdone_poll; + bool txdone_none; unsigned txpoll_period; struct mbox_chan *(*of_xlate)(struct mbox_controller *mbox, const struct of_phandle_args *sp);