From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 349F9C04A68 for ; Wed, 27 Jul 2022 16:27:42 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id CE8BB83FA5; Wed, 27 Jul 2022 18:27:39 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=metanate.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=metanate.com header.i=@metanate.com header.b="UUUtBsLK"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 91AEF84062; Wed, 27 Jul 2022 18:27:38 +0200 (CEST) Received: from metanate.com (unknown [IPv6:2001:8b0:1628:5005::111]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 56B3884099 for ; Wed, 27 Jul 2022 18:27:36 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=metanate.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=john@metanate.com DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=metanate.com; s=stronger; h=In-Reply-To:Content-Type:References:Message-ID: Subject:Cc:To:From:Date:Reply-To:Content-Transfer-Encoding:Content-ID: Content-Description; bh=Jz8oCRnehIeYyZE+El1s/IJtbg+FKX1qQuSndFpI/mk=; b=UUUtB sLKYKEGXPZfL3rIHvNtRYcZ4m7b5IN/+7b1XUd2/C3hXBTgY9l/lgB0tmJtt5bgPGvsVdK6iWJEx3 sEUMLtI+zHGumg/E5ZHfJFVgP4JoGRx/s0rtGPr+LQL6Vb+ilI/b0qk9zUkiMIQK6NLry5DyfnK3p ftNUSzeu677GqDIj2/wLuu8OPDanLPCuRq75HFer+gzFNGFS9FROxCjeFNp2EuSPu/D1g6j/ZQvtf p5NjOqk18uhzxYilC0ke6UwZmvy+ND7XdmYAQ6lMxfchmomgSz/I6zMW0rOCvaxSJyebrr+27V+B+ /F+LM4iqb9Tr9W2Lg84OrFrM+103Q==; Received: from dougal.metanate.com ([192.168.88.1] helo=donbot) by email.metanate.com with esmtpsa (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1oGjsi-0000G9-Tu; Wed, 27 Jul 2022 17:27:33 +0100 Date: Wed, 27 Jul 2022 17:27:32 +0100 From: John Keeping To: Simon Glass Cc: U-Boot Mailing List , Philipp Tomsich , Kever Yang Subject: Re: [PATCH/RFC] rockchip: derive GPIO bank from alias if available Message-ID: References: <20220726162509.1304234-1-john@metanate.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Authenticated: YES X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.6 at phobos.denx.de X-Virus-Status: Clean Hi Simon, On Tue, Jul 26, 2022 at 01:53:44PM -0600, Simon Glass wrote: > On Tue, 26 Jul 2022 at 10:25, John Keeping wrote: > > > > Upstream device trees now use standard node names like "gpio@ff..." but > > the rk_gpio driver expects a name like "gpio0@ff..." (note the index > > before the @). > > > > This is not a change that can be made in a -u-boot.dtsi file, so > > updating to the latest upstream device trees requires updating the > > driver. > > > > When a sequence number is given explicitly via an alias it makes sense > > to use this for the bank number (and aliases can be added via > > -u-boot.dtsi when they are not present upstream), so make this the > > preferred scheme for assigning a bank index, falling back to the current > > method if no alias is defined. > > > > Signed-off-by: John Keeping > > --- > > I'm not sure if it would be better just to use dev_seq(dev) > > unconditionally here. If no aliases are defined, then the device tree > > nodes are in the right order for all Rockchip SoCs anyway so the > > sequence numbers will be sensible. > > Well dev_seq() should now match the alias numbers if provided, so it > seems better. Right, when there are aliases dev_seq() is definitely right, but currently the bank number is derived from a node like: gpio0: gpio0@ff750000 { where the name is "gpio0@..." and it's that zero that is used to determine the bank. I don't think all boards define aliases for the GPIOs, so I thought it might be better to preserve the existing node-name scheme when no alias is set. But there seems to be quite a push towards standardised node names upstream so eventually updating the device trees from upstream will break this scheme. Having looked around a bit more, it seems that of the drivers generating a bank name with 'A'+index, while PIC32 uses the same node name scheme as Rockchip, both octeon and mvebu use dev_seq(), so it does seem sensible to just switch to dev_seq() as the right way to do this. Regards, John