Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp21207865ybl; Sun, 5 Jan 2020 23:23:25 -0800 (PST) X-Google-Smtp-Source: APXvYqxhtH8p4F70AZLJwH1AL2d92B1EnzI2h4ePOBG6MA0WHVXZWhcm6Dt1Bs5nsVUcDhEeyyIc X-Received: by 2002:a9d:1c95:: with SMTP id l21mr103851656ota.271.1578295405710; Sun, 05 Jan 2020 23:23:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1578295405; cv=none; d=google.com; s=arc-20160816; b=AH6piBb4ofBzzEHPIZ5kQ0BJSlXBaR82/IzYgz5MY/2/DhUaR3daHVzXezPazwpJi4 4CRKsUS5aLPZ15fM7V3WEzgIUltN+QsY0nrjOis8O+/NC4Fzp5hrYhCtbVj4YKFY/Wk2 rQqv8h6kN0p4Z1FVuft0QBI6TdxilyfqxCGW9z4LiDM9hIJTq+88QUwigby6qF9ZhxGO skGiRasoqSQH0hHFVFWM6paYvQG3VOYBjImTnebT8i60tebZ7Ep5xoI6YzVhRqNhk9Ql AJe5rHQv5m80LAo4TMLbscQ6MjoOEnIqAGiIUarL+kt86INwvY/tn1td+Lz7BmJ6Ufxw 7+Sg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature; bh=qnUvpIVI6jilLhA8MwTkPqoyoqaSkFHL57CbN/GbI7g=; b=JkwayAzm3Wo/aXgT/K58Gz5UDRwo+OiEY3OpcmnCvxxsh187sVWT3pa34YxVlFWSKV xpLN/TOiHilbVH0dVN68S/rUKvE89vVxfyFC8GXgzAW930jYmQJJk8p9YbeOS/9j75dN jHgSKqUbtnJ5TGzD8dWhFsBfZpdOQ/AwSwUZZvcFk9AQuILaQlIqFEaKYBw2tcLeZxjG 7iw/BflJegJXH9dP0XFjK08csqeJqsAB+Mgc2TUe5p0/bMwXmEakYornP5GbenYjyC+q pEFhW6+TA6vgBzARHoTVZ660PJe77G09gxgqRwIp5z1mBeGK4zzJlSQtIAL12ADL7pfr Qy4Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=lbcHXjkp; 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 h14si37314847otn.6.2020.01.05.23.23.13; Sun, 05 Jan 2020 23:23:25 -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=lbcHXjkp; 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 S1726698AbgAFHW1 (ORCPT + 99 others); Mon, 6 Jan 2020 02:22:27 -0500 Received: from mail-pg1-f196.google.com ([209.85.215.196]:37169 "EHLO mail-pg1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726448AbgAFHW1 (ORCPT ); Mon, 6 Jan 2020 02:22:27 -0500 Received: by mail-pg1-f196.google.com with SMTP id q127so26475805pga.4; Sun, 05 Jan 2020 23:22:26 -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:in-reply-to:references :in-reply-to:references; bh=qnUvpIVI6jilLhA8MwTkPqoyoqaSkFHL57CbN/GbI7g=; b=lbcHXjkpQo7dQQgKv7FiC2zhZQzdkQceveV++pQGU+MBXnRIrRMEHKKa4/E+QDdKgV ChUU7UmZG8hoKl4LvDpH34vVSl7A/35BUZq6GU4WOWZ293O2ky4y7WFGsZpdC0Ya2xF4 scwm60WdiMEU2liYGKPW7bTt6XmrSX7Lu/6rcW080PgnMLGTAaI5nJ0gsZoHC5vA8MQY 9TX1wHNBnVw/P7lFCwTeGSX4NkKIU+wUGGqW6/j14am3HOiDgg3oRYLwX4ig59ARUY8q v4SEYHMBXVkiBv3Y4Ohslp//hecJo2kicHVhEOqxvjyMmya3JjuMQnczLxrKiat5I2K8 bpGA== 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:in-reply-to:references; bh=qnUvpIVI6jilLhA8MwTkPqoyoqaSkFHL57CbN/GbI7g=; b=BOFO1YLwze6LzPlCzbcXbovi7IpXwrTKFKrEOS2/8sdhu/dJL4TWefHorbaASR2fR7 ZejbBdRLnfNRLlR+B4xes7m7Rs+eiLQepr2ntZ6xDzId9InNkgVTBWutcJ67HOlGolMa XNSo48b3Jl/kaxjsgr0LQ/044D4cip8Gk3QdaO7HrxCJzwPhkfV4Vip5sB347N4baGoQ XmKZqx4t3bk+BmiY4GnlHlhZfC6AY5ST8x3Nj9zFOKWmrnLyEl7NhumDH5tspDlSa2wN guEtLWwCUI5ySkdZUOsJRIacupt2LM8oLsA4Lsm9q2ydeizB+m+10xfVfuSrgCtJxfeT lUUQ== X-Gm-Message-State: APjAAAWqxShFGCdq9LehlUWvniEJZBmbegYXDPyKFes7cW0AQP3Xp58R msp9yPxP65NNSHdw+xLBrKA= X-Received: by 2002:a63:3484:: with SMTP id b126mr106717399pga.17.1578295346391; Sun, 05 Jan 2020 23:22:26 -0800 (PST) Received: from localhost.localdomain ([49.207.56.131]) by smtp.gmail.com with ESMTPSA id q8sm72968137pgg.92.2020.01.05.23.22.23 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 05 Jan 2020 23:22:25 -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 v1 1/3] dt-bindings: ttyvs: document serial null modem driver dt bindings Date: Mon, 6 Jan 2020 12:51:53 +0530 Message-Id: <68e8f2bc664fd2d624bdb5f7a374abb42e5a5770.1578235515.git.gupt21@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: References: In-Reply-To: References: 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 --- .../devicetree/bindings/serial/ttyvs.yaml | 175 +++++++++++++++++++++ 1 file changed, 175 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..d37c237 --- /dev/null +++ b/Documentation/devicetree/bindings/serial/ttyvs.yaml @@ -0,0 +1,175 @@ +# 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 accessible through node + /dev/ttyvs_card. This card can have 0 to 65535 virtual tty devices. + The card is modeled 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 through DT (see examples Ex1/2/3 at the end) + or by writing pre-formatted string to card node. + + If the driver is built as loadable module, standard null modem pairs + can be created by passing 'init_num_nm_pairs' parameter. Similarly, + standard loopback devices can be created by passing 'init_num_lb_devs' + parameter. When DT is used and device nodes are defined, all devices + created due to module parameters will be deleted first and then + devices specified by DT will be created. + + Devices can be deleted only by writing pre-formatted string to card node, + irrespective of whether they were created using DT or through string. + +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' parameter to the driver or + by defining 'max-num-vs-devs' DT property. If both are used then + first all devices created during module loading are deleted, 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: + A node representing one virtual tty device. This node optionally, + describes, device number and its configuration. + + properties: + dev-num: + allOf: + - $ref: /schemas/types.yaml#/definitions/uint32 + - minimum: 0 + - maximum: 0xffff + maxItems: 1 + description: + Specifies index (N in /dev/ttyvsN) to use for creating device. + If this property is not specified then next lowest free index + is used by driver. Valid value for N is 0 to 65535. + + 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 + +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