Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp747956pxj; Thu, 10 Jun 2021 11:41:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwP0bIK4GaHjRv2zGRNOJwi023IUGAy77RRiflLBezszh11rudxYBMCqjRtBSXnam15l98/ X-Received: by 2002:a17:906:7b4f:: with SMTP id n15mr58317ejo.220.1623350494142; Thu, 10 Jun 2021 11:41:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623350494; cv=none; d=google.com; s=arc-20160816; b=eFcDicgtU3257zMFqatm2OeKFgIpiqEMZATFHfaQon2uQZ5PKJC/wZELRam8Y1M00f qqsxJswSz9vc7CVpyEAeGqAE02+x8Sdxi9JNPUHMiX8rr/XITPGBranWUeC5K+LsANzo KftkSdk7BRHV6GGVmBDE+gzN95yp3MH3Tj4mxM8dk3ZPFyOpi9K7KzEtgKWR1SNhGUee 7GRt7mwLo9OK0zP0yjuIg4soM/rb7YmkW2GHWkpmwkwXGTERsJVLDipmgCPFl/DDNH/W c7+vpjduVXf7zLPMyfnlYQfEfxXZl8LzPqeKeOJS2sOh7tiKOf0AjoP5VK4iGhb1RjoS 8kRw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent:references:message-id :in-reply-to:subject:cc:to:from:date; bh=yzj7Uzg2MPO37cJRGmDQBmhXHQvTXR5IbG5DD95Ng7E=; b=lZ9R6b4dDbTXXprYDKZAU4SSLneZG2qniPmIUYdrl/ZlEbhD2RHeZC9/WSP4J9Nrue GZfwFwCrzsy52gm9CE1q7iy/XU7kbvMeerb5tka3IPP7HspH6PqY/zpM/fX87I8om1jK kt1OJleQD1tIEFpmEDPHDeWS8wIydBtPWiafIFz4VzW3q3YiBADH2m33El6sjVNTUMlG /lQM6K4W7V0Iix5A94WNQ3wSp0XGjSmXVI4qHV6Otr7bvOJLJGURPw53EfRZD4IPJpO9 l/mTAbryUxLR2efxzpfJg+fR32K+RjCMo/Ova9nsyogA9sntM/krrpInyuNGwcQb+e8t oDbg== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l15si2898934ejc.521.2021.06.10.11.41.10; Thu, 10 Jun 2021 11:41:34 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231161AbhFJSlT (ORCPT + 99 others); Thu, 10 Jun 2021 14:41:19 -0400 Received: from angie.orcam.me.uk ([78.133.224.34]:41690 "EHLO angie.orcam.me.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230478AbhFJSlT (ORCPT ); Thu, 10 Jun 2021 14:41:19 -0400 Received: by angie.orcam.me.uk (Postfix, from userid 500) id 0C88A92009D; Thu, 10 Jun 2021 20:39:21 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by angie.orcam.me.uk (Postfix) with ESMTP id 0678D92009B; Thu, 10 Jun 2021 20:39:20 +0200 (CEST) Date: Thu, 10 Jun 2021 20:39:20 +0200 (CEST) From: "Maciej W. Rozycki" To: Greg Kroah-Hartman , Jiri Slaby cc: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 4/4] serial: 8250: Define RX trigger levels for OxSemi 950 devices In-Reply-To: Message-ID: References: User-Agent: Alpine 2.21 (DEB 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Oxford Semiconductor 950 serial port devices have a 128-byte FIFO and in the enhanced (650) mode, which we select in `autoconfig_has_efr' with the ECB bit set in the EFR register, they support the receive interrupt trigger level selectable with FCR bits 7:6 from the set of 16, 32, 112, 120. This applies to the original OX16C950 discrete UART[1] as well as 950 cores embedded into more complex devices. For these devices we set the default to 112, which sets an excessively high level of 112 or 7/8 of the FIFO capacity, unlike with other port types where we choose at most 1/2 of their respective FIFO capacities. Additionally we don't make the trigger level configurable. Consequently frequent input overruns happen with high bit rates where hardware flow control cannot be used (e.g. terminal applications) even with otherwise highly-performant systems. Lower the default receive interrupt trigger level to 32 then, and make it configurable. Document the trigger levels along with other port types, including the set of 16, 32, 64, 112 for the transmit interrupt as well[2]. References: [1] "OX16C950 rev B High Performance UART with 128 byte FIFOs", Oxford Semiconductor, Inc., DS-0031, Sep 05, Table 10: "Receiver Trigger Levels", p. 22 [2] same, Table 9: "Transmit Interrupt Trigger Levels", p. 22 Signed-off-by: Maciej W. Rozycki --- drivers/tty/serial/8250/8250_port.c | 3 ++- include/uapi/linux/serial_reg.h | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) linux-serial-8250-oxsemi-fifo.diff Index: linux-malta-cbus-uart/drivers/tty/serial/8250/8250_port.c =================================================================== --- linux-malta-cbus-uart.orig/drivers/tty/serial/8250/8250_port.c +++ linux-malta-cbus-uart/drivers/tty/serial/8250/8250_port.c @@ -122,7 +122,8 @@ static const struct serial8250_config ua .name = "16C950/954", .fifo_size = 128, .tx_loadsz = 128, - .fcr = UART_FCR_ENABLE_FIFO | UART_FCR_R_TRIG_10, + .fcr = UART_FCR_ENABLE_FIFO | UART_FCR_R_TRIG_01, + .rxtrig_bytes = {16, 32, 112, 120}, /* UART_CAP_EFR breaks billionon CF bluetooth card. */ .flags = UART_CAP_FIFO | UART_CAP_SLEEP, }, Index: linux-malta-cbus-uart/include/uapi/linux/serial_reg.h =================================================================== --- linux-malta-cbus-uart.orig/include/uapi/linux/serial_reg.h +++ linux-malta-cbus-uart/include/uapi/linux/serial_reg.h @@ -62,6 +62,7 @@ * ST16C654: 8 16 56 60 8 16 32 56 PORT_16654 * TI16C750: 1 16 32 56 xx xx xx xx PORT_16750 * TI16C752: 8 16 56 60 8 16 32 56 + * OX16C950: 16 32 112 120 16 32 64 112 PORT_16C950 * Tegra: 1 4 8 14 16 8 4 1 PORT_TEGRA */ #define UART_FCR_R_TRIG_00 0x00