Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp5090654ybb; Tue, 24 Mar 2020 10:46:35 -0700 (PDT) X-Google-Smtp-Source: ADFU+vu/CvrbZGxjCqCsLAkYI8Tu3FyP20KRUCWdGt/Mit5ocRP+VSYMQTSF6MsXkcJNDOsRouyj X-Received: by 2002:a9d:7f05:: with SMTP id j5mr7093607otq.312.1585071995717; Tue, 24 Mar 2020 10:46:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585071995; cv=none; d=google.com; s=arc-20160816; b=Stx5/bkXn7DzTt7kQPJ/bECVYMlBv9U/t0pl2ahf9aZKN22owHZyqWrM+0nFjdEiCa +TizBH9mQDdjebNqSgefdqZu8uhW9m1C0tZhmT4su7YIKoHOILZ67lSWCVXCXxJkClGy EzyKsUx8qwe0FaDf6wQwP0wrb8oKmUqIcfkhwNI9g0LaAQLQWI09O6xHWr3d4mK/UBsB +KfhZ1AcHbhj5H7hU7/JWwli+GbK0Z/z+CkMwIJy+LTs31DNIu0zd1TT0jMQm6OkFIMR G3/gcJf/01TjK7i1Tl91/OG4Z2+ysfzsB9d16rQ5IxVF/VYuVyJwEk5dR+87EgvdeDTK OLDQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=gm8o3p9zY1Nww2ErmVEzpZYR85DamogULeQ92HOiqsg=; b=cwRfpyDBuaKeaX34Q+qFwIml6cvbmuQZt0rH9nCSDzUfmRLaL8ohL1newdBRkuhaSa 33/xeg2e/wMp8Am9dn8xOa9K7LUEU3HFbIIOkzojrT6iQqm6dxv4FrvJa8TI87SJUZ/n bVU2V/FiqogIXiygRgmcKZCiddyuWoXxf0TFLXyGQ+A3lQrkU1bVWjvlu86ca644GYam Yj6y6xiJcDDqUmhfWltdHyiLqwQGm8IUht9OOl1TzrfR1Qy/FPhh+hdx7S/sqkOCX9fr oySfc49Eo6oLLz9XDruJvPfbdTKTyPxfffpP2CooCqWKkuQpVKT5Zy8QFiIVi0wmTdyf xZrQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=MJ5Q2eN7; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y67si8782164oia.184.2020.03.24.10.46.23; Tue, 24 Mar 2020 10:46:35 -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=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=MJ5Q2eN7; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727855AbgCXRpD (ORCPT + 99 others); Tue, 24 Mar 2020 13:45:03 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:54012 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727775AbgCXRpB (ORCPT ); Tue, 24 Mar 2020 13:45:01 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=Content-Transfer-Encoding: Content-Type:In-Reply-To:MIME-Version:Date:Message-ID:From:References:Cc:To: Subject:Sender:Reply-To:Content-ID:Content-Description; bh=gm8o3p9zY1Nww2ErmVEzpZYR85DamogULeQ92HOiqsg=; b=MJ5Q2eN7pgjMr1qGPiNVaVF4YX S8uK2Ve6zQ5viz+aS2zad3jugoq82QLkfDEvjP1Y1VAoEsIodg9B5iyueY7TP7ZdJlBbZQqSuHgJ4 imKPSmGBmU2IEGVMM4m8i7Ds1nRMIQ/xtRjA62qBIjnsNOT3BR03YwYnUwUPnIEIxkI6WJzEh1XOZ YXi03zulnM4gdykL0w1Xrncmf4zZrBJxhD++gWzKygcl6il2jlaYDDZravNtlnS2buJ7R+is5Fpzc KzoAAsTpyeotKdGewfwZ139mXokDXhzia8ZOAtpKKZ0Hbpbj1ji0tfYqUymXuhYLsLeD5St42NP/1 KqfQQ6Vw==; Received: from [2601:1c0:6280:3f0::19c2] by bombadil.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1jGnbi-00021Q-Jv; Tue, 24 Mar 2020 17:44:54 +0000 Subject: Re: [PATCH v7 2/2] tty: add rpmsg driver To: Arnaud Pouliquen , Ohad Ben-Cohen , Bjorn Andersson , Greg Kroah-Hartman , Jiri Slaby , linux-kernel@vger.kernel.org, linux-remoteproc@vger.kernel.org, Mathieu Poirier Cc: Suman Anna , Fabien DESSENNE , linux-stm32@st-md-mailman.stormreply.com, Alan Cox , xiang xiao References: <20200324170407.16470-1-arnaud.pouliquen@st.com> <20200324170407.16470-3-arnaud.pouliquen@st.com> From: Randy Dunlap Message-ID: <8821448b-3c6e-6277-06d2-9be7f81de9e9@infradead.org> Date: Tue, 24 Mar 2020 10:44:52 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.6.0 MIME-Version: 1.0 In-Reply-To: <20200324170407.16470-3-arnaud.pouliquen@st.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, On 3/24/20 10:04 AM, Arnaud Pouliquen wrote: > This driver exposes a standard TTY interface on top of the rpmsg > framework through a rpmsg service. > > This driver supports multi-instances, offering a /dev/ttyRPMSGx entry > per rpmsg endpoint. > > Signed-off-by: Arnaud Pouliquen > --- > Documentation/serial/tty_rpmsg.rst | 45 ++++ > drivers/tty/Kconfig | 9 + > drivers/tty/Makefile | 1 + > drivers/tty/rpmsg_tty.c | 417 +++++++++++++++++++++++++++++ > 4 files changed, 472 insertions(+) > create mode 100644 Documentation/serial/tty_rpmsg.rst > create mode 100644 drivers/tty/rpmsg_tty.c > > diff --git a/Documentation/serial/tty_rpmsg.rst b/Documentation/serial/tty_rpmsg.rst > new file mode 100644 > index 000000000000..fc1d3fba73c5 > --- /dev/null > +++ b/Documentation/serial/tty_rpmsg.rst > @@ -0,0 +1,45 @@ > +.. SPDX-License-Identifier: GPL-2.0 > + > +============= > +The rpmsg TTY > +============= > + > +The rpmsg tty driver implements serial communication on the RPMsg bus to makes possible for user-space programs to send and receive rpmsg messages as a standard tty protocol. to make it possible > + > +The remote processor can instantiate a new tty by requesting: > +- a "rpmsg-tty-raw" RPMsg service, for TTY raw data support without flow control > +- a "rpmsg-tty-ctrl" RPMSg service, for TTY support with flow control. > + > +Information related to the RPMsg and associated tty device is available in > +/sys/bus/rpmsg/devices/. > + > +RPMsg TTY without control > +--------------------- extend underline under "control" > + > +The default end point associated with the "rpmsg-tty-raw" service is directly > +used for data exchange. No flow control is available. > + > +To be compliant with this driver, the remote firmware must create its data end point associated with the "rpmsg-tty-raw" service. > + > +RPMsg TTY with control > +--------------------- extend underline length. > + > +The default end point associated with the "rpmsg-tty-ctrl" service is reserved for > +the control. A second endpoint must be created for data exchange. > + > +The control channel is used to transmit to the remote processor the CTS status, > +as well as the end point address for data transfer. > + > +To be compatible with this driver, the remote firmware must create or use its end point associated with "rpmsg-tty-ctrl" service, plus a second endpoint for the data flow. > +On Linux rpmsg_tty probes, the data endpoint address and the CTS (set to disable) > +is sent to the remote processor. > +The remote processor has to respect following rules: respect the following rules: > +- It only transmits data when Linux remote cts is enable, otherwise message CTS is enabled, > + could be lost. > +- It can pause/resume reception by sending a control message (rely on CTS state). > + > +Control message structure: > +struct rpmsg_tty_ctrl { > + u8 cts; /* remote reception status */ > + u16 d_ept_addr; /* data endpoint address */ > +}; Is that struct packed or padded? -- ~Randy