Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp22318369ybl; Mon, 6 Jan 2020 23:52:20 -0800 (PST) X-Google-Smtp-Source: APXvYqwPd2X7kjV2DHCLxwPu7d1WTmIf4LOkNfvqi68QuHuSVP0mBDUOyfboLQSAHVx+INUDsWFP X-Received: by 2002:a9d:53cb:: with SMTP id i11mr123384625oth.158.1578383540405; Mon, 06 Jan 2020 23:52:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1578383540; cv=none; d=google.com; s=arc-20160816; b=e+D54CC1+BsTk7tfDAROU1aV4ufv/0Tf1GvVndjsho5xGRbTRK519bc2gzWXuhzWYR BhhiSUaSCtQ1UtNp6c4WStufZM1+WH5mEcIyPwr+sTqVIE51C9k3Yjva2Y0S3OyX0g4q U3C1pkzHCbC5pQ/2+zmupPBWauTvz+I/JXKFRjnWsUgdi7jYUJ1F9TZyGY6tVlX0Nzht K8i2MJVmlcgEHwPzwYuzTSiMxQfqURaAQuDjcYg54yjuQt0Qy7iKcOLIIsLn9c1uB4j4 WGdvlVemwT1ZhwnQMo/2L/VUTttcWX22gJezdZyDydCC2Og0QE4LsgX25oisovNRf66D x4bQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version; bh=IhDjpeV2ZD5b67TQjXpRRWA8ieXAlI0j5cPvLS0Mz9w=; b=eBE7JvSi3HvdqAiSrLZUHZO+5QFN+nWTl1Hfmvm06x/HBEzIHU8yMvBggoGgA5pN1X DDKiCxg0vG1I73FxRG7WMKpHguVRJqiM2QemvkbSGYSGvf+AFEk0QT1k6nY9i6bjCdQu SM+mfMqwYVb1303A4eOMGNHjZifcrboGMtTUAv9ZNhNfahkDlGp+KQnK+Hn4K1q7CvyU dGrVuufEHMYQRYb4/yNTNdjUbfC1qgCXAhLjsNI8JjPcsjG33EjVkoPH17gAHN2hSbTl 4V6n4qsgvyllcILNJE9WhIIZV0CgRC79tGFre7QyQAitrJZzB4Yo05Q8PPk1SLlbQe2s cukA== 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 i9si39047597otp.139.2020.01.06.23.52.06; Mon, 06 Jan 2020 23:52:20 -0800 (PST) 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 S1727185AbgAGHvZ (ORCPT + 99 others); Tue, 7 Jan 2020 02:51:25 -0500 Received: from mail-ot1-f66.google.com ([209.85.210.66]:40154 "EHLO mail-ot1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726428AbgAGHvZ (ORCPT ); Tue, 7 Jan 2020 02:51:25 -0500 Received: by mail-ot1-f66.google.com with SMTP id w21so67504781otj.7; Mon, 06 Jan 2020 23:51:24 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=IhDjpeV2ZD5b67TQjXpRRWA8ieXAlI0j5cPvLS0Mz9w=; b=LNVH4hNZ2mzsBrhmRO//uoQK+g/C5YSHWasMW1Fg2PwcclJMLQmNcVguQwtoStWmQO 6VxeFVM0qDT3f2GRe2XMsXrKca9P7nXNAUCKa9Noe/LM3JQdvPGfsHA1Zrv9vBdlGVbi MOd4bQTZcpKup/5hQIRMdsNzDDB4fG1bmlGANMbuhnA6GIZHtWhZQfSC7oKx5mcmfhJl Rw0q+m8PjTIW7xhO61F4FKIDPVCQNr+U0iqgOtiFURn+H4uGgOMkM1JG4KffrR1suv+P JM/XgvPmx7ZuQnl12RP/yE0s9V6MJjkMHCGaGhlVRpV5gIbO2P3QTKHDIcpvZdn/l62M dpcw== X-Gm-Message-State: APjAAAUGG8+4Or23tijj77lKmB2NNzSmPqjIKNd7P/sy0O1tC0jRuaeA EL9w+pgxnWb0+LaWVFT3e0PZ1d4Ku98wNclqvxE6SA== X-Received: by 2002:a9d:8f1:: with SMTP id 104mr112915400otf.107.1578383484352; Mon, 06 Jan 2020 23:51:24 -0800 (PST) MIME-Version: 1.0 References: <20191230133852.5890-1-geert+renesas@glider.be> In-Reply-To: From: Geert Uytterhoeven Date: Tue, 7 Jan 2020 08:51:13 +0100 Message-ID: Subject: Re: [PATCH/RFC 0/2] gpio: of: Add DT overlay support for GPIO hogs To: Frank Rowand Cc: Geert Uytterhoeven , Linus Walleij , Bartosz Golaszewski , Pantelis Antoniou , Rob Herring , Peter Ujfalusi , Chris Brandt , "open list:GPIO SUBSYSTEM" , "open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS" , Linux-Renesas , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Frank, On Tue, Jan 7, 2020 at 12:34 AM Frank Rowand wrote: > On 12/30/19 7:38 AM, Geert Uytterhoeven wrote: > > As GPIO hogs are configured at GPIO controller initialization time, > > adding/removing GPIO hogs in Device Tree overlays currently does not > > work. Hence this patch series adds support for that, by registering an > > of_reconfig notifier, as is already done for platform, i2c, and SPI > > devices. > > > > Perhaps this would be better served through a pinctrl-gpio driver? > > Pinctrl is already working fine with DT overlays, as the pinctrl-* > > properties are part of the slave device node, and thus looked up at > > slave device node attachment time, not at pin controller initialization > > time. > > > > In my particular use case (talking to SPI devices connected to a PMOD > > connector on the RSK+RZA1 development board), the GPIO performs board > > level muxing of a.o. the SPI MOSI/MISO/SCK signals. Hence the hog > > really needs to be active only while talking to the SPI device, so the > > muxing could (in theory) be done upon demand. > > But how to describe that in DT, and implement it (using Runtime PM?)? > > I'm trying to understand the use case. I can easily imagine two cases: > > (1) want to configure the GPIO to be able to use the SPI bus sometimes, > but configure the GPIO differently when not using the SPI bus > > (2) want to describe a device on the SPI bus in an overlay, thus > also needing to describe the associate gpio hog node in the > same overlay > > For use case (2), the proposed patch seems to be a good solution. > > For use case (1), this is a case of trying to use devicetree as a > way to control configuration instead of describing the hardware. > In this case, Bartosz' reply may indicate the way forward. > > I'll assume use case (2) for patch comments. Yes, my main interest is use case (2). I have no plans to pursue use case (1). However, I have some more comments and questions for use case (1). Before you can control configuration, you have to describe the hardware. Hence isn't that a job for DT? Furthermore, I'd like you to step back and answer the following question: what is the difference between a GPIO serving as a chip select for an SPI slave, and a GPIO controlling board level muxing? In both cases the GPIO controls to which hardware other signals are routed, and both may be changed at runtime. Thanks! Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds