| Message ID | 20261029-submit-h616-uart-fifo-v1-v5-7-53b433aebbf8@gmail.com (mailing list archive) |
|---|---|
| State | New |
| Headers |
Return-Path: <linux-sunxi+bounces-26967-sunxi=pue.re@lists.linux.dev>
X-Original-To: noreply@patchwork.local
Delivered-To: noreply@patchwork.local
Received: from tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114])
by mxe881.netcup.net (Postfix) with ESMTPS id 8879E1C30DE
for <noreply@patchwork.local>; Thu, 29 Oct 2026 19:53:07 +0100 (CET)
Authentication-Results: mxe881;
dkim=pass header.d=gmail.com;
spf=pass (sender IP is 172.105.105.114)
smtp.mailfrom=linux-sunxi+bounces-26967-noreply=patchwork.local@lists.linux.dev
smtp.helo=tor.lore.kernel.org
Received-SPF: pass (mxe881: domain of lists.linux.dev designates
172.105.105.114 as permitted sender) client-ip=172.105.105.114;
envelope-from=linux-sunxi+bounces-26967-noreply=patchwork.local@lists.linux.dev;
helo=tor.lore.kernel.org;
Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org
[100.77.114.92])
by tor.lore.kernel.org (Postfix) with ESMTP id 8A46231019
for <noreply@patchwork.local>; Thu, 29 Oct 2026 18:47:55 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
t=1793299661;
b=Zu4A0lFFy9f76jnIKsDXU+FAmOxLF1zaRQTD1JgfPVmyWkNZi307gX24cs5uLAtkjLUf
HKeGcxJIDQOSQr8VXJNIEXcFaRrbhoyIaqLmQO2/CYmqtIeGBgnrciZDuiTfOz3Z72+91
YB56mfVz6e+q1TwqMA097ND57JIuIjQf+brdP4XAltVXqLUIIjNj6T7ahQIiMlOuhC86V
LsEtHSu7rTI3OI1us0zlTgsL0dEUEJI+Xql657PnLuZ4KszTv0QPPJzQKEDKydk23sScd
lHxRYFxXOHSqm7D4hSKnRxQzu13D2qBmxehhW/4li1lv6VIi2vvgDrbxUgHvsicfARw==
ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
a=rsa-sha256; c=relaxed/relaxed; t=1793299661;
h=X-Original-To:Received:DMARC-Filter:Received:DKIM-Signature:
X-Google-DKIM-Signature:X-Forwarded-Encrypted:X-Gm-Message-State:
X-Gm-Gg:X-Received:Received:From:Date:Subject:X-Mailing-List:List-Id:
List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner:
Precedence:MIME-Version:Content-Type:Content-Transfer-Encoding:
Message-Id:References:In-Reply-To:To:Cc:X-Mailer;
bh=XiQ0h5RUDVFXY9TV9nlMQOKan7K7h2eTMSJt9GdccNU=;
b=hdls182O7l/2LWMt3UT4Iiovdk1Ueq8KkTy4bpdS/wYL7U0exznbS03r3mFrh81imqus
5DVGUYG4s6EhIEYg1JltAlP0LKSNuyUOH4ZdxVVAbevbXWiYgUPr2bEzjqvHPVFjBRVm2
H5vIJZsufFwB7yJSoZYfO2d5wGiyFeJtxbdKWrl5tJ2I17nGfDkQDM5oSvNk1RWmtXxqg
hVkDVDTwqyLPfImYWLTRgQ73xdqvA9vnzunyWSz3Wn/AoJlnWhi9Pp2YVDfxJsRvNdGak
BBGUZ89paUsCXvc3C+/5G0SlGSPusW16nTQHDhyo28dPogcEtOcR/TnCKgrvL5QjGyw==
ARC-Authentication-Results: i=2; smtp.subspace.kernel.org;
dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256
header.s=20260707 header.b=yaHX2hiI;
dmarc=pass header.from=gmail.com;
spf=pass smtp.mailfrom=gmail.com;
arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
Received: from localhost.localdomain (localhost [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id C3BEA60A2605;
Thu, 29 Oct 2026 18:47:41 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key,
unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256
header.s=20260707 header.b=yaHX2hiI
X-Original-To: linux-sunxi@lists.linux.dev
Authentication-Results: smtp.subspace.kernel.org;
arc=none smtp.remote-ip=209.85.161.53
ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
t=1793299661;
b=wKxs/GIsYHM7USUGOb6Q1A5xVrOJPTfLdSVijFLqulDVcNxKzRd8U6s+ZV8tP5581FTX
kfJE1JiArFMdR6T+bMO1UKuWne/u9Y7xjSjMUOC58GXPs+KrzX8aL5wLjJwP1AwvS5zTj
gBw4uDSmJAYufeZ92pbClVoS4+GQCA8+qwG/x+qYqQ3z2uwMvIyWBZsYbCl+xE07Nmbrg
jtaF0xy5FB1c+vsN4qZ8CfTI5iKW/DrvGUQV+RFY67btA3VAJMWb8wsn2Gv9zUU2X5pj8
kok8GZyEATizjpB/e/kbw/02JhPpDtQHHu0AtE3Juoh4LI1juhLybekPgfHWPWTwm1g==
ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
a=rsa-sha256; c=relaxed/relaxed; t=1793299661;
h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature:
X-Forwarded-Encrypted: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=XiQ0h5RUDVFXY9TV9nlMQOKan7K7h2eTMSJt9GdccNU=;
b=qiHIePU1CNXbWrfLg49DPUqz+r/83Cp0iCYAiOyAFfpxOUuugLYklt2ky0OqzlOnjoHs
T8frak5QU9M2aIspqmbX7Q/mjTEfv3gxqYuGy87wqGSo5PYL1kV4rV9CIZJUpUSSdbnGU
WwkERBckfho52eiIzIwrQ+WaKadJYeJtRXZGy6lAd52lvxzeOBVIL3KqqdhIJ3aQbqgrY
KBqaj3Ua5SVObo4YleP+AkJ3VwNFnelUzSDU74XLvjaDkO7STZVhRL7Wnb477V9ZQdcwH
7RJrKuZ06/Je+ECZld9fXCjs9Z71vtQSE6ryYo8uhrXAR2AAbWej6prQzMU2Y/FM98A==
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=yaHX2hiI;
arc=none smtp.remote-ip=209.85.161.53
Received: from mail-oo1-f53.google.com (mail-oo1-f53.google.com
[209.85.161.53])
(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 5841360A2602
for <linux-sunxi@lists.linux.dev>; Thu, 29 Oct 2026 18:47:41 +0000 (UTC)
DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 5841360A2602
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
Received: by mail-oo1-f53.google.com with SMTP id
006d021491bc7-6e560e00a86so1881579eaf.1
for <linux-sunxi@lists.linux.dev>;
Thu, 29 Oct 2026 11:47:41 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20260707; t=1793299660; x=1793904460;
darn=lists.linux.dev;
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=XiQ0h5RUDVFXY9TV9nlMQOKan7K7h2eTMSJt9GdccNU=;
b=yaHX2hiIMvNuktutT5X9/DhiAepLIQWJXRa5dS/RhoICJvRtTy/nY4s/yMy5lW/am2
WUh5QAqCmGsM28xpNiG+WfxnKE80QAs+Ehwsv0Nue/x6pGFbPjN0LQ54YsXJBQnmz8fO
mnkdpLGOopSFD8b4RGMgiYra/eb/2qCvUGKltLyZPI6Zd9oGJuTQDI3xwEcctzPwHvo0
KxwukehN+A5Uz+8BeDsTHFSast7z0du73C941qyU4S5sTkDIga7McHj1wC9lbTY5/UbL
rPtdD6eMEykf8CdX04TnqrlYCJpDol3knpwceFa9yXgqPwEAFMTPZKLLWEK+Q6Arza6D
KQvw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20260707; t=1793299660; x=1793904460;
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=XiQ0h5RUDVFXY9TV9nlMQOKan7K7h2eTMSJt9GdccNU=;
b=kuScBPuSWzWdatjF8N9D5nAMAh/hC/Gs0Xc5qIvDAec4z/QgZxE6GEFTLX+rFcchnI
Ji7otoLKH7X67xBJTphbi6sDXEeOehekDRlVtyjRajnBzY4e7bF9iualNL4HfqtABX1r
u6T7Y66xE5wcNBkOW2EVPEunAZkl/WuMpRS5Rvby7DJ3N/xcJygajvqYSSftXp8nhkfG
RjG4LJqcWXegi/p0J8DEDmAuiaZQpGFyv8yzu2FDIFjoonr0D0vDVDqqTwWQc1Lz5FuK
cITP3U1HddZUk+MO5UnPnvB1cG1NOtaBddFlSUgJteGnTeLeBgP9Ozi1zJtTAP2DZO1L
LWjg==
X-Forwarded-Encrypted: i=1;
AKwUvBwFhwa12Y2MVNCwvv2fbf3TFNsEbvi5JUIdd7W6Hd8YP1EFj1eXIu0FSFLgYPnyacv6Un4YywGkEriM3g==@lists.linux.dev
X-Gm-Message-State: AFq9FYIs3541ByPTC8EM6SOVTSO4+gfrloxmprjXd4GJwotFtp/auUX1
qERsObCoNEAfAQbHL930M5PSBcKA/rJp8I6z/cN3eVPbsWUE+9EP9tLd
X-Gm-Gg: AYBFou0kHV6kVtaqTciJM8aY8T0e07q3kgY3Udl4NEJH3JXSoupMofMS+I8OIO6LZHG
phrJdTv2C/2GurgYxhPeJ58YPLDrniSc0N6Zny/uEys0p9DIp++8c+4aekzeRdD5y6KYBtVGfa0
++oDDnf1lNRVMHpwQXYvVJns+3b2nAc2CC6yL9OFpcFfUH4s4XT277ijapr/eAjCC2PIL26e/uH
JgufTuMadCBdgKAN8VaJeoaT29zSw4WVQCwxRDxOnLJKYq6V7G2LyxH7DFkxUBHubmu6rgtBx4v
TA2YJ2C4HWQuFXatG71R1TcJlarVJgEjlJ/8IAAhvgShRxfEAuj3hiMzzZgCVP8R2Yc6kXmNjNG
WEksKrQG0EsbJXy7o4ABzoVpvcn3zowNUJlW9WXtpSmY4mi0w/G54jjRrVKMZM7DZrlvrV9C4lP
rvqi6BGOeU55+Qa0vUasdwB5NvViUMlApWp8hXliXAJxqAUaQCCstRGg5/+lXL6/qtm8tQucwYC
TI4lyuvislWMvCQPiJXnGfYzfPnMo+XOifjnqf4t66tMRtVL+K6MN+iA+XIt6Rrj0L3DE/G0pnW
4ZuMVTINTZBURERfwJhsBjWfchfDxvLbx5h6mVmx/6n6FDZYG/nKe/tMrQSrZwKkMMiiTYixZLE
TeaDn09+UtAkXKMedvDmE34C9/yM5yz7Nx3oaYG4oJ6lgGrO088inC/rJg4STSqlGlKXULtGy05
oBkIeExQpEZ1GJybF+R5/ItaQ0X3qjV7JbR9fcq0q/GGMpNNVyMs8=
X-Received: by 2002:a05:6820:a65c:10b0:6e2:3d8b:a01c with SMTP id
006d021491bc7-714f24006f7mr112598eaf.19.1793299660372;
Thu, 29 Oct 2026 11:47:40 -0700 (PDT)
Received: from [127.0.1.1] (174-29-1-49.hlrn.qwest.net. [174.29.1.49])
by smtp.gmail.com with ESMTPSA id
46e09a7af769-85d354cfb83sm221871a34.14.2026.10.29.11.47.39
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Thu, 29 Oct 2026 11:47:40 -0700 (PDT)
From: James Hilliard <james.hilliard1@gmail.com>
Date: Thu, 29 Oct 2026 12:47:28 -0600
Subject: [PATCH v5 7/8] serial: 8250_dw: discover Allwinner A523 FIFO
depths through FCC
X-Mailing-List: linux-sunxi@lists.linux.dev
List-Id: <linux-sunxi.lists.linux.dev>
List-Post: <mailto:linux-sunxi@lists.linux.dev>
List-Help: <mailto:linux-sunxi+help@lists.linux.dev>
List-Subscribe: <mailto:linux-sunxi+subscribe@lists.linux.dev>
List-Unsubscribe: <mailto:linux-sunxi+unsubscribe@lists.linux.dev>
List-Owner: <mailto:linux-sunxi+owner@lists.linux.dev>
Precedence: list
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 7bit
Message-Id: <20261029-submit-h616-uart-fifo-v1-v5-7-53b433aebbf8@gmail.com>
References: <20261029-submit-h616-uart-fifo-v1-v5-0-53b433aebbf8@gmail.com>
In-Reply-To: <20261029-submit-h616-uart-fifo-v1-v5-0-53b433aebbf8@gmail.com>
To: Andy Shevchenko <andriy.shevchenko@linux.intel.com>, =?utf-8?q?Ilpo_J?=
=?utf-8?q?=C3=A4rvinen?= <ilpo.jarvinen@linux.intel.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Jiri Slaby <jirislaby@kernel.org>, Rob Herring <robh@kernel.org>,
Krzysztof Kozlowski <krzk+dt@kernel.org>, Conor Dooley <conor+dt@kernel.org>,
Chen-Yu Tsai <wens@kernel.org>, Jernej Skrabec <jernej.skrabec@gmail.com>,
Samuel Holland <samuel@sholland.org>
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 <james.hilliard1@gmail.com>
X-Mailer: b4 0.15.2
X-Rspamd-Server: rspamd-worker-8404
X-Spamd-Result: default: False [-1.19 / 15.00];
BAYES_HAM(-5.50)[100.00%];
RBL_SENDERSCORE(2.00)[172.105.105.114:from];
SUSPICIOUS_RECIPS(1.50)[];
DMARC_POLICY_SOFTFAIL(1.00)[gmail.com : SPF not aligned (relaxed),
No valid DKIM,none];
MAILLIST(-0.18)[generic];
MIME_GOOD(-0.10)[text/plain];
BAD_REP_POLICIES(0.10)[];
HAS_LIST_UNSUB(-0.01)[];
DBL_BLOCKED_OPENRESOLVER(0.00)[tor.lore.kernel.org:helo,tor.lore.kernel.org:rdns];
FORGED_SENDER_MAILLIST(0.00)[];
RCVD_COUNT_FIVE(0.00)[6];
RCPT_COUNT_TWELVE(0.00)[16];
FROM_HAS_DN(0.00)[];
FREEMAIL_CC(0.00)[vger.kernel.org,lists.infradead.org,lists.linux.dev,gmail.com];
TAGGED_RCPT(0.00)[dt];
FROM_NEQ_ENVFROM(0.00)[jameshilliard1@gmail.com,linux-sunxi@lists.linux.dev];
ASN(0.00)[asn:63949, ipnet:172.105.96.0/20, country:SG];
MID_RHS_MATCH_FROM(0.00)[];
TO_DN_SOME(0.00)[];
FREEMAIL_FROM(0.00)[gmail.com];
RECEIVED_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[209.85.161.53:received,100.77.114.92:received,174.29.1.49:received];
RBL_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[172.105.105.114:from];
TAGGED_FROM(0.00)[bounces-26967-noreply=patchwork.local];
R_SPF_ALLOW(0.00)[+ip4:172.105.105.114];
FORGED_RECIPIENTS_MAILLIST(0.00)[];
ARC_ALLOW(0.00)[subspace.kernel.org:s=arc20261015:i=2];
FREEMAIL_TO(0.00)[linux.intel.com,linuxfoundation.org,kernel.org,gmail.com,sholland.org];
RCVD_TLS_LAST(0.00)[];
MIME_TRACE(0.00)[0:+];
RCVD_VIA_SMTP_AUTH(0.00)[]
X-Rspamd-Queue-Id: 8879E1C30DE
X-MORS-Enabled: yes
X-MORS-DOMAIN: patchwork.local
X-MORS-HOSTING: hosting172546
X-MORS-USER: hosting172546
X-getmail-retrieved-from-mailbox: INBOX
|
| Series |
serial: 8250_dw: describe the Allwinner H616 and A523 UART configurations
|
|
Commit Message
James Hilliard
Oct. 29, 2026, 6:47 p.m. UTC
The A523 UART integration, also used by A527 and T527, has 64-byte FIFOs
on UART0 and 128-byte FIFOs on UART1 through UART7. Each controller reports
its TX/RX FIFO depth in bits 31:8 of the FIFO Clock Control register at
offset 0xf0. The field holds a byte count, not a logarithmic encoding.
Read this field in the sunxi setup callback when platform data does not
provide a fixed FIFO size. A fixed size takes precedence, so H616 retains
its 256-byte configuration without accessing FCC. The probe has already
enabled the clocks and deasserted reset before invoking the callback.
Leave the FIFO clock-control bits untouched.
Validate the depth before generating the RX trigger table or setting the
transmit load. The quarter-full threshold must be positive and the
FIFO-depth-minus-two threshold must fit in the byte-sized table and RX
trigger API. Report an invalid depth and fail probe instead of generating
zero or truncated thresholds.
Select this setup for the A523 compatible. Derive the transmit load and
RX threshold table from the discovered depth using the common sunxi
helpers. This handles the different FIFO sizes with one compatible and
one receive-trigger mapping.
Like H616, this integration has Allwinner-specific debug-divisor and
RS485 registers overlapping the generic DesignWare feature probes. Use
the common sunxi PIO setup, BUSY-safe integer divisor programming and
software RS485 handling. Keep the APB clock gate enabled during termios
updates with SKIP_SET_RATE.
Signed-off-by: James Hilliard <james.hilliard1@gmail.com>
---
drivers/tty/serial/8250/8250_dw.c | 23 +++++++++++++++++++++++
1 file changed, 23 insertions(+)
Comments
On Thu, 29 Oct 2026, James Hilliard wrote: > The A523 UART integration, also used by A527 and T527, has 64-byte FIFOs > on UART0 and 128-byte FIFOs on UART1 through UART7. Each controller reports > its TX/RX FIFO depth in bits 31:8 of the FIFO Clock Control register at > offset 0xf0. The field holds a byte count, not a logarithmic encoding. > > Read this field in the sunxi setup callback when platform data does not > provide a fixed FIFO size. A fixed size takes precedence, so H616 retains > its 256-byte configuration without accessing FCC. The probe has already > enabled the clocks and deasserted reset before invoking the callback. > Leave the FIFO clock-control bits untouched. > > Validate the depth before generating the RX trigger table or setting the > transmit load. The quarter-full threshold must be positive and the > FIFO-depth-minus-two threshold must fit in the byte-sized table and RX > trigger API. Report an invalid depth and fail probe instead of generating > zero or truncated thresholds. > > Select this setup for the A523 compatible. Derive the transmit load and > RX threshold table from the discovered depth using the common sunxi > helpers. This handles the different FIFO sizes with one compatible and > one receive-trigger mapping. > > Like H616, this integration has Allwinner-specific debug-divisor and > RS485 registers overlapping the generic DesignWare feature probes. Use > the common sunxi PIO setup, BUSY-safe integer divisor programming and > software RS485 handling. Keep the APB clock gate enabled during termios > updates with SKIP_SET_RATE. > > Signed-off-by: James Hilliard <james.hilliard1@gmail.com> > --- > drivers/tty/serial/8250/8250_dw.c | 23 +++++++++++++++++++++++ > 1 file changed, 23 insertions(+) > > diff --git a/drivers/tty/serial/8250/8250_dw.c b/drivers/tty/serial/8250/8250_dw.c > index 3bc6735fc253..2ab91f479fc6 100644 > --- a/drivers/tty/serial/8250/8250_dw.c > +++ b/drivers/tty/serial/8250/8250_dw.c > @@ -17,6 +17,7 @@ > #include <linux/device.h> > #include <linux/err.h> > #include <linux/io.h> > +#include <linux/limits.h> > #include <linux/lockdep.h> > #include <linux/module.h> > #include <linux/mutex.h> > @@ -45,6 +46,10 @@ > #define RZN1_UART_xDMACR_8_WORD_BURST (2 << 1) > #define RZN1_UART_xDMACR_BLK_SZ(x) ((x) << 3) > > +/* Allwinner FIFO Clock Control register */ > +#define SUNXI_UART_FCC 0xf0 > +#define SUNXI_UART_FCC_FIFO_DEPTH GENMASK(31, 8) > + > /* Quirks */ > #define DW_UART_QUIRK_OCTEON BIT(0) > #define DW_UART_QUIRK_ARMADA_38X BIT(1) > @@ -64,6 +69,7 @@ > struct dw8250_platform_data { > u8 usr_reg; > u32 cpr_value; > + /* Fixed sunxi FIFO depth; zero selects discovery through FCC */ Please generalize the wording by removing sunxi, it might true today but as more drivers start to use it, then the comment gets obsoleted by the code additions. > unsigned int fifo_size; > unsigned int quirks; > int (*setup)(struct uart_port *p); > @@ -729,6 +735,16 @@ static int dw8250_sunxi_setup(struct uart_port *p) > p->type = PORT_16550A; > p->flags |= UPF_FIXED_TYPE; > p->fifosize = data->pdata->fifo_size; > + if (!p->fifosize) { > + u32 fcc = dw8250_readl_ext(p, SUNXI_UART_FCC); > + > + p->fifosize = FIELD_GET(SUNXI_UART_FCC_FIFO_DEPTH, fcc); > + } > + /* The RX trigger table must contain positive, byte-sized thresholds */ > + if (p->fifosize < 4 || p->fifosize - 2 > U8_MAX) As is, these checks are hard to understand / connect to why. It would make this more obvious if you'd name those literals so they'd connect to the FCR side code (naming should be done already in the FCR patch, obviously). > + return dev_err_probe(p->dev, -EINVAL, > + "invalid FIFO size %u\n", p->fifosize); > + > up->capabilities = UART_CAP_FIFO | UART_CAP_NOTEMT | UART_CAP_AFE; > > dw8250_sunxi_setup_rxtrig(p); > @@ -972,6 +988,12 @@ static const struct dw8250_platform_data dw8250_h616_data = { > .setup = dw8250_sunxi_setup, > }; > > +static const struct dw8250_platform_data dw8250_a523_data = { > + .usr_reg = DW_UART_USR, > + .quirks = DW_UART_QUIRK_SKIP_SET_RATE, > + .setup = dw8250_sunxi_setup, > +}; > + > static const struct dw8250_platform_data dw8250_octeon_3860_data = { > .usr_reg = OCTEON_UART_USR, > .quirks = DW_UART_QUIRK_OCTEON, > @@ -1024,6 +1046,7 @@ static const struct dw8250_platform_data dw8250_tda54 = { > static const struct of_device_id dw8250_of_match[] = { > { .compatible = "snps,dw-apb-uart", .data = &dw8250_dw_apb }, > { .compatible = "allwinner,sun50i-h616-uart", .data = &dw8250_h616_data }, > + { .compatible = "allwinner,sun55i-a523-uart", .data = &dw8250_a523_data }, > { .compatible = "cavium,octeon-3860-uart", .data = &dw8250_octeon_3860_data }, > { .compatible = "marvell,armada-38x-uart", .data = &dw8250_armada_38x_data }, > { .compatible = "renesas,rzn1-uart", .data = &dw8250_renesas_rzn1_data }, > >
On Thu, 29 Oct 2026, James Hilliard wrote: > The A523 UART integration, also used by A527 and T527, has 64-byte FIFOs > on UART0 and 128-byte FIFOs on UART1 through UART7. Each controller reports > its TX/RX FIFO depth in bits 31:8 of the FIFO Clock Control register at > offset 0xf0. The field holds a byte count, not a logarithmic encoding. > > Read this field in the sunxi setup callback when platform data does not > provide a fixed FIFO size. A fixed size takes precedence, so H616 retains > its 256-byte configuration without accessing FCC. The probe has already > enabled the clocks and deasserted reset before invoking the callback. > Leave the FIFO clock-control bits untouched. > > Validate the depth before generating the RX trigger table or setting the > transmit load. The quarter-full threshold must be positive and the > FIFO-depth-minus-two threshold must fit in the byte-sized table and RX > trigger API. Report an invalid depth and fail probe instead of generating > zero or truncated thresholds. > > Select this setup for the A523 compatible. Derive the transmit load and > RX threshold table from the discovered depth using the common sunxi > helpers. This handles the different FIFO sizes with one compatible and > one receive-trigger mapping. > > Like H616, this integration has Allwinner-specific debug-divisor and > RS485 registers overlapping the generic DesignWare feature probes. Use > the common sunxi PIO setup, BUSY-safe integer divisor programming and > software RS485 handling. Keep the APB clock gate enabled during termios > updates with SKIP_SET_RATE. > > Signed-off-by: James Hilliard <james.hilliard1@gmail.com> > --- > drivers/tty/serial/8250/8250_dw.c | 23 +++++++++++++++++++++++ > 1 file changed, 23 insertions(+) > > diff --git a/drivers/tty/serial/8250/8250_dw.c b/drivers/tty/serial/8250/8250_dw.c > index 3bc6735fc253..2ab91f479fc6 100644 > --- a/drivers/tty/serial/8250/8250_dw.c > +++ b/drivers/tty/serial/8250/8250_dw.c > @@ -17,6 +17,7 @@ > #include <linux/device.h> > #include <linux/err.h> > #include <linux/io.h> > +#include <linux/limits.h> > #include <linux/lockdep.h> > #include <linux/module.h> > #include <linux/mutex.h> > @@ -45,6 +46,10 @@ > #define RZN1_UART_xDMACR_8_WORD_BURST (2 << 1) > #define RZN1_UART_xDMACR_BLK_SZ(x) ((x) << 3) > > +/* Allwinner FIFO Clock Control register */ > +#define SUNXI_UART_FCC 0xf0 > +#define SUNXI_UART_FCC_FIFO_DEPTH GENMASK(31, 8) > + > /* Quirks */ > #define DW_UART_QUIRK_OCTEON BIT(0) > #define DW_UART_QUIRK_ARMADA_38X BIT(1) > @@ -64,6 +69,7 @@ > struct dw8250_platform_data { > u8 usr_reg; > u32 cpr_value; > + /* Fixed sunxi FIFO depth; zero selects discovery through FCC */ > unsigned int fifo_size; > unsigned int quirks; > int (*setup)(struct uart_port *p); > @@ -729,6 +735,16 @@ static int dw8250_sunxi_setup(struct uart_port *p) > p->type = PORT_16550A; > p->flags |= UPF_FIXED_TYPE; > p->fifosize = data->pdata->fifo_size; > + if (!p->fifosize) { > + u32 fcc = dw8250_readl_ext(p, SUNXI_UART_FCC); > + > + p->fifosize = FIELD_GET(SUNXI_UART_FCC_FIFO_DEPTH, fcc); > + } > + /* The RX trigger table must contain positive, byte-sized thresholds */ > + if (p->fifosize < 4 || p->fifosize - 2 > U8_MAX) One additional comment. What is the reason for this "byte-sized" limit? Is it Allwinner specific or perhaps the use of unsigned char in 8250 driver to store them? In the DW databook the CPR given fifosizes go all the way up to 2k. I'm not sure how large actual UARTs make them but applying the FCR formulas one could get > U8_MAX thresholds. If it's just 8250 drivers type limitation, I think the comment should make that obvious the type could be changed as needed.
On Fri, Oct 30, 2026 at 4:15 AM Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> wrote: > > On Thu, 29 Oct 2026, James Hilliard wrote: > > > The A523 UART integration, also used by A527 and T527, has 64-byte FIFOs > > on UART0 and 128-byte FIFOs on UART1 through UART7. Each controller reports > > its TX/RX FIFO depth in bits 31:8 of the FIFO Clock Control register at > > offset 0xf0. The field holds a byte count, not a logarithmic encoding. > > > > Read this field in the sunxi setup callback when platform data does not > > provide a fixed FIFO size. A fixed size takes precedence, so H616 retains > > its 256-byte configuration without accessing FCC. The probe has already > > enabled the clocks and deasserted reset before invoking the callback. > > Leave the FIFO clock-control bits untouched. > > > > Validate the depth before generating the RX trigger table or setting the > > transmit load. The quarter-full threshold must be positive and the > > FIFO-depth-minus-two threshold must fit in the byte-sized table and RX > > trigger API. Report an invalid depth and fail probe instead of generating > > zero or truncated thresholds. > > > > Select this setup for the A523 compatible. Derive the transmit load and > > RX threshold table from the discovered depth using the common sunxi > > helpers. This handles the different FIFO sizes with one compatible and > > one receive-trigger mapping. > > > > Like H616, this integration has Allwinner-specific debug-divisor and > > RS485 registers overlapping the generic DesignWare feature probes. Use > > the common sunxi PIO setup, BUSY-safe integer divisor programming and > > software RS485 handling. Keep the APB clock gate enabled during termios > > updates with SKIP_SET_RATE. > > > > Signed-off-by: James Hilliard <james.hilliard1@gmail.com> > > --- > > drivers/tty/serial/8250/8250_dw.c | 23 +++++++++++++++++++++++ > > 1 file changed, 23 insertions(+) > > > > diff --git a/drivers/tty/serial/8250/8250_dw.c b/drivers/tty/serial/8250/8250_dw.c > > index 3bc6735fc253..2ab91f479fc6 100644 > > --- a/drivers/tty/serial/8250/8250_dw.c > > +++ b/drivers/tty/serial/8250/8250_dw.c > > @@ -17,6 +17,7 @@ > > #include <linux/device.h> > > #include <linux/err.h> > > #include <linux/io.h> > > +#include <linux/limits.h> > > #include <linux/lockdep.h> > > #include <linux/module.h> > > #include <linux/mutex.h> > > @@ -45,6 +46,10 @@ > > #define RZN1_UART_xDMACR_8_WORD_BURST (2 << 1) > > #define RZN1_UART_xDMACR_BLK_SZ(x) ((x) << 3) > > > > +/* Allwinner FIFO Clock Control register */ > > +#define SUNXI_UART_FCC 0xf0 > > +#define SUNXI_UART_FCC_FIFO_DEPTH GENMASK(31, 8) > > + > > /* Quirks */ > > #define DW_UART_QUIRK_OCTEON BIT(0) > > #define DW_UART_QUIRK_ARMADA_38X BIT(1) > > @@ -64,6 +69,7 @@ > > struct dw8250_platform_data { > > u8 usr_reg; > > u32 cpr_value; > > + /* Fixed sunxi FIFO depth; zero selects discovery through FCC */ > > unsigned int fifo_size; > > unsigned int quirks; > > int (*setup)(struct uart_port *p); > > @@ -729,6 +735,16 @@ static int dw8250_sunxi_setup(struct uart_port *p) > > p->type = PORT_16550A; > > p->flags |= UPF_FIXED_TYPE; > > p->fifosize = data->pdata->fifo_size; > > + if (!p->fifosize) { > > + u32 fcc = dw8250_readl_ext(p, SUNXI_UART_FCC); > > + > > + p->fifosize = FIELD_GET(SUNXI_UART_FCC_FIFO_DEPTH, fcc); > > + } > > + /* The RX trigger table must contain positive, byte-sized thresholds */ > > + if (p->fifosize < 4 || p->fifosize - 2 > U8_MAX) > > One additional comment. > > What is the reason for this "byte-sized" limit? Is it Allwinner specific > or perhaps the use of unsigned char in 8250 driver to store them? It comes from the current 8250 software interface, not an Allwinner hardware restriction. The per-port u8 threshold table is introduced by this series, but the existing set_rxtrig() callback takes unsigned char byte counts, and rx_trig_bytes sysfs writes are parsed with kstrtou8(). The existing per-UART-type threshold tables also use unsigned char. > In the DW databook the CPR given fifosizes go all the way up to 2k. I'm > not sure how large actual UARTs make them but applying the FCR formulas > one could get > U8_MAX thresholds. I haven't found an Allwinner UART documented as having a FIFO larger than 256 bytes in the vendor manuals reviewed, and the BSP configurations checked also stay within that size. With the Allwinner mapping, the largest threshold for those depths is 254 bytes, so the current types cover the hardware identified so far. A larger FIFO could exceed that representation: a 512-byte FIFO would need a 510-byte threshold, which would truncate to 254 in our u8 table. The check prevents that truncation. It is a software limitation, not a claim that Allwinner hardware cannot implement larger FIFOs. > If it's just 8250 drivers type limitation, I think the comment should > make that obvious the type could be changed as needed. The comment should identify this as a limitation of the current byte-count representation. Supporting larger thresholds would require widening the new table and shared conversion helper, together with the existing setter argument and sysfs input parsing. Widening just our table would not allow those thresholds to be requested through the current interface. > > -- > i. > > > + return dev_err_probe(p->dev, -EINVAL, > > + "invalid FIFO size %u\n", p->fifosize); > > + > > up->capabilities = UART_CAP_FIFO | UART_CAP_NOTEMT | UART_CAP_AFE; > > > > dw8250_sunxi_setup_rxtrig(p); > > @@ -972,6 +988,12 @@ static const struct dw8250_platform_data dw8250_h616_data = { > > .setup = dw8250_sunxi_setup, > > }; > > > > +static const struct dw8250_platform_data dw8250_a523_data = { > > + .usr_reg = DW_UART_USR, > > + .quirks = DW_UART_QUIRK_SKIP_SET_RATE, > > + .setup = dw8250_sunxi_setup, > > +}; > > + > > static const struct dw8250_platform_data dw8250_octeon_3860_data = { > > .usr_reg = OCTEON_UART_USR, > > .quirks = DW_UART_QUIRK_OCTEON, > > @@ -1024,6 +1046,7 @@ static const struct dw8250_platform_data dw8250_tda54 = { > > static const struct of_device_id dw8250_of_match[] = { > > { .compatible = "snps,dw-apb-uart", .data = &dw8250_dw_apb }, > > { .compatible = "allwinner,sun50i-h616-uart", .data = &dw8250_h616_data }, > > + { .compatible = "allwinner,sun55i-a523-uart", .data = &dw8250_a523_data }, > > { .compatible = "cavium,octeon-3860-uart", .data = &dw8250_octeon_3860_data }, > > { .compatible = "marvell,armada-38x-uart", .data = &dw8250_armada_38x_data }, > > { .compatible = "renesas,rzn1-uart", .data = &dw8250_renesas_rzn1_data }, > > > > >
diff --git a/drivers/tty/serial/8250/8250_dw.c b/drivers/tty/serial/8250/8250_dw.c index 3bc6735fc253..2ab91f479fc6 100644 --- a/drivers/tty/serial/8250/8250_dw.c +++ b/drivers/tty/serial/8250/8250_dw.c @@ -17,6 +17,7 @@ #include <linux/device.h> #include <linux/err.h> #include <linux/io.h> +#include <linux/limits.h> #include <linux/lockdep.h> #include <linux/module.h> #include <linux/mutex.h> @@ -45,6 +46,10 @@ #define RZN1_UART_xDMACR_8_WORD_BURST (2 << 1) #define RZN1_UART_xDMACR_BLK_SZ(x) ((x) << 3) +/* Allwinner FIFO Clock Control register */ +#define SUNXI_UART_FCC 0xf0 +#define SUNXI_UART_FCC_FIFO_DEPTH GENMASK(31, 8) + /* Quirks */ #define DW_UART_QUIRK_OCTEON BIT(0) #define DW_UART_QUIRK_ARMADA_38X BIT(1) @@ -64,6 +69,7 @@ struct dw8250_platform_data { u8 usr_reg; u32 cpr_value; + /* Fixed sunxi FIFO depth; zero selects discovery through FCC */ unsigned int fifo_size; unsigned int quirks; int (*setup)(struct uart_port *p); @@ -729,6 +735,16 @@ static int dw8250_sunxi_setup(struct uart_port *p) p->type = PORT_16550A; p->flags |= UPF_FIXED_TYPE; p->fifosize = data->pdata->fifo_size; + if (!p->fifosize) { + u32 fcc = dw8250_readl_ext(p, SUNXI_UART_FCC); + + p->fifosize = FIELD_GET(SUNXI_UART_FCC_FIFO_DEPTH, fcc); + } + /* The RX trigger table must contain positive, byte-sized thresholds */ + if (p->fifosize < 4 || p->fifosize - 2 > U8_MAX) + return dev_err_probe(p->dev, -EINVAL, + "invalid FIFO size %u\n", p->fifosize); + up->capabilities = UART_CAP_FIFO | UART_CAP_NOTEMT | UART_CAP_AFE; dw8250_sunxi_setup_rxtrig(p); @@ -972,6 +988,12 @@ static const struct dw8250_platform_data dw8250_h616_data = { .setup = dw8250_sunxi_setup, }; +static const struct dw8250_platform_data dw8250_a523_data = { + .usr_reg = DW_UART_USR, + .quirks = DW_UART_QUIRK_SKIP_SET_RATE, + .setup = dw8250_sunxi_setup, +}; + static const struct dw8250_platform_data dw8250_octeon_3860_data = { .usr_reg = OCTEON_UART_USR, .quirks = DW_UART_QUIRK_OCTEON, @@ -1024,6 +1046,7 @@ static const struct dw8250_platform_data dw8250_tda54 = { static const struct of_device_id dw8250_of_match[] = { { .compatible = "snps,dw-apb-uart", .data = &dw8250_dw_apb }, { .compatible = "allwinner,sun50i-h616-uart", .data = &dw8250_h616_data }, + { .compatible = "allwinner,sun55i-a523-uart", .data = &dw8250_a523_data }, { .compatible = "cavium,octeon-3860-uart", .data = &dw8250_octeon_3860_data }, { .compatible = "marvell,armada-38x-uart", .data = &dw8250_armada_38x_data }, { .compatible = "renesas,rzn1-uart", .data = &dw8250_renesas_rzn1_data },