Messages in this thread | | | Date | Mon, 30 Mar 2020 17:56:45 +0300 | From | Andy Shevchenko <> | Subject | Re: [PATCH v2 6/7] serial: 8250: Support separate rs485 rx-enable GPIO |
| |
On Thu, Mar 26, 2020 at 12:14:21AM +0100, Heiko Stuebner wrote: > From: Heiko Stuebner <heiko.stuebner@theobroma-systems.com> > > The RE signal is used to control the duplex mode of transmissions, > aka receiving data while sending in full duplex mode, while stopping > receiving data in half-duplex mode. > > On a number of boards the !RE signal is tied to ground so reception > is always enabled except if the UART allows disabling the receiver. > This can be taken advantage of to implement half-duplex mode - like > done on 8250_bcm2835aux. > > Another solution is to tie !RE to RTS always forcing half-duplex mode. > > And finally there is the option to control the RE signal separately, > like done here by introducing a new rs485-specifc gpio that can be > set depending on the RX_DURING_TX setting in the common em485 callbacks.
> + if (port->rs485_re_gpio)
Redundant. Same for all other cases.
> + gpiod_set_value(port->rs485_re_gpio, 1);
> + port->rs485_re_gpio = devm_gpiod_get(dev, "rs485-rx-enable", > + GPIOD_FLAGS_BIT_DIR_OUT); > + if (IS_ERR(port->rs485_re_gpio)) { > + ret = PTR_ERR(port->rs485_re_gpio); > + port->rs485_re_gpio = NULL; > + if (ret != -ENOENT) { > + if (ret != -EPROBE_DEFER) > + dev_err(dev, "Cannot get rs485-rx-enable-gpios\n"); > + return ret; > + } > + }
NIH of gpiod_get_optional().
-- With Best Regards, Andy Shevchenko
| |