mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
To: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: James Hilliard <james.hilliard1@gmail.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 v4 4/5] serial: 8250_dw: configure the Allwinner H616 UART
Date: Fri, 30 Oct 2026 12:08:06 +0200 (EET)	[thread overview]
Message-ID: <3e73ec0c-2623-d891-7146-dcf1c7a68c41@linux.intel.com> (raw)
In-Reply-To: <auHW9nkDqZUXeHNZ@ashevche-desk.local>

On Wed, 28 Oct 2026, Andy Shevchenko wrote:

> On Tue, Oct 27, 2026 at 05:05:32PM -0600, James Hilliard wrote:
> > 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 describe H616's fixed 256-byte FIFO depth in platform
> > data. Use common Allwinner setup helpers to configure the transmit load
> > and receive trigger table from that depth.
> > 
> > Derive the receive thresholds from the documented 1-byte, quarter-full,
> > half-full and FIFO-depth-minus-two mapping. On H616 these are 1, 64, 128
> > and 254 bytes; the normal 16550A half-full FCR setting selects 128 bytes.
> > 
> > Build the threshold table during setup and use the shared 8250 conversion
> > helper to select the nearest lower threshold for sysfs writes.
> > 
> > Serialize trigger changes with termios and hold a runtime PM reference
> > while programming FCR, preserving the FIFO contents. Propagate runtime
> > resume errors before changing either the FCR shadow or the hardware.
> > 
> > Advertise automatic flow control so CRTSCTS enables MCR.AFCE. The
> > DesignWare termios path selects hardware CTS handling, so the capability
> > must be present for the corresponding hardware control to be enabled.
> > 
> > Select the fixed configuration through the platform setup callback.
> > H616 has debug-divisor and RS485 control registers at the offsets used to
> > detect DesignWare hardware RS485 and fractional-divisor support. Avoid
> > those probes and retain the BUSY-safe integer divisor hook and software
> > RS485 handling.
> > 
> > Use the existing SKIP_SET_RATE quirk to keep the UART clock enabled during
> > termios changes. Its clock is a gate on the shared APB2 source, rather than
> > an independent baud-rate generator.
> 
> ...
> 
> > +	unsigned int fifo_size;
> 
> This is should come from DT (based on the property or compatible),
> 
> ...
> 
> >  	u8			no_int_count;
> > +	u8			rxtrig_bytes[UART_FCR_R_TRIG_MAX_STATE];
> 
> Why do you need it here? Can it be provided via driver_data?
> 
> ...
> 
> > +/* The trigger is the masked, unshifted FCR receive trigger field. */
> > +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 / 4;
> > +	case UART_FCR_TRIGGER_8:
> > +		return p->fifosize / 2;
> > +	default:
> > +		return p->fifosize - 2;
> > +	}
> > +}
> 
> You don't need this, just provide a set of numbers directly.

That was my first thought as well, but James explained that he wanted to 
reuse this for HW different fifosize which makes sense.

And these formulas are given in DW spec so I suppose we could actually 
infer these for all DW UARTs, not just these ones being added now, using 
the same formulas. (A future work item.)

-- 
 i.


  parent reply	other threads:[~2026-10-30 10:08 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-27 23:05 [PATCH v4 0/5] serial: 8250_dw: describe the Allwinner H616 UART configuration James Hilliard
2026-10-27 23:05 ` [PATCH v4 1/5] serial: 8250_dw: select port setup through platform data James Hilliard
2026-10-28  8:56   ` Andy Shevchenko
2026-10-28  9:40     ` Andy Shevchenko
2026-10-27 23:05 ` [PATCH v4 2/5] serial: 8250: share the RX trigger conversion helper James Hilliard
2026-10-28  8:30   ` Ilpo Järvinen
2026-10-28  9:38     ` Andy Shevchenko
2026-10-28  9:37   ` Andy Shevchenko
2026-10-27 23:05 ` [PATCH v4 3/5] dt-bindings: serial: snps-dw-apb-uart: add Allwinner H616 James Hilliard
2026-10-28  8:06   ` Krzysztof Kozlowski
2026-10-27 23:05 ` [PATCH v4 4/5] serial: 8250_dw: configure the Allwinner H616 UART James Hilliard
2026-10-28  8:39   ` Ilpo Järvinen
2026-10-28  8:53     ` James Hilliard
2026-10-28  8:57       ` Ilpo Järvinen
2026-10-28 11:05   ` Andy Shevchenko
2026-10-29 19:08     ` James Hilliard
2026-10-30 10:08     ` Ilpo Järvinen [this message]
2026-10-27 23:05 ` [PATCH v4 5/5] arm64: dts: allwinner: h616: describe the UART integration James Hilliard
2026-10-28  8:57 ` [PATCH v4 0/5] serial: 8250_dw: describe the Allwinner H616 UART configuration Andre Przywara
2026-10-28  9:04   ` James Hilliard
2026-10-28  9:04   ` Chen-Yu Tsai

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=3e73ec0c-2623-d891-7146-dcf1c7a68c41@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

all inboxes | Powered by JetHome®