From: Jan Kiszka <jan.kiszka@siemens.com>
To: Andy Shevchenko <andy.shevchenko@gmail.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Linus Walleij <linus.walleij@linaro.org>,
Alexandre Courbot <gnurou@gmail.com>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
"linux-serial@vger.kernel.org" <linux-serial@vger.kernel.org>,
"linux-gpio@vger.kernel.org" <linux-gpio@vger.kernel.org>,
Sudip Mukherjee <sudip.mukherjee@codethink.co.uk>,
Sascha Weisenberger <sascha.weisenberger@siemens.com>
Subject: Re: [PATCH v2 5/6] gpio-exar/8250-exar: Make set of exported GPIOs configurable
Date: Sun, 21 May 2017 13:43:13 +0200 [thread overview]
Message-ID: <83279eaf-69aa-333c-58b8-202d221375d3@siemens.com> (raw)
In-Reply-To: <CAHp75VcOHq05ZHc=arV9URQ9C6_guLiERB=FQ7FQgBTBYNrvPQ@mail.gmail.com>
On 2017-05-18 19:43, Andy Shevchenko wrote:
> On Thu, May 18, 2017 at 5:59 PM, Jan Kiszka <jan.kiszka@siemens.com> wrote:
>> On the SIMATIC, IOT2040 only a single pin is exportable as GPIO, the
>> rest is required to operate the UART. To allow modeling this case,
>> expand the platform device data structure to specify a (consecutive) pin
>> subset for exporting by the gpio-exar driver.
>
>> + unsigned int first_gpio;
>
> Perhaps pin?
> Or shift?
>
> Because first_gpio a bit confusing with Linux side of GPIO.
Ack, going for "pin".
>
>> - unsigned int bank = offset / 8;
>> - unsigned int addr;
>> + struct exar_gpio_chip *exar_gpio = gpiochip_get_data(chip);
>> + unsigned int bank, addr;
>>
>> + offset += exar_gpio->first_gpio;
>> + bank = offset / 8;
>
> Can't we instead do something like the following:
>
> struct exar_gpio_chip *exar_gpio = gpiochip_get_data(chip);
> unsigned int bank = (offset + exar_gpio->pin) / 8;
> unsigned int line = (offset + exar_gpio->pin) % 8;
>
OK, I'm using this pattern now:
unsigned int addr = (offset + exar_gpio->first_pin) / 8 ?
EXAR_OFFSET_MPIOLVL_HI : EXAR_OFFSET_MPIOLVL_LO;
unsigned int bit = (offset + exar_gpio->first_pin) % 8;
>
>> + pdata.first_gpio = first_gpio;
>> + pdata.ngpio = ngpio;
>
> Still thinking about device properties ("ngpios" and something like
> "exar8250,gpio-start").
Changed back to properties, removing all platform data.
But what's the purpose of prefixing the name here? This does not have
anything to do with device trees. It's a private parameter channel
between the creating device driver and the gpio driver, and there will
be no other bindings.
>
>> + unsigned int first_gpio;
>> + unsigned int ngpio;
>
> u16 ?
>
If we do that, then we would rather have to choose u8. But this is
pointless restriction. I prefer to stay with the native type.
Jan
--
Siemens AG, Corporate Technology, CT RDA ITP SES-DE
Corporate Competence Center Embedded Linux
next prev parent reply other threads:[~2017-05-21 11:43 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-18 14:59 [PATCH v2 0/6] serial/gpio: exar: Fixes and support for IOT2000 Jan Kiszka
2017-05-18 14:59 ` [PATCH v2 1/6] gpio: exar: Fix passing in of parent PCI device Jan Kiszka
2017-05-18 17:14 ` Andy Shevchenko
2017-05-21 11:44 ` Jan Kiszka
2017-05-22 15:43 ` Linus Walleij
2017-05-18 14:59 ` [PATCH v2 2/6] gpio: exar: Allocate resources on behalf of the platform device Jan Kiszka
2017-05-18 14:59 ` [PATCH v2 3/6] gpio: exar: Fix iomap request Jan Kiszka
2017-05-18 14:59 ` [PATCH v2 4/6] gpio: exar: Fix reading of directions and values Jan Kiszka
2017-05-18 15:28 ` Andy Shevchenko
2017-05-18 14:59 ` [PATCH v2 5/6] gpio-exar/8250-exar: Make set of exported GPIOs configurable Jan Kiszka
2017-05-18 17:43 ` Andy Shevchenko
2017-05-21 11:43 ` Jan Kiszka [this message]
2017-05-22 16:33 ` Andy Shevchenko
2017-05-22 17:04 ` Jan Kiszka
2017-05-22 15:44 ` Linus Walleij
2017-05-18 14:59 ` [PATCH v2 6/6] serial: exar: Add support for IOT2040 device Jan Kiszka
2017-05-18 16:33 ` Andy Shevchenko
2017-05-18 16:39 ` Jan Kiszka
2017-05-18 16:58 ` Jan Kiszka
2017-05-18 17:23 ` Jan Kiszka
2017-05-18 17:41 ` Andy Shevchenko
2017-05-22 15:46 ` Linus Walleij
2017-05-22 16:28 ` Jan Kiszka
2017-05-22 16:34 ` Andy Shevchenko
2017-05-22 16:40 ` Jan Kiszka
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=83279eaf-69aa-333c-58b8-202d221375d3@siemens.com \
--to=jan.kiszka@siemens.com \
--cc=andy.shevchenko@gmail.com \
--cc=gnurou@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=linus.walleij@linaro.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-serial@vger.kernel.org \
--cc=sascha.weisenberger@siemens.com \
--cc=sudip.mukherjee@codethink.co.uk \
/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
all inboxes | Powered by JetHome®