Devicetree
 help / color / mirror / Atom feed
From: zjzhao@edatec.cn
To: Jiri Slaby <jirislaby@kernel.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Rob Herring <robh@kernel.org>,
	Krzysztof Kozlowski <krzk+dt@kernel.org>,
	Conor Dooley <conor+dt@kernel.org>,
	linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org,
	devicetree@vger.kernel.org, zjzhao <zjzhao@edatec.cn>
Subject: Re: [PATCH 1/2] serial: wk2xxx: Add WK2xxx SPI UART driver
Date: Fri,  4 Sep 2026 17:32:46 +0800	[thread overview]
Message-ID: <20260904093246.100569-1-zjzhao@edatec.cn> (raw)
In-Reply-To: <8f8a4946-e8e2-4683-b837-c783c40b81c1@kernel.org>

From: zjzhao <zjzhao@edatec.cn>

Hi Jiri,

thanks for the review. Answers and a [PATCH v2] follow; v2 also carries
the Sashiko round-2 findings.

> Have you checked that there is no similar driver which could be only
> extended?

Yes. The only SPI/I2C UART bridge drivers in the tree are max3100.c,
max310x.c and sc16is7xx.c. The latter two implement the 16550-style
register set (THR/RHR, IER, IIR/FCR, LCR, MCR/MSR, LSR) over regmap,
which is exactly what the WK2xxx does *not* provide: its register map
and SPI protocol are proprietary (the sub-UART number and a page-select
bit live in the SPI command byte, plus dedicated FIFO burst commands),
it has no modem-control registers and only supports 8 data bits. Folding
it into sc16is7xx/max310x would force a more capable shared layer to
degrade, and it would mix two vendors into one binding. I take the
kernel's own precedent (sc16is7xx and max310x are separate drivers even
though sc16is7xx is derived from max310x) as confirmation that a
dedicated driver is the right model.

> > +	scoped_guard(mutex, &s->reg_lock) { ... }
> why is this one scoped?

The early return inside made it scoped; that was overkill since the lock
covers the whole function anyway. v2 uses a plain guard(mutex) for
wk2xxx_port_reg_update() and wk2xxx_conf_port().

> throttle/unthrottle, set_termios: this can be a guard too, right?

Yes - v2 uses guard(uart_port_lock_irqsave).

> What's the reason not to use any of the uart_port_tx* helpers?

TX needs sleeping SPI transfers, which cannot run while the port
spinlock is held. The helpers acquire port->lock around the drain, so
they are not usable here; like sc16is7xx/max310x, TX is run from the
kthread worker under a per-port mutex.

> Why not guard?  (handle_tx)  /  And kill the goto then.

Done in v2: guard(mutex) + scoped_guard(uart_port_lock_irqsave), the
goto and the tail unlock are gone.

> Should you perhaps cap the loop count as well?

Done - the drain loop is now bounded by WK2XXX_IRQ_MAX_PASSES.

> return IRQ_HANDLED ... bad for shared irqs

Fixed in v2 (IRQ_NONE when nothing was pending).

> Did you mean to use explicit u64?

Fixed - the divisor computation now uses div_u64()/u64 and builds on
32-bit.

> req + rel are optional. Drop them.

Done - request_port/release_port and their no-op helpers are dropped.

> membase=(void __iomem *)~0 ... compiler/sparse not complain?

Rather than fixing the cast I switched the ports to UPIO_BUS (as
sc16is7xx/max310x do) and removed the membase workaround altogether.

The v2 cover letter lists the full change set. Please review; happy to
iterate.

thanks,

--
zjzhao
EDATEC Technology Co., Ltd.

  reply	other threads:[~2026-09-04  9:32 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-04  7:20 [PATCH 0/2] WK2xxx SPI to UART bridge driver zjzhao
2026-09-04  7:20 ` [PATCH 1/2] serial: wk2xxx: Add WK2xxx SPI UART driver zjzhao
2026-09-04  7:35   ` sashiko-bot
2026-09-04  8:17   ` Jiri Slaby
2026-09-04  9:32     ` zjzhao [this message]
2026-09-04  7:20 ` [PATCH 2/2] dt-bindings: serial: Document WK2xxx SPI UART bindings zjzhao
2026-09-04  7:28   ` sashiko-bot
2026-09-04  9:33 ` [PATCH v2 0/2] WK2xxx SPI to UART bridge driver zjzhao
2026-09-04  9:33   ` [PATCH v2 1/2] serial: wk2xxx: Add WK2xxx SPI UART driver zjzhao
2026-09-04  9:53     ` sashiko-bot
2026-09-04  9:33   ` [PATCH v2 2/2] dt-bindings: serial: Document WK2xxx SPI UART bindings zjzhao
2026-09-04  9:40     ` sashiko-bot
2026-09-05  7:31     ` Krzysztof Kozlowski
2026-09-04 10:52   ` [PATCH v3 0/2] WK2xxx SPI to UART bridge driver zjzhao
2026-09-04 10:52     ` [PATCH v3 1/2] serial: wk2xxx: Add WK2xxx SPI UART driver zjzhao
2026-09-04 11:10       ` sashiko-bot
2026-09-04 10:52     ` [PATCH v3 2/2] dt-bindings: serial: Document WK2xxx SPI UART bindings zjzhao
2026-09-04 11:12       ` sashiko-bot
2026-09-04 15:28       ` Conor Dooley
2026-09-05  7:32       ` Krzysztof Kozlowski

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=20260904093246.100569-1-zjzhao@edatec.cn \
    --to=zjzhao@edatec.cn \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=jirislaby@kernel.org \
    --cc=krzk+dt@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=robh@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