Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp2053352imm; Thu, 24 May 2018 05:08:37 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpPEJ2R+Ms8B6Em2Yh/CtEOjXuM3W90jeUmLjwDIlS8yDkranEiSEfdglvH6PfNMKQMk2k6 X-Received: by 2002:a63:ab05:: with SMTP id p5-v6mr5492468pgf.387.1527163717087; Thu, 24 May 2018 05:08:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527163717; cv=none; d=google.com; s=arc-20160816; b=BkI21AmcFdB4izYe0IFmErjeZvEeQ7Anl2SdTKt7L1AFZWoX6bAoXkcsP0OLORAoq4 aRsnvZ5A5x+r6eqELfX7efyEPqUTCUo6IlFc05JLfsgC305CxAx0L7OU2tv/IbtOs1tf VAYWOxzmKgPxCzpkBpbj0GoVkInoK4o+fEZczBZqkmGFX31/gdjtu+s+u2aGjxHUL7FC majyqSP2HC7PNkwZU9oLQ/mItsG2gXuNdEn9L3HbZmdH0KEFMbX0YhQzcpjwSaj0GiSo 2g8/Eeb4xOgdrEAOa1EeZozHZe89IsXAfmSLlE5p8z8J583HW5zjuXWXXQ7ouywRL8V9 G0LQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=N59AiP3Btu+dOM2C8fm6oInsxrf/CEGkvUnns0xP6h8=; b=exsKuL9J/aH9hjdxbpXm7aL9axQHgRC744AWz9XUyFnhZhaE6MVWESF3mVwM4aZyPN MZCrwNy4K/fcUIYUrByxMENm4lkK1AA1/JaLzhkP1MgBXXaUTN6B3PZDmzx3tmCGJSTS KcT5Byw9WKV4jbxXvom4dc9lcXQ0SPx4hs9YCbG7UPwOm2AmWUdJYB20Ipi6p7UZatGF EfYyvwpwCG+fcdDZtjgdYSnv7ECkZASvKmCNBdX8Y0DmELvEfgl44mnO6MLVnlrhTiGe wP6b187jveGaN5ejGe5heFfzp8K8hDhwAJkQ7E2tY3zvhPouK8OH/zpi86L7IN0jjomO 8StA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p18-v6si16661805pgv.493.2018.05.24.05.08.21; Thu, 24 May 2018 05:08:37 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S969673AbeEXMHc convert rfc822-to-8bit (ORCPT + 99 others); Thu, 24 May 2018 08:07:32 -0400 Received: from gloria.sntech.de ([95.129.55.99]:34242 "EHLO gloria.sntech.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S966644AbeEXMH0 (ORCPT ); Thu, 24 May 2018 08:07:26 -0400 Received: from wd0766.dip.tu-dresden.de ([141.76.110.254] helo=phil.localnet) by gloria.sntech.de with esmtpsa (TLS1.1:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.80) (envelope-from ) id 1fLp1X-0005HP-4K; Thu, 24 May 2018 14:07:15 +0200 From: Heiko Stuebner To: Rob Herring Cc: Levin Du , "open list:ARM/Rockchip SoC..." , Wayne Chou , devicetree@vger.kernel.org, Linus Walleij , "linux-kernel@vger.kernel.org" , "open list:GPIO SUBSYSTEM" , Mark Rutland , "moderated list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE" Subject: Re: [PATCH v2 2/5] gpio: syscon: Add gpio-syscon for rockchip Date: Thu, 24 May 2018 14:07:09 +0200 Message-ID: <3307687.qJF5Pr3uHG@phil> In-Reply-To: References: <1526614328-6869-1-git-send-email-djw@t-chip.com.cn> <1685755.J6GI985WX3@diego> MIME-Version: 1.0 Content-Transfer-Encoding: 8BIT Content-Type: text/plain; charset="iso-8859-1" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Rob, Am Mittwoch, 23. Mai 2018, 21:53:53 CEST schrieb Rob Herring: > On Wed, May 23, 2018 at 10:12 AM, Heiko St?bner wrote: > > Am Mittwoch, 23. Mai 2018, 16:43:07 CEST schrieb Rob Herring: > >> On Tue, May 22, 2018 at 9:02 PM, Levin Du wrote: > >> > On 2018-05-23 2:02 AM, Rob Herring wrote: > >> >> On Fri, May 18, 2018 at 11:52:05AM +0800, djw@t-chip.com.cn wrote: > >> >>> From: Levin Du > >> >>> > >> >>> Some GPIOs sit in the GRF_SOC_CON registers of Rockchip SoCs, > >> >>> which do not belong to the general pinctrl. > >> >>> > >> >>> Adding gpio-syscon support makes controlling regulator or > >> >>> LED using these special pins very easy by reusing existing > >> >>> drivers, such as gpio-regulator and led-gpio. > >> >>> > >> >>> Signed-off-by: Levin Du > >> >>> > >> >>> --- > >> >>> > >> >>> Changes in v2: > >> >>> - Rename gpio_syscon10 to gpio_mute in doc > >> >>> > >> >>> Changes in v1: > >> >>> - Refactured for general gpio-syscon usage for Rockchip SoCs. > >> >>> - Add doc rockchip,gpio-syscon.txt > >> >>> > >> >>> .../bindings/gpio/rockchip,gpio-syscon.txt | 41 > >> >>> > >> >>> ++++++++++++++++++++++ > >> >>> > >> >>> drivers/gpio/gpio-syscon.c | 30 > >> >>> > >> >>> ++++++++++++++++ > >> >>> > >> >>> 2 files changed, 71 insertions(+) > >> >>> create mode 100644 > >> >>> > >> >>> Documentation/devicetree/bindings/gpio/rockchip,gpio-syscon.txt > >> >>> > >> >>> diff --git > >> >>> a/Documentation/devicetree/bindings/gpio/rockchip,gpio-syscon.txt > >> >>> b/Documentation/devicetree/bindings/gpio/rockchip,gpio-syscon.txt > >> >>> new file mode 100644 > >> >>> index 0000000..b1b2a67 > >> >>> --- /dev/null > >> >>> +++ b/Documentation/devicetree/bindings/gpio/rockchip,gpio-syscon.txt > >> >>> @@ -0,0 +1,41 @@ > >> >>> +* Rockchip GPIO support for GRF_SOC_CON registers > >> >>> + > >> >>> +Required properties: > >> >>> +- compatible: Should contain "rockchip,gpio-syscon". > >> >>> +- gpio-controller: Marks the device node as a gpio controller. > >> >>> +- #gpio-cells: Should be two. The first cell is the pin number and > >> >>> + the second cell is used to specify the gpio polarity: > >> >>> + 0 = Active high, > >> >>> + 1 = Active low. > >> >> > >> >> There's no need for this child node. Just make the parent node a gpio > >> >> controller. > >> >> > >> >> Rob > >> > > >> > Hi Rob, it is not clear to me. Do you suggest that the grf node should be > >> > a > >> > gpio controller, > >> > like below? > >> > > >> > + grf: syscon at ff100000 { > >> > + compatible = "rockchip,gpio-syscon", "rockchip,rk3328-grf", > >> > "syscon", "simple-mfd"; > >> > >> Yes, but drop "rockchip,gpio-syscon" and "simple-mfd". > > > > I would disagree quite a bit here. The grf are the "general register files", > > a bunch of registers used for quite a lot of things, and so it seems > > among other users, also a gpio-controller for some more random pins > > not controlled through the regular gpio controllers. > > > > For a more fully stocked grf, please see > > https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/arch/arm/boot/dts/rk3288.dtsi#n855 > > https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/arch/arm64/boot/dts/rockchip/rk3399.dtsi#n1338 > > > > So the gpio controller should definitly also be a subnode. > > Sigh, yes, if there are a bunch of functions needing subnodes like the > above, then yes that makes sense. But that's not what has been > presented. Please make some attempt at defining *all* the functions. > An actual binding would be nice, but I'll settle for just a list of > things. The list should have functions that have DT dependencies (like > clocks for phys in the above) because until you do, you don't need > child nodes. That's the problem with the Rockchip-GRF, you only realize its content when implementing specific features. Like on the rk3399 the table of the register-list of the GRF alone is 11 pages long with the register details tables taking up another 230 pages. And functional description is often somewhat thin. So I'm not sure I fully understand what you're asking, but in general we define the bindings for sub-devices when tackling these individual components, see for example https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit?id=72580a49a837c2c7da83f698c00592eac41537d8 which also has a real phy-driver behind it and binding against that subnode of the GRF simple-mfd. These are real IP blocks somewhere on the socs, with regular supplies like resets, clocks etc in most cases. Only their controlling registers got dumped into the GRF for some reason. And in retrospect it really looks like we're doing something right, because it seems these bindings seem quite stable over time. > > The gpio in question is called "mute", so I'd think the gpio-syscon driver > > should just define a "rockchip,rk3328-gpio-mute" compatible and contain > > all the register voodoo in the driver itself and not define it in the dt. > > Is there really just one GPIO? If it has a defined function, then is > it really GP? Can you control direction? I know Linus W doesn't like > that kind of abuse of GPIO. looks like I convinced Linus that we're not abusing anything with this :-) . Heiko