From: richard.genoud@gmail.com (Richard Genoud)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2 1/4] tty/serial: Add GPIOLIB helpers for controlling modem lines
Date: Wed, 12 Feb 2014 09:33:57 +0100 [thread overview]
Message-ID: <CACQ1gAjM7n3Zs_XapmMuS83A+X_yde5+iJ9F28SCfOCGA7Bdmg@mail.gmail.com> (raw)
In-Reply-To: <1392142986.607813065@f171.i.mail.ru>
2014-02-11 19:23 GMT+01:00 Alexander Shiyan <shc_work@mail.ru>:
> Hello.
Hi !
>
> ???????, 11 ??????? 2014, 18:45 +01:00 ?? Richard Genoud <richard.genoud@gmail.com>:
>> This patch add some helpers to control modem lines (CTS/RTS/DSR...) via
>> GPIO.
>> This will be useful for many boards which have a serial controller that
>> only handle CTS/RTS pins (or even just RX/TX).
>>
>> Signed-off-by: Richard Genoud <richard.genoud@gmail.com>
>> ---
>
> OK, a few comments below.
>
> ...
>> +config SERIAL_MCTRL_GPIO
>> + def_bool y
>> + depends on GPIOLIB
>
> I suggest to move GPIOLIB dependency to serial_mctrl_gpio.h header, so
> unit can be used with or without GPIOLIB, so Kconfig will look something like this:
>
> config SERIAL_MCTRL_GPIO
> tristate
>
> Then, you can select this option for particular UART:
> config SERIAL_ATMEL
> ...
> select SERIAL_MCTRL_GPIO
Yes, you're right, it seems better like that.
> ...
>> +++ b/drivers/tty/serial/serial_mctrl_gpio.c
> ...
>> +static const char *mctrl_gpio_of_names[UART_GPIO_MAX] = {
>> + "cts", "dsr", "dcd", "ri", "rts", "dtr"
>> +};
>
> Make a combined array. This will use cycles for set/get operations.
>
> static struct {
> const char *name;
> unsigned int mctrl;
> } mctrl_gpios[] = {
> { "cts", TIOCM_CTS, },
> ...
> };
yes, good idea !
> ...
>> +int mctrl_gpio_init(struct device *dev, struct mctrl_gpios *gpios)
>> +{
>
> I'm not sure whether to make a non-DT support at all ...
I don't understand what you mean.
You would like another _init() function for non-DT board ?
Well, I thought that non DT board could handle their GPIO init (like I
did in atmel_serial.c for platform_data based boards), but still use
the mctrl_gpio_{get,set} functions.
>> + enum mctrl_gpio_idx i;
>> + int err = 0;
>> + int ret = 0;
>> +
>> + for (i = UART_GPIO_MIN; i < UART_GPIO_MAX; i++) {
>> + gpios->gpio[i] = gpiod_get(dev, mctrl_gpio_of_names[i]);
>
> What a reason to using gpiod_xxx() ?
> Why we cannot use standart devm_gpio_request/get/set etc. ?
Ah ! I missed devm_gpiod_get()
I'll use it.
>
> In addition, I recommend create this patch as separate,
> because it will most likely still be comments later.
Well, I'd rather not separate this patch from at least "patch 4/4
tty/serial: at91: use mctrl_gpio helpers"
because if the patch 4/4 is merged before this one, the compilation
will fail, and git bisecting will be a pain.
Or there's another solution ?
> Thanks.
Thanks !
next prev parent reply other threads:[~2014-02-12 8:33 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-02-11 17:45 [PATCH v2 0/4] tty/serial: Add helpers to use GPIOs to control modem lines Richard Genoud
2014-02-11 17:45 ` [PATCH v2 1/4] tty/serial: Add GPIOLIB helpers for controlling " Richard Genoud
2014-02-11 18:23 ` Alexander Shiyan
2014-02-12 8:33 ` Richard Genoud [this message]
2014-02-11 17:45 ` [PATCH v2 2/4] tty/serial: at91: use dev_err instead of printk Richard Genoud
2014-02-11 17:45 ` [PATCH v2 3/4] tty/serial: at91: remove unused open/close hooks Richard Genoud
2014-02-11 17:45 ` [PATCH v2 4/4] tty/serial: at91: use mctrl_gpio helpers Richard Genoud
2014-02-13 17:37 ` [PATCH v2 0/4] tty/serial: Add helpers to use GPIOs to control modem lines Greg Kroah-Hartman
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=CACQ1gAjM7n3Zs_XapmMuS83A+X_yde5+iJ9F28SCfOCGA7Bdmg@mail.gmail.com \
--to=richard.genoud@gmail.com \
--cc=linux-arm-kernel@lists.infradead.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).