From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-oa1-f44.google.com (mail-oa1-f44.google.com [209.85.160.44]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A277D6713 for ; Tue, 6 Sep 2022 15:55:55 +0000 (UTC) Received: by mail-oa1-f44.google.com with SMTP id 586e51a60fabf-127a0d798bdso8755658fac.4 for ; Tue, 06 Sep 2022 08:55:55 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date; bh=2Fy4H2MBwjVVVrFLZsY4ti38bj+tXW/iTfIXfNTv+3g=; b=Nqy1b1KYx30siytrytsKgHSdBn7QwyvQuhzU+q613PNLx4mHHoEiIvMINwMBG8S5BS xsUp4nwCuGRA1Ao9bCJ2pvW75YTketx30WveP0h0nkcVk4EFykwOVXlSzVwRNttA8tFg tOHIWbttYXuXaURtJOW98FXumBCY/5D66zpIyN7351SmxhB6SPcWWwITaoEAoOJ9v9RU craGUuMybVkU5N7qpEImXnPOsseSSjC/yahIMAr8OSYNfgXi9qu0D+eoClHciQVVMqgm kwpGxP+3t+Y6Ujyyio3q/lmk1WuqhNSddKZC18DpSETGC8WM8XlqFU/z6KtztGdrF9CE mOLA== X-Gm-Message-State: ACgBeo2+yl6C5HIU+0B8t9oCagkCmFtoPxnWFRBEonfwa1uQpjRojlmZ UFArVdbd50bdGhjM12UUqA== X-Google-Smtp-Source: AA6agR6qziKVqiJIw7PdgqemkFs/WLC9+0abUzjCVXa8LjJdoJxpx0czecK1Nr0cIDU7nnpcz2j3+w== X-Received: by 2002:a05:6870:6195:b0:127:3394:9c with SMTP id a21-20020a056870619500b001273394009cmr6323369oah.218.1662479754538; Tue, 06 Sep 2022 08:55:54 -0700 (PDT) Received: from robh.at.kernel.org (66-90-144-107.dyn.grandenetworks.net. [66.90.144.107]) by smtp.gmail.com with ESMTPSA id b20-20020a05687061d400b001275f056133sm3074236oah.51.2022.09.06.08.55.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Sep 2022 08:55:54 -0700 (PDT) Received: (nullmailer pid 594109 invoked by uid 1000); Tue, 06 Sep 2022 15:55:53 -0000 Date: Tue, 6 Sep 2022 10:55:53 -0500 From: Rob Herring To: "Russell King (Oracle)" Cc: Mark Kettenis , Hector Martin , linus.walleij@linaro.org, krzysztof.kozlowski@linaro.org, arnd@arndb.de, lee@kernel.org, alyssa@rosenzweig.io, asahi@lists.linux.dev, brgl@bgdev.pl, linux-arm-kernel@lists.infradead.org, linux-gpio@vger.kernel.org, sven@svenpeter.dev, krzysztof.kozlowski+dt@linaro.org, devicetree@vger.kernel.org Subject: Re: [PATCH 1/6] dt-bindings: mfd: add binding for Apple Mac System Management Controller Message-ID: <20220906155553.GB534217-robh@kernel.org> References: <909bb4e7-5bd2-2903-5bba-87ae37f3448a@marcan.st> <5b75dc7e-5337-73eb-450f-b72f479793c4@marcan.st> Precedence: bulk X-Mailing-List: asahi@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: On Tue, Sep 06, 2022 at 03:54:50PM +0100, Russell King (Oracle) wrote: > On Tue, Sep 06, 2022 at 04:25:49PM +0200, Mark Kettenis wrote: > > > Date: Tue, 6 Sep 2022 22:53:47 +0900 > > > From: Hector Martin > > > > > > I agree that this is something to think about (I was about to reply on > > > the subject). > > > > > > I can think of two ways: using `reg` for the key name, but that feels > > > icky since it's ASCII and not *really* a register number/address, or > > > something like this: > > > > > > gpio@0 { > > > apple,smc-key-base = "gP00"; > > > ... > > > } > > > > > > gpio@1 { > > > apple,smc-key-base = "gp00"; > > > ... > > > } > > > > This would still require us to add a (one-cell) "reg" property and > > would require adding the appropriate "#address-cells" and > > "#size-cells" properties to the SMC node. > > Yes, and at that point, as I suggested, it probably would be better > to use: > > #address-cells = <1>; > #size-cells = <0>; > > gpio@67503030 { > reg = <0x67503030>; > }; > > gpio@67703030 { > reg = <0x67703030>; > }; > > Then the "reg" has a meaning that is directly related to the SMC. That's certainly odd, but if that's how it is addressed, then okay I suppose. > > > > But this ties back to the device enumeration too, since right now the DT > > > does not drive that (we'd have to add the subdevice to the mfd subdevice > > > list somehow anyway, if we don't switch to compatibles). > > > > > > I'd love to hear Rob's opinion on this one, and also whether the > > > existing Linux and OpenBSD code would currently find gpio@0 {} instead > > > of gpio {} for backwards compat. Node names are generally not considered ABI except when they are. :) Generally, core code doesn't care. Specific bindings with defined child nodes often do, but finding nodes by compatible is strongly preferred. Linux drivers can bind by node name (w/o unit-address), but that's really only ever done on ancient h/w. > > > > The OpenBSD driver does a lookup by name and the "@0" is part of that > > name. So that would break backwards compat. > > Oh, that's annoying - and is a different behaviour to Linux. > > On Linux, we only look at the node name up to the @ when matching (see > of_node_name_eq() in drivers/of/base.c, so it doesn't matter to Linux > what follows the @ when you try to look up a node named "gpio" - you'll > find gpio@anythingyoulike. > > > Maybe just name the slave GPIO controller "gpio-slave"? If we add > > compatibles, the compatibles for the nodes should propbably be > > different such that we can switch to do a lookup by compatible? > > I don't think the DT folk would be happy with "gpio-slave" because > node names are supposed to be generic. Also, "slave" probably isn't > a good choice of name in this modern era given past history. Yeah, not a great choice for both reasons. > Rather than the above, we could use "reg" to indicate which GPIO > controller we're talking about, and lookup the reg value in a table > to give the key. So gpio@0, reg=<0> => gP00, gpio@1, reg=<1> => gp00. > gpio@2, reg=<2> => whatever next. Keep in mind that for any level, there is only 1 address space. So if there's anything else with multiple instances, they share the same address space. IOW, you couldn't have say 'rtc@1'. (Another example of why I want to see a full picture.) > > That sounds like it won't break the existing OpenBSD. No? Isn't OpenBSD looking for 'gpio' which wouldn't find 'gpio@0'? Rob