Message ID | 20160930085801.21497-2-richard.genoud@gmail.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Hello Greg, On Fri, Sep 30, 2016 at 10:57:59AM +0200, Richard Genoud wrote: > This function returns true if CTS and RTS are used as GPIOs. > Some drivers (like atmel_serial) needs to know if the flow control is > handled by the controller or by GPIOs. just for the record: I don't like this patch because I think it's highly at91 specific and could so well live in that driver. Moreover I'm not conviced yet that it's really the correct thing to do even for this driver. So please don't apply, at least until we're done with the discussion of patch 2. Best regards Uwe
diff --git a/drivers/tty/serial/serial_mctrl_gpio.c b/drivers/tty/serial/serial_mctrl_gpio.c index d2da6aa7f27d..38e6e784faa2 100644 --- a/drivers/tty/serial/serial_mctrl_gpio.c +++ b/drivers/tty/serial/serial_mctrl_gpio.c @@ -72,6 +72,13 @@ struct gpio_desc *mctrl_gpio_to_gpiod(struct mctrl_gpios *gpios, } EXPORT_SYMBOL_GPL(mctrl_gpio_to_gpiod); +bool mctrl_gpio_use_rtscts(struct mctrl_gpios *gpios) +{ + return mctrl_gpio_to_gpiod(gpios, UART_GPIO_CTS) && + mctrl_gpio_to_gpiod(gpios, UART_GPIO_RTS); +} +EXPORT_SYMBOL_GPL(mctrl_gpio_use_rtscts); + unsigned int mctrl_gpio_get(struct mctrl_gpios *gpios, unsigned int *mctrl) { enum mctrl_gpio_idx i; diff --git a/drivers/tty/serial/serial_mctrl_gpio.h b/drivers/tty/serial/serial_mctrl_gpio.h index fa000bcff217..c34269733c62 100644 --- a/drivers/tty/serial/serial_mctrl_gpio.h +++ b/drivers/tty/serial/serial_mctrl_gpio.h @@ -101,6 +101,11 @@ void mctrl_gpio_enable_ms(struct mctrl_gpios *gpios); */ void mctrl_gpio_disable_ms(struct mctrl_gpios *gpios); +/* + * Return true if both CTS and RTS are used with GPIOs + */ +bool mctrl_gpio_use_rtscts(struct mctrl_gpios *gpios); + #else /* GPIOLIB */ static inline @@ -152,6 +157,11 @@ static inline void mctrl_gpio_disable_ms(struct mctrl_gpios *gpios) { } +static inline bool mctrl_gpio_use_rtscts(struct mctrl_gpios *gpios) +{ + return false; +} + #endif /* GPIOLIB */ #endif
This function returns true if CTS and RTS are used as GPIOs. Some drivers (like atmel_serial) needs to know if the flow control is handled by the controller or by GPIOs. Signed-off-by: Richard Genoud <richard.genoud@gmail.com> --- drivers/tty/serial/serial_mctrl_gpio.c | 7 +++++++ drivers/tty/serial/serial_mctrl_gpio.h | 10 ++++++++++ 2 files changed, 17 insertions(+)