From patchwork Mon Nov 2 19:55:19 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Hilliard X-Patchwork-Id: 3809 Return-Path: X-Original-To: noreply@patchwork.local Delivered-To: noreply@patchwork.local Received: from sto.lore.kernel.org (sto.lore.kernel.org [172.232.135.74]) by mxe881.netcup.net (Postfix) with ESMTPS id 35B251C349D for ; Mon, 2 Nov 2026 21:02:05 +0100 (CET) Authentication-Results: mxe881; dkim=pass header.d=gmail.com; spf=pass (sender IP is 172.232.135.74) smtp.mailfrom=linux-sunxi+bounces-27082-noreply=patchwork.local@lists.linux.dev smtp.helo=sto.lore.kernel.org Received-SPF: pass (mxe881: domain of lists.linux.dev designates 172.232.135.74 as permitted sender) client-ip=172.232.135.74; envelope-from=linux-sunxi+bounces-27082-noreply=patchwork.local@lists.linux.dev; helo=sto.lore.kernel.org; Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by sto.lore.kernel.org (Postfix) with ESMTP id 19B0E60C66D for ; Mon, 2 Nov 2026 19:56:17 +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=1793649331; b=FifEIq3/Gy5lnIUCRVsprbU4vtQAYsXtKNp9vYp/fQnmqlmOeorIklKQSRvBeAh0GiiR hpUkB6Vp2bQBMB4ca5jS/bWOCLu/BF9cG2jqaw8wothItg8g3dU9pJRmpwDI09g3E8Wfm Dff9TYNNAwk3RxOYAo9mT/oTqJq8TVVDqScEkyMy2oBjmMfioMgA/LB6gVuiGSAv4d0Fw ThdRSwEUfiWHFnN5RUjlwrTUGqOqx8URjqX3gqfnBKaJGzq4YJ9g47p0wzRvsXejOjHbB PJtbsf3v5dk1VF3p5NTj8CArb7X2AOze6Jqdy742Be3MJbxxyrdAE3jEOriTEsqWrag== ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1793649331; 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=37idryY/a/htHBbpIdMpV4QXCrwUTlQBCm2nQ8PKPDc=; b=g065OJgztVRoVQKDrBd8Z+b6rXdMWVZD841gO38OyhSEMJsSsP/BcVDkg3ofIsYe1RhO SG1fFDrLiOojI/dQUZjLirSQ3YJLn/UpH+oyC9TsK1itfXh8HC+ItEKNCQwC1r+c4iBUd gy15EKZ0FZsebS+wbtNWMqABFC1VdQ4qBZ8040PZubieyVj8INVrN3tCKm1NJsegTzwAp 0GUm64p1uIIBOS0O8c3wY7/LkjV+h/i2woMRSGJCH01tHqGqFcmfEK1YqVdu0iDHr0B5e kSpfU9iziLPcqJyeUuD6X9XP3iiHnuwisIqgf2lGEiDnMIutgWVZ9gCOqvNNAg0cVTQ== 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="e16wor5/"; 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 1ADC96082BD7; Mon, 2 Nov 2026 19:55:31 +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=e16wor5/ X-Original-To: linux-sunxi@lists.linux.dev Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.160.54 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1793649331; b=Rw6LB4kq1+0V6XHcLX4awSeiMQLWD3tYHG2VRvtVhuUIPHGGQnUFgKOC8CPBg7NJXVHn 1/NJqNiE/Ynox1nituIB9/Gvw9yC2HfQb41KW9VuSLD75ZhCpOTD+LGxUYxAVNG0reb8y l6LsVPzI01G+bukim00mkqW14mOo+Q42QX6oNm9NdpRAG5qrTlFdmOWZ7PYp0gCUnuSrj EgwadDCEeRiVbJYfkaxNNMM2ctuK7XdS/6cKW5YyEkyRFW44b4xffHKJ+43IC6Fmw9poN HkLmhoKrQ7c/8eqFC38Qc/ZfUPeCDoju+Aagq5fVjhe/i9btBfjGaFht51u15ncSl/w== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1793649331; 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=37idryY/a/htHBbpIdMpV4QXCrwUTlQBCm2nQ8PKPDc=; b=QqK5wUzzoqpIRzAbVwJib6PxoXO3L8adqaZPnpPnlVQLtt1WnJiq2RJ/s5AgvoGo32xC vOaSXflsqomM0TCYcUCDeLskj1bT0XidErwkv3S154uk6XwtiRrcnHVSIfXFFcW+Z/dR0 mnZ/qqyUFGD73+xq6QC4rAxif9/MO9rDuJIaFV/fHsis6CDoN+S6R2cwDaKKL7nlKUokI vlZcse1AUM5Y3B6MywcwaJVhnwV8bE/dPTa/wiXCKn6g23qQro0w4VeGvR7iJ/2mc+UrU gV1CvFfUAPjcWPl60g2bREke6NxaCf1zT8HAHzs0rqB5fqTjhEV3+1mZA08bavnpN4Q== 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="e16wor5/"; arc=none smtp.remote-ip=209.85.160.54 Received: from mail-oa1-f54.google.com (mail-oa1-f54.google.com [209.85.160.54]) (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 4AC526082BC3 for ; Mon, 2 Nov 2026 19:55:30 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 4AC526082BC3 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-oa1-f54.google.com with SMTP id 586e51a60fabf-499f20c7054so1969898fac.0 for ; Mon, 02 Nov 2026 11:55:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1793649329; x=1794254129; 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=37idryY/a/htHBbpIdMpV4QXCrwUTlQBCm2nQ8PKPDc=; b=e16wor5//PGxPI2Jb2G8r4sW2k03ZztdDItByNEwlfm2s05YaknpXheTdCuC2BoVbl SJOoGWWS2DaoIwjGNHuIJeMzVlnxXmD1mq47xNzsOtZib6B6OKH4S2aNAScObGs5sQPQ FXa9so+DfxTBRwNiDaSzLH3CAmkRC2YYzI/4oUfvIWkdaGTv1T5MbczsL5cpU9xHKXeh UKz0zmD5JxGWuDLH090VrURayJuCxjR27fMzCt9AMTrxAV8a3/LtsuvuatskFn+hFji3 dZLatj9KapK9do980Zq7z6SrNOKaTtxoL8CWZ4ShGwsrhomy+vO83KRwOu2DA2uIxDr7 D3Sg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1793649329; x=1794254129; 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=37idryY/a/htHBbpIdMpV4QXCrwUTlQBCm2nQ8PKPDc=; b=LyxoBMSDM/J2ziwzUUtmTzosYhdv/UqT7eAi+IKbXNku3oO3pwo3/Msr12i0mZq4bt Lbcz8Q9DzEslL5t8p9HESbet36OiN/vOUQWtceYM0QdnaJibunB3UlQCvNEJEagHtHPB kkuIlSfsthM76lC9NqGOGtnJC+EBktOxGL/hVErA7Ihyn0FxNVaMHLNM+wzi+B1plqqI Czez1469CyvFmFCfTkSLw9gn3Xqg7YKdni9ybFf7uCNgcRsA0CC/5uTQSdvWLYfCTJWC baKvll2suUw3vFR1giGvEnOvGHD2FEWMWlCGBjN2tTjK059TN+v1mhe4h39gIJ60hpjZ asGg== X-Forwarded-Encrypted: i=1; AKwUvBzG5b+CtQxnYF99XbfHL4Ch382WcUeVvfwW0UTK+tioEa53ipPRQngtRDrfWewN4jTpHsbuMmTqGn0YkA==@lists.linux.dev X-Gm-Message-State: AFq9FYL95/KWf6exo3yoJyIHY2UWhmza5wwN72d1jRR08ESzxpT0pBaF 1t7VzzD91zUs0Rf1OT7Ly4T76Yia/obQEsbQjBil6KdoKVHznDWUNVQs X-Gm-Gg: AYBFou2+d69EEbqn+zlZ5L1Rle+usll/QExFJm1V70LHosHtuG5gjD9zizhCEN3hbkr u6azDOArXTfsRdfbrSCcXgLxZ14UDPX21AbeXNQyG80uSxHa65UE1UAGXBUMBX56aPk6oRhyIda tDsLwGQ1c/NhLtcVJW0+gWxA8NXYcIuHXA45afWaUtVUXSiUzRNNjLMWmzrnQD/u0FXxBao+nRz UfDRMYQmnUtUwtsJp5vm/7EazdEByJWQg43bWuVIIIHujH9zIYYxa3GdijderwWxY3PUpF+q7Wk eEIXQZOy7jE3SATwzKb0wviFy//9Y8H4x2zUAj+g6hD/ZE08K8vkf2yqDFCmaiTEb9EZ/9h2xID hkkjZ+kx1UEDchr6wzEbuI8MkU5zhDHciFn59SCoIZc0mdGUUY+Ihifu5ynHN91zBalXeNq1Hlk XG5eozyBzFpEW4v7MREcns8jiMpO3aoczQn7paVDelf5iADD9iihlU/fU6kIXCk4JCpAXVRkNBT ekWuX6OjqBz6qSZd0DLbOb9vOZuh0Iplg++n6/rgKzmWWuRiKKeh9ZlhblbCRXRnmPRsfe8PpK4 VrxqtYaIoJNnwVSs6LchntrF3SW2pNUH/o+7ZJ+Z6UXx1D2ajsNfwxnkU/a0WOJhoy2dYBJFmoN LllX8CI7gy+1B0ra97jZ+QAqekfuE69QEtpkDMBqWVzqi+oXOXLLGppFmKa4xtD4SXy2Fjm8PhC 1EZPqQcUA1/rIFXBfZCThrvkcLSjbstbkyikXyiBuxTZN6GQA6Nb1S X-Received: by 2002:a05:6870:8242:b0:456:5d8b:5681 with SMTP id 586e51a60fabf-4a9072d45b8mr7344269fac.1.1793649329174; Mon, 02 Nov 2026 11:55:29 -0800 (PST) Received: from [127.0.1.1] (174-29-1-49.hlrn.qwest.net. [174.29.1.49]) by smtp.gmail.com with ESMTPSA id 586e51a60fabf-4a921353dcfsm7809249fac.0.2026.11.02.11.55.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Nov 2026 11:55:28 -0800 (PST) From: James Hilliard Date: Mon, 02 Nov 2026 12:55:19 -0700 Subject: [PATCH v6 4/8] serial: 8250_dw: configure the Allwinner H616 UART X-Mailing-List: linux-sunxi@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Message-Id: <20261102-submit-h616-uart-fifo-v1-v6-4-25afcb346b0c@gmail.com> References: <20261102-submit-h616-uart-fifo-v1-v6-0-25afcb346b0c@gmail.com> In-Reply-To: <20261102-submit-h616-uart-fifo-v1-v6-0-25afcb346b0c@gmail.com> To: Andy Shevchenko , =?utf-8?q?Ilpo_J?= =?utf-8?q?=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.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.232.135.74:from]; SUSPICIOUS_RECIPS(1.50)[]; DMARC_POLICY_SOFTFAIL(1.00)[gmail.com : SPF not aligned (relaxed), No valid DKIM,none]; MAILLIST(-0.18)[generic]; BAD_REP_POLICIES(0.10)[]; MIME_GOOD(-0.10)[text/plain]; HAS_LIST_UNSUB(-0.01)[]; ARC_ALLOW(0.00)[subspace.kernel.org:s=arc20261015:i=2]; FROM_HAS_DN(0.00)[]; TAGGED_RCPT(0.00)[dt]; RCPT_COUNT_TWELVE(0.00)[16]; FREEMAIL_CC(0.00)[vger.kernel.org,lists.infradead.org,lists.linux.dev,gmail.com]; DBL_BLOCKED_OPENRESOLVER(0.00)[sto.lore.kernel.org:helo,sto.lore.kernel.org:rdns]; FORGED_SENDER_MAILLIST(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_NEQ_ENVFROM(0.00)[jameshilliard1@gmail.com,linux-sunxi@lists.linux.dev]; ASN(0.00)[asn:63949, ipnet:172.232.128.0/19, country:SG]; FREEMAIL_FROM(0.00)[gmail.com]; R_SPF_ALLOW(0.00)[+ip4:172.232.135.74]; TO_DN_SOME(0.00)[]; RECEIVED_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[100.77.114.92:received,209.85.160.54:received,174.29.1.49:received]; RCVD_COUNT_FIVE(0.00)[6]; FREEMAIL_TO(0.00)[linux.intel.com,linuxfoundation.org,kernel.org,gmail.com,sholland.org]; MIME_TRACE(0.00)[0:+]; TAGGED_FROM(0.00)[bounces-27082-noreply=patchwork.local]; FORGED_RECIPIENTS_MAILLIST(0.00)[]; MID_RHS_MATCH_FROM(0.00)[]; RCVD_TLS_LAST(0.00)[]; RBL_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[172.232.135.74:from] X-Rspamd-Queue-Id: 35B251C349D X-MORS-Enabled: yes X-MORS-DOMAIN: patchwork.local X-MORS-HOSTING: hosting172546 X-MORS-USER: hosting172546 X-getmail-retrieved-from-mailbox: INBOX 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 H616's fixed FIFO depth through platform data. The 8250 core derives the transmit load from that depth. Allwinner encodes receive thresholds relative to the FIFO depth: one byte, quarter-full, half-full and depth minus two. Construct the RX trigger threshold array on the fly so other FIFO sizes can reuse the same mapping. For H616 the thresholds are 1, 64, 128 and 254 bytes, with the normal half-full FCR setting selecting 128 bytes. Use this array for both RX trigger callbacks and the shared bytes-to-FCR conversion. Serialize trigger changes with termios through the port mutex. Hold a runtime PM reference for the register access and the UART port lock while updating the FCR shadow and hardware. Changing only the trigger field preserves the FIFO contents; a runtime resume failure leaves both the shadow and hardware unchanged. Advertise automatic flow control so CRTSCTS enables MCR.AFCE, matching the DesignWare termios path's hardware CTS handling. Select this configuration through the platform setup callback. H616's debug-divisor and RS485 control registers overlap offsets used to detect generic DesignWare features. 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. Signed-off-by: James Hilliard --- drivers/tty/serial/8250/8250_dw.c | 104 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 104 insertions(+) diff --git a/drivers/tty/serial/8250/8250_dw.c b/drivers/tty/serial/8250/8250_dw.c index a546cf2de7b6..0b0156464af6 100644 --- a/drivers/tty/serial/8250/8250_dw.c +++ b/drivers/tty/serial/8250/8250_dw.c @@ -9,6 +9,7 @@ * LCR is written whilst busy. If it is, then a busy detect interrupt is * raised, the LCR needs to be rewritten and the uart status register read. */ +#include #include #include #include @@ -19,6 +20,7 @@ #include #include #include +#include #include #include #include @@ -44,6 +46,11 @@ #define RZN1_UART_xDMACR_8_WORD_BURST (2 << 1) #define RZN1_UART_xDMACR_BLK_SZ(x) ((x) << 3) +/* Allwinner FIFO-relative receive thresholds */ +#define SUNXI_UART_RXTRIG_QUARTER_DIV 4 +#define SUNXI_UART_RXTRIG_HALF_DIV 2 +#define SUNXI_UART_RXTRIG_FULL_MARGIN 2 + /* Quirks */ #define DW_UART_QUIRK_OCTEON BIT(0) #define DW_UART_QUIRK_ARMADA_38X BIT(1) @@ -63,6 +70,7 @@ struct dw8250_platform_data { u8 usr_reg; u32 cpr_value; + unsigned int fifo_size; unsigned int quirks; int (*setup)(struct uart_port *p); }; @@ -81,6 +89,7 @@ struct dw8250_data { unsigned int in_idle:1; u8 no_int_count; + u8 rxtrig_bytes[UART_FCR_R_TRIG_MAX_STATE]; }; static inline struct dw8250_data *to_dw8250_data(struct dw8250_port_data *data) @@ -652,6 +661,93 @@ static int dw8250_setup(struct uart_port *p) return dw8250_setup_dma(p); } +/* The trigger is the masked FCR receive trigger field, in register position */ +static unsigned int dw8250_sunxi_rxtrig_bytes(struct uart_port *p, unsigned int trigger) +{ + switch (trigger) { + case UART_FCR_TRIGGER_1: + return 1; + case UART_FCR_TRIGGER_4: + return p->fifosize / SUNXI_UART_RXTRIG_QUARTER_DIV; + case UART_FCR_TRIGGER_8: + return p->fifosize / SUNXI_UART_RXTRIG_HALF_DIV; + default: + return p->fifosize - SUNXI_UART_RXTRIG_FULL_MARGIN; + } +} + +static int dw8250_sunxi_get_rxtrig(struct uart_port *p) +{ + struct dw8250_data *data = to_dw8250_data(p->private_data); + struct uart_8250_port *up = up_to_u8250p(p); + + guard(uart_port_lock_irqsave)(p); + + return data->rxtrig_bytes[UART_FCR_R_TRIG_BITS(up->fcr)]; +} + +static int dw8250_sunxi_set_rxtrig(struct uart_port *p, unsigned char bytes) +{ + struct dw8250_data *data = to_dw8250_data(p->private_data); + struct uart_8250_port *up = up_to_u8250p(p); + int fcr, ret; + + fcr = serial8250_bytes_to_fcr(data->rxtrig_bytes, bytes); + if (fcr < 0) + return fcr; + + guard(mutex)(&p->state->port.mutex); + + PM_RUNTIME_ACQUIRE_IF_ENABLED(p->dev, pm); + ret = PM_RUNTIME_ACQUIRE_ERR(&pm); + if (ret) + return ret; + + guard(uart_port_lock_irqsave)(p); + + up->fcr &= ~UART_FCR_TRIGGER_MASK; + up->fcr |= fcr; + /* Changing the trigger alone preserves the FIFO contents */ + serial_port_out(p, UART_FCR, up->fcr); + + return 0; +} + +static void dw8250_sunxi_setup_rxtrig(struct uart_port *p) +{ + struct dw8250_data *data = to_dw8250_data(p->private_data); + + /* Allwinner RX thresholds differ from the standard 16550A table */ + for (unsigned int i = 0; i < ARRAY_SIZE(data->rxtrig_bytes); i++) { + unsigned int trigger = FIELD_PREP(UART_FCR_TRIGGER_MASK, i); + + data->rxtrig_bytes[i] = dw8250_sunxi_rxtrig_bytes(p, trigger); + } + p->get_rxtrig = dw8250_sunxi_get_rxtrig; + p->set_rxtrig = dw8250_sunxi_set_rxtrig; +} + +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); + + 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; + + dw8250_sunxi_setup_rxtrig(p); + + /* 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; @@ -875,6 +971,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, @@ -926,6 +1029,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 },