From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934685AbeB1Rx3 (ORCPT ); Wed, 28 Feb 2018 12:53:29 -0500 Received: from out5-smtp.messagingengine.com ([66.111.4.29]:38899 "EHLO out5-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934285AbeB1RwC (ORCPT ); Wed, 28 Feb 2018 12:52:02 -0500 X-ME-Sender: Subject: Re: [PATCH 3/3] mailbox: sunxi-msgbox: Add a new mailbox driver To: Jassi Brar Cc: Maxime Ripard , Chen-Yu Tsai , Rob Herring , Linux Kernel Mailing List , ", linux-arm-kernel"@lists.infradead.org, linux-mediatek@lists.infradead.org, srv_heupstream , Devicetree List , Andre Przywara References: <20180228022714.30068-1-samuel@sholland.org> <20180228022714.30068-4-samuel@sholland.org> From: Samuel Holland Message-ID: Date: Wed, 28 Feb 2018 11:51:59 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.2 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, On 02/28/18 03:16, Jassi Brar wrote: > On Wed, Feb 28, 2018 at 7:57 AM, Samuel Holland wrote: > .... > >> +/* >> + * The message box hardware provides 8 unidirectional channels. As the mailbox >> + * framework expects them to be bidirectional >> > That is incorrect. Mailbox framework does not require a channel to be > TX and RX capable. Sorry, it would be more accurate to say that the intended mailbox _client_ expects the channels to be bidirectional. > You should expose each channel as per its physical capability, let the > client configure it for direction (if its bidirectional) and acquire > separate channels for RX and TX if it needs to. Is there any way for the mailbox framework to inform the client that a channel is uni/bidirectional? Or if the channel supports RX/TX specifically? I couldn't find any. It looks like all of the clients assume one case or the other, based on the hardware they were initially designed to support. For example arm_scpi expects one channel per client, while ti_sci and st_remoteproc expect two separate RX and TX channels per client. Since there's no API for the client to know the hardware properties, modifying arm_scpi to support unidirectional mailbox channels would break support for all existing bidirectional mailboxes. To expose the physical channels individually, there would need to be an API to: a) Determine if a mailbox channel supports unidirectional or bidirectional operation. b) If a channel is unidirectional, determine which direction(s) it supports. c) If a unidirectional channel supports both directions, configure which direction it should run in. Since that API doesn't currently exist, I wrote the driver to match what the intended client expected (as all other mailbox controller drivers currently do). > Cheers! Regards, Samuel