Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp1255740imm; Wed, 23 May 2018 12:55:44 -0700 (PDT) X-Google-Smtp-Source: AB8JxZoVBu0WijKm/iapwMmeJZ922gOFcExoj3FN/Czfdfhrpj+V4gDWFtvIBvvxVkam554ZQucP X-Received: by 2002:a65:4a46:: with SMTP id a6-v6mr3404809pgu.227.1527105344675; Wed, 23 May 2018 12:55:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527105344; cv=none; d=google.com; s=arc-20160816; b=SsrLgtY0bWnveL/YW0RYtsbN6mdSv0Fky2j2cb5cS+Vv4Cqr3ues2oFZN/RWpAxyCv OfcVfABooQz6sgkCDKF5sfjAwjBlTZw7JiUzr4lTFbs9B6hWGhbJeodGiH51APjs7krO W5I/ewEPpqmDNj/CdD46eQi50Sz/99MhbWLZ/qCll4A+pFPz5AYA9u39kdYiXjmPsKgQ Us1imQcMewOLWmqVwdTy6hGr0N3AdfasB9BTtppccYbhur2J8ivmiMtaw5svMvRVAncH wT9rLpXJ8jgcKO36Drl/BqYROl/IBjLjhk/rCpuit05a8T43QqsVwVCT4aFlJjeSpG/5 UQ5Q== 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:cc:to:subject :message-id:date:from:references:in-reply-to:mime-version :dkim-signature:arc-authentication-results; bh=vA1uafpMtntiaHto9NlY/ploSZP5sseGRSzj2B8BmdM=; b=l35RNsPpS2SME57xxvA2CFMfdcMAVDSGCi6dceUkafaXeEN2SkbvUSQSfosz0x9mYs Vp7zHZdnqD6vBtsWwIrTv3bbY21Ub9265uEHo2zBXrVmePBRlbNXrgzTwVTO40U2NM8Q 9z495/uhkeMCLykeY5AuivshfkEG/5WBeXGvrOw3sUcO+eXLrHanZIRBjIajM7ohFKly FzJt3xXGPZ2dbQVuKDGaQh2/a6aZEcoe/KPhSYxudA/1bYG4mbCvYh2Qdf3q26GfyGVE nUILKKJpzbKFPcKq8p6ca06+ClP7QAt1kQYHNkicsezErD16RujOhiLNZuyaDBueOqjV GpqA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=fGvl9jiR; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 32-v6si19839098pls.157.2018.05.23.12.55.29; Wed, 23 May 2018 12:55:44 -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; dkim=pass header.i=@kernel.org header.s=default header.b=fGvl9jiR; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934664AbeEWTyS (ORCPT + 99 others); Wed, 23 May 2018 15:54:18 -0400 Received: from mail.kernel.org ([198.145.29.99]:47422 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934181AbeEWTyP (ORCPT ); Wed, 23 May 2018 15:54:15 -0400 Received: from mail-qt0-f175.google.com (mail-qt0-f175.google.com [209.85.216.175]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id F19862087A; Wed, 23 May 2018 19:54:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1527105255; bh=w07aKfawXsgyDVpNosj4GFL0e60guQejIyK1YxcEfXY=; h=In-Reply-To:References:From:Date:Subject:To:Cc:From; b=fGvl9jiRKXeIy5gl0e5if8vMBo6wSmO1LLrUUGoQM7xtQb5WtDTcvfz5W8QVsMiKJ Vf2xsOiDaVdO/NUlIVDwYSiOUSWjeRoZweZXwUVqQsuQINQkNl1BIQGGqKMhYUPJ8L LWkZmaRmt+ayHQtkytYsCIi6m08UazVBU7l+FnKE= Received: by mail-qt0-f175.google.com with SMTP id 32-v6so5725484qtr.13; Wed, 23 May 2018 12:54:14 -0700 (PDT) X-Gm-Message-State: ALKqPwcMOetOSk40RZOIFt8Ms0WpURBa2WlQfdQ3ERiM64Y5CNkZoxex A6PfAdBPqYJHdWONDgqo0Os3XO0C/3wwm1yjyg== X-Received: by 2002:aed:26c3:: with SMTP id q61-v6mr4336209qtd.60.1527105254100; Wed, 23 May 2018 12:54:14 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a0c:9b02:0:0:0:0:0 with HTTP; Wed, 23 May 2018 12:53:53 -0700 (PDT) In-Reply-To: <1685755.J6GI985WX3@diego> References: <1526614328-6869-1-git-send-email-djw@t-chip.com.cn> <6ffb43dc-55a5-14eb-eb18-3a731cdaf424@t-chip.com.cn> <1685755.J6GI985WX3@diego> From: Rob Herring Date: Wed, 23 May 2018 14:53:53 -0500 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v2 2/5] gpio: syscon: Add gpio-syscon for rockchip To: =?UTF-8?Q?Heiko_St=C3=BCbner?= 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" Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, May 23, 2018 at 10:12 AM, Heiko St=C3=BCbner wrot= e: > Hi Rob, Levin, > > sorry for being late to the party. > > 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.tx= t >> >>> @@ -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 =3D Active high, >> >>> + 1 =3D 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 =3D "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 file= s", > 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/a= rch/arm/boot/dts/rk3288.dtsi#n855 > https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/a= rch/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. > The gpio in question is called "mute", so I'd think the gpio-syscon drive= r > 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. > So it should probably look like > > grf: syscon at ff100000 { > compatible =3D "rockchip,rk3328-grf", "syscon", "simple-mfd"; > > [all the other syscon sub-devices] > > gpio_mute: gpio-mute { > compatible =3D "rockchip,rk3328-gpio-mute"; > gpio-controller; > #gpio-cells =3D <2>; > }; > > [more other syscon sub-devices] > };