From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1946797AbcBRQuM (ORCPT ); Thu, 18 Feb 2016 11:50:12 -0500 Received: from mail-pf0-f174.google.com ([209.85.192.174]:33244 "EHLO mail-pf0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1426559AbcBRQuJ (ORCPT ); Thu, 18 Feb 2016 11:50:09 -0500 Subject: Re: [PATCH v8 3/3] tty: 8250_omap: Use software emulated RS485 direction control To: =?UTF-8?B?0JjQu9GM0Y/RgSDQk9Cw0YHQsNC90L7Qsg==?= , "Matwey V. Kornilov" References: Cc: Greg KH , Jiri Slaby , Andy Shevchenko , One Thousand Gnomes , linux-kernel , linux-serial@vger.kernel.org From: Peter Hurley Message-ID: <56C5F63B.1060306@hurleysoftware.com> Date: Thu, 18 Feb 2016 08:50:03 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.5.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 02/18/2016 01:46 AM, Ильяс Гасанов wrote: > 2016-02-18 10:18 GMT+03:00 Ильяс Гасанов : >> Also, forgot to mention that if serial8250_em485_init is called not >> upon uart startup but elsewhere (upon port register for example), and >> em485 is set, serial8250_do_startup should call >> serial8250_em485_rts_after_send, or else RTS might be in wrong state >> whenever the port device is opened, making it impossible to receive >> data through RTS-controlled RS232<->RS485 hardware converters. > > Just found out that it doesn't help. Actually, it is the behavior of > tty_open function to call tty_port_block_til_ready after startup, and > of the latter - to set RTS via ioctl if baud is not zero - both of > which cannot be overriden within the scope of the 8250 framework. The > reason this works in legacy omap_serial is that my GPIO which is used > to emulate RTS is not tied to mctrl there, so the call of > tty_port_block_til_ready does not affect its state. > > Therefore, a check for SER_RS485_ENABLED needs to be introduced to > tty_port_block_til_ready. No, that's not the way. First, there's plenty of driver hooks to properly manage the RTS level for rs485. Second, how are you running GPIO rts with the omap8250 driver?