From patchwork Mon Jul 26 04:51:41 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 485801 Delivered-To: patch@linaro.org Received: by 2002:a02:c94a:0:0:0:0:0 with SMTP id u10csp3476553jao; Sun, 25 Jul 2021 21:52:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw8OHg05P5vH1JE1EetbKYLxgQcXi1b3HxHzg9lJ7VVBtM/C9bYsfbV279OqAuDkkDPCmxp X-Received: by 2002:a6b:f813:: with SMTP id o19mr12958501ioh.49.1627275125204; Sun, 25 Jul 2021 21:52:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1627275125; cv=none; d=google.com; s=arc-20160816; b=SZZ0i0pjBU/xH5hMw9OoCmwYzord0vjcM8GKzygm/hrgJVvgl8XGBkzzpF41dLuE3v XnAR9d//une4WV+7uMxhwLPBxlB1ZsxyV0jKbACxX3hDmpMibt+ssSGXTQ/KCaqVMJrT MVm3G/OOImjzCekBE+t/SJPkWXyBndCSst8lU8/tgK5LHLR2aIkS19r64FA7Bt3vuWeH elEOPkWbr2texJMSs2DPolvXQAxwp1hMmGRIudbA2pusduHFt8bXuPXbpi4dbl9d8e10 gseesHtGpJzuDe9JEOg7OU4pyWhyEzyCC6uPf1MKD7Phwact3oL9LGP0O5zrW5Z0MjeR 1wmg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=BKW8SJUXD86+uZHpTY6dXOSgo09YOklrbve/i0ZpdAI=; b=UEBb2IFb6SFW+nnly6KjdeYzA6MvhIGzYA31WKK348oR9HEJXxjbI2oAeaRDqxE6jd mlkPm5k9m9BD9D1Cm43DF/ss06IQQBJHUbQ2nyAxgYDyKkNxFSyLBcQHqN4OLf3W5/9G hhLmfND545d094R2okYT4Aj1sWMONaZsjr6kv5oNwp3oQ1L4t65RIUxCWUjhpx4nx0uS KGHs0hByF2yBiAnpD03IeQ2G2cNbdcwX1BAa6npl7R9SEpSnmKs6wSL0+/PMZW77sAaB aoghX9p/EQjECwRRUoVtWPW03Ke2CXDhnLBFaNcw792u7m6fFg9rmT95PYpnDjKEnlws Q8rQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ZNxdofEa; spf=pass (google.com: domain of devicetree-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s1si40247194jar.29.2021.07.25.21.52.05; Sun, 25 Jul 2021 21:52:05 -0700 (PDT) Received-SPF: pass (google.com: domain of devicetree-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ZNxdofEa; spf=pass (google.com: domain of devicetree-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231280AbhGZELe (ORCPT + 7 others); Mon, 26 Jul 2021 00:11:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38630 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229680AbhGZELd (ORCPT ); Mon, 26 Jul 2021 00:11:33 -0400 Received: from mail-pj1-x1030.google.com (mail-pj1-x1030.google.com [IPv6:2607:f8b0:4864:20::1030]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 964CEC061765 for ; Sun, 25 Jul 2021 21:52:02 -0700 (PDT) Received: by mail-pj1-x1030.google.com with SMTP id m1so11276558pjv.2 for ; Sun, 25 Jul 2021 21:52:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=BKW8SJUXD86+uZHpTY6dXOSgo09YOklrbve/i0ZpdAI=; b=ZNxdofEazuCanYJelkULP0+4OuqXw2vw2lLc6piV+972Mo2ZMLPaKvvgt0IeKeeOz4 qfs1uZUtM4SK2si8JRoCdtymsO11GLCcE3dvHNw2RvTb81Op5nV3XSybxbruXjNV/k6U uiyQKL2dOkyLbTmCQBvIoJtmU76+bBYUQVsrfwV3/4etV2OplljWvUKFedVvS7S4tLz6 qPuZ+xPD58dVHGWU4gnH8urTbFlJBUS+bsnPJyDWy308Hc2jbeOdFnFrxxxWDgIdduZj VPVm09fCKAnFZMjSZUk7opAUFtgLYbqIHx32jSDW934DBT3Vwqk5DlaMbp1F2DzXks5/ bL4Q== 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:mime-version:content-transfer-encoding; bh=BKW8SJUXD86+uZHpTY6dXOSgo09YOklrbve/i0ZpdAI=; b=Q0+tQDL5Lg8lJtKE84R4jPilkqEWsI8Sla4iHryMd7SPhMtDv1uXrVU5v+m1A+KL7W E7563ZVwXynG8POnm5IgoSvLHxUDw2ujBseDvSBjVDgOPsfTLCCNuxWXLpqSrW6mV89e ucjggq5oJAZSfzpUb5ET7bvzhIk9ilmq7z31RJd8+ewEwZLIHpnA6fmj5acxPHWFUDSC 0WgB9u4Pn2qoQmsvHdP5xZ4ItaO9AHPz+H5kzTFsV2EfHhDgDI9eGUsK4pW3b6e+FMw5 vzNpbKDE4ySFmvHY46Z184diPgrneJ4FrVlxVxjJ68ODgZtsfYUCulqLXuqx3QJO4xPI ErsA== X-Gm-Message-State: AOAM531leS2mbDdaCnEtD499D+djTg3VKuctmI371DLGGQ8NH89TZm29 XRVoTNDg1UJ1c16lUbm6KJq4xA== X-Received: by 2002:aa7:9687:0:b029:337:3b49:df24 with SMTP id f7-20020aa796870000b02903373b49df24mr15887381pfk.35.1627275122181; Sun, 25 Jul 2021 21:52:02 -0700 (PDT) Received: from localhost ([122.172.201.85]) by smtp.gmail.com with ESMTPSA id t26sm45725593pgu.35.2021.07.25.21.51.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 25 Jul 2021 21:51:57 -0700 (PDT) From: Viresh Kumar To: Jason Wang , "Michael S. Tsirkin" , Rob Herring , Arnd Bergmann , Jean-Philippe Brucker , Viresh Kumar Cc: Vincent Guittot , Bill Mills , =?utf-8?q?Alex_Benn=C3=A9e?= , "Enrico Weigelt, metux IT consult" , Jie Deng , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, virtualization@lists.linux-foundation.org Subject: [PATCH V3 1/5] dt-bindings: virtio: Add binding for virtio devices Date: Mon, 26 Jul 2021 10:21:41 +0530 Message-Id: X-Mailer: git-send-email 2.31.1.272.g89b43f80a514 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org Allow virtio device sub-nodes to be added to the virtio mmio or pci nodes. The compatible property for virtio device must be of format "virtio,", where DID is virtio device ID in hexadecimal format. Signed-off-by: Viresh Kumar --- .../devicetree/bindings/virtio/mmio.yaml | 2 +- .../bindings/virtio/virtio-device.yaml | 47 +++++++++++++++++++ 2 files changed, 48 insertions(+), 1 deletion(-) create mode 100644 Documentation/devicetree/bindings/virtio/virtio-device.yaml -- 2.31.1.272.g89b43f80a514 diff --git a/Documentation/devicetree/bindings/virtio/mmio.yaml b/Documentation/devicetree/bindings/virtio/mmio.yaml index d46597028cf1..1b91553f87c6 100644 --- a/Documentation/devicetree/bindings/virtio/mmio.yaml +++ b/Documentation/devicetree/bindings/virtio/mmio.yaml @@ -36,7 +36,7 @@ title: virtio memory mapped devices - reg - interrupts -additionalProperties: false +additionalProperties: true examples: - | diff --git a/Documentation/devicetree/bindings/virtio/virtio-device.yaml b/Documentation/devicetree/bindings/virtio/virtio-device.yaml new file mode 100644 index 000000000000..15cb6df8c98a --- /dev/null +++ b/Documentation/devicetree/bindings/virtio/virtio-device.yaml @@ -0,0 +1,47 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/virtio/virtio-device.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Virtio device bindings + +maintainers: + - Viresh Kumar + +description: + These bindings are applicable to virtio devices irrespective of the bus they + are bound to, like mmio or pci. + +# We need a select here so we don't match all nodes with 'virtio,mmio' +properties: + $nodename: + pattern: '^[a-z0-9]+-virtio(-[a-z0-9]+)?$' + description: | + Exactly one node describing the virtio device. The name of the node isn't + significant but its phandle can be used to by a user of the virtio device. + + compatible: + pattern: "^virtio,[0-9a-f]+$" + description: Virtio device nodes. + "virtio,DID", where DID is the virtio device id. The textual + representation of DID shall be in lower case hexadecimal with leading + zeroes suppressed. + +required: + - compatible + +additionalProperties: true + +examples: + - | + virtio@3000 { + compatible = "virtio,mmio"; + reg = <0x3000 0x100>; + interrupts = <43>; + + i2c-virtio { + compatible = "virtio,22"; + }; + }; +... From patchwork Mon Jul 26 04:51:42 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 486014 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 29C25C4320A for ; Mon, 26 Jul 2021 04:52:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 12ED860EB2 for ; Mon, 26 Jul 2021 04:52:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231557AbhGZELk (ORCPT ); Mon, 26 Jul 2021 00:11:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38654 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231362AbhGZELh (ORCPT ); Mon, 26 Jul 2021 00:11:37 -0400 Received: from mail-pj1-x102a.google.com (mail-pj1-x102a.google.com [IPv6:2607:f8b0:4864:20::102a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7E480C0613C1 for ; Sun, 25 Jul 2021 21:52:06 -0700 (PDT) Received: by mail-pj1-x102a.google.com with SMTP id m10-20020a17090a34cab0290176b52c60ddso6493607pjf.4 for ; Sun, 25 Jul 2021 21:52:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=25stCq9hJ2wceSqg94GCYZ0IegUstb1Ha6+CpcC6mxE=; b=w3jI5G4dOmRLxP2MlxkQOM2/L+5kcH9M9Un+WZvOEFtFgbL1253v+O6A900H9pX1OR qw9GFzKgAHqsrSJv+xKzkMtnxu1u/k2FsfUMM1jvwQ7qiqwCBoEnT2kKN5BFtfFCrJrT zLaW0eb8OTIpMtSe7SRO+IeJrGQkCkhy0oq2jYpTMgEpeBMMX1acx7jWiBTtABkWiX09 Naj0FNAJXC7dcbn4cIjgDHkKmWbDsYNlvr19r4z7ob4upxnluKGyAwX8INWrwqjTjOeW +xVP8Pg8xLAdzd55q5lvBBX9Vr/Nv+DCBhy7jd1sGD2JEonDcgIvAs5XUlq2VGQwP95Y AsIA== 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:mime-version:content-transfer-encoding; bh=25stCq9hJ2wceSqg94GCYZ0IegUstb1Ha6+CpcC6mxE=; b=rOmaFPHrEVZyyN8ujjH+dplid36D0bc6eAlSrxc12RiBU+1GA03qbWotS39zWMn3EK TY67QSK1CL5wBjSJSGf0FlG5EiFXPn0Rai0951NA5ZN6qVi51QNjgKU0ZxZMKubDYvQP n9R50xH1j7OiHxFPk743lvwMAQrwdtNLGIHY2sj4VzLCsU78FCu8Mqy2ADz2ZtLgHXrN 0utyPer+vICBHhC1KnHy8bE2X0BXvM/6NEJJ96ZGaard0dq0B0IC2UHQo5IhZ1X1Semv 9GcomiWokuiQhYwDvKsxP4YaQmBgQUlIJ0XAeFhNG9arftp3F87AJiOETbxrNeNxtdhP ud1A== X-Gm-Message-State: AOAM5327hzfFsqnVLU+Uw+C2L+EQWB0wrAn/FBq6n1OZuAGrmTbJj/Mf NDmItKKYnrLJpZ+umklSPxx5Ug== X-Google-Smtp-Source: ABdhPJwNPhh3+pdzKQ+M8usE3bVyjxSjNPWjsz7M3m6jZ8gVABNHZmWDEQUzTbhje9b+6aWj/M6+jg== X-Received: by 2002:a65:6a0d:: with SMTP id m13mr16774454pgu.356.1627275126102; Sun, 25 Jul 2021 21:52:06 -0700 (PDT) Received: from localhost ([122.172.201.85]) by smtp.gmail.com with ESMTPSA id q18sm41345108pfj.178.2021.07.25.21.52.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 25 Jul 2021 21:52:04 -0700 (PDT) From: Viresh Kumar To: Jason Wang , "Michael S. Tsirkin" , Rob Herring , Arnd Bergmann , Jean-Philippe Brucker , Viresh Kumar Cc: Vincent Guittot , Bill Mills , =?utf-8?q?Alex_Benn=C3=A9e?= , "Enrico Weigelt, metux IT consult" , Jie Deng , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, virtualization@lists.linux-foundation.org, Wolfram Sang , linux-i2c@vger.kernel.org Subject: [PATCH V3 2/5] dt-bindings: i2c: Add bindings for i2c-virtio Date: Mon, 26 Jul 2021 10:21:42 +0530 Message-Id: <4182aff2d1437b30025f3d17d11e5fdc21845239.1627273794.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 2.31.1.272.g89b43f80a514 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org This patch adds binding for virtio I2C device, it is based on virtio-device bindings. Acked-by: Wolfram Sang Signed-off-by: Viresh Kumar --- .../devicetree/bindings/i2c/i2c-virtio.yaml | 51 +++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 Documentation/devicetree/bindings/i2c/i2c-virtio.yaml diff --git a/Documentation/devicetree/bindings/i2c/i2c-virtio.yaml b/Documentation/devicetree/bindings/i2c/i2c-virtio.yaml new file mode 100644 index 000000000000..0381d9065287 --- /dev/null +++ b/Documentation/devicetree/bindings/i2c/i2c-virtio.yaml @@ -0,0 +1,51 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/i2c/i2c-virtio.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Virtio I2C Adapter + +maintainers: + - Viresh Kumar + +allOf: + - $ref: /schemas/i2c/i2c-controller.yaml# + - $ref: /schemas/virtio/virtio-device.yaml# + +description: + Virtio I2C device, see /schemas/virtio/virtio-device.yaml for more details. + +properties: + $nodename: + pattern: '^i2c-virtio(-[a-z0-9]+)?$' + + compatible: + const: virtio,22 + +required: + - compatible + +unevaluatedProperties: false + +examples: + - | + virtio@3000 { + compatible = "virtio,mmio"; + reg = <0x3000 0x100>; + interrupts = <41>; + + i2c-virtio { + compatible = "virtio,22"; + + #address-cells = <1>; + #size-cells = <0>; + + light-sensor@1c { + compatible = "dynaimage,al3320a"; + reg = <0x20>; + }; + }; + }; + +... From patchwork Mon Jul 26 04:51:43 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 485803 Delivered-To: patch@linaro.org Received: by 2002:a02:c94a:0:0:0:0:0 with SMTP id u10csp3476619jao; Sun, 25 Jul 2021 21:52:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy1/GRK3yCBl+YuUv6VdX1mKJmc2NUhfw7U/p66OWoCeTAWcx8FTMA+LnfO9tkk4firu9zh X-Received: by 2002:a05:6e02:12e3:: with SMTP id l3mr7330088iln.6.1627275131865; Sun, 25 Jul 2021 21:52:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1627275131; cv=none; d=google.com; s=arc-20160816; b=EUfS6ThnembzxEUTrFXJqF5R8UoaUnfe+0nl7POX8wwnmesrDthmxuNBCQi1jZlx46 xKNMzVSbRg7WSWzolhIE5Uh7bNN7Gyj76wWTjcr1RMB4812g0XwvR20OHgL6LlAeurHE i97ud+yW9rwzXc+J7Jt+kLU/ma3QrOFlKp3Lz8O1hUVd0XWScLKZVMDtfSOetAs8+q5A cXpcDiQ6TaktGouMLSpv5wj1r9bPFI/PfR8Bx+cZB+fcG/BVR0Dr1MIKam6j/zl/inch 8dU7/sxym0aI1olM9y8VKmmsEL8jPswFnT2iQKuLRyTu8jJ9lii+hv+EBNpPUDuDiPLU +lSA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=muwPPr/wH77yClDsFJrEFYw3n7hGXGW3QcFllPO0brU=; b=DKsWkQdXFCDi54/wylJdbEAroc3ElHTPnkx3MpaycH6Vx+kriI4lgCLWiERaq2hG5L bTXRCPqjv5tKBlqYBo3gQwLl7H7YV1k2FD5OFLJ1puaQ1eejrgDOMPQcxypI0Xt9JINV Gf9OtZTegasLydDhIjbXFpLK8BJ3q7R69saJ32YmTsNJvgymwvGdd6UPpp+2wvkqsysn oi5IXg0l8/6kiWZ1Ja+4zcPPUSOf40m+Scyt01rtAAF9iSgfXyaWrx5k/WRcK2quUS6t BUzPujBQFlsDdZ5KnCNDBUhJh2L6lN+nqH8LlXpstD0cv7SjcKUwX8SVJw/j55f5QQzA rgpA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ycpwrBVD; spf=pass (google.com: domain of devicetree-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p19si28958143iov.90.2021.07.25.21.52.11; Sun, 25 Jul 2021 21:52:11 -0700 (PDT) Received-SPF: pass (google.com: domain of devicetree-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ycpwrBVD; spf=pass (google.com: domain of devicetree-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229711AbhGZELl (ORCPT + 7 others); Mon, 26 Jul 2021 00:11:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38680 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231540AbhGZELk (ORCPT ); Mon, 26 Jul 2021 00:11:40 -0400 Received: from mail-pl1-x630.google.com (mail-pl1-x630.google.com [IPv6:2607:f8b0:4864:20::630]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6DB77C061760 for ; Sun, 25 Jul 2021 21:52:09 -0700 (PDT) Received: by mail-pl1-x630.google.com with SMTP id i1so10138182plr.9 for ; Sun, 25 Jul 2021 21:52:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=muwPPr/wH77yClDsFJrEFYw3n7hGXGW3QcFllPO0brU=; b=ycpwrBVDwGd3Ld3v1W5tGdLHkVB1bJPYN1wrP6W6KB0X3EJPQBADk6S/2yCJy6YoIb CMjXIMA7JeZJrWSHKQIeMbTDlKhkex5g3KPI99HW0FUzbflO2F8JG/DSxOvg3Vr9oMx5 +3FJjFdZbbzEvubq3LP0cjPPk43QYpjvukKxiqn3TQZoyQF72iOSJYLR/+gT7+tNMxES EzOMkKRg48/0AcFriy2csYJHtgUtDVH+ZMJ5R5K4mDm5kuuPJ/b8B639fKzbd10hCmTD zwOyEwPH0mmxUadbtLGlt0JD1DI9QBKl8jEfeGZPXdE3CgVRdrJIRizl1hhyN4xs9QdV nwdw== 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:mime-version:content-transfer-encoding; bh=muwPPr/wH77yClDsFJrEFYw3n7hGXGW3QcFllPO0brU=; b=s8E8E3+56SGtf5TPoR5evrstz4/dAAjxBUrAuirKx4cqeKocttKOCYQw9XQraV2lQK JLd7C7Gi7ysS+vQreFDcyo5S9qu3jEJc791+wDdrorpXbVvAmX4SRAb691dVixZF1W18 0PwW3/rC/KhDANdg0dLcaIZ3nfesTbGfqOkj1bsKnwEcmzaq0rk39rj7UZwmtANVusZt JypPdgdx1rliTM2xVThjlMGR2LNwOWsuhy/g448MLDtCh8smMikWlXNhBfDLl3Xwsa+x RZm3rRFz6DSPSGXZxe/XQzfqvqcSi3g6/OD5BDef/OvqkTZS54GQpK/HF/+STZuvA+/j TJ4Q== X-Gm-Message-State: AOAM532lVA6PGbDhHT8/kvKvqCdSUZLng2kIh747FiHbbjE45WNsHffT BqeCwEh75w5CXaM03WqFScqUjg== X-Received: by 2002:a17:902:9046:b029:12c:e88:429c with SMTP id w6-20020a1709029046b029012c0e88429cmr5300973plz.77.1627275128984; Sun, 25 Jul 2021 21:52:08 -0700 (PDT) Received: from localhost ([122.172.201.85]) by smtp.gmail.com with ESMTPSA id z5sm16448583pgz.77.2021.07.25.21.52.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 25 Jul 2021 21:52:08 -0700 (PDT) From: Viresh Kumar To: Jason Wang , "Michael S. Tsirkin" , Rob Herring , Arnd Bergmann , Jean-Philippe Brucker , Linus Walleij , Bartosz Golaszewski , Viresh Kumar Cc: Vincent Guittot , Bill Mills , =?utf-8?q?Alex_Benn=C3=A9e?= , "Enrico Weigelt, metux IT consult" , Jie Deng , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, virtualization@lists.linux-foundation.org, linux-gpio@vger.kernel.org Subject: [PATCH V3 3/5] dt-bindings: gpio: Add bindings for gpio-virtio Date: Mon, 26 Jul 2021 10:21:43 +0530 Message-Id: <605b87ce93b9a528810a5857984bfe6b913d5e73.1627273794.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 2.31.1.272.g89b43f80a514 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org This patch adds binding for virtio GPIO controller, it is based on virtio-device bindings. Signed-off-by: Viresh Kumar --- .../devicetree/bindings/gpio/gpio-virtio.yaml | 60 +++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 Documentation/devicetree/bindings/gpio/gpio-virtio.yaml -- 2.31.1.272.g89b43f80a514 Reviewed-by: Arnd Bergmann , except diff --git a/Documentation/devicetree/bindings/gpio/gpio-virtio.yaml b/Documentation/devicetree/bindings/gpio/gpio-virtio.yaml new file mode 100644 index 000000000000..96108cfb7a08 --- /dev/null +++ b/Documentation/devicetree/bindings/gpio/gpio-virtio.yaml @@ -0,0 +1,60 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/gpio/gpio-virtio.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Virtio GPIO controller + +maintainers: + - Viresh Kumar + +allOf: + - $ref: /schemas/gpio/gpio.yaml# + - $ref: /schemas/virtio/virtio-device.yaml# + +description: + Virtio GPIO controller, see /schemas/virtio/virtio-device.yaml for more + details. + +properties: + $nodename: + pattern: '^gpio-virtio(-[a-z0-9]+)?$' + + compatible: + const: virtio,29 + + gpio-controller: true + + "#gpio-cells": + const: 2 + + interrupt-controller: true + + "#interrupt-cells": + const: 2 + +required: + - compatible + - gpio-controller + - "#gpio-cells" + +unevaluatedProperties: false + +examples: + - | + virtio@3000 { + compatible = "virtio,mmio"; + reg = <0x3000 0x100>; + interrupts = <41>; + + gpio: gpio-virtio { + compatible = "virtio,29"; + gpio-controller; + #gpio-cells = <2>; + interrupt-controller; + #interrupt-cells = <2>; + }; + }; + +... From patchwork Mon Jul 26 04:51:44 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 485804 Delivered-To: patch@linaro.org Received: by 2002:a02:c94a:0:0:0:0:0 with SMTP id u10csp3476662jao; Sun, 25 Jul 2021 21:52:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw5jFh3IkSNGvNSWiueG1oKFlLbd1HK8pW0TaoKnvq5+cyq0e2Kkp1Q4pDPg2F3C4tZkCMm X-Received: by 2002:a92:7b13:: with SMTP id w19mr7618633ilc.291.1627275138893; Sun, 25 Jul 2021 21:52:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1627275138; cv=none; d=google.com; s=arc-20160816; b=x0i+KVSAUK5BucESY0oOCy6KzHnCWmq/Td0jJK8z17VE6Co9QNrxFKPxq458ynPa30 kja/VgJL5hAXWNo+/hWU8oYRwfP2AkiHEojQ4bmmAkTUR2n3W91ZUK+Sg2DWqhyrjM1H os4g5a3+KxlQTBswKQzQt63XuqZvVrcbHyrRdrs3da07/ndC+tS+n6PX30w6r4BVmE6p cgErb0c8oSj9raX5DhQkXnM5I3ln+GPHgrasuKn8jI5MCEUG1oC80iN6TyApBfYqlFcw d/3WUbskDdhF/Ekz2Lxd/6zwVXn5E5ajnVExiClS3FLmJLRdX7wbykeGSAvz+Zm3cXoV /oQw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=eK8DOqvzTIA+QnY/7E9eUfZzzNYH4fK9bj2nYZkAiVA=; b=Xt6PMZXs1Ys8eiGCarWN9afqXjhIirUfInsi6M3lEpFhurTA2lihyqm5Bb4tNo0gGK 25818FrOoq+FnQRz/RPOQIt7oKFNjP3ogBgUycnshT4eMhhF6SGiwCsVobCZobHuG6RC BmvlnTrc3MM/GUbMricBsUpsM9b6kvRtZnhP7Hc87PsGiqEspUaqcb3ITstrOFJn8qj2 lQIqcvMY+GKY85oQRerii8LKmFfgnLB+Fj07Bfb5SnFJDv9z+7KCXubbSWR2KREBY5a2 vOBHMJz84rQR7rtDMrA9uCuKlHw0Vu2ZvlwPM6ZcWULzRhDXlGSJghk6wXzmp+6aFV/W RXoA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="SoRDc4f/"; spf=pass (google.com: domain of devicetree-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p19si28958143iov.90.2021.07.25.21.52.18; Sun, 25 Jul 2021 21:52:18 -0700 (PDT) Received-SPF: pass (google.com: domain of devicetree-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="SoRDc4f/"; spf=pass (google.com: domain of devicetree-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231537AbhGZELr (ORCPT + 7 others); Mon, 26 Jul 2021 00:11:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38702 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231598AbhGZELo (ORCPT ); Mon, 26 Jul 2021 00:11:44 -0400 Received: from mail-pj1-x1032.google.com (mail-pj1-x1032.google.com [IPv6:2607:f8b0:4864:20::1032]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A4F41C0613CF for ; Sun, 25 Jul 2021 21:52:12 -0700 (PDT) Received: by mail-pj1-x1032.google.com with SMTP id pf12-20020a17090b1d8cb0290175c085e7a5so18007173pjb.0 for ; Sun, 25 Jul 2021 21:52:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=eK8DOqvzTIA+QnY/7E9eUfZzzNYH4fK9bj2nYZkAiVA=; b=SoRDc4f/lRhAl74xoIPjFbw7Dib8Di56QspJCEXHcsSsoeG2PeHGJBe7RwI/R3vTUE qM+bG+qGXc43mEFOcG+GGkFNDsJzFeTeLfbJOeJ2IvHxCxqqqu6BQcz0bika3Vl8I4BA Vi4felRcJuq3De1PlLHQxAPiHhG18JWn+YH1mIMh7dCzUTaba7W3bHHv55BEUPOgvlEP rezZd1ukuSYTrpRfZ1kJRxPqYBhZf8G4shxpmyUx7dxUp/Nh4tWnAy2nGbbWJx4j2q1v xojUc0myLSYEUrOuZ0j6rCHBwckaDzDSNBB1WDt84nMEbnG867niEdPx7BzOGqDna7pw YRdA== 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:mime-version:content-transfer-encoding; bh=eK8DOqvzTIA+QnY/7E9eUfZzzNYH4fK9bj2nYZkAiVA=; b=PkSFU0bO52ERdYA4fsyEqzP573lK8rnRNf5xGOn7rLD4PzvLTIJpSt7WUvUiyg8Kiw wAyiulp3r4689HP0j/xdJmMhberstVXSuLbUv0GuxHupG+MT/hyPUxGM36OVY/Tdp/2R xfwGuKdLbvtuesWiG8S1XHLr00KB1sO9ZUpYq0LjnzevFnwlbRyZ60MKX0x7L8uP3Xi9 1LCUMK9Y1SlezbhZBsLTHOj03kCvYrZSeHuNjaYlAdTgYqRHfKXgMY5Ub99iecmonKeR ZBllg7GKGsahREgotVmIOBLqEWQMfomGaES7ZNxci39wP5peLZ6Wra3PyMiqRj2Gk8e3 yNOQ== X-Gm-Message-State: AOAM533SLIcg4JvjgULSxPHrNIC2EOakCzLatHt3gZVp7+gJVJ08b8zc Cw2Bcevcu0idkUETXJ6enZuoFA== X-Received: by 2002:a17:90b:609:: with SMTP id gb9mr7453554pjb.156.1627275132187; Sun, 25 Jul 2021 21:52:12 -0700 (PDT) Received: from localhost ([122.172.201.85]) by smtp.gmail.com with ESMTPSA id q19sm29598565pgj.17.2021.07.25.21.52.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 25 Jul 2021 21:52:11 -0700 (PDT) From: Viresh Kumar To: Jason Wang , "Michael S. Tsirkin" , Rob Herring , Arnd Bergmann , Jean-Philippe Brucker Cc: Viresh Kumar , Vincent Guittot , Bill Mills , =?utf-8?q?Alex_Benn=C3=A9e?= , "Enrico Weigelt, metux IT consult" , Jie Deng , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, virtualization@lists.linux-foundation.org Subject: [PATCH V3 4/5] uapi: virtio_ids: Sync ids with specification Date: Mon, 26 Jul 2021 10:21:44 +0530 Message-Id: <9450f75be4d6fc6abd5f52c7ff75890f04303324.1627273794.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 2.31.1.272.g89b43f80a514 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org This synchronizes the virtio ids with the latest list from virtio specification. Signed-off-by: Viresh Kumar --- include/uapi/linux/virtio_ids.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) -- 2.31.1.272.g89b43f80a514 diff --git a/include/uapi/linux/virtio_ids.h b/include/uapi/linux/virtio_ids.h index 70a8057ad4bb..3c8e11820fdb 100644 --- a/include/uapi/linux/virtio_ids.h +++ b/include/uapi/linux/virtio_ids.h @@ -54,8 +54,20 @@ #define VIRTIO_ID_SOUND 25 /* virtio sound */ #define VIRTIO_ID_FS 26 /* virtio filesystem */ #define VIRTIO_ID_PMEM 27 /* virtio pmem */ +#define VIRTIO_ID_RPMB 28 /* virtio rpmb */ #define VIRTIO_ID_MAC80211_HWSIM 29 /* virtio mac80211-hwsim */ +#define VIRTIO_ID_VIDEO_ENCODER 30 /* virtio video encoder */ +#define VIRTIO_ID_VIDEO_DECODER 31 /* virtio video decoder */ +#define VIRTIO_ID_SCMI 32 /* virtio scmi */ +#define VIRTIO_ID_NITRO_SEC_MOD 33 /* virtio nitro secure module*/ +#define VIRTIO_ID_I2C_ADAPTER 34 /* virtio i2c adapter */ +#define VIRTIO_ID_WATCHDOG 35 /* virtio watchdog */ +#define VIRTIO_ID_CAN 36 /* virtio can */ +#define VIRTIO_ID_DMABUF 37 /* virtio dmabuf */ +#define VIRTIO_ID_PARAM_SERV 38 /* virtio parameter server */ +#define VIRTIO_ID_AUDIO_POLICY 39 /* virtio audio policy */ #define VIRTIO_ID_BT 40 /* virtio bluetooth */ +#define VIRTIO_ID_GPIO 41 /* virtio gpio */ /* * Virtio Transitional IDs From patchwork Mon Jul 26 04:51:45 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 485805 Delivered-To: patch@linaro.org Received: by 2002:a02:c94a:0:0:0:0:0 with SMTP id u10csp3476705jao; Sun, 25 Jul 2021 21:52:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwdgyVhJA5wwEUAtIOuXADBDw7D+rbbrpu0pbjg0hDSzVa8SpAX0BU4Asaivfedv81VtVyn X-Received: by 2002:a02:cc4e:: with SMTP id i14mr14794754jaq.125.1627275141896; Sun, 25 Jul 2021 21:52:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1627275141; cv=none; d=google.com; s=arc-20160816; b=AMynvewRAZd6OxQT3bl/WAoWX3/tKbsXQKp0Qb49u7FN9nOMvpLbP6NbP/rOvsfHfR k6LzBE4Vcdk29zbbIpG8RbnLOR1KVWeSq15oB/ne14KN1yGS4DMEk9co2p1w43gngjnt YpCF82WTm+wQgDVEh++hfdzaVHn1DAM7D5jhto5foq3fqjnCIp2dWdOq96cU+TF3/GrZ /t8hjKz7i0YjMSrqoR22smxOuuVrSM4MpCrnVeLTPFOL0q/PFtGGGV+dP2Vb0fEtEjXX 1e4aoOcag1bemlQpJX81cGJt6LLOD3w5cPYd+qiaFUwIWoVUZAK9Y+cUo81P+80ox99z r5pQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=/etw2x/IOV61XRm5aQ4SVHdlMT8behp6226Zn4BBbvI=; b=njNj1zTWZ+jGGY1CSSeKuHi3JMdjeR7u1XDhvVxwd39Sp6B13EbONCUmc3/x8cZLhP hhwumPu5yM7UuuWv+0Wz/dcUS78bXcg3HmfjogzjOOST47tXq2Wi9x0jsMh1zcsH/SLd CMp0KodGnherj3Lf+YPTtQVcsI6rrLxHPs86gTvH6fi2pJWia0v039wBJxAS1qecRus7 MWebRFm/ap9omU33dEt0KBd5q17w6xxCJ91BfVdWTm6mYpTWMZGes8kDldeqoxw1G+oc dVFlUFgONsj/f91RJFRaqfv8Si5LFrPz0ueDywVTdU2qGXU5QYePF4VMNE4aB8fwRTAp aGSg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=zuRFX0Gs; spf=pass (google.com: domain of devicetree-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p19si28958143iov.90.2021.07.25.21.52.21; Sun, 25 Jul 2021 21:52:21 -0700 (PDT) Received-SPF: pass (google.com: domain of devicetree-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=zuRFX0Gs; spf=pass (google.com: domain of devicetree-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231502AbhGZELu (ORCPT + 7 others); Mon, 26 Jul 2021 00:11:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38712 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231674AbhGZELs (ORCPT ); Mon, 26 Jul 2021 00:11:48 -0400 Received: from mail-pl1-x636.google.com (mail-pl1-x636.google.com [IPv6:2607:f8b0:4864:20::636]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 576CDC061757 for ; Sun, 25 Jul 2021 21:52:17 -0700 (PDT) Received: by mail-pl1-x636.google.com with SMTP id k1so10041239plt.12 for ; Sun, 25 Jul 2021 21:52:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=/etw2x/IOV61XRm5aQ4SVHdlMT8behp6226Zn4BBbvI=; b=zuRFX0GsaWbTMCQA/Ng8TO6XyGJferSVQ0pAR0GxmcQn7+Kzm77KAn2t5e4HF2W9uF FMEIR74TtOxn5m6zy27FZBynywpPlZcsMfoq89vx7yljF/e+K98SPrmyPYRc8YhfF7c7 P213mVoA1mMTBDcd8QWJTLv9MPuZcn7fvQ1ZSmq8h/9RB5ELESMVb5AdoIHbBLvmrrbr 01gn8WRioJm45UWG1fwg/UqyWFqFgi4BFpshTukJxa7vWqKfZCf5xv9DOnBXiLtIuceT +uQ2Yx/KFTVSligZUmlPiOVxl6pXLyWWPzc9+QeeIvvlrmwzi/UqDfYw19ItXSYPOKlN Mg3A== 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:mime-version:content-transfer-encoding; bh=/etw2x/IOV61XRm5aQ4SVHdlMT8behp6226Zn4BBbvI=; b=CmYGqFJmFVd7aSaZK00Gf7upnjNRNAkZoq0ObkZXZCbd/5KA8lZS1PwJfhZV+6b84u +alCmkWS8Q+60psrHriFvIiyxaTAnKSd06KhdiTrZc/wXkDzRmA7CWRtgJ6OBcopSmq+ V7W3Upw2d/jmAyvXUW0npYH5g/ioq+oiGOUgawKVP7K5dmvF+Vyn0WpfAySJrRi1h3BR UJDi+hRpz6acl2HIAOO+Gllld58dGPNSoDQ7hI8rCiYpZS8WtNbcV0IYnQdTE7YHzRvh /rxo+rQBgPepCuG6SdnCFgs2pcdR1K1sTkMowAIkHiYj6MmpxPA1PXdU+Jb6ufzBYzvy Wgsg== X-Gm-Message-State: AOAM532V6VeVB07lnloBczCN0iZY4bxtTgJnHb2mgHqreJ56q0vBY90M usp5/bTmKQcoRJWuWkIthAjsOw== X-Received: by 2002:a05:6a00:2306:b029:331:ebe8:a4b4 with SMTP id h6-20020a056a002306b0290331ebe8a4b4mr15787418pfh.15.1627275136900; Sun, 25 Jul 2021 21:52:16 -0700 (PDT) Received: from localhost ([122.172.201.85]) by smtp.gmail.com with ESMTPSA id b2sm46529295pgh.9.2021.07.25.21.52.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 25 Jul 2021 21:52:14 -0700 (PDT) From: Viresh Kumar To: Jason Wang , "Michael S. Tsirkin" , Rob Herring , Arnd Bergmann , Jean-Philippe Brucker Cc: Viresh Kumar , Vincent Guittot , Bill Mills , =?utf-8?q?Alex_Benn=C3=A9e?= , "Enrico Weigelt, metux IT consult" , Jie Deng , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, virtualization@lists.linux-foundation.org, Arnd Bergmann Subject: [PATCH V3 5/5] virtio: Bind virtio device to device-tree node Date: Mon, 26 Jul 2021 10:21:45 +0530 Message-Id: <454a58f998b0d16847d72a97b32192829fab2c8c.1627273794.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 2.31.1.272.g89b43f80a514 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org Bind the virtio devices with their of_node. This will help users of the virtio devices to mention their dependencies on the device in the DT itself. Like GPIO pin users can use the phandle of the device node, or the node may contain more subnodes to add i2c or spi eeproms and other users. Reviewed-by: Arnd Bergmann Signed-off-by: Viresh Kumar --- drivers/virtio/virtio.c | 57 ++++++++++++++++++++++++++++++++++++++--- 1 file changed, 54 insertions(+), 3 deletions(-) -- 2.31.1.272.g89b43f80a514 diff --git a/drivers/virtio/virtio.c b/drivers/virtio/virtio.c index 4b15c00c0a0a..d001e84a5b23 100644 --- a/drivers/virtio/virtio.c +++ b/drivers/virtio/virtio.c @@ -4,6 +4,7 @@ #include #include #include +#include #include /* Unique numbering for virtio devices. */ @@ -292,6 +293,9 @@ static int virtio_dev_remove(struct device *_d) /* Acknowledge the device's existence again. */ virtio_add_status(dev, VIRTIO_CONFIG_S_ACKNOWLEDGE); + + of_node_put(dev->dev.of_node); + return 0; } @@ -319,6 +323,43 @@ void unregister_virtio_driver(struct virtio_driver *driver) } EXPORT_SYMBOL_GPL(unregister_virtio_driver); +static int virtio_device_of_init(struct virtio_device *dev) +{ + struct device_node *np, *pnode = dev_of_node(dev->dev.parent); + char compat[] = "virtio,XXXXXXXX"; /* Reserve enough space 32-bit id */ + int ret, count; + + if (!pnode) + return 0; + + count = of_get_available_child_count(pnode); + if (!count) + return 0; + + /* There can be only 1 child node */ + if (WARN_ON(count > 1)) + return -EINVAL; + + np = of_get_next_available_child(pnode, NULL); + if (WARN_ON(!np)) + return -ENODEV; + + BUG_ON(snprintf(compat, sizeof(compat), "virtio,%x", dev->id.device) >= + sizeof(compat)); + + if (!of_device_is_compatible(np, compat)) { + ret = -EINVAL; + goto out; + } + + dev->dev.of_node = np; + return 0; + +out: + of_node_put(np); + return ret; +} + /** * register_virtio_device - register virtio device * @dev : virtio device to be registered @@ -343,6 +384,10 @@ int register_virtio_device(struct virtio_device *dev) dev->index = err; dev_set_name(&dev->dev, "virtio%u", dev->index); + err = virtio_device_of_init(dev); + if (err) + goto out_ida_remove; + spin_lock_init(&dev->config_lock); dev->config_enabled = false; dev->config_change_pending = false; @@ -362,10 +407,16 @@ int register_virtio_device(struct virtio_device *dev) */ err = device_add(&dev->dev); if (err) - ida_simple_remove(&virtio_index_ida, dev->index); + goto out_of_node_put; + + return 0; + +out_of_node_put: + of_node_put(dev->dev.of_node); +out_ida_remove: + ida_simple_remove(&virtio_index_ida, dev->index); out: - if (err) - virtio_add_status(dev, VIRTIO_CONFIG_S_FAILED); + virtio_add_status(dev, VIRTIO_CONFIG_S_FAILED); return err; } EXPORT_SYMBOL_GPL(register_virtio_device);