From patchwork Tue Jul 27 05:23:48 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 486659 Delivered-To: patch@linaro.org Received: by 2002:a02:c94a:0:0:0:0:0 with SMTP id u10csp4197601jao; Mon, 26 Jul 2021 22:24:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJweg0GqDP/VSK+YImE3k7eOcWfCEL86FYQhE9uyzh5ZGxN4uTuR+n1ZJmWSdbZ5XW9vYrSI X-Received: by 2002:a5e:c70d:: with SMTP id f13mr17421884iop.95.1627363446086; Mon, 26 Jul 2021 22:24:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1627363446; cv=none; d=google.com; s=arc-20160816; b=QZHv08ahFCNhGfxHWzG4waR2en2ImZCvRuHbURSGnrZPXYX/jhYAzrcUFNt4de88HR MTsRLZod216pSfT77Ip/69g2cVjWrLVkjTE965+I6nzCehaqvlm6dRXJyyRLJNkzyaVP DG76+xrtt98h/DfnlPwf5BXafVpH/Kd4G8JWhxOl6abMl8IVsWYx0tr5Amfh/+xmdPTA jmLtnOTJrY8lwSEmcZCWh1d4mrV47+SRPrm/mInvmJdB+aexWU0xUGyr7g+q3rxTbVXQ ZP1f7PnjTaMKOXEm0Q7PyrEPYB3EPas2s2yADZwBnq1pifxUSUVy6mhNsmhVzT9cDXjU EnlQ== 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=pli4HJidOpxsK8M83Hgdvi+NbofSGQAN0jGG2SdYKog=; b=NCP1+z1ZaC8xpnfor3xRGs7JZCN/6Pv/fmUqee/zmz9maqzTBhuEhPGZNt6naMMzza uLfEFFQbfo8g8S2krFwrUegdve/L2NeT1ZcmwIqLDtaT4DSQwDcinLVBzTfOtGn+lSkG uC1SQfYDFpOKzPn7287txEduodXaACZUkLdBkw2Yk8XBD/cfSFyTOEaKdpyQYLg/VJbG O96WHIgR7kQYAZoZDcJNysm/8Ou32fQxNpXZqLAxcGbAjThB9rwAfTO+9gcb6W8aAF2J EjueDKuO6LCpDFD/FTifsKJ6XKrn91zca1euqk3uj8HXR6VQ57CGo9msl0YYoQH8fiD9 WFHQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=tmUUUVQw; 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 q8si2715784ilo.95.2021.07.26.22.24.05; Mon, 26 Jul 2021 22:24:06 -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=tmUUUVQw; 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 S235253AbhG0FYB (ORCPT + 7 others); Tue, 27 Jul 2021 01:24:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36082 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235217AbhG0FYA (ORCPT ); Tue, 27 Jul 2021 01:24:00 -0400 Received: from mail-pl1-x62a.google.com (mail-pl1-x62a.google.com [IPv6:2607:f8b0:4864:20::62a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6AA4CC061764 for ; Mon, 26 Jul 2021 22:24:01 -0700 (PDT) Received: by mail-pl1-x62a.google.com with SMTP id c16so8889524plh.7 for ; Mon, 26 Jul 2021 22:24:01 -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=pli4HJidOpxsK8M83Hgdvi+NbofSGQAN0jGG2SdYKog=; b=tmUUUVQweZacwI01RO3nQ+0SYtgnKAmFfjVdsxkSGafeGPRhnTcLzjTLff3NffemQY bZu8YkYmdFOpGUTi16lwRipdAGxhIG8f3gUx/zul1mAKBVuM/5a+U0P6tek/bCJMSmg7 pAK9hhWPFL95tv8ujz7S8F4eboM80B5NqLUPXCd89AQ2M6d7jz8N0lVYykfcVJjqAUp/ 0rlneCGVpuCvfhLmjX4H+prUiaNneK6Rk4cD1d/wMkKpnhJy4srY0MDs3dQWjhHlKp4e MpvBBqv0iHX2esEKoBxiSfCvdzsjqGBlzRx/54ojkbKa5Kg/jJJ2wCBCrX+FSi+VgsrZ ltIA== 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=pli4HJidOpxsK8M83Hgdvi+NbofSGQAN0jGG2SdYKog=; b=gatCyEb8gLn/Ih19bcpDr96Fd6oYS7DwI768dXoex7N/K3KPJu6K91U8BnksNMK5dE nJRBPZmL0JW5hI+7LG1+ov+XO3gieTq0K4/aBGNus5uY1kvU6hx1eg2qong4yER7XqkO j3YtmLFlvbGzw5y1aK9doHjPso6I5mRCiaspXQFZH9mFpJzdJAcdJDkyLaXptnJzS1z/ Lb5PilSyrbNVq/wEvuzfFYGGBbDKuD8ZXPBWpLbgGTVIYzB6I7busToVj1L1veRZDpZY jzKnwu0UxvkAM+9vc65vov6Nd32CzbOZLxDsMoctATSg/y9dT0SjcsoyJ+WGA5lxlFo4 +EZg== X-Gm-Message-State: AOAM5313ftbjFpThI8VUN+dR36LhPPL/C4CDu2vH8sqe0cELtKMHI6OI DctVd7+rVJWcb3iaHymwfJferw== X-Received: by 2002:a17:90b:a0c:: with SMTP id gg12mr20634688pjb.165.1627363441015; Mon, 26 Jul 2021 22:24:01 -0700 (PDT) Received: from localhost ([122.172.201.85]) by smtp.gmail.com with ESMTPSA id f3sm1433531pjt.19.2021.07.26.22.24.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Jul 2021 22:24:00 -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 V4 1/5] dt-bindings: virtio: Add binding for virtio devices Date: Tue, 27 Jul 2021 10:53:48 +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 the format "virtio,device", where ID is virtio device ID in hexadecimal format. Signed-off-by: Viresh Kumar --- .../devicetree/bindings/virtio/mmio.yaml | 3 +- .../bindings/virtio/virtio-device.yaml | 41 +++++++++++++++++++ 2 files changed, 43 insertions(+), 1 deletion(-) create mode 100644 Documentation/devicetree/bindings/virtio/virtio-device.yaml -- 2.31.1.272.g89b43f80a514 Reviewed-by: Arnd Bergmann Reviewed-by: Rob Herring diff --git a/Documentation/devicetree/bindings/virtio/mmio.yaml b/Documentation/devicetree/bindings/virtio/mmio.yaml index d46597028cf1..4b7a0273181c 100644 --- a/Documentation/devicetree/bindings/virtio/mmio.yaml +++ b/Documentation/devicetree/bindings/virtio/mmio.yaml @@ -36,7 +36,8 @@ title: virtio memory mapped devices - reg - interrupts -additionalProperties: false +additionalProperties: + type: object 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..1778ea9b5aa5 --- /dev/null +++ b/Documentation/devicetree/bindings/virtio/virtio-device.yaml @@ -0,0 +1,41 @@ +# 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: + compatible: + pattern: "^virtio,device[0-9a-f]{1,8}$" + description: Virtio device nodes. + "virtio,deviceID", where ID is the virtio device id. The textual + representation of ID 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 { + compatible = "virtio,device22"; + }; + }; +... From patchwork Tue Jul 27 05:23:49 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 486660 Delivered-To: patch@linaro.org Received: by 2002:a02:c94a:0:0:0:0:0 with SMTP id u10csp4197695jao; Mon, 26 Jul 2021 22:24:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyOo9SrxGY7Eh4x7F1PWt/0zvvsssRJjVh734xo6wY1lSw4jdLs3ZByQUyka8yQnTj8BXOc X-Received: by 2002:a92:ac0b:: with SMTP id r11mr15315009ilh.44.1627363458436; Mon, 26 Jul 2021 22:24:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1627363458; cv=none; d=google.com; s=arc-20160816; b=IpUoJgfTS8rih9EYjmwloBzdoPqProvnajRU4Ea0IiNQwns+wo3QZf1Cnq3nFZXClP Ng4TCMrkImMwGFhYWteC3Xgxt6qPicRszBucfb1s+Hxgded17ZM0r0RSuU6ktMYOascu IiNNR8FAEqFCCofudlovVA+s8KWGeWnnEkzFXHEGF/jsDfEpoGOaZQH2YNUo2v4kE1xu cYsMqYTSmzaKKC4WXm0I3RyoskGnlUQbEBruGpqFvmwmHTXhPgNvV9zJOrsCm4qEr1/0 xN1E/0c2dxy5VFTTLF+lq8+/0eyoFZKKjy2OlqG4RJP8JkBochv1pUPFfEdg9AHGc72C +png== 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=xHUwfXrMCktpWTFh8tgPEYEudq0so6k6jsU7prpKKxM=; b=Y9ieMaRNvH5GYRD0qmKO3LwgN1DAmCXsmwDpSOBv6tN6FKOkmtX9Jna48OlhxsMEtZ O8Y3eHWwSIXUMOk1y8n7u4KiNU/0zcM+6N1XXPJWmJmiUH3jYaZuoYtDPWyVs9U8z/lw SqJj/tl3NUlWsoUWj8GYUcDOekpqarrwZpzNmhhaskIQQMoin7ulrL6HM2pM8r2z9Z5n qScoVZRBsyK0wY9e/fmC7Gs8/0gXI8OpqoNHli4heE5wNAYY/FfxGoToAgZiNnHUdGrS E7ZGGcxDcs1PYl8tWvd1po8LEgKhvoV4TzRv1MoVSgt8R0a23WL64iR3dsQk6Mk+C2Mi CrDA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="IUw/yKaT"; 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 q8si2715784ilo.95.2021.07.26.22.24.18; Mon, 26 Jul 2021 22:24: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="IUw/yKaT"; 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 S235294AbhG0FYQ (ORCPT + 7 others); Tue, 27 Jul 2021 01:24:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36134 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235280AbhG0FYJ (ORCPT ); Tue, 27 Jul 2021 01:24:09 -0400 Received: from mail-pj1-x1033.google.com (mail-pj1-x1033.google.com [IPv6:2607:f8b0:4864:20::1033]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9B2A9C061757 for ; Mon, 26 Jul 2021 22:24:09 -0700 (PDT) Received: by mail-pj1-x1033.google.com with SMTP id pf12-20020a17090b1d8cb0290175c085e7a5so2562044pjb.0 for ; Mon, 26 Jul 2021 22:24: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=xHUwfXrMCktpWTFh8tgPEYEudq0so6k6jsU7prpKKxM=; b=IUw/yKaT2Q1avrSaWO/Gu4k9VthmbqMHeBs5c8FGhtFdKAyTgXjTmNrLE5oim7W+Nz z2pGb2uJc57bBUq2TY0YF4ivQFhrWCWSAhVQ60/3uM8JhtbsdJ1zsKg327J9Fbp2qarn Dkz0bNo85bdqr0Gppo3GV1P0tU0IY6CSAv3oF3n0tml6DogIuCD0up0twu3esmt096yU l4DkTnFL226WUztDxN2hxLijlYeWHNtq+GMME0XKKICf8a8ajJ0b/v+RWeSBdMxePDPs yDne1HDTuUNw7sXtsK+66uPRpjqIpGS1IohIGIw9iIQzzuRcSk3O04WT6f0Y46tOBo4Q XB4Q== 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=xHUwfXrMCktpWTFh8tgPEYEudq0so6k6jsU7prpKKxM=; b=VPtbtceLS2c+/41DYJ55PqFUkXaQ4VuZwrmqdMm1MDYc7Ldxl6O2TnRd89JTHIHPo3 UrNZEof89oDuznRvO9SEBfLpYOHRgzRyXgb0wtD5eWFv5vipuaEOm57yVlGfATGy3zTf grO0ns0DADZCRcj3u2fNBp6ydagkSp33dytROz3YOy56z65xjaWSUfMlSoxRA+kQ55I7 pAQgDHPBur1S7PhKMK6WQ+vsqag7WRSHfyGim7A2HsF9WikF+8bmPmKYec1VN6MOo+P0 kkOmd0hKf3f5XQQ5WqJGWBCwvohrDovzrUaQe7LkAeeJui3aI9OmLWDJOddx2GVjvC8g 1krA== X-Gm-Message-State: AOAM533AItbHAtnQoLjlCQnI7BTCE46d+VebLz7G1zU9lrjUDVozUMfV V6eQM7KtkJnBeyVUt6QT/EJt1w== X-Received: by 2002:a63:550c:: with SMTP id j12mr21589541pgb.31.1627363449249; Mon, 26 Jul 2021 22:24:09 -0700 (PDT) Received: from localhost ([122.172.201.85]) by smtp.gmail.com with ESMTPSA id s193sm1917237pfc.183.2021.07.26.22.24.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Jul 2021 22:24:03 -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 , Arnd Bergmann , linux-i2c@vger.kernel.org Subject: [PATCH V4 2/5] dt-bindings: i2c: Add bindings for i2c-virtio Date: Tue, 27 Jul 2021 10:53:49 +0530 Message-Id: <33c317b95097ce491845c697db1e8285e3ec1d41.1627362340.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 Reviewed-by: Arnd Bergmann 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 -- 2.31.1.272.g89b43f80a514 Reviewed-by: Rob Herring diff --git a/Documentation/devicetree/bindings/i2c/i2c-virtio.yaml b/Documentation/devicetree/bindings/i2c/i2c-virtio.yaml new file mode 100644 index 000000000000..7d87ed855301 --- /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: + const: i2c + + compatible: + const: virtio,device22 + +required: + - compatible + +unevaluatedProperties: false + +examples: + - | + virtio@3000 { + compatible = "virtio,mmio"; + reg = <0x3000 0x100>; + interrupts = <41>; + + i2c { + compatible = "virtio,device22"; + + #address-cells = <1>; + #size-cells = <0>; + + light-sensor@20 { + compatible = "dynaimage,al3320a"; + reg = <0x20>; + }; + }; + }; + +... From patchwork Tue Jul 27 05:23:50 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 486661 Delivered-To: patch@linaro.org Received: by 2002:a02:c94a:0:0:0:0:0 with SMTP id u10csp4197736jao; Mon, 26 Jul 2021 22:24:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzrDaITmdLCAVmeIsx3kD0Pxzxd8qsxzM/pHB8wVzLvnFnFkDo6ToKWokJ6sRqEazmxqv+3 X-Received: by 2002:a5d:96da:: with SMTP id r26mr17890205iol.47.1627363465679; Mon, 26 Jul 2021 22:24:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1627363465; cv=none; d=google.com; s=arc-20160816; b=qDN/5ofvGRvTuqGeF3yiK+yNI+ae7P+1TPTZs0HJYfdWHYSLVGncub0WchYYCY2CHd CccstXrVeCRBGrstE/7RLAl1njAhgB0lNGCF1lTB4olcbZQ7XzQoSWXTg3hQIrJD1Zgr tetYdMcCxAOUXsj37HIh911GnC95AfsxQc1odiC4JEpNgKkFC9gOPgsCIqhDUU7NWjNy sBXb1G8zoWsnMINdz50NQdyG7+TqvLFiUSLWRK9bxUI1oeaRRSS7BxOifEJ/6+tsJW3z eOn3Yi8goYH8qLjUDbKWvEVMm+eTIt57G4uC/v5Vlv856PvEX5XYRUKtxLYnKl7YQyW+ s2lg== 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=Ruqu7XRyeoHO5d3dL3cpXjWaNCM/mJSqSGYC+47F2jM=; b=wvl2T0Jfkg/sELbYIpanYLKe/VJedNTmZWpq9F4GJRWXGTVVH//6odfp/28q0rz7to yOnzNUWRiOZn9TVfff9hWnnrzvxDRkyQK40zLg4UaDqj72Owrs+AdyTqJ2oVbn4JSTDF qvpGbI8hleZWQodAHU50J/Z2QTDWiVGIQmaEEkaXQRK/fwMJb2FpDuzFNmxeIvGofoJM xbB2aFd0lFg7OjRCDk7Ji1LUOn1ufNJk3eoFD3JtR+c0NiqMdJNdwrn9xtIBgPfGtnhn gjcxg1wMOq9ltAz7uMDyLWaz+1G2dHSTgD9pre6ZgszWS6J0t8eVsRedbIjwcQqMO/iZ kHsw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=OK5Eq5Ea; 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 a4si2097346ild.162.2021.07.26.22.24.25; Mon, 26 Jul 2021 22:24:25 -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=OK5Eq5Ea; 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 S235306AbhG0FYV (ORCPT + 7 others); Tue, 27 Jul 2021 01:24:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36174 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235307AbhG0FYS (ORCPT ); Tue, 27 Jul 2021 01:24:18 -0400 Received: from mail-pl1-x62e.google.com (mail-pl1-x62e.google.com [IPv6:2607:f8b0:4864:20::62e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0D98EC061764 for ; Mon, 26 Jul 2021 22:24:18 -0700 (PDT) Received: by mail-pl1-x62e.google.com with SMTP id d17so14427080plh.10 for ; Mon, 26 Jul 2021 22:24:18 -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=Ruqu7XRyeoHO5d3dL3cpXjWaNCM/mJSqSGYC+47F2jM=; b=OK5Eq5EaYOj7pmvubgA/5zHGMhwmsXjjVac7YqdjIyrJAuYnBWil+CUwlP04n+LrdT f5NKctWjool1sMCzalGRQvx6uWxHQeH0ophl0ANynHrmCxpgHGRQmAxEqwdIo+eT4KDQ WLDPo8iG6MTUXW1jAcwHZu0N2HmZNkGgfXq6CU1BwTjN11zZVyUjStSvUvZHsjxeBlmH NWp7U7o5qADjx99jjJCRKdgiwdXKD5RvwtZaDletZ4v0zzsCbg511OuTR4OoWLgk30Jq NfULFuLm1p74l06sdwm4e0TV5w1i1+ZVtfOSnHu/Y25TVbNzI1Zx4Y0bF3t2WzRxEdHx fNXA== 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=Ruqu7XRyeoHO5d3dL3cpXjWaNCM/mJSqSGYC+47F2jM=; b=dLF6CSBzfTRAlOcN6x0ORqt29lRwcIjaFaAMFq9vD+rVB4cewfQLiwRlKPHc4/DCIg 0p5wdQEQ6iFFlwcL2UJLGryCZelJXF+i/oiAqz9C9utSXkUpnuEmLXvKcZo6KYaR30mw JZkyQjqaCAE0wa7a+vmY8P8bAwGTlo5+hPVh6WtDJzuyV1pboDeL2G+Rhi5/R8k6i6nB eEWTm7yFlxJrI8Lz9gnWNtAjYX0Za3ZHfqrN/tpLxifEo8Twi3dDo4UEphEUbgdBdwPo 8ivlkyOhEThR4vXIP9dix+e1DYFb7Rpo/kDnn5yzQf7arAcVN8Am6k4ClNzVHDm9UyBE cb+g== X-Gm-Message-State: AOAM533QrH9gneHMYjlfyr3DTitY7CDiIIifsMtfW9LLjGDYUn+m4B8X Nh+wgkAcU86T2AeUZKykIczelg== X-Received: by 2002:a17:90b:ec5:: with SMTP id gz5mr5361661pjb.77.1627363457626; Mon, 26 Jul 2021 22:24:17 -0700 (PDT) Received: from localhost ([122.172.201.85]) by smtp.gmail.com with ESMTPSA id c23sm1929324pfo.174.2021.07.26.22.24.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Jul 2021 22:24:11 -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, Arnd Bergmann , linux-gpio@vger.kernel.org Subject: [PATCH V4 3/5] dt-bindings: gpio: Add bindings for gpio-virtio Date: Tue, 27 Jul 2021 10:53:50 +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 This patch adds binding for virtio GPIO controller, it is based on virtio-device bindings. Reviewed-by: Arnd Bergmann Signed-off-by: Viresh Kumar --- .../devicetree/bindings/gpio/gpio-virtio.yaml | 59 +++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 Documentation/devicetree/bindings/gpio/gpio-virtio.yaml -- 2.31.1.272.g89b43f80a514 Reviewed-by: Rob Herring diff --git a/Documentation/devicetree/bindings/gpio/gpio-virtio.yaml b/Documentation/devicetree/bindings/gpio/gpio-virtio.yaml new file mode 100644 index 000000000000..601d85754577 --- /dev/null +++ b/Documentation/devicetree/bindings/gpio/gpio-virtio.yaml @@ -0,0 +1,59 @@ +# 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/virtio/virtio-device.yaml# + +description: + Virtio GPIO controller, see /schemas/virtio/virtio-device.yaml for more + details. + +properties: + $nodename: + const: gpio + + compatible: + const: virtio,device29 + + 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 { + compatible = "virtio,device29"; + gpio-controller; + #gpio-cells = <2>; + interrupt-controller; + #interrupt-cells = <2>; + }; + }; + +... From patchwork Tue Jul 27 05:23:51 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 486662 Delivered-To: patch@linaro.org Received: by 2002:a02:c94a:0:0:0:0:0 with SMTP id u10csp4197781jao; Mon, 26 Jul 2021 22:24:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx47c5AfPgsrCmdNfnjgemgzAj5Qlv6jNoeCGVvQgx/3rYJSSWjzVPeONdl8ZrPplISnq1y X-Received: by 2002:a5d:8b8b:: with SMTP id p11mr17994501iol.77.1627363473688; Mon, 26 Jul 2021 22:24:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1627363473; cv=none; d=google.com; s=arc-20160816; b=p1V+Nib4GnPDsDn654c4O7dYRnF6BOhs51UOpdx7tL6Pphsc/8f0n3coFMuaPkLJ4b VaCOjkWULzAptxwIzYTnYo7Yf2kUPittuXk4L6o9Aasp4hgusnRh1q1/jIvbyp2GvSGX LabECGmDN8xfGTie8rdcuCKiB3GNB0XV/RiAmWFZdR1g9Y/3EkvDUAb0A2mkvh02ZTG5 8JLLASjvPI/cvxq9ddtIWkTvEZAMBl1tvBRXdLuWfyIb5kRUObTpz16IedstIXdZ6Pkm iXKuVGwoYOsMSCIKLYWNSaJizOpQFAAa40HBNMx3m6TkrbcOGr5LsUkKGyR33f58uq5M r1ow== 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=ETojcto/KFAPr378xvNhLVyNl3M+t+w7C+BI634SE53S8+kI03PXJZhpewK8C/CLBQ jJPuAiwdAyxb9BDl6wu3Ent24LSOCPoNwaFHSdhhsPJShO48St0y2MLpHMCE6fpZ3RPD G+A5swcxKfCa5AlK41cbdkjdJYhiiuRFP3efRWYnrycjavA/9QONkohaahxV3oj4Hq8w ZIN2AsDrSLmeulRtDpg2GgtJjz2pNj2GyuVwhhYXW1o04gqjKnCLpQutkt8KcSgmDL71 tm8zxGRFfVfmIRGVftNHghbDAihLxwyCoAXjT6xJbsyBee0IxVW0FmTqNVFMIi2izPjy sKTw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=dteFSvxf; 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 d21si2289503ioh.102.2021.07.26.22.24.33; Mon, 26 Jul 2021 22:24:33 -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=dteFSvxf; 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 S235315AbhG0FYa (ORCPT + 7 others); Tue, 27 Jul 2021 01:24:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36218 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235333AbhG0FY0 (ORCPT ); Tue, 27 Jul 2021 01:24:26 -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 22879C0613D5 for ; Mon, 26 Jul 2021 22:24:26 -0700 (PDT) Received: by mail-pl1-x630.google.com with SMTP id i10so11378815pla.3 for ; Mon, 26 Jul 2021 22:24:26 -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=dteFSvxfHiolxWExFCYBJpIdo7z7XthW2duKjP9HC9nPVQnFZxCHAaDfYC/WnS+tCs Q7bfzBcs2VcLHnHdgtN3Yl58ZdpAMmqjlLP1IaZ/Zz2IWkg+K8X1xHO/NryCoqAItG1j Ou3dHWLNXdjeP8RiFRY7QG/mAu5B8BOCOUo7Fz9PPjJzpPQ6KnfiIoYkSrLMeIAf3DK5 xfC/HxiYc/e+RUzrim8Jp8nO9FbXeM8NhSoG/OZitD3rrAtDsQ2aCIpDW9euJlXcQOO4 9+wpvm7zzZyQRq8Yqvw6kLxNCjLqjObe0rjc6Bj577cCozYlzYviWuV5gAULASRIDxSX 1azA== 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=dnre1J6zxwp7K4nsbxJrlJCNINnOTmI/3TY/Mjjm+n6ozmhfhaAreKeycBNS1IHRRJ LsCQNHtfY3AupSc2BBlHlmLpPPtupShDdGw66b1UzPjmr7ci39wnnf6fIT8a3iWq0Yaa af6fdpz+b3RZ2bvTkd7TFSMxsQIOwoBijpdOCdoWhdY/nhKFSj0Gj7Od5WQTpjpDTey3 SHYAeE9pDogYQai15fXwjf/JLzJYg0o+nH0P6/au9q0ZgYq8oQZGU+kAteKogs7DsCDX Ag7cibDiuxV8mYO3uzfYktM/lgdWh35OPNQvzLAMmsmj18R8L85y92niZcTZZGx3+066 1Glw== X-Gm-Message-State: AOAM531JZttQaXbMlpHDCrMcFAuf082Uifbt2VdKUsO7C/G7xPMVOhZ1 jQOh72LF6MnmPuGnR+l93ipR3Q== X-Received: by 2002:a17:902:e843:b029:12b:2260:b634 with SMTP id t3-20020a170902e843b029012b2260b634mr17178785plg.27.1627363465701; Mon, 26 Jul 2021 22:24:25 -0700 (PDT) Received: from localhost ([122.172.201.85]) by smtp.gmail.com with ESMTPSA id k20sm1263589pji.3.2021.07.26.22.24.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Jul 2021 22:24:19 -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 V4 4/5] uapi: virtio_ids: Sync ids with specification Date: Tue, 27 Jul 2021 10:53:51 +0530 Message-Id: <61b27e3bc61fb0c9f067001e95cfafc5d37d414a.1627362340.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 Tue Jul 27 05:23:52 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 486663 Delivered-To: patch@linaro.org Received: by 2002:a02:c94a:0:0:0:0:0 with SMTP id u10csp4197834jao; Mon, 26 Jul 2021 22:24:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwyJ1pOFF0Jg9342jmmZbf/IlZKD419X749epQjJt+WdwzOjI2VwyB6/zeOKAQAtAHDogh2 X-Received: by 2002:a05:6602:584:: with SMTP id v4mr17492990iox.181.1627363484079; Mon, 26 Jul 2021 22:24:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1627363484; cv=none; d=google.com; s=arc-20160816; b=JVC2TuDLkvVePGxEWSU4d7Lw2ykcWGoMoM8bAoybvpP60vu8laq6J7v1kZ9F+EflQR i13FZeHWtgk2z+mS48D43k6D/7YIrZGftpUU9gx2iO0l+hkEeuTwsxNHirFu1KRS/qsf /vgguM9F1xkd4Gkf5h8el/3//FsgEMHBYgtrE0EQ/w1F8LraN8hb4mm2IuDyQ9ER5Yp3 e4A9XHAXidXULxBD6CcXFFpWFnhx19jkzhx2OJooYniZNxnhzlsDlAkHNLoHVY6kccG5 DEG6A3JfRlYzbgDKxTohPAwWJTlc6Sz1S0PeD9fyE8MvQGXY4fwPkwz5kbHvXAu3MqVb zMSw== 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=2bReu9/QiDlixJ/zUrMpF+Tdh8nXeZ2MTWODegeEltE=; b=nC+Ti64feme4+SsZhYi0ggpZyLW6WdRBUF/cvfO4XxY0F4EEK4uahuBoYOiMHwOKRr 49mumQLH1KIUfk5ccPjIxx8Xl3yRPMaWCTKc6Id2DQq4GHrz1HRC2sC0hL621ksoB5tu 0BAbApXHmg9Rv9f5nDuGxDtZYYstSxEuQIfxgS6Bm2Cx14093MVfWrYs/dIqy3Be7hUI yWHBQeVgNI5voeWd0PjNr6dXDVMSO7M20mfcr2IIDXN798RDQMi9syydAimyamahy8Zq dqK87Gwu+VzfjMDQfftgwhMrYmFIlle0TsQsX6HnG2pifuE6gwLZHW17TiOzffYu6tKF p17A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=sguymNCU; 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 m19si2419395jat.15.2021.07.26.22.24.43; Mon, 26 Jul 2021 22:24:44 -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=sguymNCU; 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 S235281AbhG0FYm (ORCPT + 7 others); Tue, 27 Jul 2021 01:24:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36260 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235365AbhG0FYd (ORCPT ); Tue, 27 Jul 2021 01:24:33 -0400 Received: from mail-pl1-x629.google.com (mail-pl1-x629.google.com [IPv6:2607:f8b0:4864:20::629]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 52928C061796 for ; Mon, 26 Jul 2021 22:24:34 -0700 (PDT) Received: by mail-pl1-x629.google.com with SMTP id f13so3988103plj.2 for ; Mon, 26 Jul 2021 22:24:34 -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=2bReu9/QiDlixJ/zUrMpF+Tdh8nXeZ2MTWODegeEltE=; b=sguymNCUwJvY2Vm/IznufncDBF3sjETSlEYR+vj6oJ+UM67MLBhMqFWHk4mxJ2PsSK 5b/s7cah1FqzNg7kC19ikh307/G6HXGV6vMozb6gQ9Ivrinas5A5uGFE+gYR4y+sp8CP ooRPiSyF+J/ZHTpxuhxzjHDtCtY6Ig6pMCAsZA77tabFVO9u5bZFxnaz0DMP43yxUwc0 BsPvx34ZEDZ4sn9IAvNFCcHSOMaiylMSvxoU6OsQqf64kvFfB6/cJZ/Wc6nZS8In21fJ Il3PEhvnL7Rv74YUjSqCJQU+77wRAcE34sRn7mrHM27QxxrNB5RZ77Q1OyKTtOWvxq+T z91A== 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=2bReu9/QiDlixJ/zUrMpF+Tdh8nXeZ2MTWODegeEltE=; b=tP9yYr4v4sKT2LcUy8HX1erCAEVDBCUDuasLrhbeHN6ohHUap/UixJARiM+yCpL/co 7M/UhDLRrYsi9fgbgM4fcaNJKxiWDVCR7l/6eYYWa1usmfHqEPjvKOHhbW8axIZzBW9t cCM5ZPMAocYMw5q9s61ko5Qo1eT+/hOf1KGjaF77radEw4MHQRIWvMb7+54C5zvg6KPn TmBjGVqy6UMlvKaNAk1ab4yfKl0EXLhQ82ObQukMI9t3MuSCO3A1NxGiR7yRh+v/RHNa 1mUhjg4Wg6HwsIEsFKJlOunN5jEUz6fzDUdp1aDW1MMapdj9rkkc+C7F9XMf50/AZ1KF EPDQ== X-Gm-Message-State: AOAM532tfosjyZgkBbS+JpZfHhmP+NQYE1t33yItGKw6YtP0D0ZRIWHa MxSViSfudrcs5WY2ofJttwuQ/g== X-Received: by 2002:a17:90a:86:: with SMTP id a6mr2447703pja.133.1627363473907; Mon, 26 Jul 2021 22:24:33 -0700 (PDT) Received: from localhost ([122.172.201.85]) by smtp.gmail.com with ESMTPSA id b9sm1857444pfm.124.2021.07.26.22.24.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Jul 2021 22:24:28 -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 V4 5/5] virtio: Bind virtio device to device-tree node Date: Tue, 27 Jul 2021 10:53:52 +0530 Message-Id: <94c12705602929968477aaf27e02439eb7a7f253.1627362340.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..5f80786c2aa2 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,deviceXXXXXXXX"; + 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; + + ret = snprintf(compat, sizeof(compat), "virtio,device%x", dev->id.device); + BUG_ON(ret >= 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);