Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1527761
| Path | csiph.com!eternal-september.org!feeder.eternal-september.org!news.unit0.net!news.panservice.it!bofh.it!news.nic.it!robomod |
|---|---|
| From | Thierry Reding <thierry.reding@gmail.com> |
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH] gpio: tegra186: Add support for T186 GPIO |
| Date | Tue, 22 Nov 2016 18:40:02 +0100 |
| Message-ID | <sGnd0-1Py-41@gated-at.bofh.it> (permalink) |
| References | <sz1hf-56k-17@gated-at.bofh.it> <sBjWq-53v-57@gated-at.bofh.it> |
| Dkim-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=DJ6qQtYgADa2ri58if2nBMCCA+UhyQVUNYNeXegUCV8=; b=sptbNVxuveUBH4dlMZIqLlf3DcLBNwwhQx+5DH2t8aZ5QjHcp8Ka0dM/dxrQAS8x4H XLUN6ZwsjeSj+sHzQprcFK8PsdmPEkEAVp7lq8h1dqQFg36/50t/yApbMckwhxZH+ZuZ A6W833JZkhUkC16cK6UQX5XCePypumI3pXTuTVJaLmMdNg4mP62VFzABvpDsS619epGv uIq7e3AuLbJVyrGjecWWaX74ELQo6+LWjnS7FlWxLzw8ex0+xao9i6ILm9SKz5TLFmu5 fdFb0LPaClxRDNbqnU99K8Q39oms/cb6jd089ajfyqULOocihpN7TrKs+dS5LAUWIt1D MT5w== |
| X-Google-Dkim-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=DJ6qQtYgADa2ri58if2nBMCCA+UhyQVUNYNeXegUCV8=; b=TXCkX69kWoLURdFdetFtHVoLDPK0SyDKR16HuFGLZ8pAm1jFrmaCe2Rh+BnT2Zp+Sw fVX8NU0jN9e3yOH2jwzj12VbATGIBEWqY7hyDYEgnoT6ojaNxHOh1z/ABRvCWMSckPtf W0+AX/MOOyaXk5valQFbNwVx0mMFTCxZBj7vgCXANU1v23v8KXYlKFqAiksVh0JFPFWI wkAnSr9Am3LFDrfKtaQRebFvtsE4jb61BaNVhmjGW7rXiXrvph0CRHn6k/IMgUqBk3qj GYC15qOyI7nwvfBq6P5JgBtjb35kc2qBDzEJjBLbOMsa+77XkMDJtg2CHGp+TH7w2dDt gJmg== |
| X-Gm-Message-State | AKaTC00DCOZ4cOqV0vPJCOURLCZhr4h+g9UxJLqslkgJDZpFHNE868QmAwKQN72NDPpXPA== |
| X-Received | by 10.99.96.85 with SMTP id u82mr46500057pgb.47.1479835846598; Tue, 22 Nov 2016 09:30:46 -0800 (PST) |
| MIME-Version | 1.0 |
| Content-Type | multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="IS0zKkzwUGydFO0o" |
| Content-Disposition | inline |
| User-Agent | Mutt/1.7.1 (2016-10-04) |
| Sender | robomod@news.nic.it |
| List-ID | <linux-kernel.vger.kernel.org> |
| X-Mailing-List | linux-kernel@vger.kernel.org |
| Approved | robomod@news.nic.it |
| Lines | 105 |
| Organization | linux.* mail to news gateway |
| X-Original-Cc | Suresh Mangipudi <smangipudi@nvidia.com>, ldewangan@nvidia.com, gnurou@gmail.com, linux-kernel@vger.kernel.org, linux-gpio@vger.kernel.org, linux-tegra@vger.kernel.org |
| X-Original-Date | Tue, 22 Nov 2016 18:30:42 +0100 |
| X-Original-Message-ID | <20161122173042.GA3239@ulmo.ba.sec> |
| X-Original-References | <1478083719-14836-1-git-send-email-smangipudi@nvidia.com> <0e3e89a8-a2f1-68c2-0586-58902fb91587@wwwdotorg.org> |
| X-Original-Sender | linux-kernel-owner@vger.kernel.org |
| Xref | csiph.com linux.kernel:1527761 |
Show key headers only | View raw
[Multipart message — attachments visible in raw view] - view raw
On Tue, Nov 08, 2016 at 12:07:55PM -0700, Stephen Warren wrote: > On 11/02/2016 04:48 AM, Suresh Mangipudi wrote: > > Add GPIO driver for T186 based platforms. > > Adds support for MAIN and AON GPIO's from T186. > > I'm not sure how you/Thierry will approach merging this with the other GPIO > driver he has, but here's a very quick review of this one in case it's > useful. This puts me in an unfortunate situation. I'd really like to avoid being the maintainer for this driver, but on the other hand, the version of the driver that I wrote is pretty much what we'd end up if Stephen's comments were all addressed. Suresh's driver does a couple of things in addition (like the accessibility checks), but then I find my driver to be more easily related to the TRM because it uses the register names from that. So I don't really know how to go about merging both. I'll reply to this email later with a copy of the patch that I wrote, maybe we can take it from there. > > + tgi->gc.ngpio = tgi->soc->nports * 8; > > This will leave some gaps in the GPIO numbering, since not all ports have 8 > GPIOs. I think this is the correct thing to do, but IIRC Thierry found this > caused some issues in the GPIO core since it attempts to query initial > status of each GPIO. Did you see this issue during testing? I think the immediate issue that I was seeing is avoided in this driver by the call to gpio_is_accessible() in the ->get_direction() callback. In the driver that I have there's no such check, and hence I would get an exception on probe. However there's another problem with this patch. If you try and export a non-existing GPIO via sysfs and try to read the value file you can easily make the driver hang a CPU. This only seems to happen for the AON GPIO controller. The approach that I chose was to compact the range of GPIOs that the GPIO subsystem knows about to the ones that actually exist. This has the slight disadvantage that we can't use a simple port * 8 + offset to compute the pin number anymore. However for the primary use-case (GPIO specifier in DT) that's not a problem because we can translate the pin number into the compacted space. That means the only issue will be with sysfs support because if we use the simple formula we'll eventually get a pin number that's outside of the range. One way to solve this is to make a massive change to the GPIO subsystem to check for the validity of a GPIO before any access. I'm not sure if that's desirable, maybe Linus has some thoughts about that. If we stick with a compacted number space, there are two solutions that I can think of to remedy the sysfs problem. One would be to register a separate struct gpio_chip for each controller. That's kind of a sledge- hammer solution because it will create multiple number spaces and hence completely avoid the sparse number space for the whole controller. I think Stephen had originally proposed this as a solution. The other possibility would be for the GPIO subsystem to gain per-chip GPIO export via sysfs. That is, instead of the global export file that you write a global GPIO number to, each per-chip directory would get an export file. Values written into that file could get translated via driver-specific callbacks (much like the ->xlate() callback for GPIO specifiers). I think that's a change that makes sense anyway. Usually users will know what GPIO controller they want to access and the offset of the pin therein. Currently they have to somewhat jump through hoops to get at the right pin (find controller, read GPIO base, add offset to base and write that to the export file). The new sequence would be much more straightforward: find controller, write offset to export file. The new per-chip export file would be flexible enough to deal with compacted number spaces, which is obviously something we can't do with the global export file. Thierry
Back to linux.kernel | Previous | Next — Next in thread | Find similar | Unroll thread
Re: [PATCH] gpio: tegra186: Add support for T186 GPIO Thierry Reding <thierry.reding@gmail.com> - 2016-11-22 18:40 +0100
[PATCH] gpio: Add Tegra186 support Thierry Reding <thierry.reding@gmail.com> - 2016-11-22 19:00 +0100
Re: [PATCH] gpio: Add Tegra186 support Linus Walleij <linus.walleij@linaro.org> - 2016-11-23 14:40 +0100
Re: [PATCH] gpio: Add Tegra186 support Thierry Reding <thierry.reding@gmail.com> - 2016-11-23 20:50 +0100
Re: [PATCH] gpio: Add Tegra186 support Linus Walleij <linus.walleij@linaro.org> - 2016-11-24 16:50 +0100
Re: [PATCH] gpio: Add Tegra186 support Laxman Dewangan <ldewangan@nvidia.com> - 2016-11-24 08:20 +0100
Re: [PATCH] gpio: Add Tegra186 support Thierry Reding <thierry.reding@gmail.com> - 2016-11-24 15:50 +0100
Re: [PATCH] gpio: Add Tegra186 support Laxman Dewangan <ldewangan@nvidia.com> - 2016-11-24 16:10 +0100
Re: [PATCH] gpio: Add Tegra186 support Thierry Reding <thierry.reding@gmail.com> - 2016-11-24 16:10 +0100
Re: [PATCH] gpio: tegra186: Add support for T186 GPIO Linus Walleij <linus.walleij@linaro.org> - 2016-11-23 14:30 +0100
Re: [PATCH] gpio: tegra186: Add support for T186 GPIO Thierry Reding <thierry.reding@gmail.com> - 2016-11-23 21:00 +0100
Re: [PATCH] gpio: tegra186: Add support for T186 GPIO Laxman Dewangan <ldewangan@nvidia.com> - 2016-11-24 08:00 +0100
Re: [PATCH] gpio: tegra186: Add support for T186 GPIO Thierry Reding <thierry.reding@gmail.com> - 2016-11-24 16:10 +0100
Re: [PATCH] gpio: tegra186: Add support for T186 GPIO Linus Walleij <linus.walleij@linaro.org> - 2016-11-24 16:10 +0100
Re: [PATCH] gpio: tegra186: Add support for T186 GPIO Thierry Reding <thierry.reding@gmail.com> - 2016-11-24 17:40 +0100
Re: [PATCH] gpio: tegra186: Add support for T186 GPIO Linus Walleij <linus.walleij@linaro.org> - 2016-11-25 00:30 +0100
csiph-web