linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Laxman Dewangan <ldewangan-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
To: Thierry Reding <thierry.reding-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Cc: Linus Walleij
	<linus.walleij-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>,
	Stephen Warren <swarren-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>,
	Suresh Mangipudi
	<smangipudi-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>,
	Alexandre Courbot
	<gnurou-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-gpio-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH] gpio: Add Tegra186 support
Date: Fri, 25 Nov 2016 17:40:47 +0530	[thread overview]
Message-ID: <58382A47.2040205@nvidia.com> (raw)
In-Reply-To: <20161124150841.GC26657-EkSeR96xj6Pcmrwk2tT4+A@public.gmane.org>


On Thursday 24 November 2016 08:38 PM, Thierry Reding wrote:
> * PGP Signed by an unknown key
>
> On Thu, Nov 24, 2016 at 08:14:31PM +0530, Laxman Dewangan wrote:
>>>
>>> This has nothing to do with the device tree binding. What the device
>>> tree binding defines is the indices to use to obtain a given GPIO within
>>> a given port. What numbering the driver uses internally is completely up
>>> to the driver implementation.
>>>
>>> Oh, and the above works just fine.
>>
>> Nop, it will not work. The reason is:
>> include/dt-binding/gpio/tegra186-gpio.h
>>
>>
>> #define TEGRA_MAIN_GPIO(port, offset) \
>>          ((TEGRA_MAIN_GPIO_PORT_##port * 8) + offset)
>>
>>
>> so in your DTS file, if you use this macro for the gpio number then you will
>> have pin per port as 8.
>> And so your total GPIO is 23 *8 (Port CC) but in source code ngpio is very
>> less.
> Yes, within the source code, ngpio will be the exact number of pins that
> the GPIO controller physically exposes. But that still works fine, feel
> free to test the driver if you don't believe me. The translation from
> one numberspace to the other is done in tegra186_gpio_of_xlate().

OK, so you are mapping the DT gpio number to new number using xlate.

This method is fine but it complicate the driver and always it needs to 
calculate the base for the port.
If we have one to one mapping then probably, we can have fixed lookup table.

I am just incline to make stuff simple so that we can have better 
maintainability and debugging. This is very common driver and almost all 
BSPS engineer debug here so want to make this driver extremely simple.

  parent reply	other threads:[~2016-11-25 12:10 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-02 10:48 [PATCH] gpio: tegra186: Add support for T186 GPIO Suresh Mangipudi
2016-11-07  7:53 ` Linus Walleij
2016-11-07 13:21   ` Thierry Reding
     [not found]     ` <20161107132127.GE12559-EkSeR96xj6Pcmrwk2tT4+A@public.gmane.org>
2016-11-08  1:42       ` Olof Johansson
     [not found]         ` <CAOesGMgJUepmq2JTT7imKh74BsnGobcpBWFuNp94WnX1WtzEjA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2016-11-08 15:55           ` Thierry Reding
2016-11-08 16:49             ` Stephen Warren
     [not found]               ` <08947785-2e7f-0117-2392-b6b1a774bbb8-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
2016-11-08 17:58                 ` Thierry Reding
     [not found] ` <1478083719-14836-1-git-send-email-smangipudi-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2016-11-08 19:07   ` Stephen Warren
2016-11-22 17:30     ` Thierry Reding
2016-11-22 17:55       ` [PATCH] gpio: Add Tegra186 support Thierry Reding
     [not found]         ` <20161122175539.3897-1-thierry.reding-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2016-11-23 13:30           ` Linus Walleij
2016-11-23 19:44             ` Thierry Reding
2016-11-24 15:40               ` Linus Walleij
2016-11-24  6:53         ` Laxman Dewangan
     [not found]           ` <58368E84.6040104-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2016-11-24 14:44             ` Thierry Reding
     [not found]               ` <20161124144411.GA26657-EkSeR96xj6Pcmrwk2tT4+A@public.gmane.org>
2016-11-24 14:44                 ` Laxman Dewangan
2016-11-24 15:08                   ` Thierry Reding
     [not found]                     ` <20161124150841.GC26657-EkSeR96xj6Pcmrwk2tT4+A@public.gmane.org>
2016-11-25 12:10                       ` Laxman Dewangan [this message]
     [not found]       ` <20161122173042.GA3239-EkSeR96xj6Pcmrwk2tT4+A@public.gmane.org>
2016-11-23 13:25         ` [PATCH] gpio: tegra186: Add support for T186 GPIO Linus Walleij
     [not found]           ` <CACRpkdbfkv7Yt3cOah_BGcgnqVtxvzWOqm2+HH_rkrpnJt0nFA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2016-11-23 19:40             ` Thierry Reding
     [not found]               ` <20161123194036.GA25876-EkSeR96xj6Pcmrwk2tT4+A@public.gmane.org>
2016-11-24  6:36                 ` Laxman Dewangan
2016-11-24 15:01                   ` Thierry Reding
2016-11-24 15:08                 ` Linus Walleij
2016-11-24 16:32                   ` Thierry Reding
     [not found]                     ` <20161124163231.GD26657-EkSeR96xj6Pcmrwk2tT4+A@public.gmane.org>
2016-11-24 23:24                       ` Linus Walleij

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=58382A47.2040205@nvidia.com \
    --to=ldewangan-ddmlm1+adcrqt0dzr+alfa@public.gmane.org \
    --cc=gnurou-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=linus.walleij-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org \
    --cc=linux-gpio-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=smangipudi-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org \
    --cc=swarren-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org \
    --cc=thierry.reding-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).