From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.210.45 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796380158; b=A5BN102W5bMvKeahxKUxG1XX8yE9PHgqAv3gQLe5bEpaZkYJXsa9gVbxMXWNLu2NcqEG H7kI4xkcC1oeYvQJvw5U3PK8PxcFG570z1SWiGadM7HdvRqcLxl5vmeKF8PyGde4tB9mY LFhUWSoPVnh7Oloah+/HXG4W1yJGMFYXymAOPXMUUOHSnNkWgfGyDTbrYN1Gs4TGic48t yaLfB+iqxlv2fWFWny0cUm0TP90O3U3iX9oV3VPvq5xgNTYmuBVe/Y0FDB9wjFRuwzt2W tCY6T91YK+PpKhiB4+e/AZkAV/oOhQ6QvIx7biULjiGhTdNe6LiSfwA63YfGVMDiE1g== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796380158; 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=upZ2j45AcpwdTeeKdimzffbqVWCWhiPa0UMrt/+R8i4=; b=YLnGP2b4e3w/x8/y8wUMyt/bxHvUm6GNxiVQVFPU6PiJ2NAxCfqdLeK5CUPuXMx+iJvL yIfZgGn8BAFRjHCz4SVITqJueNAQUNIK+NIT266YUA6b0lH8dHWmJ6S/391zem9qxZ8VL /vOCUh0CRItitGCFn7ZCTELqvpjWRLDQBcZwVaVAfjAHShCCinIj0Ox2C8c5jx4kymh9V Xz9mCASfO/jwstYVZ25E0DNwxX0YzYrUB2aUDkyMBwc4boxAHHZ7S8dSs/oiSODMO0dVi PZkMgJaE3U4wEXLKJpicMS3ky+oppc15DDbR3ktUYldW2QroA1Ozn/cvv7IVde5bP5Q== 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=I9jbeJbc; arc=none smtp.remote-ip=209.85.210.45 Received: from mail-ot1-f45.google.com (mail-ot1-f45.google.com [209.85.210.45]) (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 237EC606A33C for ; Fri, 4 Dec 2026 10:29:18 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 237EC606A33C 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=I9jbeJbc Received: by mail-ot1-f45.google.com with SMTP id 46e09a7af769-86298f9267fso468430a34.0 for ; Fri, 04 Dec 2026 02:29:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1796380157; x=1796984957; 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=upZ2j45AcpwdTeeKdimzffbqVWCWhiPa0UMrt/+R8i4=; b=I9jbeJbcRlL4T5winQbZwJd3YmGSxlNX0LuWkDR3hjt+iYaennDVDuEsiiEgbcpL/C 4l9AbnlLtFLPVxV0HIRh/pV0Jekr5HsnOkUA3ktS5s+y0rGotqYBoBuHpN088n49WKoQ XwUqdhhefAtm+PVwqpuf90iZVxSZCcsuuGIe3LwYjQzSiLHhJGLfa+hf8FuXkZuppGph r/EE/x1lxmwsc1EowL81/a4cqXe20QC0HLpscpo0NvIMiYTXZuaGhnVm2YoEBBP+EK7u u2l9T/qdj/bUFgIMWkrLq/kkZdRZYw3sVL7cQFT1wOqA7Qa6VhaKAeBOMDjA+vqk9Ttd bJaA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796380157; x=1796984957; 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=upZ2j45AcpwdTeeKdimzffbqVWCWhiPa0UMrt/+R8i4=; b=IO86sYw1Uefo4YhUO8wWXTk2ncOR49kQ/95X2VEjIfSF3WeN3K7d4zuw5oL61coeek MbK5J3RGUZk6JvP2Yv4aeVjEulR6VjqnS74DMZbvjQvjWCWgS0y28JUnVkyJzaiCmeDc PWGdi/5HFoVm6jKarZgf3QtjenMfMWzjokQM2K59yk9DJ0Qx4Yhm0yBDWNIlJstAlNI9 Ydjf5zwa0umOFlz65xJPywdga7CzZQKqT2Og5rPk3cwiI8GdmWu+Y9aKPO/NBR7GWsU/ Fhd/II7xodHGSgT7RLSC0B8YRaHwxAkE0L9Uo2TsP4jnL3SRPnntsigJ+T++PEQwILAR I0Sg== X-Gm-Message-State: APuU4Z/JNB+XTNmMwx8bMYEwwXlxjT48xISPaa8syZXQUiq8dJYSQkWT oVJH+DECCYg2T5kre9OfI/iZXCBGvRwoxGeuNrS7eerslVXagRtjq8Ta X-Gm-Gg: AZFdTZe0GNjdp3Xrjw/cEbJqRjXVLzm6YSENY2FmBfU0llJmAixEgPE+CLGqZQGgDGN TqhOnnTpmY7Ish01k5w0AQwx7eb4Assm0eZ/v4qZb7+0yRP0GTJd04oU/sfUv0X0uccCGlBaEsE SxaFatE1ZCEr522Iuhzigtx3iZwbumYGjicU+0wPvn+cGDuBOdmmxYJhGXYRQMdkWKKHKDQu55U 5DIXPawJyMdS7DKYWTvxKMIzDm8oZw1V6iNRE4jknURdOWHcDTWRGAgXXoMkLIxeewAiNc2z/Qy QFPWRyGpUgwJretZA3+LvC5mQPT9JGnXZSbAG2ttUTNidYvpzBS/7mfrnVNQrq35kzFYHBtJ+v3 B8ZcBeGd1njXHaoeg/mDx7S88p5/NVlrJlAFSdHS6ZI/xOK/NSS4VgyLTpyThkn1aJ7CbyfJFpH kROkEXNa0zzacm0tGLervlBhn5R5DMLctyUwEbMVzhK2KkfA4jsLBn9ZIIkPMzqhzTDolX6Zn8d 3GjfXLniyXJyz5HDWiKZ8MYCSRAuHD68cxNFvYXRwuosn6FDhP7cm4a/ujzkQ0EKlsrg8G169+G Xkh06VhUDJKzI+ZaRRE9Q9etEFny3+abG+BlYY5WGgk6O9Ab0Em6E6hKeGRLIP2SlfXH5tBQ7Sn lvmLl9HDBOdX+MxhgaK8y+hRCzaWxQgnFh+0cpFoXjOotwMi9HzviEGECYvysLEb8FZ14PkvQcY ph69ppyUB9JEZ4RjwFMyGfeROgi3E9bdzI2Gv5xk7Elm+VWk+Fw9LJRA== X-Received: by 2002:a05:6830:2b08:b0:862:bda5:b876 with SMTP id 46e09a7af769-863f89eb9a8mr1790074a34.12.1796380157227; Fri, 04 Dec 2026 02:29:17 -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.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Dec 2026 02:29:16 -0800 (PST) From: James Hilliard Date: Fri, 04 Dec 2026 03:28:53 -0700 Subject: [PATCH v10 08/11] serial: 8250_dw: configure the Allwinner H616 UART 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-8-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 H616 has 256-byte transmit and receive FIFOs, but its optional DesignWare component parameter register reads as zero. Generic 16550 probing leaves the port using the 16-byte FIFO configuration and its trigger-level table. Keep PORT_16550A and supply the fixed FIFO depth through platform data. The 8250 core derives the transmit load from that depth. Use the shared DesignWare receive-trigger setup to describe the 1, 64, 128 and 254-byte thresholds, with the normal half-full FCR setting selecting 128 bytes. Advertise automatic flow control so CRTSCTS enables MCR.AFCE, matching the DesignWare termios path for hardware CTS handling. Select this configuration through the platform setup callback. H616 has debug-divisor and RS485 control registers overlapping the optional DesignWare feature probes. Use the fixed configuration with BUSY-safe integer divisor programming and software RS485 handling. Keep the UART clock enabled during termios changes with SKIP_SET_RATE. Its clock is a gate on the shared APB2 source rather than an independent baud-rate generator. Reviewed-by: Andy Shevchenko Signed-off-by: James Hilliard --- drivers/tty/serial/8250/8250_dw.c | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/drivers/tty/serial/8250/8250_dw.c b/drivers/tty/serial/8250/8250_dw.c index a20adb38e046..7695755666bc 100644 --- a/drivers/tty/serial/8250/8250_dw.c +++ b/drivers/tty/serial/8250/8250_dw.c @@ -63,6 +63,7 @@ struct dw8250_platform_data { u8 usr_reg; u32 cpr_value; + unsigned int fifo_size; unsigned int quirks; int (*setup)(struct uart_port *p); }; @@ -657,6 +658,31 @@ static int dw8250_setup(struct uart_port *p) return dw8250_setup_dma(p); } +static int dw8250_sunxi_setup(struct uart_port *p) +{ + struct dw8250_data *data = to_dw8250_data(p->private_data); + struct uart_8250_port *up = up_to_u8250p(p); + int ret; + + p->type = PORT_16550A; + p->flags |= UPF_FIXED_TYPE; + p->fifosize = data->pdata->fifo_size; + + up->capabilities = UART_CAP_FIFO | UART_CAP_NOTEMT | UART_CAP_AFE; + + ret = dw8250_setup_rxtrig(p); + if (ret) + return ret; + + /* Use software RS485 with the Allwinner register layout */ + p->rs485_config = serial8250_em485_config; + p->rs485_supported = serial8250_em485_supported; + up->rs485_start_tx = serial8250_em485_start_tx; + up->rs485_stop_tx = serial8250_em485_stop_tx; + + return 0; +} + static int dw8250_probe(struct platform_device *pdev) { struct uart_8250_port uart = {}, *up = &uart; @@ -880,6 +906,13 @@ static const struct dw8250_platform_data dw8250_dw_apb = { .usr_reg = DW_UART_USR, }; +static const struct dw8250_platform_data dw8250_h616_data = { + .usr_reg = DW_UART_USR, + .fifo_size = 256, + .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, @@ -931,6 +964,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 = "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 }, -- 2.53.0