From patchwork Mon Jul 26 04:51: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: 485800 Delivered-To: patch@linaro.org Received: by 2002:a02:c94a:0:0:0:0:0 with SMTP id u10csp3476477jao; Sun, 25 Jul 2021 21:51:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwz6Q6w2fRA0JZUcYoYKlG+3wFps6fGES989fo8ebTZUNNuX8KzuvXZRiBNpYLKd5J8vqVg X-Received: by 2002:a02:9f89:: with SMTP id a9mr14912837jam.51.1627275116565; Sun, 25 Jul 2021 21:51:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1627275116; cv=none; d=google.com; s=arc-20160816; b=QQUrkos4VPgfdxsJamlKWOywPsan8/D0Kqi7G6a7B/t7tSxU3SCJwH38s1KWUw4zMI OOMjp7EpCK/H+uekPrOo+VnQkpqE+d+ICVJzpq/CqPIUewjL3FleQUTaRNaueq9FOUZz CLk2BvmsEGLNh4rDqyw+FOwKh1TDUBaoIXl+uFDIdna/X/vhEdKy1o5vQHP7WoVyx17l auYCJeozJxQCedJxTjUx01A3GuDOXXddhnMTzpQD7GU2Y5H45Ts5rNAoEVR7/duXYINh qPWBg+PndAjDU6SkxuUaxO88fYZZFf0V/2Vm8gyqB3iFGfE7Akd81/LT0w137DP3Teij hVKw== 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=mJObmosw0ECxR5bJoxzM8fJ9A3xHxXUklA4Az95YtEw=; b=sEV+9UulFyDCS1CxrL9RsEYOVtbAI9FvmJLCAsxe5Y5rI1Vf669xPeaW2y9HTB7oDH L63bLRPma5odh5QNCt9poNjTxLSfOQm6eYZHAhQU4Xc7Y8NrO5OoYsRt6h1qL0OsoPoq C/fcPapRC3PRCFTsLqEXCtDk9gviyjU3Z3IcHuedqZbLEV1vrsIeJiyurvdthifnkfHb S6Ed6IvqM9EmR0ZBYePVd1GbNp+DYo8Vzkm3Ry4yz+0CNPaOJtRvbhm8utQLxDkobfiQ CMBDofVLq70vgXgoGA9r0DoPyiCpzpGItAv4XKmeywKeeZ6thMJMic8vIfHteZ1oqWmt 1o2w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=v7SItLgk; 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 x4si21794479ilj.71.2021.07.25.21.51.56; Sun, 25 Jul 2021 21:51:56 -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=v7SItLgk; 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 S229580AbhGZEL0 (ORCPT + 3 others); Mon, 26 Jul 2021 00:11:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38580 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229468AbhGZELZ (ORCPT ); Mon, 26 Jul 2021 00:11:25 -0400 Received: from mail-pj1-x1031.google.com (mail-pj1-x1031.google.com [IPv6:2607:f8b0:4864:20::1031]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 40983C061760 for ; Sun, 25 Jul 2021 21:51:55 -0700 (PDT) Received: by mail-pj1-x1031.google.com with SMTP id gv20-20020a17090b11d4b0290173b9578f1cso12094440pjb.0 for ; Sun, 25 Jul 2021 21:51: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:mime-version :content-transfer-encoding; bh=mJObmosw0ECxR5bJoxzM8fJ9A3xHxXUklA4Az95YtEw=; b=v7SItLgkseAmfU2SuQoWbIGar0knRK0cIjLDi+TJza2wkb62A0wyaMZI4pIbqEpqR3 9D20yhOV9HG4H1AiGzztWiX33fsODizFsIMj863LwJ2VQpaDz/3V36RIir4OqV6uDX/1 K44beOOsdsumld4Peg+pzllADsAKuxQ8z89dp9seCs0d9xpu+4YWMUL3FOf0LyibnV5k i1yKFLLsCF/sXIYMCeiSBYVczAP22hSukf5bkiroV8p8ksxpkvWN4eXGCusCyEWR5aFW 4zV6AnUjLYKiGe8cQcsFr21zGL5WCm5JRKMOGXDJgyzoZ4PLuKd+EwGYLHW9psHvNH4C wGRg== 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=mJObmosw0ECxR5bJoxzM8fJ9A3xHxXUklA4Az95YtEw=; b=EIpVfowdR8Y/vawc34zcCFtKp5Bs5G/80hB5JowL6dEYJqJqWO5P9bC5Tk3LFGQ10p AArimPjoEWRU4sIk5THbw0dfRsb+zUzgmCX8qTG0OrUASYPTSrd1MKumzt4NJGOXlyqx Lvz9s0ocJh09NNEkv4KgVhKtQIZaKmwg9mRXXgEmYHwSkDO4NboIVBnvNfKm0ZMbF/2s lacrgLHtDlt4YGfp1AleAC1s1tI/tHV+eSJPy5OjWv78B1BzSpPJdnIKILvoTv8OcPHz GGOxBaMWVU+hs14k87c2phogStUnEnMcTsLNSL5v0iahywbkPMyZX6jHC1gIjxRWCmvJ S9Rw== X-Gm-Message-State: AOAM533chYo5r/90y5y8weBbVg0EgHSeBkRQe2BLh4kfLr2lqOrg/uaT ttfKPFZ08sxFLmb4YJi5n//ijA== X-Received: by 2002:a63:5706:: with SMTP id l6mr16514459pgb.217.1627275114651; Sun, 25 Jul 2021 21:51:54 -0700 (PDT) Received: from localhost ([122.172.201.85]) by smtp.gmail.com with ESMTPSA id v5sm46165190pgi.74.2021.07.25.21.51.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 25 Jul 2021 21:51:53 -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 V3 0/5] virtio: Add virtio-device bindings Date: Mon, 26 Jul 2021 10:21:40 +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. Pending: - Arnd suggested that "virtio,deviceXX" may be a better compatible string, while I used "virtio,XX" to match what PCI and USB do currently. I didn't change it yet to hear Rob's view on the same before making the change, in case he has any preferences. 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 | 60 +++++++++++++++++++ .../devicetree/bindings/i2c/i2c-virtio.yaml | 51 ++++++++++++++++ .../devicetree/bindings/virtio/mmio.yaml | 2 +- .../bindings/virtio/virtio-device.yaml | 47 +++++++++++++++ drivers/virtio/virtio.c | 57 +++++++++++++++++- include/uapi/linux/virtio_ids.h | 12 ++++ 6 files changed, 225 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 Reviewed-by: Arnd Bergmann , except