Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp3055990ybv; Sat, 15 Feb 2020 09:51:48 -0800 (PST) X-Google-Smtp-Source: APXvYqxepNpXl+FdAu365adRJCJPVDl6CP6Q69qIIxsZcSqy33W0DVtaUCf1TxNnm5QdUHkEFT14 X-Received: by 2002:a9d:6b91:: with SMTP id b17mr6267374otq.235.1581789107931; Sat, 15 Feb 2020 09:51:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581789107; cv=none; d=google.com; s=arc-20160816; b=lvy9QF0aj9faHzxMqPtyDLul3axkr6vOthZo4hopDAPk2nRr8+VJ/6be77rNxcPxj3 M76ZNQP51qJ2W2/Bff5datUGdAdkk+w5/v5vGSxwKfkHtYhRMHmqfoTzJDDcS9q7cbjN LDABbagdu/f/eGEWmV0aANQtt6QAELJPY3zY4LNL0j4wouTFQSORDvlswlULlQouDx14 AUGcUgiHuiniHDh6YWUz0EFXR9ZF2b/naYFkuPWCN3NGuuFfMwn4mvFIJUP3li1DPmeN NkUEyK4g3hLHjotWKCkE4OdTLkd6x62E8ToWqDIV195+D67YimmSYzn4tpfId9CkFP4l nqeg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature; bh=WwHvpZLXwUUzL5832t8riOLNNuOlQyc6hyd24yYnpxk=; b=VaJSwYug0fSz8QNp6XCpofM+oTbamTivf+KnQyy2sW2nT6qujegzegisXXWJW417fS O1FiQl/8Hkdy0zRgZ+vSCBofymwnfTbsnHyo9I4Z+lOadyugGUKjj6NhtUzKaF3kR9Ia ob0yWBios0hSS7lcxschvMX5xdfLzOWq3oQ5uKKdOIgr0WPPRWG8Dj41SEpxjAc3YHRM x/kGnKGjVJ3YI8tBhdWUGlJ84VOGiXSMFdsR3P5AQCpMCrt7zhhQYzQeGWCvolyXxJKg +otiVZ/QKFa4+V+3s4McgJR7vLHUj1LkQGSu23xrtQSNsFfpiw6ZoW35hP+AM5fcQNX9 Ti0A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=PMfa9w4g; 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 w16si4624509oih.154.2020.02.15.09.51.35; Sat, 15 Feb 2020 09:51:47 -0800 (PST) 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=PMfa9w4g; 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 S1726565AbgBORvX (ORCPT + 99 others); Sat, 15 Feb 2020 12:51:23 -0500 Received: from mail-pj1-f65.google.com ([209.85.216.65]:53920 "EHLO mail-pj1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726318AbgBORvW (ORCPT ); Sat, 15 Feb 2020 12:51:22 -0500 Received: by mail-pj1-f65.google.com with SMTP id n96so5385194pjc.3; Sat, 15 Feb 2020 09:51:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=WwHvpZLXwUUzL5832t8riOLNNuOlQyc6hyd24yYnpxk=; b=PMfa9w4gphEkhAlWRUVE+fe5gLfT8l+Y3B8MqBwnSTebRwmZqVBiS6SH/l+fNa+8Ba UKAybU0rYqaZNar7E9vrFt6uaSePMd9DACxeOdawFxpJ/6O/4cJF9Dpg4xIRudUZBbpi 2MPCcgmsSZn2yljVD28q8adueOHhWOjCgHWJPVF4eZT8YjXIDgr3KGuofqzEyyuFFl0D o3u+buAcafThDKkLkbieva7Z4xROefwZkiXmSxN9016Z2zuOmXKOAXutbC73mRAk1Yp2 EKTEcjyQFs+uwk3qs+HIFXOVFVwImuLFcd16+rw/MbJ6SkozvFK90NcWje+I1QI8R+Tk tXjg== 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; bh=WwHvpZLXwUUzL5832t8riOLNNuOlQyc6hyd24yYnpxk=; b=DfvsZn2vsB6EhWZ2Y+fd3QwJRPwS9nGkepHz4R9SHUYd+5RH/2rssHSBMdVwYqOmXE 3zI7gBQlKwt9/JXtPVLlNQ3aQL9hfogUhnxdfaKjgxMwjUzcOeXkXyts2b5EoYMuXY90 LVWnrhBbkXJYEY+E735H6EXOTEptcuVx2+0U7GgXXxU2fj7IGIMNrjIuyZOvcMwq8UEM 9xmhK2yoAPtURO9hG6NYSpiXyFPh9Z5Q5UO9jc+rsw5+jVT+blFRefCQfUytOPJN139+ nyV2Aac8jz9e/ikbeLHxxme/C3EBcQXG2NvXj6PpFi7fQRppi6ksichK9c8+C37yG0op xfIg== X-Gm-Message-State: APjAAAUEqOkOgbV5Ih7lo/XnP68oDaV34w65Hgrlp36IOPFXXdnKpLAX mpmK9/oMFGZ/pvzJgXd5Kgw= X-Received: by 2002:a17:902:b604:: with SMTP id b4mr8693221pls.340.1581789081726; Sat, 15 Feb 2020 09:51:21 -0800 (PST) Received: from localhost.localdomain ([49.207.56.214]) by smtp.gmail.com with ESMTPSA id g13sm7176375pgh.82.2020.02.15.09.51.19 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 15 Feb 2020 09:51:21 -0800 (PST) From: Rishi Gupta To: gregkh@linuxfoundation.org, robh+dt@kernel.org Cc: jslaby@suse.com, linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, Rishi Gupta Subject: [PATCH v2 1/4] dt-bindings: ttyvs: document serial null modem driver bindings Date: Sat, 15 Feb 2020 23:21:06 +0530 Message-Id: <1581789069-5232-1-git-send-email-gupt21@gmail.com> X-Mailer: git-send-email 2.7.4 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The ttyvs driver creates virtual tty devices. These devices can also be created through device tree. This commit document this. Signed-off-by: Rishi Gupta --- Changes in v2: - Made dev-num property mandatory - Removed descriptions not needed due to driver changes .../devicetree/bindings/serial/ttyvs.yaml | 165 +++++++++++++++++++++ 1 file changed, 165 insertions(+) create mode 100644 Documentation/devicetree/bindings/serial/ttyvs.yaml diff --git a/Documentation/devicetree/bindings/serial/ttyvs.yaml b/Documentation/devicetree/bindings/serial/ttyvs.yaml new file mode 100644 index 0000000..c919424 --- /dev/null +++ b/Documentation/devicetree/bindings/serial/ttyvs.yaml @@ -0,0 +1,165 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/serial/ttyvs.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Virtual multi-port serial card DT bindings + +maintainers: + - Rishi Gupta + +description: | + The ttyvs driver creates a virtual card which can have 0 to 65535 + virtual tty devices. The card is modelled as a node with zero or more + child nodes each representing a virtual tty device. These devices + can be configured to be a loop-back type device or it can be part of + a null-modem pair. + + Devices can be created by defining properties required to instantiate + a device (see examples Ex1/2/3 at the end). More information about + how to use this driver is here Documentation/virtual/tty-ttyvs.rst + +properties: + compatible: + const: ttyvs,virtual-uart-card + + max-num-vs-devs: + allOf: + - $ref: /schemas/types.yaml#/definitions/uint32 + - minimum: 0 + - maximum: 0xffff + maxItems: 1 + description: + By default, the driver can create upto 64 devices. This number can + be changed by passing 'max_num_vs_devs' module parameter to the driver + or by defining 'max-num-vs-devs' DT property. If both are used then + driver updates itself to support total number of devices as defined + by max-num-vs-devs property. + +patternProperties: + "^ttyvs@[0-9]+$": + type: object + description: + Node representing one virtual tty device. This describes, device + number and its configuration. + + properties: + dev-num: + allOf: + - $ref: /schemas/types.yaml#/definitions/uint32 + - minimum: 0 + - maximum: 65534 + maxItems: 1 + description: + Specifies index (N in /dev/ttyvsN) to use for creating device. + Valid value for dev-num is from 0 to 65534. + + rtsmap: + allOf: + - $ref: /schemas/types.yaml#/definitions/uint32-array + items: + - enum: [1, 6, 8, 9] + maxItems: 1 + description: + Specifies to which pin(s) RTS pin of this device should be + connected. Valid values are pin 1 (DCD), pin 6 (DSR), pin 8 + (CTS) and pin 9 (RI). If this is not used then RTS pin is + left unconnected. + + dtrmap: + allOf: + - $ref: /schemas/types.yaml#/definitions/uint32-array + items: + - enum: [1, 6, 8, 9] + maxItems: 1 + description: + Specifies to which pin(s) DTR pin of this device should be + connected. Valid values are pin 1 (DCD), pin 6 (DSR), pin 8 + (CTS) and pin 9 (RI). If this is not used then DTR pin is + left unconnected. + + set-dtr-at-open: + type: boolean + description: + If used, DTR signal will be asserted by driver when device + node is opened by user space application. + + peer-dev: + $ref: /schemas/types.yaml#definitions/phandle + description: + Phandle to the peer DT node if this node is part of a null + modem pair. + +required: + - compatible + - dev-num + +examples: + - | + # Ex1; Null-modem pair only TX/RX connected + # /dev/ttvs0 <---> /dev/ttyvs1 + # TX (3) ----> (2) RX + # RX (2) <---- (3) TX + + ttyvs-card@0 { + compatible = "ttyvs,virtual-uart-card"; + + ttyvs0: ttyvs0 { + dev-num = <0>; + peer-dev = <&ttyvs1>; + }; + + ttyvs1: ttyvs1 { + dev-num = <1>; + peer-dev = <&ttyvs0>; + }; + }; + + - | + # Ex2; Standard loop-back device + # TX (3) -->| + # RX (2) <--| + + ttyvs-card@0 { + compatible = "ttyvs,virtual-uart-card"; + ttyvs2 { + dev-num = <2>; + rtsmap = <8>; + dtrmap = <1 6>; + set-dtr-at-open; + }; + }; + + - | + # Ex3; Standard null-modem pair for hardware flow control + # TX (3) ----> (2) RX + # RX (2) <---- (3) TX + # RTS (7) ----> (8) CTS + # DTR (4) --+-> (1) DCD + # +-> (6) DSR + # CTS (8) <---- (7) RTS + # DCD (1) <-+-- (4) DTR + # DSR (6) <-+ + + ttyvs-card@0 { + compatible = "ttyvs,virtual-uart-card"; + max-num-vs-devs = <128>; + + ttyvs3: ttyvs3 { + dev-num = <3>; + rtsmap = <8>; + dtrmap = <1 6>; + set-dtr-at-open; + peer-dev = <&ttyvs4>; + }; + + ttyvs4: ttyvs4 { + dev-num = <4>; + rtsmap = <8>; + dtrmap = <1 6>; + set-dtr-at-open; + peer-dev = <&ttyvs3>; + }; + }; +... -- 2.7.4