Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp1267717ybl; Tue, 13 Aug 2019 09:50:50 -0700 (PDT) X-Google-Smtp-Source: APXvYqynUfMjBM0TFEM6WDOcQtNLG4IQn8NLYNou/7ju15bksT2ZUt1iaRSyufq2S3YFcq7qpvKp X-Received: by 2002:a63:6c02:: with SMTP id h2mr36901748pgc.61.1565715050046; Tue, 13 Aug 2019 09:50:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565715050; cv=none; d=google.com; s=arc-20160816; b=rWJBAShCVQyBsLg1+ZpIAWjMLzJ4cke1UvLVMrwUWPwb1IcNBSKhVgYaDFuexLf/ea 9pTVE83FfzYTyyXsftZn5CTNkdGoly8giDzMskaOpXIv6pnA2MhTu5IoNqoSw9pfk9BS td/YNO2/Fi7g/upUauKONp1Cj0qib522jLcXjre9igB19EqIjaKEdvIFEDY3KqvxcDvu fhPMlrHGtK1TQDT+AnmF1WiIEMNc2cAX5fyZxaMtdmZ77DswWn/LP5JUyIS+7WvaPhqN sqxBzokFXQ4bVy3EmeMVewLjNU25zKPcNCAXXFiA/FXtXBr35mESIQ/ZtrZz6Db7HZsu nZiA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=2+rDaHmg0AFJSGfYYUVedTTISFoQ3Y2D4evPtewEfoo=; b=e2F6JuNNw2CZ8WFp6lT9grl1e+HnoMQEkR3Xm+mvawm+CthmFHcX5+5nbP1Y+YMamy MfLudvX7GdbKJAWIDTdq0Kuj3JDz/S/btH5PdGzftaPtgzhy8Eueln54hAU3q8bf19a0 y7shRENso49mN+xT1TO6IuB5z8I/mtUMUZJRakg4Lk5577B/O8onP1rP4LjPcVMxrwCX XWc8Hdg77OaeCsBqK+Ec7t3Pcf1CX3e8Da4NCMeqr8JJNyN54NkAw8jaiFcXsoI0RMcy JZYYdH3uR0u7pRA/67L0nBc7Nh1bMo4g4MT8NoNJcl2ppbIvaX2va1XYMnQxyNFIwsAK AA/A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=gjhVLbQq; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n129si65477398pgn.254.2019.08.13.09.50.33; Tue, 13 Aug 2019 09:50:50 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=gjhVLbQq; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727885AbfHMQhJ (ORCPT + 99 others); Tue, 13 Aug 2019 12:37:09 -0400 Received: from mail-ot1-f68.google.com ([209.85.210.68]:46655 "EHLO mail-ot1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726705AbfHMQhI (ORCPT ); Tue, 13 Aug 2019 12:37:08 -0400 Received: by mail-ot1-f68.google.com with SMTP id z17so56443810otk.13; Tue, 13 Aug 2019 09:37:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=2+rDaHmg0AFJSGfYYUVedTTISFoQ3Y2D4evPtewEfoo=; b=gjhVLbQq0PtSOEK+lsGngWKMKah1F9bDZEc0tF9UYs2eSsx2v0BbDM14D88Fh1eitS nbV4l6+nLsoKMelVKWaqevVFsFL4IwILcYzSDF/iRvz1a1v1BXX9IvGmfBZpwFQ45iQk N88DLpE5t1Ad+nVuEnBhK3V3AjWE6LU9aD5JdnxnrJolT03QenET8BP083O9p08SmdLw pDdv6Xdk/oQpe82Ah8QAjQr5sI8HH0nyWz7NicrNWblZN3o62KBmEdFk6vOPl2ZFI7EM M4Oz3gqNTq3RuQUUqqwg7fd9pb5tDSsDfn76fxRCFdDrTafRsKegw4a7icf11QLgcgJD rwZA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=2+rDaHmg0AFJSGfYYUVedTTISFoQ3Y2D4evPtewEfoo=; b=nWhZxyyiYmjxV7aVed+6uf+X0Q3ULtqc/inE6OjWEUg5Tu7T6HS07NGC15YOLJ7JCn bFax9SEGIHTfcN6eWOmSh5FiNIL3jrQbJRRMV2zQS8RuVeIWM9X/SKJFoX2LmGXZ2iXs MOxENNnt3C3HHVK9u6BXc3hUJeBnyj2u9LFmOmyKhO319ySnlgCvxyBXkmNQ/KR36y04 K1NDy6YiUjMxp7W4t9JpcYo4SFZ7ByVuESvGUlBx/kOx9sa0M/mWT75AUuL54OHC1wYY i20dxOwIwmC7QjrhVS3Zd4AoThObGzmOjZWLEdHraPHXkz8VvUu3b5MC8WIY/YQczMYt 9sgg== X-Gm-Message-State: APjAAAW/QjloAyrw/IA3TLn+OIb176ip9PVEhOygtj/1ZVgMStiJ+xTO uzu+rWMRoAkQjL2KYJYkKDc14zrcL/cuXd1utJM= X-Received: by 2002:a05:6638:143:: with SMTP id y3mr2274329jao.68.1565714227401; Tue, 13 Aug 2019 09:37:07 -0700 (PDT) MIME-Version: 1.0 References: <20190717192616.1731-1-tushar.khandelwal@arm.com> <20190717192616.1731-2-tushar.khandelwal@arm.com> In-Reply-To: From: Jassi Brar Date: Tue, 13 Aug 2019 11:36:56 -0500 Message-ID: Subject: Re: [PATCH 1/4] mailbox: arm_mhuv2: add device tree binding documentation To: Morten Borup Petersen Cc: Tushar Khandelwal , Linux Kernel Mailing List , "tushar.2nov@gmail.com" , "nd@arm.com" , Morten Borup Petersen , Rob Herring , Mark Rutland , Devicetree List Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Aug 2, 2019 at 5:41 AM Morten Borup Petersen wrote: > > > > On 7/31/19 9:31 AM, Jassi Brar wrote: > > On Sun, Jul 28, 2019 at 4:28 PM Morten Borup Petersen wrote: > >> > >> > >> > >> On 7/25/19 7:49 AM, Jassi Brar wrote: > >>> On Sun, Jul 21, 2019 at 4:58 PM Jassi Brar wrote: > >>>> > >>>> On Wed, Jul 17, 2019 at 2:26 PM Tushar Khandelwal > >>>> wrote: > >>>> > >>>>> diff --git a/Documentation/devicetree/bindings/mailbox/arm,mhuv2.txt b/Documentation/devicetree/bindings/mailbox/arm,mhuv2.txt > >>>>> new file mode 100644 > >>>>> index 000000000000..3a05593414bc > >>>>> --- /dev/null > >>>>> +++ b/Documentation/devicetree/bindings/mailbox/arm,mhuv2.txt > >>>>> @@ -0,0 +1,108 @@ > >>>>> +Arm MHUv2 Mailbox Driver > >>>>> +======================== > >>>>> + > >>>>> +The Arm Message-Handling-Unit (MHU) Version 2 is a mailbox controller that has > >>>>> +between 1 and 124 channel windows to provide unidirectional communication with > >>>>> +remote processor(s). > >>>>> + > >>>>> +Given the unidirectional nature of the device, an MHUv2 mailbox may only be > >>>>> +written to or read from. If a pair of MHU devices is implemented between two > >>>>> +processing elements to provide bidirectional communication, these must be > >>>>> +specified as two separate mailboxes. > >>>>> + > >>>>> +A device tree node for an Arm MHUv2 device must specify either a receiver frame > >>>>> +or a sender frame, indicating which end of the unidirectional MHU device which > >>>>> +the device node entry describes. > >>>>> + > >>>>> +An MHU device must be specified with a transport protocol. The transport > >>>>> +protocol of an MHU device determines the method of data transmission as well as > >>>>> +the number of provided mailboxes. > >>>>> +Following are the possible transport protocol types: > >>>>> +- Single-word: An MHU device implements as many mailboxes as it > >>>>> + provides channel windows. Data is transmitted through > >>>>> + the MHU registers. > >>>>> +- Multi-word: An MHU device implements a single mailbox. All channel windows > >>>>> + will be used during transmission. Data is transmitted through > >>>>> + the MHU registers. > >>>>> +- Doorbell: An MHU device implements as many mailboxes as there are flag > >>>>> + bits available in its channel windows. Optionally, data may > >>>>> + be transmitted through a shared memory region, wherein the MHU > >>>>> + is used strictly as an interrupt generation mechanism. > >>>>> + > >>>>> +Mailbox Device Node: > >>>>> +==================== > >>>>> + > >>>>> +Required properties: > >>>>> +-------------------- > >>>>> +- compatible: Shall be "arm,mhuv2" & "arm,primecell" > >>>>> +- reg: Contains the mailbox register address range (base > >>>>> + address and length) > >>>>> +- #mbox-cells Shall be 1 - the index of the channel needed. > >>>>> +- mhu-frame Frame type of the device. > >>>>> + Shall be either "sender" or "receiver" > >>>>> +- mhu-protocol Transport protocol of the device. Shall be one of the > >>>>> + following: "single-word", "multi-word", "doorbell" > >>>>> + > >>>>> +Required properties (receiver frame): > >>>>> +------------------------------------- > >>>>> +- interrupts: Contains the interrupt information corresponding to the > >>>>> + combined interrupt of the receiver frame > >>>>> + > >>>>> +Example: > >>>>> +-------- > >>>>> + > >>>>> + mbox_mw_tx: mhu@10000000 { > >>>>> + compatible = "arm,mhuv2","arm,primecell"; > >>>>> + reg = <0x10000000 0x1000>; > >>>>> + clocks = <&refclk100mhz>; > >>>>> + clock-names = "apb_pclk"; > >>>>> + #mbox-cells = <1>; > >>>>> + mhu-protocol = "multi-word"; > >>>>> + mhu-frame = "sender"; > >>>>> + }; > >>>>> + > >>>>> + mbox_sw_tx: mhu@10000000 { > >>>>> + compatible = "arm,mhuv2","arm,primecell"; > >>>>> + reg = <0x11000000 0x1000>; > >>>>> + clocks = <&refclk100mhz>; > >>>>> + clock-names = "apb_pclk"; > >>>>> + #mbox-cells = <1>; > >>>>> + mhu-protocol = "single-word"; > >>>>> + mhu-frame = "sender"; > >>>>> + }; > >>>>> + > >>>>> + mbox_db_rx: mhu@10000000 { > >>>>> + compatible = "arm,mhuv2","arm,primecell"; > >>>>> + reg = <0x12000000 0x1000>; > >>>>> + clocks = <&refclk100mhz>; > >>>>> + clock-names = "apb_pclk"; > >>>>> + #mbox-cells = <1>; > >>>>> + interrupts = <0 45 4>; > >>>>> + interrupt-names = "mhu_rx"; > >>>>> + mhu-protocol = "doorbell"; > >>>>> + mhu-frame = "receiver"; > >>>>> + }; > >>>>> + > >>>>> + mhu_client: scb@2e000000 { > >>>>> + compatible = "fujitsu,mb86s70-scb-1.0"; > >>>>> + reg = <0 0x2e000000 0x4000>; > >>>>> + mboxes = > >>>>> + // For multi-word frames, client may only instantiate a single > >>>>> + // mailbox for a mailbox controller > >>>>> + <&mbox_mw_tx 0>, > >>>>> + > >>>>> + // For single-word frames, client may instantiate as many > >>>>> + // mailboxes as there are channel windows in the MHU > >>>>> + <&mbox_sw_tx 0>, > >>>>> + <&mbox_sw_tx 1>, > >>>>> + <&mbox_sw_tx 2>, > >>>>> + <&mbox_sw_tx 3>, > >>>>> + > >>>>> + // For doorbell frames, client may instantiate as many mailboxes > >>>>> + // as there are bits available in the combined number of channel > >>>>> + // windows ((channel windows * 32) mailboxes) > >>>>> + , > >>>>> + , > >>>>> + ... > >>>>> + ; > >>>>> + }; > >>>> > >>>> If the mhuv2 instance implements, say, 3 channel windows between > >>>> sender (linux) and receiver (firmware), and Linux runs two protocols > >>>> each requiring 1 and 2-word sized messages respectively. The hardware > >>>> supports that by assigning windows [0] and [1,2] to each protocol. > >>>> However, I don't think the driver can support that. Or does it? > >>>> > >>> Thinking about it, IMO, the mbox-cell should carry a 128 (4x32) bit > >>> mask specifying the set of windows (corresponding to the bits set in > >>> the mask) associated with the channel. > >>> And the controller driver should see any channel as associated with > >>> variable number of windows 'N', where N is [0,124] > >>> > >>> mhu_client1: proto1@2e000000 { > >>> ..... > >>> mboxes = <&mbox 0x0 0x0 0x0 0x1> > >>> } > >>> > >>> mhu_client2: proto2@2f000000 { > >>> ..... > >>> mboxes = <&mbox 0x0 0x0 0x0 0x6> > >>> } > >>> > >>> Cheers! > >>> > >> > >> As mentioned in the response to your initial comment, the driver does > >> not currently support mixing protocols. > >> > > Thanks for acknowledging that limitation. But lets also address it. > > > > We are hesitant to dedicate time to developing mixing protocols given > that we don't have any current usecase nor any current platform which > would support this. > Can you please share the client code against which you tested this driver? From my past experience, I realise it is much more efficient to tidyup the code myself, than endlessly trying to explain the benefits. Thanks