Received: by 2002:ab2:6d45:0:b0:1fb:d597:ff75 with SMTP id d5csp347968lqr; Wed, 5 Jun 2024 07:52:21 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCW7nK/6h5CodXLpjL/6XZoiIWQG8UNMDD0RTLDjDFqYTDYn3zbseH2LbLy0sY5hLN7YYBnLqJyDWqc6mA2RBCAn5TVyvbji1f+XuDw4wA== X-Google-Smtp-Source: AGHT+IH60KWUi9p0mFDCnnSAla1j9emtZUzso7Vlx6+USn/CsB5SWqlT4ZJwsFHtwfp96vKLa4u1 X-Received: by 2002:a05:6a00:2e85:b0:702:5950:178b with SMTP id d2e1a72fcca58-703e5a5b653mr3071221b3a.30.1717599141568; Wed, 05 Jun 2024 07:52:21 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717599141; cv=pass; d=google.com; s=arc-20160816; b=meIm2xVq959EGmQSFJqomq8gPHEvy0xKB8jGPvOlWp5RAwn8X5GmxqhX9rwyStdEK7 sgq66mi1RgNpz1YyRiflNfsV1lWBcjtIKNJ4VjLh/DHRYXH+a10TSRknOs4dp52zpWwt Vfo5tpNK5TU+qxVoNT7osKU4H2+cwEwRpxirW2pAAgFfrFFgTMmsoDY54DlVJGj3spTq a32w9ERjdZ7zd/dv9QgRWjm3Ex3p2v0ZZ91d52uhtNNrx/82x0iB9rXJGJwPN4WR4lQO znOBqjouKJS/dHICbaaaweuv49ryrU/LVDDl7maaV3FwTdOEE9QCtCseCY6W97ASmIq+ Cl6A== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:message-id:subject:cc:to:from:date:dkim-signature; bh=vJ2LLNkUm7RsaUN9fsalJ2juc8iIDvMTFH7/Oos+5ds=; fh=nTwXZgWKusxbGlNkWPWDsVXw7g5CPXC41UPtym6Ceh4=; b=p0o59wHE5D8an8tIgThl7IatzQlkrQ6xcSYbuKum6eYIasjByoaon9bBu56koAd9Jm IMlr6W5QVtWRtZIVfMtPifpXLRN8Q6Rn+lZso290LZttCMMWNK7MRURIQ94MiwVsEsrg 7iKRV8j/e5jzIVZGXJFVih0PZazqwAPUt8QTeI6EWHs4Uw6inU3ajet9kar4tz0uprx9 m/BO+v92+nhddEdqLHX5XoO20ZNp95R5LHSGD+uC3JDYCXNCcvxjSBHk9yZHlP81i9JB AY7DUD0t1IAP9TIWFBTcxgqoT1jEePh/JI1to9ozdTC94R8Y4Nkk1FD+M2bx9ITIPWPc T5nw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=b+HGNOjL; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-202786-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-202786-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id d2e1a72fcca58-7026ecfe549si4005504b3a.84.2024.06.05.07.52.21 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Jun 2024 07:52:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-202786-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=b+HGNOjL; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-202786-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-202786-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org 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 sv.mirrors.kernel.org (Postfix) with ESMTPS id CEFDF287D9B for ; Wed, 5 Jun 2024 14:45:41 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C9F9327450; Wed, 5 Jun 2024 14:45:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="b+HGNOjL" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 9F5021426C; Wed, 5 Jun 2024 14:45:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717598734; cv=none; b=Md/0cvos77wrZfAJ2dTDkttPMNiie0BXrT8wZKp+Sgg21Ne6FNbzl9ndDE3W9Cj7ZmdIRML3oRzMpqopbDrxcYsvavbOmYa7gvCqi9Qenp1FOUTIC5A4Nbv7cgQ/c2oKbHmpwKqqlLonVOWPoeqQ0fk/VhedMrG23nSnOAs0XFw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717598734; c=relaxed/simple; bh=mHx8HVUaCOXB9TNFRsb/Kr5+jRe8xYJtJCTxzswwyL8=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=UEj5FZaWpVBeeFARmGiGRHpZOhMpe7p/jUeKSVUGKb4j/hattQ66/B/7p6f+5D/1p52fBQbluPHT5HTWwEUu9zEFEkKTbLytq/qwn2MLbX653oz9SMWOFIBsbyp0BffJpUS17dotjDwauqs5MR9NWcPTdLzGkym3fmeZQXRM0zg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=b+HGNOjL; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id C5BC0C2BD11; Wed, 5 Jun 2024 14:45:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1717598734; bh=mHx8HVUaCOXB9TNFRsb/Kr5+jRe8xYJtJCTxzswwyL8=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=b+HGNOjLTmLvbLanSFpFvA22GtGdn4J0i3MW2C5W4vRitwIq5oiSsfak1fBtzSLLr eTB/yjYVnzdgcPNUn7xbSGXexZSgk4GVvGRR0A5mhG9xTe5Hnh5X1gDP9owkFQYKbs 1EFC0SX8fgXlR/LRX7/yh925kcgccJU9pzYnO43yQBilSDoet1YyRanpsZRCbH3uwn jkPqU8K2EvZAgER8jcR7EXLDmfUh1AgoTw9Vl3TgA0du0pWTJcG8ebTPkFyXZYfpoT OBXDbACxvLYopLguh082VMxKZEFA8+YvKYBi8J1z9vDxfOFKUXqoCwkNDF7L9tSbXT GiDej3pcclA8g== Date: Wed, 5 Jun 2024 08:45:31 -0600 From: Rob Herring To: Luca Ceresoli Cc: Krzysztof Kozlowski , Conor Dooley , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter , Derek Kiernan , Dragan Cvetic , Arnd Bergmann , Greg Kroah-Hartman , Saravana Kannan , Paul Kocialkowski , =?iso-8859-1?Q?Herv=E9?= Codina , Thomas Petazzoni , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, Paul Kocialkowski , Srinivas Kandagatla , Miquel Raynal Subject: Re: [PATCH v2 1/5] dt-bindings: connector: add GE SUNH hotplug addon connector Message-ID: <20240605144531.GA2642279-robh@kernel.org> References: <20240510-hotplug-drm-bridge-v2-0-ec32f2c66d56@bootlin.com> <20240510-hotplug-drm-bridge-v2-1-ec32f2c66d56@bootlin.com> <20240510163625.GA336987-robh@kernel.org> <20240514185125.58225238@booty> 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=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20240514185125.58225238@booty> On Tue, May 14, 2024 at 06:51:25PM +0200, Luca Ceresoli wrote: > Hello Rob, > > +cc Srinivas and Miqu?l for the NVMEM cell discussion below > > On Fri, 10 May 2024 11:36:25 -0500 > Rob Herring wrote: > > > On Fri, May 10, 2024 at 09:10:37AM +0200, Luca Ceresoli wrote: > > > Add bindings for the GE SUNH add-on connector. This is a physical, > > > hot-pluggable connector that allows to attach and detach at runtime an > > > add-on adding peripherals on non-discoverable busses. > > > > > > Signed-off-by: Luca Ceresoli > > [...] > > > > +++ b/Documentation/devicetree/bindings/connector/ge,sunh-addon-connector.yaml > > > @@ -0,0 +1,197 @@ > > > +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) > > > +%YAML 1.2 > > > +--- > > > +$id: http://devicetree.org/schemas/connector/ge,sunh-addon-connector.yaml# > > > +$schema: http://devicetree.org/meta-schemas/core.yaml# > > > + > > > +title: GE SUNH hotplug add-on connector > > > + > > > +maintainers: > > > + - Luca Ceresoli > > > + > > > +description: > > > + Represent the physical connector present on GE SUNH devices that allows > > > + to attach and detach at runtime an add-on adding peripherals on > > > + non-discoverable busses. > > > + > > > + This connector has status GPIOs to notify the connection status to the > > > + CPU and a reset GPIO to allow the CPU to reset all the peripherals on the > > > + add-on. It also has a 4-lane MIPI DSI bus. > > > + > > > + Add-on removal can happen at any moment under user control and without > > > + prior notice to the CPU, making all of its components not usable > > > + anymore. Later on, the same or a different add-on model can be connected. > > > > Is there any documentation for this connector? > > > > Is the connector supposed to be generic in that any board with any SoC > > could have it? If so, the connector needs to be able to remap things so > > overlays aren't tied to the base dts, but only the connector. If not, > > then doing that isn't required, but still a good idea IMO. > > It is not generic. The connector pinout is very specific to this > product, and there is no public documentation. > > > > +examples: > > > + # Main DTS describing the "main" board up to the connector > > > + - | > > > + / { > > > + #include > > > + > > > + addon_connector: addon-connector { > > > > Just 'connector' for the node name. > > OK > > > > + compatible = "ge,sunh-addon-connector"; > > > + reset-gpios = <&gpio1 1 GPIO_ACTIVE_LOW>; > > > + plugged-gpios = <&gpio1 2 GPIO_ACTIVE_LOW>; > > > + powergood-gpios = <&gpio1 3 GPIO_ACTIVE_HIGH>; > > > + > > > + ports { > > > + #address-cells = <1>; > > > + #size-cells = <0>; > > > + > > > + port@0 { > > > + reg = <0>; > > > + > > > + hotplug_conn_dsi_in: endpoint { > > > + remote-endpoint = <&previous_bridge_out>; > > > + }; > > > + }; > > > + > > > + port@1 { > > > + reg = <1>; > > > + > > > + hotplug_conn_dsi_out: endpoint { > > > + // remote-endpoint to be added by overlay > > > + }; > > > + }; > > > + }; > > > + }; > > > + }; > > > + > > > + # "base" overlay describing the common components on every add-on that > > > + # are required to read the model ID > > > > This is located on the add-on board, right? > > Exactly. Each add-on has an EEPROM with the add-on model ID stored > along with other data. > > > Is it really any better to have this as a separate overlay rather than > > just making it an include? Better to have just 1 overlay per board > > applied atomically than splitting it up. > > (see below) > > > > + - | > > > + &i2c1 { > > > > Generally, I think everything on an add-on board should be underneath > > the connector node. For starters, that makes controlling probing and > > removal of devices easier. For example, you'll want to handle > > reset-gpios and powergood-gpios before any devices 'appear'. Otherwise, > > you add devices on i2c1, start probing them, and then reset them at some > > async time? > > This is not a problem because the code is asserting reset before > loading the first overlay. From patch 5/5: What if the bootloader happened to load the overlay already? Or you kexec into a new kernel? Keeping things underneath a connector node makes managing the dependencies easier. It also can allow us to have some control over what overlays can and can't modify. It also reflects reality that these devices sit behind the connector. > > static int sunh_conn_attach(struct sunh_conn *conn) > { > int err; > > /* Reset the plugged board in order to start from a stable state */ > sunh_conn_reset(conn, false); > > err = sunh_conn_load_base_overlay(conn); > ... > } > > > For i2c, it could look something like this: > > > > connector { > > i2c { > > i2c-parent = <&i2c1>; > > > > eeprom@50 {...}; > > }; > > }; > > I think this can be done, but I need to evaluate what is needed in the > driver code to support it. > > > > + #address-cells = <1>; > > > + #size-cells = <0>; > > > + > > > + eeprom@50 { > > > + compatible = "atmel,24c64"; > > > + reg = <0x50>; > > > + > > > + nvmem-layout { > > > + compatible = "fixed-layout"; > > > + #address-cells = <1>; > > > + #size-cells = <1>; > > > + > > > + addon_model_id: addon-model-id@400 { > > > + reg = <0x400 0x1>; > > > + }; > > > + }; > > > + }; > > > + }; > > > + > > > + &addon_connector { > > > + nvmem-cells = <&addon_model_id>; > > > + nvmem-cell-names = "id"; > > > + }; > > > > It's kind of sad that an addon board has an eeprom to identify it, but > > it's not itself discoverable... > > Not sure I got what you mean exactly here, sorry. Only that to be discoverable, you shouldn't need DT. > The add-on board is discoverable in the sense that it has a GPIO > (actually two) to be notified of plug/unplug, and it has a way to > describe itself by reading a model ID. Conceptually this is what HDMI > monitors do: an HPD pin and an EEPROM at a fixed address with data at > fixed locations. > > If you mean the addon_connector node might be avoided, then I kind of > agree, but this seems not what the NVMEM DT representation expects so > I'm not sure removing it would be correct in the first place. > > Srinivas, do you have any insights to share about this? The topic is a > device tree overlay that describes a hotplug-removable add-on, and in > particular the EEPROM present on all add-ons to provide the add-on > model ID. > > > Do you load the first overlay and then from it decide which > > specific overlay to apply? > > Exactly. > > The first overlay (the example you quoted above) describes enough to > reach the model ID in the EEPROM, and this is identical for all add-on > models. The second add-on is model-specific, there is one for each > model, and the model ID allows to know which one to load. So you don't really need an overlay for this unless the EEPROM model changes or the model-id offset changes. I suppose nvmem needs something in DT to register a region. That's really nvmem's problem, but I guess what you have is fine. Rob