[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200330145645.GX1922688@smile.fi.intel.com>
Date: Mon, 30 Mar 2020 17:56:45 +0300
From: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
To: Heiko Stuebner <heiko@...ech.de>
Cc: gregkh@...uxfoundation.org, jslaby@...e.com,
matwey.kornilov@...il.com, linux-serial@...r.kernel.org,
linux-kernel@...r.kernel.org, lukas@...ner.de,
christoph.muellner@...obroma-systems.com,
giulio.benetti@...ronovasrl.com,
Heiko Stuebner <heiko.stuebner@...obroma-systems.com>
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@...obroma-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
Powered by blists - more mailing lists