From patchwork Thu Nov 5 20:52:03 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: James Hilliard X-Patchwork-Id: 3906 Return-Path: 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 35E0B1C539E for ; Thu, 5 Nov 2026 21:52:38 +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-27290-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-27290-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 D1BE4261BF for ; Thu, 5 Nov 2026 20:52:18 +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=1793911937; b=O0KdH8SV3lraUTwlRQcjjOC/kyljO1+ENJsOjmEz2CY5pMb5KQnCDPFnn9PPrt9ukEbC N4VNrbnNQULXVfSL6gS9rUq6GfhJUyjvz5KHAYdbjNFoI7iH3tgDlxAlcr1vS6IyrkECv sR6suiVqdGoN7h2L3C/D/LsYcX3t1D/n97SihmsUHzkkTmKpHYCR4Ad7k4S+HoT9gjcC2 B1YQTfTimP1hNQJYI7E5hfsHgXq+ojod1JTdWmxJpr1djoZapWXZ18qOM2gZ1Nwy5HEWo t5ZGK/P1UDt7mr5VgAIinRiRV2i/YRGalOUNDKnZfexOi/Uu1+FVkKD9AEnCQnPa7Wg== ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1793911937; 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=gFXtfo2QF4UuPe88KiYuo+dmf8LupFBJ/LFbUjyQRiE=; b=wUQu/PoWjdNPbQzNFo3lxg3Y0ygZi/325y/l2MvTqDnyCIbFwhuGzWv4E+V5/a0MBolZ jCDg+SMUW/BKu+LV+nSb/YTZ2ZHNp8QyPVVIWp/jW1dZ3eg3f97759QqGCJMNQWZQwbJX ZzQvv/Gn7kRO7r5djpgPAcYa2QzWHdmYGE3fp85k++QGMNv2EOUeFDdx8/m982nB+IHgt iQ+kPSd5ISOMzKLxYnguimzsvzWUq7pw64xOAgAU1cjyBhrcbhHYdjeHld9iALgU61Qbv thUcc3SB9z+/RR/KrRtxnyPy7TQZUZm3AnsmE28ks8quyeL6qk6PeO7mKs6Qi9CmT0Q== 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=CN9l4OuM; 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 CC0C6606A330; Thu, 5 Nov 2026 20:52:17 +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=CN9l4OuM X-Original-To: linux-sunxi@lists.linux.dev Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.210.51 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1793911937; b=2/X+YMsh3RTq4JeBYuArBF+tMDlbiRyeJzKY6M55KIFVDUV3ZPeHbdJZ7MZ/Bi7szhjx y+rhB29RjT5QiSs+ToAJVnDsuh7GwcIWqtFD2tzC7EDx3RI+k1KixOHgfOPhXkauzyhOp wWdDNDGyZonBJnrgwGZb0o670P0jlIVf+4NKG5p+NUqy2EdszqpnU+K8wPQCudG5b6a0W kI2e/uk0lue0qpqb9X0pm00VBRKeBVj8VnMLol7SJjRbmAxpZmhgU+MFi3jVyFr3nm5+0 shUVe32TmpO5XHNRKpF5JHw9UxGzG/yG+a4X1cSz3Dkygei3S9ZMYFpkbNDauXE17ZQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1793911937; 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=gFXtfo2QF4UuPe88KiYuo+dmf8LupFBJ/LFbUjyQRiE=; b=aCRYVnZ+jJrbBiOe2YrRQ+hX9WTayOg4+nDZ0WLVhyGQJQHBJa6IycfmxmHr/FDYVtlu xZc7IePr7mTjKYucufYNSaz8oIf/RL03r9PSCbqfXEjIi1Nr1FDcJrf1tKCZXjMrilLI7 orPanJNmCt1WuLg7sFXNKI+Pz+zzk3eL7pLVt9zSCcNR7wTRwX9sqWNG35UAG4wBx0HrU 6d79eHAln24hjiQijLLQ6aovTwGGOd9Emp4WiXx5YbCIuIirazNaTjUtfzvwTwspoqZow Ak9Icf9MDMejXfA4a0HekRUNYKM38YninalBAOM9Js3bHqgY0z24xRn/j52VRMF39BQ== 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=CN9l4OuM; arc=none smtp.remote-ip=209.85.210.51 Received: from mail-ot1-f51.google.com (mail-ot1-f51.google.com [209.85.210.51]) (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 60574606A329 for ; Thu, 5 Nov 2026 20:52:17 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 60574606A329 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-ot1-f51.google.com with SMTP id 46e09a7af769-8446af403b5so1397398a34.2 for ; Thu, 05 Nov 2026 12:52:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1793911936; x=1794516736; 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=gFXtfo2QF4UuPe88KiYuo+dmf8LupFBJ/LFbUjyQRiE=; b=CN9l4OuMIHb5CWU2AQsOFrMMlhIojvUH0PlrZ/JXedg0QsmDNQIIUszfXxes268/GM yK3j6T9OnmYmt/yPrvnv8xttBR6T2kyiHO/ChtQSz9AVLtmzq9Y1oKxjG5OnzlSXVHQv kY9TWc+ILFVrJN7AEd98iZ2tDHkrv/C9Ld1pPh6JNvhMXhPVThQKvvHNYRKRJBlekHt9 J/Ncqn5NgnHwFaiv/5IMc/83SwCJ7W9skbZSMIoBEHPycoEJv7DQMkCWaFssHhrsz1fd NE4NZrj1PwzpXFZoqevwxvt7u2nMy1epP29E9Qupu56hqZYTkAwDcyHYB4q5QbEuQnI3 ebvA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1793911936; x=1794516736; 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=gFXtfo2QF4UuPe88KiYuo+dmf8LupFBJ/LFbUjyQRiE=; b=WOb6381EIgMxtW688ErVTGR8gV7IKOIUaHIHoFxAvvhIR/0PiIraY5dh4mNsOpAeAx c6LTGZMwX4bQo4wY9ctXfZwi7jEgzOZ6s1uMlREJV+WTMkcVk3+qZKw1NLySu4xoSTWx cg7ldVhElE+bwT19b9oyUxxKEevaTvIyJ+GYwfArYdeGbJESTXd/Qym0TgZNwwpy+Xpz 75rXyOOPNYHPmnEvxEbLzk6uHvPivqg5DA0GwiO/UZ/3XB6HfQI0lSGcA9WCqQewVyyi bJyxvjxtuFMnM3rZ7PyWIolbcXj6Y7IOrTp08cEQebm2laa40MPVFCS7IXbyWRHW/vPa P+TA== X-Forwarded-Encrypted: i=1; AKwUvBz6mFPE4IKuNWxWk5Z2B6lzZF328w49a0wZi7iJWrOdj9ZMJ35cbSbRGs33gf0wMDaXSTbni4uvAkJJMg==@lists.linux.dev X-Gm-Message-State: APuU4Z9zqPebKKLIujhz+6anRJbT9O1/4mnufW9WLKwFNX6NcIgvKMe7 aWTKpZx2ourgW/5l9wrj8Xn2fkJTCPwtXblST2lyrqdgQEKsnI87bygG X-Gm-Gg: AYBFou2PBGrbQricv/juvYNOaicEDiPx7SK9L9MtXZrjzQPBspgTc7tBLcuqaGbjL8C 9FkweBvarxoc2AaI1TJuh4yk8LUzgvj5tGf4kPYRsJxyIh6gpDkxKqSgTrhr88JbtNei1ODHU/4 R6r16pztXXPhqJJNr+e0t8oYgrsgkFwIsokdU3Z1iwmNF+W1CwiQlw2iEsOIOKRMOGO0bxpJzPN GqODoBO1zyj9ByrMS9OkMmxUd4ShGh+IAOyltUble/SvpV6s39RGTSkrI4SRzLXWFHjWtCzmpC6 IC6ttMLxjn2NwrPx7T8iJXdRENwv/hBWpIosmMhWjPrE0gswL9VWJutq6KoJvM7qeXlxWZZjk91 2k1W1MqD9BzNg3Y8a/I2V8Mtoj5RfdUkOmLDJUZUsul7FBUxIRqIu3E7ctQfrIiIoxrq2gc3Wj+ IlaIlMvbdGQKXWCJkMrR6tkmnsaTpZZv5CqyJTInZ6LfXkbB+i4DL7ISDKmhk0uGDhtFEJSxfnw 0lhucvdGtI9WaGQUgBO/47kanBDpv0uL8K291eM8Q8xDczS1zGLOKUCi77//j3xISHnDgc2mVgD rZ8RkGVWfUPyvheZddwF6QNm0r77xl9mlYirXmufSTZdWAS1aO7zJKvVZz26Q9LontRGGwccRSm Hndv+o6gOpHP90hbYWctBDlJQna+57kLtUxgy/UPzbZIDOlFRLvGTfs0Ds6vGKqHnOOsqDlnycH eD2sHxpDGRRnjLf9IO9s29gmgM2YYI5mK4U4zqlARRT2ONyPS7OW4= X-Received: by 2002:a05:6830:3e03:b0:85e:f25a:7d26 with SMTP id 46e09a7af769-85f1cdfaf90mr603385a34.1.1793911936207; Thu, 05 Nov 2026 12:52:16 -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 46e09a7af769-85f1dbb298fsm292276a34.6.2026.11.05.12.52.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Nov 2026 12:52:14 -0800 (PST) From: James Hilliard Date: Thu, 05 Nov 2026 13:52:03 -0700 Subject: [PATCH v8 02/11] serial: 8250_dw: select port setup through platform data 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: <20261105-submit-h616-uart-fifo-v1-v8-2-14024d2b184b@gmail.com> References: <20261105-submit-h616-uart-fifo-v1-v8-0-14024d2b184b@gmail.com> In-Reply-To: <20261105-submit-h616-uart-fifo-v1-v8-0-14024d2b184b@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-MORS-Enabled: yes X-MORS-DOMAIN: patchwork.local X-MORS-HOSTING: hosting172546 X-MORS-USER: hosting172546 X-getmail-retrieved-from-mailbox: INBOX Select feature discovery and DMA attachment through a platform-data setup callback. The generic callback probes the optional registers and attaches DMA when a FIFO size is available. Integrations with a fixed configuration can supply their own setup before the port is registered. Allow setup to return an error so integrations can reject invalid configuration before registration. Replace skip_autocfg with the Octeon setup selection. Octeon is a 64-bit platform and continues to skip optional-register probing while preserving its existing conditional DMA attachment. Select the DMA setup helper directly for this integration. Keep generic setup for devices without matched platform data as well. Reviewed-by: Ilpo Järvinen Signed-off-by: James Hilliard Reviewed-by: Andy Shevchenko --- drivers/tty/serial/8250/8250_dw.c | 49 ++++++++++++++++++++++++++++----------- 1 file changed, 35 insertions(+), 14 deletions(-) diff --git a/drivers/tty/serial/8250/8250_dw.c b/drivers/tty/serial/8250/8250_dw.c index 80b2b673b422..613907b8a40f 100644 --- a/drivers/tty/serial/8250/8250_dw.c +++ b/drivers/tty/serial/8250/8250_dw.c @@ -64,6 +64,7 @@ struct dw8250_platform_data { u8 usr_reg; u32 cpr_value; unsigned int quirks; + int (*setup)(struct uart_port *p); }; struct dw8250_data { @@ -76,7 +77,6 @@ struct dw8250_data { struct clk *pclk; struct reset_control *rst; - unsigned int skip_autocfg:1; unsigned int uart_16550_compatible:1; unsigned int in_idle:1; @@ -596,7 +596,6 @@ static void dw8250_quirks(struct uart_port *p, struct dw8250_data *data) p->serial_out = dw8250_serial_outq; p->flags = UPF_SKIP_TEST | UPF_SHARE_IRQ | UPF_FIXED_TYPE; p->type = PORT_OCTEON; - data->skip_autocfg = true; } #endif @@ -631,6 +630,33 @@ static void dw8250_shutdown(struct uart_port *port) d->no_int_count = 0; } +static int dw8250_setup_dma(struct uart_port *p) +{ + struct dw8250_data *data = to_dw8250_data(p->private_data); + struct uart_8250_port *up = up_to_u8250p(p); + + /* DMA setup requires a FIFO */ + if (!p->fifosize) + return 0; + + data->data.dma.rxconf.src_maxburst = p->fifosize / 4; + data->data.dma.txconf.dst_maxburst = p->fifosize / 4; + up->dma = &data->data.dma; + + return 0; +} + +static int dw8250_setup(struct uart_port *p) +{ + int ret; + + ret = dw8250_setup_port(p); + if (ret) + return ret; + + return dw8250_setup_dma(p); +} + static int dw8250_probe(struct platform_device *pdev) { struct uart_8250_port uart = {}, *up = &uart; @@ -765,22 +791,16 @@ static int dw8250_probe(struct platform_device *pdev) dw8250_setup_dma_filter(p, data); - if (!data->skip_autocfg) { - err = dw8250_setup_port(p); - if (err) - return err; - } + if (data->pdata && data->pdata->setup) + err = data->pdata->setup(p); + else + err = dw8250_setup(p); + if (err) + return err; /* Use the BUSY-safe sequence for both integer and fractional divisors. */ p->set_divisor = dw8250_set_divisor; - /* If we have a valid fifosize, try hooking up DMA */ - if (p->fifosize) { - data->data.dma.rxconf.src_maxburst = p->fifosize / 4; - data->data.dma.txconf.dst_maxburst = p->fifosize / 4; - up->dma = &data->data.dma; - } - data->data.uport = serial8250_register_8250_port(up); if (IS_ERR(data->data.uport)) return PTR_ERR(data->data.uport); @@ -863,6 +883,7 @@ static const struct dw8250_platform_data dw8250_dw_apb = { static const struct dw8250_platform_data dw8250_octeon_3860_data = { .usr_reg = OCTEON_UART_USR, .quirks = DW_UART_QUIRK_OCTEON, + .setup = dw8250_setup_dma, }; static const struct dw8250_platform_data dw8250_armada_38x_data = {