Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp604513pxj; Thu, 17 Jun 2021 09:34:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxUthzsoajEnyrdKtTlWajf4ikWtgkxoAtzHwqR0fgh08Aihi70vQlTCJdwEsE/F47deaGM X-Received: by 2002:a05:6402:440c:: with SMTP id y12mr7910060eda.208.1623947697041; Thu, 17 Jun 2021 09:34:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623947697; cv=none; d=google.com; s=arc-20160816; b=cfnZYBUw1V3qtiHWgV/rswMvp04CtNOoS0/Nsj14kNX0g0ZVz2Jg60mfh0Rn6IOgMU rsXg9GPNQ4Lf80XG1VB6WqZcDmkks8QcsLp/2JIgfIYJsbR3gQa1uG7y91mlGOwVOUjl nm73hqwSskAuWyfMsOV+OUM0f5VBjqWjUNJudswYnRMmJyeojEIX+pHCYDMJB6uk6Csl rxb/Q4xPC4/MAIL7JXMc/qB7qUSeGlJul81ct6pvB7prU32ZJbJMrX57lLLQSoEcCky2 R+G+T6uacdHCWz49SPiptlA3iey2Mf+h7/VNdtYPBFRPQftEU8EP8SfH9bYh0I8BF9v0 cFUA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=r5/I5B0Vnz3iUBZp4kZkh1KGd6Kh5ZWsWBR7WGQnF6M=; b=VQYdv/532OogqthwGdoQuIwkhQS6DAB5hLo/NHaZfU4VOHTFb15nISZpWnfRYz1lFT oZDO7RpiIdusZaQ3ZG6quWSPY5a4FfhHSe2a9WeI9kpjnfUeyMc1phNx2LzZ5qRTuQ0B S1jjwyiE+GuY42joOHhKXe8jgP0J3Zxme2QUH6turelkWipFhWXsI/d2htI/pR3Lkjev aYXO+51guCjW3SKPCEJPsUB1zd3TLYFbKcmm6+/abJM+rJn4c5YhBqWQ5HdUqAXvyWom IASaqJSgb2KJ2Go6ylcTgNTvIAJ7mF5x/Ci9ia5cAW0ggU5r+bsWXipQAMLQkPpledXW 9x0g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmx.net header.s=badeba3b8450 header.b="h5/3nYFO"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=gmx.de Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id kv8si6692707ejc.232.2021.06.17.09.34.33; Thu, 17 Jun 2021 09:34:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmx.net header.s=badeba3b8450 header.b="h5/3nYFO"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=gmx.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231814AbhFQQPl (ORCPT + 99 others); Thu, 17 Jun 2021 12:15:41 -0400 Received: from mout.gmx.net ([212.227.15.18]:50757 "EHLO mout.gmx.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233973AbhFQQOO (ORCPT ); Thu, 17 Jun 2021 12:14:14 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1623946322; bh=r5/I5B0Vnz3iUBZp4kZkh1KGd6Kh5ZWsWBR7WGQnF6M=; h=X-UI-Sender-Class:Subject:To:Cc:References:From:Date:In-Reply-To; b=h5/3nYFOxSkkTQMkRSUXYU0hfcG2IiHA4EKaFhR9azvbowUbM5Wo3YzJR6NLOwfTX AkJsLFxhCswWItzVNyAs2X9+bEzqkdyHZvQW785vMBXiC5LAY+Jmzf8eUZXhPpkW8/ SQ+tjb0HvDwc3rN8+bvGeQLwj3NG98VbefBTZNZA= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from [192.168.178.51] ([149.172.234.120]) by mail.gmx.net (mrgmx004 [212.227.17.190]) with ESMTPSA (Nemesis) id 1M9o1v-1lz7Hb0lM5-005r9E; Thu, 17 Jun 2021 18:12:02 +0200 Subject: Re: [PATCH] serial: amba-pl011: add RS485 support To: Jiri Slaby , gregkh@linuxfoundation.org Cc: linux@armlinux.org.uk, linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org References: <20210610135004.7585-1-LinoSanfilippo@gmx.de> <5f00ff43-9287-4027-7d80-474da957703c@kernel.org> From: Lino Sanfilippo Message-ID: <98c29d64-3155-4769-8336-413325de4057@gmx.de> Date: Thu, 17 Jun 2021 18:12:00 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <5f00ff43-9287-4027-7d80-474da957703c@kernel.org> Content-Type: text/plain; charset=iso-8859-2 Content-Language: en-US Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:gYhl3DhnjcjxDBSEAFDK5aGNxAE9MP3TLPWMYDvAHDgBL5mboSo WpX5Ly3u8KPF50wS39FXghDeeJiAA/fvP8WU3Gt0v52AyNBzlTl6IyiS2ac2I/feFy/L+LM CZrdCfAOTcQY2zVqp/LBsVmZAIWjk13H0+B8eWr6fDH+XCSUV4ItkFB8wYRuP5RWHKWpJvF ZC1fJOEU5E6xziauaIPPg== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:Zn0+x4+swtI=:FwzqTc09oj3dT7aNSf89Ch 4FzohALxxr/95tc6Xg7INuuGnwnqFHK2+X53wnqc5RxKVdMrHa+d7j3aiBavF20BuSV8FtoTy qe0xM88zYl7lj42jjS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ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, On 16.06.21 at 08:18, Jiri Slaby wrote: >> +=A0=A0=A0 if (port->rs485.delay_rts_before_send) >> +=A0=A0=A0=A0=A0=A0=A0 mdelay(port->rs485.delay_rts_before_send); > > This is up to 1 second delay with interrupts disabled. Definitely not ni= ce. 8250 clamps this to 100 ms at least, why did you choose 1000 ms? > I got this value from rs485.yaml where the max number for both rts delay b= efore and after send is specified as 1000ms. I thought to keep it up to the user to choose a sa= ne setting. But yes, its a very long time with interrupts disabled. I will send an updated vers= ion of this patch that limits both values to 100ms. os(struct uart_port *port, struct ktermios *termios, >> =A0=A0=A0=A0=A0 unsigned int lcr_h, old_cr; >> =A0=A0=A0=A0=A0 unsigned long flags; >> =A0=A0=A0=A0=A0 unsigned int baud, quot, clkdiv; >> +=A0=A0=A0 unsigned int bits; >> =A0 =A0=A0=A0=A0=A0 if (uap->vendor->oversampling) >> =A0=A0=A0=A0=A0=A0=A0=A0=A0 clkdiv =3D 8; >> @@ -1968,25 +2049,32 @@ pl011_set_termios(struct uart_port *port, struc= t ktermios *termios, >> =A0=A0=A0=A0=A0 switch (termios->c_cflag & CSIZE) { >> =A0=A0=A0=A0=A0 case CS5: >> =A0=A0=A0=A0=A0=A0=A0=A0=A0 lcr_h =3D UART01x_LCRH_WLEN_5; >> +=A0=A0=A0=A0=A0=A0=A0 bits =3D 7; >> =A0=A0=A0=A0=A0=A0=A0=A0=A0 break; >> =A0=A0=A0=A0=A0 case CS6: >> =A0=A0=A0=A0=A0=A0=A0=A0=A0 lcr_h =3D UART01x_LCRH_WLEN_6; >> +=A0=A0=A0=A0=A0=A0=A0 bits =3D 8; >> =A0=A0=A0=A0=A0=A0=A0=A0=A0 break; >> =A0=A0=A0=A0=A0 case CS7: >> =A0=A0=A0=A0=A0=A0=A0=A0=A0 lcr_h =3D UART01x_LCRH_WLEN_7; >> +=A0=A0=A0=A0=A0=A0=A0 bits =3D 9; >> =A0=A0=A0=A0=A0=A0=A0=A0=A0 break; >> =A0=A0=A0=A0=A0 default: // CS8 >> =A0=A0=A0=A0=A0=A0=A0=A0=A0 lcr_h =3D UART01x_LCRH_WLEN_8; >> +=A0=A0=A0=A0=A0=A0=A0 bits =3D 10; >> =A0=A0=A0=A0=A0=A0=A0=A0=A0 break; >> =A0=A0=A0=A0=A0 } >> -=A0=A0=A0 if (termios->c_cflag & CSTOPB) >> +=A0=A0=A0 if (termios->c_cflag & CSTOPB) { >> =A0=A0=A0=A0=A0=A0=A0=A0=A0 lcr_h |=3D UART01x_LCRH_STP2; >> +=A0=A0=A0=A0=A0=A0=A0 bits++; >> +=A0=A0=A0 } >> =A0=A0=A0=A0=A0 if (termios->c_cflag & PARENB) { >> =A0=A0=A0=A0=A0=A0=A0=A0=A0 lcr_h |=3D UART01x_LCRH_PEN; >> =A0=A0=A0=A0=A0=A0=A0=A0=A0 if (!(termios->c_cflag & PARODD)) >> =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 lcr_h |=3D UART01x_LCRH_EPS; >> =A0=A0=A0=A0=A0=A0=A0=A0=A0 if (termios->c_cflag & CMSPAR) >> =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 lcr_h |=3D UART011_LCRH_SPS; >> +=A0=A0=A0=A0=A0=A0=A0 bits++; >> =A0=A0=A0=A0=A0 } > > You can do simply: > =A0 bits =3D tty_get_frame_size(termios->c_cflag); > now: > https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty.git/commit/?h= =3Dtty-testing&id=3D3ec2ff37230e1c961d4b0d0118dd23c46b5bcdbb Ah thats a nice function, thanks for pointing at it. I will adjust the cod= e accordingly. > > thanks, Thanks for the review! Regards, Lino