From patchwork Thu Jul 22 09:56:39 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 483872 Delivered-To: patch@linaro.org Received: by 2002:a02:c94a:0:0:0:0:0 with SMTP id u10csp202832jao; Thu, 22 Jul 2021 02:56:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxZSXRv7HBpOzgG2HZEDmlgagomsahAQQu5GCfDeIDNeHxjMZ/8pbP6E/fMWp17pfVXX4lX X-Received: by 2002:a02:a115:: with SMTP id f21mr34626211jag.3.1626947816633; Thu, 22 Jul 2021 02:56:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626947816; cv=none; d=google.com; s=arc-20160816; b=jbX6ozbG063Yeyca0v+xT3rHCKkTOjXRIoD31qBlWZcK0QfraznyULK+HMGVMFaPzX zEastC16IBOPWpMNjnirPxjjz0oyvAfFDoHBaFS9yr1D/fcqN7JqL2tRYEnV6AwVRKy/ vL1RofD7pY55FlTYCkV1jt5RYUifDHpBKQwtoLRj0Wx8OdlloIyLyo07vqyu4+LzcxHe UFlkSBJeaOlTQWXfLyt+MoKzQ483H4tMwoQBANiJ3gyaWr1XKJETQ9ovmuFA4Vd1Pe6T 8yUmNTaGGQqRs1B7+el0+wxWV03I8ESFjYoi2GqRAL7Ntr56qDbaZlTaHiR4fhVNOBVE bU8g== 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=ihhUEc9nidQVROcSZzkI57rpF2sNQRi3HWb5tCOT2NlJtHCoH9Gb0HEliFj6DxQ8Q4 byuieOsguheSHgPGvj4YWzQsnhaRvAgc90xxIN309sarbvIXT2F4aCNLf9oRcSJ+mN0M Ync31AJp05HsluNDGMUT5uyGZ3n91OkFNRPaPN3VPnkWhR8Y30ss3U8mbcQuY1Q8YWTG d23j4snp6wHkP8DnLxs1Ap+2oxLZVgd5OtwD6WDW1S3iO7pSzvVFiApBZPrH/EXRozVH K/dvbpkh/pCCdGcvxXCxKkJ5ZxWnZnRKIm9VxXghUDEGdzYSDw/k67l7aHRhlnZO8i2F njJw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=rT0HWshX; 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 x12si29393817ila.97.2021.07.22.02.56.56; Thu, 22 Jul 2021 02:56:56 -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=rT0HWshX; 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 S231355AbhGVJQT (ORCPT + 7 others); Thu, 22 Jul 2021 05:16:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39372 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231474AbhGVJQR (ORCPT ); Thu, 22 Jul 2021 05:16:17 -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 B21CDC061760 for ; Thu, 22 Jul 2021 02:56:52 -0700 (PDT) Received: by mail-pj1-x102a.google.com with SMTP id gx2so5388119pjb.5 for ; Thu, 22 Jul 2021 02:56:52 -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=rT0HWshXd8nGdtBqoZiI1S6Ws0VED0exTJOCWSfoURsHS8z0r1DP8kKfEqDzoWRlCk ZpyIVRq+7RxtvnBpF/zFFE08CrsMw0EhoJ8nRM8PVPIFOJnTWplPOoWfAKmDYHL4ujnR 3qZlBy11EOkr7TNC6WkFIFv6XipygWZq0ACOPDtoAr+XVYhtSL04jKJm0PkgN42byHQy muaFvdyDV4bPBFwvtEIjNXV1HqZq2mXzlKkRLmkE3nLc2AXBt2V7XXKO2YmSQp4Fqn2O gZtBiljKKyxV6gOGkmJs1WN/00aAbmkNE/HBT/pch6yzRemSo64jG3TXfnuqM2Z39Dal zlQQ== 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=aMBFqkyZ+RT0m5NQf3o5QacspuSQ1uB8DVsfbTEHRIcPFnMLN4+qUIMbsTXx3jWJvv //x5vzbpsXGQVt9cCvnABdgPuwO4CXgjwfhCuERW964Li7Oc2qAiszSVB0tTg2wi/msq 3G2KRn7KYAxDpAgo4vKNsSURaRfiCkfY1GuaUJfZXsmoyad3kj/PsOpFW8/SuJF+vzDq JLQAV6Kf7IlFQBHWwqPbSbBe4C0+pG9LaZginD0Su7X00g8HK52YnrOAU02gK2fp01D3 9DTe6Z6flGd9t1HVrfl3XHlYK/+Vck1FN7Vaoht3R0YdWUQDWvFJzDX9zUBXF4CgP4qP DCGQ== X-Gm-Message-State: AOAM5324mEyXyDzuv2wKRFh4wQMpN4nAdTdVTpZud3BeBnnoPukFsURb CDzrOqbBpx2ehU92RJhdVNgpVgNpdU7yoQ== X-Received: by 2002:a17:90a:d598:: with SMTP id v24mr37859955pju.185.1626947812304; Thu, 22 Jul 2021 02:56:52 -0700 (PDT) Received: from localhost ([106.201.108.2]) by smtp.gmail.com with ESMTPSA id j21sm24845767pjz.26.2021.07.22.02.56.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Jul 2021 02:56:51 -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 V2 1/5] dt-bindings: virtio: Add binding for virtio devices Date: Thu, 22 Jul 2021 15:26:39 +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 Thu Jul 22 09:56:40 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 483873 Delivered-To: patch@linaro.org Received: by 2002:a02:c94a:0:0:0:0:0 with SMTP id u10csp202857jao; Thu, 22 Jul 2021 02:56:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzyGGb3kWzvM+zh9XMI+uC/ERGimsoQMR39r+EMsfLucVsbbxhvqpjPQCXXjLn76pa1BLr6 X-Received: by 2002:a05:6602:2801:: with SMTP id d1mr23012379ioe.73.1626947819012; Thu, 22 Jul 2021 02:56:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626947819; cv=none; d=google.com; s=arc-20160816; b=RmvRTHjinSCWr0Al7Na/phCzxkdUJssAlQFTtFwdQqfLXyPeDR4c5fKoSCpy8FLjDR CvoAI8RAcPuwG+fZaIA9E794erQX2lw2kaGeC/Xs8W/qJUEe6f2DCNF2WJIJipWUqH63 /b+w4fAODW3Mf05N+SHuxdc3Wy5l9HIiZFEb6/iZ7GRyz4at02XHmg9SeqIiu+SScdyd n6+qTzO9Pvglg2mLWXc9xMzfAy964ObvCdkUVsb13vbc90LKCxGU119bnhMzxhHyeSCn AON+gkTvklk27UXD/XAr5umasHGDqwN68JXTdJNNTYD4L4LeIjn9lfTkVFjZqcBoUB2u wNtg== 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=LFAzq1cRRdIrI+QwSGEpAIXO66croLV9YsUkTYMA32Q=; b=Mr1HIaUAXk930AXIga9F1q3NuOWYa5XozpGhfASglDIEi/q3UcIF0a411qAmRYDzIY cgoqmLxZM/YdCP9vPzpEd1nbn5Deov+c0YIq68KNNm2k6ePUcYPWAOetB5K7CTjTcEgp 7XEwjXJ9DPbMgVDnFJKJ2H/OIBl1OZDLOq2dbDeqlfU6b6hf7/Q9cQkEkRRHnWQhVOqH wLiyUY/EIBAyqnae0Aa9/ZCfpfjuwtdd7raUHRMJXC1t1Y92YTqXqPK8ZmQbr9SmF+3L e5bQ0+I9rjMqRIV36jCls9Cpe7UJkdROhinP1u2iRxoG4f+DrQ08mCbi4/AyvYg2yJoQ mGSg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=PsrOoWAk; 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 z25si18113964iod.45.2021.07.22.02.56.58; Thu, 22 Jul 2021 02:56:59 -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=PsrOoWAk; 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 S231496AbhGVJQV (ORCPT + 7 others); Thu, 22 Jul 2021 05:16:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39404 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231477AbhGVJQU (ORCPT ); Thu, 22 Jul 2021 05:16:20 -0400 Received: from mail-pl1-x62d.google.com (mail-pl1-x62d.google.com [IPv6:2607:f8b0:4864:20::62d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9355BC061760 for ; Thu, 22 Jul 2021 02:56:55 -0700 (PDT) Received: by mail-pl1-x62d.google.com with SMTP id u3so3836948plf.5 for ; Thu, 22 Jul 2021 02:56:55 -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=LFAzq1cRRdIrI+QwSGEpAIXO66croLV9YsUkTYMA32Q=; b=PsrOoWAkqh6dkfonRpDr/SK5Ku7QwJrkh6mKhluNLjg5DjbVNMFlGXZw4a7YGAkdZm UqZJ8F2/JN9Ph8FlGK0B9aVzABv+AR24uG84Bn1qAu8XaJ1M5OVR/QU/EQq6/M1+tNeM 3i6uxRk5VLJvwL4DIigV3L50d0zf6f688z3RfxIgjWnMZ1eyHAREjpjPyJvNnZfwi5Qa Fa8EFUYBur8UmwAJnSel2XjzEGfUyx+qiIr3RbHM7qIShqzQMJpH4fyq/A4lRdKWhsvR bDrmM4NSQTn28JrQDtrJuFT+9dO59RUp8+HluBSYizWcrftarjvpZw7b7z/17eDM8Dmi cEOw== 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=LFAzq1cRRdIrI+QwSGEpAIXO66croLV9YsUkTYMA32Q=; b=YK5ou9oes7HBXUAHwCAjNQnA35QbcTJH1ywAp4YNTJ5bsxxQwQ5+LL77vWo6zwWGyD CDAt7aoB9aqQFII0hWdPIxCfTr/evBnlkXio3yzwdQDv+gXm6cZdGMEhKrtOBuSAO9DI IryGXSKiOG8ph2blVsAigq5s4NpAEAl+IwgeVMUkdELHqAaWY1NBjZ3JafnL17Ibya55 MRAxmZ1UTb9ZidfDwlM6eaLLtqknBD671TdEv1zorZzm2FZW4AxXSIjB4v0pETM/80fj fbNTq7IWwkts6XD15T6I3jD8WgDYjK2U+PNJeOb+MP8NwBTNOw+VMdELL3DNfJQpBqSB 1drw== X-Gm-Message-State: AOAM533EYfIF4L9k787PswOjCitTudRDsccYPixNS9TRESVH9z0KxZSW TZToUBEtSR3W2gPeKd7H6m++Rw== X-Received: by 2002:a17:90a:bf88:: with SMTP id d8mr39945553pjs.222.1626947815074; Thu, 22 Jul 2021 02:56:55 -0700 (PDT) Received: from localhost ([106.201.108.2]) by smtp.gmail.com with ESMTPSA id l10sm6274768pjg.11.2021.07.22.02.56.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Jul 2021 02:56:54 -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 V2 2/5] dt-bindings: i2c: Add bindings for i2c-virtio Date: Thu, 22 Jul 2021 15:26:40 +0530 Message-Id: <705f4426a17a395bf190ee6ed6c341ac25550f6b.1626947324.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. Cc: 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 -- 2.31.1.272.g89b43f80a514 Acked-by: Wolfram Sang 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 Thu Jul 22 09:56: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: 483874 Delivered-To: patch@linaro.org Received: by 2002:a02:c94a:0:0:0:0:0 with SMTP id u10csp203128jao; Thu, 22 Jul 2021 02:57:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzEdLqLtrXvt16PVIE/1tstyBfgD1EEHUZ4Udn6pzR1BfU26jP+u3tOw6oni/MgxhtuS2GZ X-Received: by 2002:a92:c143:: with SMTP id b3mr26071358ilh.145.1626947849970; Thu, 22 Jul 2021 02:57:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626947849; cv=none; d=google.com; s=arc-20160816; b=W2rlDGco0j4EmEKvDPWYVUl+7Nz3yNa/AxxZhWFkWdnM6VRvNVXOmyYPLCC5P48Afj Xooh2Gnl0K0oucufnFc94uLKg8uZZCukX+ls2XIoSEue69Cyn/0a5h95BQjEddAVcSXA XuYZuAvDxxJxKXxhPoiaWJ+lVbspNdkyqCvgCdoZ13btnC+kNQYrWLOs9HSjdNbByLTC arVq6MZM0TKTIxhDBeMFW/9lVekCCqGyQAoZJlxFJN0jCugioz/2le60lJfJ0I5uSmoN HppoxRzesR+ahy7eIYIapNt8tR39HRxH1iTYNYIToYRa6OJ5UJ87PkX6N/G9/U7ys2wC rjpA== 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=BDFLanGDsKdTvAMxs4TCPMwjxwggwfGTuz1RKCC6Gca6gPFU8B44eDRYliHv3nvABG ne4ATLzdhpdkCuLBrJ5tX212ebp2k5XxDTlyYjobDmv7n5z13R8NHcXGiGZPBSh5T3vv 1DHamJaljefTIq439Y+kXuQDGAAF8sbK0dUxH6CqdtD+gY9l3ZOHYGcExC5AHn/Dw4QT 7zwPhgPX7IpmLAP0HGuKGVRpG7e0IL9cLha/wgMZ56CXP3Rwl/ZyOnT75E71yI6APKmx PmsESmNUFyRPqItjIl4teMxbUAsGtVYgCK6vTwxckrSBGTiaSp8Dszho7vDMs3Oxuj/W r+1g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=n8ZC3AZw; 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 z25si18113964iod.45.2021.07.22.02.57.29; Thu, 22 Jul 2021 02:57:29 -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=n8ZC3AZw; 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 S231533AbhGVJQp (ORCPT + 7 others); Thu, 22 Jul 2021 05:16:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39492 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231555AbhGVJQl (ORCPT ); Thu, 22 Jul 2021 05:16:41 -0400 Received: from mail-pl1-x62d.google.com (mail-pl1-x62d.google.com [IPv6:2607:f8b0:4864:20::62d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 88818C061798 for ; Thu, 22 Jul 2021 02:56:58 -0700 (PDT) Received: by mail-pl1-x62d.google.com with SMTP id e14so3848521plh.8 for ; Thu, 22 Jul 2021 02:56:58 -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=n8ZC3AZw3jP2jJueB1RZMhR02tbalhWqKiFDjPykAogWMoM9xPPXZM/xXeT557iwV0 zVxjo56XtoyPTXZ8dHUIGdZ0e5o9LsL9RZXeAHrIsa3vKQpuXZTfjQpIO2O74KzhGXSm ajmmB8uQiV8rYR/qUCw0LT+ue+IV0Jr8gpbssPKe7T01IU0QGDZ03V5pN2baNV47YW7g we02jklbUjKouKrsyHOvmp1DoGkFk5u6Yv14EDlWYZShNBF4I/Wd2BFKJu7eLZNtofoz 5KeXpmJQBYvo7SWgXVkWNZVIaMsfLwqptLsh2DasM30eBzw+YOEAF2Z2hNOmnn0HwkuL v79w== 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=n2u3uroZZf7GrnOgEncgbGQK5Nfgwr3SsDcDIM5p2r6NoOEImkdfyysYLD7AgqTQJ+ lQqDKbfey+DVaTj/8SxBe3zyPQO9F69kMpfYPWpOGSFuI7qXAG0PaXwbIRaX/G9KMZJ4 3qZkBfUi2LHKJnSOgYUL3oziiVhvLZQvBcOVeloluG6FQ0cH6KNKtEFKG21n7yHAN9Ym sNVcHTVQZhm2srbfu1nra7hv3ICWuheucbmisjb10V/wOqONFk69Db4FUGjnCAeMCIsx xCXIrkKXGu5Mfvz0xvWkkoXGSJvHj56BVetjvY5U9a3cAuDckMgcDERjlqrt6kpYf7N0 Fy3A== X-Gm-Message-State: AOAM533BiMNrpxIOrOZakktt8Rfe+mJpeRLYV86leGu8S4xYqNGYKuma Yr9ZNzTOZAk2cMOOHKeLn5KYAg== X-Received: by 2002:a63:4d09:: with SMTP id a9mr40115746pgb.278.1626947817936; Thu, 22 Jul 2021 02:56:57 -0700 (PDT) Received: from localhost ([106.201.108.2]) by smtp.gmail.com with ESMTPSA id u21sm29458630pfh.163.2021.07.22.02.56.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Jul 2021 02:56:57 -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 V2 3/5] dt-bindings: gpio: Add bindings for gpio-virtio Date: Thu, 22 Jul 2021 15:26:41 +0530 Message-Id: <3257b21c1179b11a5c62a95e138735f2443c90aa.1626947324.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 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 Thu Jul 22 09:56: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: 483876 Delivered-To: patch@linaro.org Received: by 2002:a02:c94a:0:0:0:0:0 with SMTP id u10csp203173jao; Thu, 22 Jul 2021 02:57:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJymgKMqpV5r3uEBeviBNpdXv72mJWzf8WxCZZ5rvfdnJSwTPlIGfTCb8RGAgFVDWMrH1Pgo X-Received: by 2002:a02:7093:: with SMTP id f141mr34818752jac.24.1626947853553; Thu, 22 Jul 2021 02:57:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626947853; cv=none; d=google.com; s=arc-20160816; b=XpwPH3BIDazVy8GUi3w1dvo5xRvKBgVrDm7h8msx8etX5K8iNZ2mOlEknsdSst7DVu yIhuuwVPTfZTe3jqR8KrfMEMxL5uQThg0nxrRQsS/y7G+Ic4zkF3CypPSGTuwrx6mm/e 7nrPPYceVt4Qcee7W01k7ADvve9jWM5QLNdAe1xLpjfCnSF1elehmrrtE3qrRtWyhPPV 24uKIHdmdAD0JFxT8jOKPxcfr805M23f4oollVDn0Dknif7bh+Hw9/U3Zq1e2TmsnunF 3WBvj3QWG4WeaW1KNDUvp9H6AgOb3Fvo22c5eHnvAYrgXeke5RGVawy8MfkMiDLlzVf2 FqxQ== 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=Qzi+EeI8lTYMlSgI+L2clJGnhnotLP3GHkH29dCH7eQ=; b=oWKxQmhw6kovG6eJgNub8ZS/aq9JehrPpJizz1yMFaRohBFKpZMaMD98kv2Cj0TTQ9 PivatA+O0OOtGIe5AmQo4iOqZIwvAbHD5f5ecabOcwtbJqBhQlWscP2IJPgBGyy7kSnW uRb/4p8P5qnH5eorWDeujww7yO3YWlEGIVyeqArPF/wo7NxD5HacjBXRiDtcJApDbPud 5Iz/rNNev4m88pF3cUEvXuvC7wZ/CYVBEnXxVAmOHznpJBdCxY1l/ennm7T+UoJEpm7s c4pXvKBGpdyDg7Y2l1wDJgE9NKVdkNKAM3DrH2P3HuHZQAWTXzOTTeOE+7MN0Sm2L1Lz Gdyw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=p4rRDOs8; 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 z25si18113964iod.45.2021.07.22.02.57.33; Thu, 22 Jul 2021 02:57: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=p4rRDOs8; 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 S231390AbhGVJQv (ORCPT + 7 others); Thu, 22 Jul 2021 05:16:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39504 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231573AbhGVJQo (ORCPT ); Thu, 22 Jul 2021 05:16:44 -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 0B57EC06179C for ; Thu, 22 Jul 2021 02:57:01 -0700 (PDT) Received: by mail-pl1-x62a.google.com with SMTP id y3so3862213plp.4 for ; Thu, 22 Jul 2021 02:57: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=Qzi+EeI8lTYMlSgI+L2clJGnhnotLP3GHkH29dCH7eQ=; b=p4rRDOs8ho2CqOkofWcRmghRvglDnp91aNbNmx9Uj7IeW/DVWobtjO4WKqxClQqHxQ JQJT4ADBL4P29YktCauIbs38K/0B5SXDm//yUlLKqG1OYNCW5CZR3S8AILGfRgF5rLDd pTMifMy0dbuu/kKyOtP7q80empPjIThBZ5OkDLThI94mhE7ntSrP7tITpzefUvUlCZvq 4ianLkjoEqOUuGWBGtzAWc4xNVJYNUF6J7nrL7pj2WE4RRgquIYL/jvNnxhTfGGju165 /83/2kgiIOP/5ogPx0/jJXVebpaozFtq25fHKk7105u9Rz/tRA+NNth0JdWTurU4hnD3 4csw== 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=Qzi+EeI8lTYMlSgI+L2clJGnhnotLP3GHkH29dCH7eQ=; b=Z+I9mVYK6TM0DJCKXSyvu+rSfGZRsNu6UasUvthVDJSx087qsmcYE9ajRP34wKVT0i voK7fJkAcOP4gQ3PB21md8AHFxc52bdgXtYM5cTDIDJjGCby0fQvrIxA/zCzdp9bbPzF cCDXuknvnkrqJYL5XX0qWy4vsLneZ0eiXidzlLSj1m5sD7yzOZcTdcc/P61zycDl8qCv /zwMf2jGNr7ZItpydyb+TbhNUT8hXfL95lXGi7B9XMD9jaNCj54ItfdaaS5PwWShjvZQ CbVsgfEbqdAGI7FdqnwvHKbaz9zPupRRNIf2hAkbktJFd4Azrm+uYc6NcQOAt1Lk9s5V sO0Q== X-Gm-Message-State: AOAM531E6jrMnTzTtci4UhaC0UedBSsSfHxfzIXvA8p4/nRAumfSTwHf 5NyTZ1XKzILkEbg3XEUDHgxYBA== X-Received: by 2002:a63:1e59:: with SMTP id p25mr39604052pgm.110.1626947820594; Thu, 22 Jul 2021 02:57:00 -0700 (PDT) Received: from localhost ([106.201.108.2]) by smtp.gmail.com with ESMTPSA id a24sm24045078pgj.12.2021.07.22.02.56.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Jul 2021 02:57:00 -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 V2 4/5] uapi: virtio_ids: Sync ids with specification Date: Thu, 22 Jul 2021 15:26:42 +0530 Message-Id: <82384d39df2463dfd9ae9833b9c3e8889da820ff.1626947324.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 --- Replaces: https://lore.kernel.org/lkml/7c716c2eb7ace5b5a560d8502af93101dbb53d24.1626170146.git.viresh.kumar@linaro.org/ 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 Thu Jul 22 09:56: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: 483875 Delivered-To: patch@linaro.org Received: by 2002:a02:c94a:0:0:0:0:0 with SMTP id u10csp203167jao; Thu, 22 Jul 2021 02:57:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz4XIgxy8p08L1A5OwhINZ4twpe+K1mQSAFVXqqz8MkSnihOVUiqkr1gtdh+ZRmpdQUDlzc X-Received: by 2002:a05:6602:584:: with SMTP id v4mr22396925iox.181.1626947853035; Thu, 22 Jul 2021 02:57:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626947853; cv=none; d=google.com; s=arc-20160816; b=dcmPYBbE0PRsF/0aZibAFaWYojizIkDMV1bLSs76On8vD7xNBlPrXnHEk0JbYTyDHr XprkI+PfPhk1G1hpY29lThssh02XQ8jhaAZArGc8yAmnGWla40PfzwQRmHoV9SMLf3uS +UWlECV24L8+NHYWgyuD5BzCTNsqiya6iBtIeNKqGXLfMXphI1yEffnBxwvZOhODiTCL 9lE8pNVaj8b/wfRuE7ZRJXgDXG57yxhkcTWQxVqyrTUoOCZUlBuTEQ57DZ+rR46njKu9 lPBVsRgVRKv3XsI1AUCRf6PghPLkhcvMAs+2q4miNBWJCnp5PcrtFHRcz2d8A3rVI3Xa eBXA== 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=zqCgE34yKyEIxvuJmPDWwVVxXXN+22OEi5ENUvJ8OeA=; b=UsKeGLoCKTqicgO8/uw7gHPZ4cd2qNMivqfnNEa38lG/RoKWy2dM6VkNAiPvSj61MZ WmL+CJZCSUmZWLsuFF62vxQHYpUrPwrdcr4WDm6ry53UnqdX/b8/ioGcy2AMX8ZHMIOO qp7NQVx+ryo/OBx0Pbx/vjbunVmQ1RVIv8z5yyaSZ+WVbB+yWjOKh5FP+LkqIXoeEIA/ ZQryiBb7PWTgpIPLvo6lmXFAXsx/ttyI5kVc4F1fgmGoaAkHskezYhe5bxzt+TXUJMfd Ni/q4c2+E3AlLDV6dsFCnUYIZ+fmSi0afZNEaOUVSclQHm5VV/gfXSMyHB29SgKNGSo1 vvAw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=oNd9Myfv; 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 z25si18113964iod.45.2021.07.22.02.57.32; Thu, 22 Jul 2021 02:57: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=oNd9Myfv; 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 S231567AbhGVJQq (ORCPT + 7 others); Thu, 22 Jul 2021 05:16:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39518 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231580AbhGVJQo (ORCPT ); Thu, 22 Jul 2021 05:16:44 -0400 Received: from mail-pl1-x632.google.com (mail-pl1-x632.google.com [IPv6:2607:f8b0:4864:20::632]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E2E2FC0617A2 for ; Thu, 22 Jul 2021 02:57:03 -0700 (PDT) Received: by mail-pl1-x632.google.com with SMTP id n11so3860560plc.2 for ; Thu, 22 Jul 2021 02:57:03 -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=zqCgE34yKyEIxvuJmPDWwVVxXXN+22OEi5ENUvJ8OeA=; b=oNd9MyfvR0nYVTjrW1t93WrZmnXFXN7AAJDIlU2Ob6ZsJ6AU3uISvEzFldVwS/MN9y T+lAXUsG6wseU6YsEN069LVRTMg2F+luTvrzDcO6ABMJee/zl4OVlVUjIxOw3AKPXCVK 7aV8DcMDgsVAgTuP+HGVtzfa1qTbErhmDrgwIiELLIroBKiMtJlnjJYkcQBlQ3wbCB9x 9SCcjQZhUu+w+qSF1F5GNFSwX+ny4kwes2xQbcFfKHhotxKM/Nq9JMYodrgOaFYlb8Ik jERO1a1rAdxXN9yAyjOamz+lXVVqJkBTLTcEyh26w+pWL1N1SH/IbLS3ggA6HRd6N7WI fTHA== 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=zqCgE34yKyEIxvuJmPDWwVVxXXN+22OEi5ENUvJ8OeA=; b=Em2RUu57DIj63pNZhY+6eRQAyna64aqv4Wv0JZR93JUsIKwnX/zKZMfSrqe0eKiCKo WV48TE7bXbpf1faapnd5aeQ3RvOCCHefGWLBG42BCrSTe+0/b6BbeWpNlKA8dmBehks3 PPu4kp+ScK/PhA034o0VhVEVMoetFmrpti6sFP+tiH9+pxe8OZcYoQbyMnH0fJuqC6Zz FxkwImTz8TNvx/ZWd0ai3wISQSYfXy7kxANgCk7slbFyqHLnohqLL2Z/6dxjxUJB+shk HY1XZ2h2Gx3HVMFFmSy004DCNJ5KvcoVj+od63kGYr97dQt25JSDvw7C56QiIIm2JZdJ a+Zw== X-Gm-Message-State: AOAM532qbRAAYSmvq2AAt+eGR0TBS1IZ4ozU8x9zL/92l04pmlhA3But aXhcDl03f47x0Dx5jER8SE1/mQ== X-Received: by 2002:a17:90a:658c:: with SMTP id k12mr8021272pjj.167.1626947823491; Thu, 22 Jul 2021 02:57:03 -0700 (PDT) Received: from localhost ([106.201.108.2]) by smtp.gmail.com with ESMTPSA id ay2sm2400955pjb.14.2021.07.22.02.57.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Jul 2021 02:57:03 -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 V2 5/5] virtio: Bind virtio device to device-tree node Date: Thu, 22 Jul 2021 15:26:43 +0530 Message-Id: <026ad5f274d64d46590623f9f3a04b8abfbe62d7.1626947324.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. Signed-off-by: Viresh Kumar --- drivers/virtio/virtio.c | 67 +++++++++++++++++++++++++++++++++++++++-- 1 file changed, 64 insertions(+), 3 deletions(-) -- 2.31.1.272.g89b43f80a514 diff --git a/drivers/virtio/virtio.c b/drivers/virtio/virtio.c index 4b15c00c0a0a..87bee5b966c3 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,53 @@ void unregister_virtio_driver(struct virtio_driver *driver) } EXPORT_SYMBOL_GPL(unregister_virtio_driver); +/* Virtio device compatibles and IDs */ +static const struct of_device_id of_virtio_devices[] = { + { .compatible = "virtio,22", .data = (void *)VIRTIO_ID_I2C_ADAPTER }, + { .compatible = "virtio,29", .data = (void *)VIRTIO_ID_GPIO }, + { } +}; + +static int virtio_device_of_init(struct virtio_device *dev) +{ + struct device_node *np, *pnode = dev->dev.parent->of_node; + const struct of_device_id *match; + 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; + + match = of_match_node(of_virtio_devices, np); + if (!match) { + ret = -ENODEV; + goto out; + } + + if ((unsigned long)match->data != dev->id.device) { + 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 +394,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 +417,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);