From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.210.44 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796380151; b=mna7MGivjjIEXF0ykOgeh0NjObFNh4GXRZChpv1xwA9+mNnYbVzI3/TPjR5gEOUHVboP 1lgJeUL+XYA9awNt3VYiqLJ6afVZWvASubkjGxcQCaXW2ZcbmMlY7MkzmY+5ndqARRXLU mCKQRFLE/VVs0d9NAIXjZwq0PxFz83E38VjH35y9/kebl2ERGPXQKTExsGFnB6cCFKm1+ ofHHCps5BktRS4hunGcH84epKsGDd3s34/ARPo9Qy1IhzKGPi7CFZpVGWi4fFieac0cXH 9/xnTi+WJLpId+LEHSWWpSlBQOrUt4j2i2gnk9FyKYxi5yAleIVMh8wEKa1L7ZoEdYw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796380151; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Gm-Message-State:X-Gm-Gg:X-Received:Received:From:Date:Subject: MIME-Version:Content-Type:Content-Transfer-Encoding:Message-Id: References:In-Reply-To:To:Cc:X-Mailer; bh=VgeV+mzKD5tq4uIdS69YHzHL/GzDJl0ly47I/OGq690=; b=tCCknJYfRgovxBUBGvV/mMb6aPUwWcXs+WlO9EQCsI57uHOiiSlzXd+i8y0d3pXswrGZ iLlTpxSRUhFKoGtjPfito6N3QktCpc0+JEqIvA6eL4mmFWb0R2lVAwOj2w7eJgNjrOoY3 bkwrv/a1CZZxbimQg/QbLBGQ7t/hwnJ0ytFoIAcWjhmWJrgvIniyxGeegbTyDbUi9V/KH 6mF4onlHF93zEzEza23S7fsOickVxGjWZc5cNqILoHMvNV2p6jkzoeeQuFSNILrjS41NR AluH3Hsa7f+zYuOSSX32SMCFEfozdBgjxZJW8skwrMeI3jg+JclLz/Wx+Ah1mrMTINg== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=kUDOdgMz; arc=none smtp.remote-ip=209.85.210.44 Received: from mail-ot1-f44.google.com (mail-ot1-f44.google.com [209.85.210.44]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B61E2606A69F for ; Fri, 4 Dec 2026 10:29:10 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org B61E2606A69F Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=kUDOdgMz Received: by mail-ot1-f44.google.com with SMTP id 46e09a7af769-845788309b4so286220a34.1 for ; Fri, 04 Dec 2026 02:29:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1796380150; x=1796984950; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=VgeV+mzKD5tq4uIdS69YHzHL/GzDJl0ly47I/OGq690=; b=kUDOdgMzoiudXVIu4bdvd8eELGlwTLN2xhhoswgOAQN7q/Ahum44ScSGdvyWi0l8ZZ yr2s5ASu5T8qHBs+fP/lPwvNEvxEK70xTlzUXZ3qp9my7ZMQUX7xmUoVQB9QEuXLrWyS C+IoggHLkzhs671UHzjSVppeCktj4Zuu5hV6Y2y7tGWaexS1LZtcQIFexrInEHV0Ya/a xmCVOTuZv70+jPGhSUZsZpSGdlBBEqfzh+1h9gr/cdp0e8KtTkwWse8WEgbz5w0uVknO 5HI6F0GOGM5A4CyZdMg31l7n7UU0h56DWk/UCSRa+q2Xfvbt8r3Jp5r9iVGtqs4ya0dv vRXw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796380150; x=1796984950; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=VgeV+mzKD5tq4uIdS69YHzHL/GzDJl0ly47I/OGq690=; b=ASz91RKr+SlsbU9Rm4yNTItacvA+PwNzaK1/l65AGYtQNyoLsiwS0Pdintitp8O+7F AlQVBfICSnOpgl55Ot7I0H8aoVljKegUTpzkALzPc27hYota2yTmLWXkA8M5JJtkyBZD piCw5owk5C2MLJDhjAhpEZXr8v3xsjWgHeWEO2CgNLr6AcGvBkB/iF9mnNNAiLINMiuQ Ha/56Gj8btOXAOSztJH+V1a/8oCtXH5GqRl+A7tpk4bCfwIXgBHQOGjALP6vwvQ6O8Jy VwWyMuDU0qyOwEsI4zSWWQWMi+Wuh54I2+pHBLZp2YoQdYiILsBszAxpNCRnLBt2RN+e xjxg== X-Gm-Message-State: APuU4Z/pNHqMrOE7gNigy1S9ofT72846dkdBqd0BOslzGXJVmU1tb7Dr E01F5py6Ke+JwAg4uTwGQYeZRXUuzx/1Bem1YEtl4e69rPPCOeRugeOY X-Gm-Gg: AZFdTZc5ym69gUzLFA02mBLbXm471IySiIDjuu83gsXvSV/Z0wp9JCIRuNajfYJmCbX CyhtO2Eil+n8bAjOloq75G5xfF74VV2K6POyFXPcchUGEIjUqAe8soy0t7oc8J3m+7QthNFIMcB F/CyN8Dd7W7NckB+JndbgZ7pNWMEJoFwvrUngbUmUhKvxCvHyf8S+Kh/TFEA4dFCk3hZ7dLS/ly q+7D6VVTms0YJ8f8syAMk4MSro55damHaU/7KbUL0MnG3bYdG3QhPXrDJR+O7LCRlDT65vcO+sT NHK89/bgZSQbkTr9OfEUikGdht0ip5tDvYUSyFZwRTIE/NF+A5+/Dnkg5L7POSTkjA3I3RNeto4 yC4lGjGA40AxDLxSJx7KO/igr4OFvzMAlApnhXz/pZW9CcwqjD++w9OYEjW77OuTMm+CYl6b9uC DqKlVaQRZ8jxjmpVjjasGiiN21qI43nJCVwNO8g69atsxv+K1L+O0qmOdiTqLJznS3ZbFs8gMsp 4ju023aOJKtt9W5Dl3pACW0FkAJ1nqSTteyw4UuUzLP+ID8AeIk7QlBsu1g9ZNt2RCUjp7cbbjd X+WX99kBmO49dXP0wXsyoqo6KCki+HR1PmtG3UPEDT8DeWXvHZppBKOX3/lGUps/YjjNhtPd2hz yK8vHi6OySqiRKpxaMZVSEr0p3xXQU6ypL4aaWTAYnpVSFLm8UvAoH/XdapGAIBPzBJAh5qEFi9 LUt9CxzuPgwFJIJE3UV17I0JqBiIc+jk5Ktk66wt7SdSiehcBofNxgGw== X-Received: by 2002:a05:6830:4407:b0:862:a0ce:f558 with SMTP id 46e09a7af769-863f89ca776mr1436879a34.22.1796380149671; Fri, 04 Dec 2026 02:29:09 -0800 (PST) Received: from [127.0.1.1] (174-29-20-82.hlrn.qwest.net. [174.29.20.82]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-863f81fad14sm1747533a34.9.2026.12.04.02.29.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Dec 2026 02:29:09 -0800 (PST) From: James Hilliard Date: Fri, 04 Dec 2026 03:28:48 -0700 Subject: [PATCH v10 03/11] serial: 8250: widen RX trigger byte counts to 16 bits X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20261204-submit-h616-uart-fifo-v1-v10-3-1a9fb4f79635@gmail.com> References: <20261204-submit-h616-uart-fifo-v1-v10-0-1a9fb4f79635@gmail.com> In-Reply-To: <20261204-submit-h616-uart-fifo-v1-v10-0-1a9fb4f79635@gmail.com> To: Andy Shevchenko , =?utf-8?q?Ilpo_J=C3=A4rvinen?= , Greg Kroah-Hartman , Jiri Slaby , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland Cc: linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev, James Hilliard X-Mailer: b4 0.17-dev DesignWare UARTs can have 2048-byte FIFOs, with receive thresholds as large as 2046 bytes. The byte-sized threshold tables, setter argument and sysfs parser cannot represent these values. Use u16 for the threshold tables and byte counts throughout the 8250 conversion and sysfs paths, including the uart_port callback interface. Keep the FCR encoding byte-sized and preserve the existing threshold selection. The Moxa setter continues to validate against its 128-byte FIFO before writing the byte-sized trigger register. Signed-off-by: James Hilliard --- drivers/tty/serial/8250/8250.h | 2 +- drivers/tty/serial/8250/8250_mxpcie.c | 2 +- drivers/tty/serial/8250/8250_port.c | 12 ++++++------ include/linux/serial_core.h | 2 +- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/drivers/tty/serial/8250/8250.h b/drivers/tty/serial/8250/8250.h index 21ed9c41b751..939b7d4209f1 100644 --- a/drivers/tty/serial/8250/8250.h +++ b/drivers/tty/serial/8250/8250.h @@ -69,7 +69,7 @@ struct serial8250_config { unsigned short fifo_size; unsigned short tx_loadsz; unsigned char fcr; - unsigned char rxtrig_bytes[UART_FCR_R_TRIG_MAX_STATE]; + u16 rxtrig_bytes[UART_FCR_R_TRIG_MAX_STATE]; unsigned int flags; }; diff --git a/drivers/tty/serial/8250/8250_mxpcie.c b/drivers/tty/serial/8250/8250_mxpcie.c index 0a3fb63991c1..eff164339611 100644 --- a/drivers/tty/serial/8250/8250_mxpcie.c +++ b/drivers/tty/serial/8250/8250_mxpcie.c @@ -257,7 +257,7 @@ static int mxpcie8250_get_rxtrig(struct uart_port *port) return serial_port_in(port, MOXA_PUART_RTL); } -static int mxpcie8250_set_rxtrig(struct uart_port *port, unsigned char bytes) +static int mxpcie8250_set_rxtrig(struct uart_port *port, u16 bytes) { struct mxpcie8250 *priv = dev_get_drvdata(port->dev); diff --git a/drivers/tty/serial/8250/8250_port.c b/drivers/tty/serial/8250/8250_port.c index 36b2b0a2c05c..452851815ffc 100644 --- a/drivers/tty/serial/8250/8250_port.c +++ b/drivers/tty/serial/8250/8250_port.c @@ -3008,14 +3008,14 @@ static int serial8250_request_port(struct uart_port *port) static int fcr_get_rxtrig_bytes(struct uart_8250_port *up) { const struct serial8250_config *conf_type = &uart_config[up->port.type]; - unsigned char bytes; + u16 bytes; bytes = conf_type->rxtrig_bytes[UART_FCR_R_TRIG_BITS(up->fcr)]; return bytes ? bytes : -EOPNOTSUPP; } -static int bytes_to_fcr_rxtrig(struct uart_8250_port *up, unsigned char bytes) +static int bytes_to_fcr_rxtrig(struct uart_8250_port *up, u16 bytes) { const struct serial8250_config *conf_type = &uart_config[up->port.type]; int i; @@ -3073,7 +3073,7 @@ static ssize_t rx_trig_bytes_show(struct device *dev, return sysfs_emit(buf, "%d\n", rxtrig_bytes); } -static int do_set_rxtrig(struct tty_port *port, unsigned char bytes) +static int do_set_rxtrig(struct tty_port *port, u16 bytes) { struct uart_state *state = container_of(port, struct uart_state, port); struct uart_port *uport = state->uart_port; @@ -3094,7 +3094,7 @@ static int do_set_rxtrig(struct tty_port *port, unsigned char bytes) return 0; } -static int do_serial8250_set_rxtrig(struct tty_port *port, unsigned char bytes) +static int do_serial8250_set_rxtrig(struct tty_port *port, u16 bytes) { int ret; @@ -3111,13 +3111,13 @@ static ssize_t rx_trig_bytes_store(struct device *dev, struct tty_port *port = dev_get_drvdata(dev); struct uart_state *state = container_of(port, struct uart_state, port); struct uart_port *uport = state->uart_port; - unsigned char bytes; + u16 bytes; int ret; if (!count) return -EINVAL; - ret = kstrtou8(buf, 10, &bytes); + ret = kstrtou16(buf, 10, &bytes); if (ret < 0) return ret; diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h index 4eeb8253752a..97301ef66af0 100644 --- a/include/linux/serial_core.h +++ b/include/linux/serial_core.h @@ -461,7 +461,7 @@ struct uart_port { unsigned int quot, unsigned int quot_frac); int (*get_rxtrig)(struct uart_port *port); - int (*set_rxtrig)(struct uart_port *port, unsigned char bytes); + int (*set_rxtrig)(struct uart_port *port, u16 bytes); int (*startup)(struct uart_port *port); void (*shutdown)(struct uart_port *port); void (*throttle)(struct uart_port *port); -- 2.53.0