From: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
To: James Hilliard <james.hilliard1@gmail.com>
Cc: Andy Shevchenko <andriy.shevchenko@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>,
LKML <linux-kernel@vger.kernel.org>,
linux-serial <linux-serial@vger.kernel.org>,
devicetree@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-sunxi@lists.linux.dev
Subject: Re: [PATCH v5 1/8] serial: 8250_dw: select port setup through platform data
Date: Fri, 30 Oct 2026 11:28:09 +0200 (EET) [thread overview]
Message-ID: <30123495-5e2a-4340-baac-abab8d511000@linux.intel.com> (raw)
In-Reply-To: <20261029-submit-h616-uart-fifo-v1-v5-1-53b433aebbf8@gmail.com>
[-- Attachment #1: Type: text/plain, Size: 3937 bytes --]
On Thu, 29 Oct 2026, James Hilliard wrote:
> 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 retaining
> its DMA setup. Select the DMA setup helper directly for this integration.
> Keep generic setup for devices without matched platform data as well.
>
> Signed-off-by: James Hilliard <james.hilliard1@gmail.com>
> ---
> drivers/tty/serial/8250/8250_dw.c | 41 ++++++++++++++++++++++++++++-----------
> 1 file changed, 30 insertions(+), 11 deletions(-)
>
> diff --git a/drivers/tty/serial/8250/8250_dw.c b/drivers/tty/serial/8250/8250_dw.c
> index 9cbe076463e0..a546cf2de7b6 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,28 @@ 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)
> +{
> + dw8250_setup_port(p);
> + return dw8250_setup_dma(p);
> +}
> +
> static int dw8250_probe(struct platform_device *pdev)
> {
> struct uart_8250_port uart = {}, *up = &uart;
> @@ -765,19 +786,16 @@ static int dw8250_probe(struct platform_device *pdev)
>
> dw8250_setup_dma_filter(p, data);
>
> - if (!data->skip_autocfg)
> - dw8250_setup_port(p);
> + 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);
> @@ -860,6 +878,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 = {
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
--
i.
next prev parent reply other threads:[~2026-10-30 9:28 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-29 18:47 [PATCH v5 0/8] serial: 8250_dw: describe the Allwinner H616 and A523 UART configurations James Hilliard
2026-10-29 18:47 ` [PATCH v5 1/8] serial: 8250_dw: select port setup through platform data James Hilliard
2026-10-29 19:04 ` sashiko-bot
2026-10-30 9:28 ` Ilpo Järvinen [this message]
2026-10-29 18:47 ` [PATCH v5 2/8] serial: 8250: share the RX trigger conversion helper James Hilliard
2026-10-29 19:10 ` sashiko-bot
2026-10-30 9:24 ` Ilpo Järvinen
2026-10-29 18:47 ` [PATCH v5 3/8] dt-bindings: serial: snps-dw-apb-uart: add Allwinner H616 James Hilliard
2026-10-29 19:11 ` sashiko-bot
2026-10-29 18:47 ` [PATCH v5 4/8] serial: 8250_dw: configure the Allwinner H616 UART James Hilliard
2026-10-29 19:17 ` sashiko-bot
2026-10-30 9:51 ` Ilpo Järvinen
2026-10-29 18:47 ` [PATCH v5 5/8] arm64: dts: allwinner: h616: describe the UART integration James Hilliard
2026-10-29 19:20 ` sashiko-bot
2026-10-29 18:47 ` [PATCH v5 6/8] dt-bindings: serial: snps-dw-apb-uart: add Allwinner A523 James Hilliard
2026-10-29 19:22 ` sashiko-bot
2026-10-30 10:28 ` Krzysztof Kozlowski
2026-10-29 18:47 ` [PATCH v5 7/8] serial: 8250_dw: discover Allwinner A523 FIFO depths through FCC James Hilliard
2026-10-29 19:24 ` sashiko-bot
2026-10-30 10:00 ` Ilpo Järvinen
2026-10-30 10:15 ` Ilpo Järvinen
2026-10-29 18:47 ` [PATCH v5 8/8] arm64: dts: allwinner: a523: describe the UART integration James Hilliard
2026-10-29 19:27 ` sashiko-bot
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=30123495-5e2a-4340-baac-abab8d511000@linux.intel.com \
--to=ilpo.jarvinen@linux.intel.com \
--cc=andriy.shevchenko@linux.intel.com \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=gregkh@linuxfoundation.org \
--cc=james.hilliard1@gmail.com \
--cc=jernej.skrabec@gmail.com \
--cc=jirislaby@kernel.org \
--cc=krzk+dt@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-serial@vger.kernel.org \
--cc=linux-sunxi@lists.linux.dev \
--cc=robh@kernel.org \
--cc=samuel@sholland.org \
--cc=wens@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox