Received: by 2002:ab2:7444:0:b0:1ef:b27b:cc29 with SMTP id f4csp2695312lqn; Wed, 20 Mar 2024 11:44:42 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWgtyt/y9NKsN1YneiEKPA4Uq5S3a+EUfzSqXC37U91kCC4h/+q0oQlDBItbqNTg9g/SL9WdSkLAxj1i0ln55X6jZ5NmASBq1apliXbgg== X-Google-Smtp-Source: AGHT+IEbtxvECmWmHjHibFWgxUKxTRpcRjTOOdrmc6nSFpt9TGVjIRCNPKZNuc5zBUV1QN2rcKzF X-Received: by 2002:a05:622a:202:b0:42e:f645:50b5 with SMTP id b2-20020a05622a020200b0042ef64550b5mr22511224qtx.30.1710960282460; Wed, 20 Mar 2024 11:44:42 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710960282; cv=pass; d=google.com; s=arc-20160816; b=F2m/60dKqXXL8oRsDeb5O6mf9sjyIFEqxrmb6m3gPk1/RF0zJIdPrHhwXHXqa4Ud6c xd/XgPk0jZUs8UHZIYI+Bxzo4nctvStRqvR4R22DFk7cSTZn1BNs4Nwliz1z3FobX87C 89r0oWDOuYNJcQalPhtdIxUAvC5kIF5jkdCgTyHSZNGcF95ZVrsTrA2nMmuERs51C5v/ aLIx1ovLvK0k2bsclxJxXBzscxxLRCFlJCc2qoWUDwIedSVVVi6jKnb/N4RgtrmUM1J9 xPJb2RxwE+RqGrLD0a/2ShuKnjf3Q+JPL/kGc/ja5u5Cz74z84Z+BVIByq6wpL93z8b7 PM+g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=fEgErpl+wLpV80SuRfPGE67eSPI0zTuNiDl4KjehtmY=; fh=xMaTgv73FRGe42XpVs0P27prC5Olzi1hNkU4c2mVrnE=; b=lqg1REBd5PSlfXsgPvRe8eMUjei+69JmG4T2d/oHkRg4W1xmxdTIHEH6Ts8N6GTkLg BWGwLHS94lFdAifRsmqgDMrfKlqQWbyXUsgio/qTUe4AFeNdJrfH0SCH4VZdp2DmrFar ysvwPNYbJGDrWr+VP1O8fatfxl7rq416iN1r0LIUxWINXD60yPCqGFdjB+3msA4G4E8T /EOgTzhScGaEn8Z0JPCwz3LHJEWW1Mj8d6Bknw18Bm4+by8U/iY4ZOWGsqPS3RqZecBC OJPsWPx4xq21zO0e9GNbjmY/ZkK1pi06zb2TMsNH3Xh4aqO5naT41LfIOVqIs1kBK9LG nwnw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b=J+vujSF5; arc=pass (i=1 spf=pass spfdomain=lunn.ch dkim=pass dkdomain=lunn.ch dmarc=pass fromdomain=lunn.ch); spf=pass (google.com: domain of linux-kernel+bounces-109305-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-109305-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=lunn.ch Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id bb42-20020a05622a1b2a00b00430978895edsi9573378qtb.425.2024.03.20.11.44.42 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Mar 2024 11:44:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-109305-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b=J+vujSF5; arc=pass (i=1 spf=pass spfdomain=lunn.ch dkim=pass dkdomain=lunn.ch dmarc=pass fromdomain=lunn.ch); spf=pass (google.com: domain of linux-kernel+bounces-109305-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-109305-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=lunn.ch Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 10CEC1C212CB for ; Wed, 20 Mar 2024 18:44:42 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2783D8529E; Wed, 20 Mar 2024 18:44:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=lunn.ch header.i=@lunn.ch header.b="J+vujSF5" Received: from vps0.lunn.ch (vps0.lunn.ch [156.67.10.101]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 10B4352F78; Wed, 20 Mar 2024 18:44:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=156.67.10.101 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710960274; cv=none; b=R5/RWa1ckR63uXtALaGJWOhQ76QfWcsZ4tPlHSrF/wueNalh+v119hrMqKskwNPUEbG70aR5s9xZckEwinluxswdwlUs0eRWHO9NRM5OHvbBPotWQUQ7GZU0gSFM10rIhtuV2fc61Hm2pkI/91ed8AH5vB7E5KbfHk8KhqLjmwg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710960274; c=relaxed/simple; bh=ti10f1siFmjiL/455g1TgRS6RuhZRQCdTQdiF11FS44=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=pqQeP/pyajlDpE7vRpWEkiA+RxZFGMFdDE6KYH3nqF8324ot99H+R35zS53yQVOdmaYyXcVR1f0EMna2qOO/NLRbbyEvjE38s4bJ3FCRk9YwHjmtrTnNLIqxFsBTB4yiylD+Sxn9HU21TM9IFWOO72G6cloaijMrtRknILwxPMU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=lunn.ch; spf=pass smtp.mailfrom=lunn.ch; dkim=pass (1024-bit key) header.d=lunn.ch header.i=@lunn.ch header.b=J+vujSF5; arc=none smtp.client-ip=156.67.10.101 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=lunn.ch Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=lunn.ch DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lunn.ch; s=20171124; h=In-Reply-To:Content-Disposition:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:From:Sender:Reply-To:Subject: Date:Message-ID:To:Cc:MIME-Version:Content-Type:Content-Transfer-Encoding: Content-ID:Content-Description:Content-Disposition:In-Reply-To:References; bh=fEgErpl+wLpV80SuRfPGE67eSPI0zTuNiDl4KjehtmY=; b=J+vujSF5pSb6RzVvu6NEt28gQM wgIlw3qz/q/rm1P4Ngknf+9+CCm5jw7vboMtODYv7u9v0R/rD7vTnQNosUl/u8sQwTRQaEe8ZWV+D XNYDL39sv97jA6+xLw2WaXD5qhG5gUKyXwCt9IBs+tEgazof4DBoeQzTzjh/hLdcSWwE=; Received: from andrew by vps0.lunn.ch with local (Exim 4.94.2) (envelope-from ) id 1rn0v4-00AoEN-42; Wed, 20 Mar 2024 19:44:10 +0100 Date: Wed, 20 Mar 2024 19:44:10 +0100 From: Andrew Lunn To: Ayush Singh Cc: Vaishnav Achath , Michael Walle , Krzysztof Kozlowski , open list , jkridner@beagleboard.org, robertcnelson@beagleboard.org, lorforlinux@beagleboard.org, Rob Herring , Krzysztof Kozlowski , Conor Dooley , Nishanth Menon , Vignesh Raghavendra , Tero Kristo , Derek Kiernan , Dragan Cvetic , Arnd Bergmann , Greg Kroah-Hartman , Mark Brown , Johan Hovold , Alex Elder , "open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS" , "moderated list:ARM/TEXAS INSTRUMENTS K3 ARCHITECTURE" , "open list:SPI SUBSYSTEM" , "moderated list:GREYBUS SUBSYSTEM" , Vaishnav M A Subject: Re: [PATCH v4 1/5] dt-bindings: misc: Add mikrobus-connector Message-ID: References: <5a9b1cd9-05ec-4606-92b6-eadbc7af6202@gmail.com> <81ec4156-8758-406e-876b-5acf13951d09@gmail.com> <2eec6437-dd11-408d-9bcb-92ba2bee4487@ti.com> <28c995cb-1660-435f-9ee4-1195439231f0@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: On Wed, Mar 20, 2024 at 10:09:05PM +0530, Ayush Singh wrote: > On 3/20/24 01:02, Andrew Lunn wrote: > > > > Yes, after discussion with Vaishnav and trying to brainstorm some way to do > > > the same thing with dt overlays, it seems that trying to use dt overlays > > > will mean need to have completely separate implementation of mikroBUS for > > > local ports and mikroBUS over greybus. > > Could you explain why please? > > > > Are greybus I2C bus masters different from physical I2C bus masters? > > Are greybus SPI bus masters different from physical SPI bus masters? > > Well, they are virtual, so they are not declared in the device tree. I have > linked the greybus i2c implementation. It basically allocates an i2c_adpater > and then adds it using `i2c_add_adapter` method. This adapter can then be > passed to say mikroBUS driver where it can be used as a normal i2c_adapter, > and we can register the device to it. Being virtual does not really stop it being added to the DT. I'm making this all up, but i assume it will look something like this: greybus@42 { compatible = "acme,greybus"; reg = <0x42 0x100>; This would represent the greybus host controller. module@0 { reg = <0>; This would represent a module discovered on the bus. I assume there is some sort of addressing? The greybus core code dynamically creates the node in DT to describe the modules it has discovered. This is not too different to USB. You can already describe USB devices in DT, but the assumption is you know they exists, e.g. because they are hard wired, not hot-plugable. The USB core will associate the USB device with the node in DT. But actually creating a node in DT is not too big a jump. interface@0 { compatible = "greybus,i2c"; reg = <0>; } interface@1 { compatible = "greybus,spi"; reg = <1>; } interface@10 { compatible = "greybus,gpio"; reg = <10>; } It can then enumerate the interfaces on the module, and create the I2C node, SPI bus node, the gpio controller etc. Again, the greybus core can add nodes to DT to described the discovered hardware, and associate them to the linux devices which are created. That gives you what you need to load a DT overlay to make use of these devices. That overlay would contain one of your virtual mikroBUS controllers. This virtual controller is basically a phandle-proxy. The virtual mikroBUS controllers is a consumer of phandles to an I2C bus, an SPI bus, GPIO bus which makes up the pins routed to the mikroBUS connector. The virtual mikroBUS controllers is also a provider of an I2C bus, an SPI bus, GPIO controller. The mikroBUS device consumes these I2C bus, SPI bus etc. The virtual mikroBUS controllers makes it simpler for the device to find the resources it needs, since they are all in one place. For a physical mikroBUS you have a DT node with phandles to the physical devices. For greybus you create a virtual device with phandles to the virtual devices added to the DT bus. You then have everything you need to describe the mikroBUS devices. For very simple devices you convert the manifest to a DT overlay and load it. For complex devices you directly use a DT overlay. I also don't see any need to do the manifest to DT overlay conversion on the fly. You have a database of manifests. They could be converted to DT and then added to the linux-firmware repo, for example. If device with an unknown manifest is found, it should be possible to read the manifest in userspace via its eeprom in /sys/class/. An tool could create DT blob and add it to /lib/firmware to get it working locally, and provide suggestions how to contribute it to the linux firmware project? Andrew