From patchwork Tue Jul 27 05:23:47 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 486658 Delivered-To: patch@linaro.org Received: by 2002:a02:c94a:0:0:0:0:0 with SMTP id u10csp4197562jao; Mon, 26 Jul 2021 22:24:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyxeeI4umcXWA7KpZgmf4FYsS9jKKD0UIrsTowCsguyOf7hGkf12NgyGW9mNwvcUiE3Ne1n X-Received: by 2002:a5d:925a:: with SMTP id e26mr17721369iol.195.1627363441315; Mon, 26 Jul 2021 22:24:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1627363441; cv=none; d=google.com; s=arc-20160816; b=nBNFZMsnw5r3cLjESBMdwsvQg61qLRG+1pbwZtPowTgfBQtYK7w8nVvse3086c0teP fCR0tb09QepUMZ11ZaXWrPD51AjADlkXgaQb7co92vW9B+BXmnSM+owJaWyOYITKB+e1 WUVC0X6yAVV5AFOQB25KcpVaV+gW0t7wNWJWybN5FW8X9slU7Zo/yv9a1D2rSmasUl7V 0HSy8mUy3leZOgFbr8o1/vqJ9cTBghonzOhWpCGWV5HgEZutCtWJW6xWlZgTi8H00RTV nwTTFjg8p18pTCzIAgrF3x69fGCq4bLBJH7GS8aR4HC5mAhEvu6K4WP0RTxsyPGje2kG tfQA== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=m4PnQ7w4ZXIbpbMOd9mPAvOkoi0Otfkeze5HMzWqDSM=; b=QpHcK4A9nwKBkWhO/9/yBIhFRoVr0SZFLw3amdqBw0aNmoOqEe37JuXxMoHlOsblYP 8dLLfQA+9gfxH60cwvDI+43vueABlwUIz9V8CSRFeGbJ6kVSNUSvCgWU1ahGeL3k+tzn ODtT55ExIOg8V6zxBHzG1AmP2n9F1U3UEwUZA9VOE3C4Zx6NibTzwIJ9NlE1dXLZI/3F YveLxe49LCA4jZL5bOnfRpN37DynCtYbn6W5EFWFq844dppyxvE4fqmM5pAg37lYY6ez oFefDjuis/tpXCqr1Dz9xdMfpRUSBGWFBV55K9+X/gU7fk4yPWBqVOHH7uY8F50MP+oi 4K4A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=o00HtKxd; spf=pass (google.com: domain of linux-gpio-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-gpio-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 h29si2097931jav.81.2021.07.26.22.24.01; Mon, 26 Jul 2021 22:24:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-gpio-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=o00HtKxd; spf=pass (google.com: domain of linux-gpio-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-gpio-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 S235182AbhG0FX7 (ORCPT + 3 others); Tue, 27 Jul 2021 01:23:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36062 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233553AbhG0FX6 (ORCPT ); Tue, 27 Jul 2021 01:23:58 -0400 Received: from mail-pl1-x631.google.com (mail-pl1-x631.google.com [IPv6:2607:f8b0:4864:20::631]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 56001C061764 for ; Mon, 26 Jul 2021 22:23:58 -0700 (PDT) Received: by mail-pl1-x631.google.com with SMTP id f13so3986680plj.2 for ; Mon, 26 Jul 2021 22:23: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:mime-version :content-transfer-encoding; bh=m4PnQ7w4ZXIbpbMOd9mPAvOkoi0Otfkeze5HMzWqDSM=; b=o00HtKxdOf6pgzaZcv7v0RCIAoZcftZntng7XdmVuSjqtZ2b8wjG0kSMM7lu+GX68P 2rGAKWvz/uQTh7cL6jW438A+V9TeI9mbi7wXXpHEaCUsQO3V1v4i0tPJOb0ngMv0Bs+3 M9LJQEIBANelTQ65JuIiInXty805GkKN7ycj23u1RGZ6a/GCtZlF8xOOaDiuOcC7b8mI iengHNowfdX5rLoqaQAOYI41O5sesvJCvfaY/KTyhE0bpWP0nsq021X7Jjh657Cqg/eO 0GRu4vqdaCm4aOorJ9S1mFCYSrxF5VM0sNpLMnvGF5x3CVa7NcLr3JdNlz1zonTq6BAo paYw== 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:mime-version :content-transfer-encoding; bh=m4PnQ7w4ZXIbpbMOd9mPAvOkoi0Otfkeze5HMzWqDSM=; b=sl47AMt4DIrD39cy0sN0zf6SqnqUYM49LlEQQhvvxIKg0iR+DqKllMjg9q/00wmqik V0QeQUV91IKj+5sX5gACzG2puSsGAQKisdnNuEo5Qh5DWz1gKWRDitsEfpJw6Vj5T3HC ij8H2QFUHrAyFQESjbggc+41/A0eZRTDBL8xLEWenAEUJByW0ulYnrZkq8EaO8DEZAk+ uz/Qadx1mOzeUHkiqIKQlvr5W2ZAcl/9izdoBwIhjh+mnWuljmldACPsIkyidy+rq56R v6VT1UKW9fIR010vdSX/Okwy8xh7QqRH/PrkbmFXiO5z2T97odUmC63eFCFg75HUn9XO N0cA== X-Gm-Message-State: AOAM5323SgjXjhoKvCyWk96Wwvfp5AEesdPNcyE59cUWoj5y86mmus5G 4hfjsCPQzz7EK5/ICT/BTyIJMQ== X-Received: by 2002:a17:90b:1d84:: with SMTP id pf4mr20491531pjb.166.1627363437795; Mon, 26 Jul 2021 22:23:57 -0700 (PDT) Received: from localhost ([122.172.201.85]) by smtp.gmail.com with ESMTPSA id f18sm1903790pfe.25.2021.07.26.22.23.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Jul 2021 22:23:57 -0700 (PDT) From: Viresh Kumar To: Jason Wang , "Michael S. Tsirkin" , Rob Herring , Arnd Bergmann , Jean-Philippe Brucker , Bartosz Golaszewski , Linus Walleij , 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, linux-i2c@vger.kernel.org, Wolfram Sang Subject: [PATCH V4 0/5] virtio: Add virtio-device bindings Date: Tue, 27 Jul 2021 10:53:47 +0530 Message-Id: X-Mailer: git-send-email 2.31.1.272.g89b43f80a514 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org Hi, Currently the DT only provides support for following node types for virtio-mmio nodes: virtio_mmio@a000000 { dma-coherent; interrupts = <0x00 0x10 0x01>; reg = <0x00 0xa000000 0x00 0x200>; compatible = "virtio,mmio"; }; Here, each virtio-mmio corresponds to a virtio-device. But there is no way for other users in the DT to show their dependency on virtio devices. This patchset provides that support. The first patch adds virtio-device bindings to allow for device sub-nodes to be present and the second patch updates the virtio core to update the of_node. Other patches add bindings for i2c and gpio devices. Tested on x86 with qemu for arm64. V3->V4: - The binding is named "virtio,deviceXXXXXXXX" now. - The virtio binding doesn't restrict the node names anymore. - The i2c/gpio nodes are named i2c and gpio now. - Dropped including gpio.yaml. - Updated code to match the new binding name. - Use "type: object" in additional-property. V2/2.1->V3: - Added review-tags from Arnd and Wolfram. - Only the 5th patch changed otherwise: - Use of_device_is_compatible() instead of keeping a list of devices. - Use snprintf (with BUG_ON on return value) to create the compatible string, whose length is fixed using "virtio,XXXXXXXX". - Use dev_of_node(). V1->V2: - The changes (both binding and code) are made at virtio level, instead of virtio-mmio. This allows the same to be used by all device types, irrespective of the transport mechanism. - Dropped the reg property and used compatible in the form "virtio,". - Dropped dt-bindings/virtio/virtio_ids.h. - Add a patch to sync virtio-ids from spec, required for the last patch. -- Viresh Viresh Kumar (5): dt-bindings: virtio: Add binding for virtio devices dt-bindings: i2c: Add bindings for i2c-virtio dt-bindings: gpio: Add bindings for gpio-virtio uapi: virtio_ids: Sync ids with specification virtio: Bind virtio device to device-tree node .../devicetree/bindings/gpio/gpio-virtio.yaml | 59 +++++++++++++++++++ .../devicetree/bindings/i2c/i2c-virtio.yaml | 51 ++++++++++++++++ .../devicetree/bindings/virtio/mmio.yaml | 3 +- .../bindings/virtio/virtio-device.yaml | 41 +++++++++++++ drivers/virtio/virtio.c | 57 +++++++++++++++++- include/uapi/linux/virtio_ids.h | 12 ++++ 6 files changed, 219 insertions(+), 4 deletions(-) create mode 100644 Documentation/devicetree/bindings/gpio/gpio-virtio.yaml create mode 100644 Documentation/devicetree/bindings/i2c/i2c-virtio.yaml create mode 100644 Documentation/devicetree/bindings/virtio/virtio-device.yaml -- 2.31.1.272.g89b43f80a514