devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
To: Jiri Slaby <jirislaby@kernel.org>
Cc: Binbin Zhou <zhoubinbin@loongson.cn>,
	Binbin Zhou <zhoubb.aaron@gmail.com>,
	 Huacai Chen <chenhuacai@loongson.cn>,
	Rob Herring <robh+dt@kernel.org>,
	 Krzysztof Kozlowski <krzk+dt@kernel.org>,
	 Conor Dooley <conor+dt@kernel.org>,
	 Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	 Haowei Zheng <zhenghaowei@loongson.cn>,
	 Huacai Chen <chenhuacai@kernel.org>,
	Xuerui Wang <kernel@xen0n.name>,
	 loongarch@lists.linux.dev, devicetree@vger.kernel.org,
	 linux-serial <linux-serial@vger.kernel.org>
Subject: Re: [PATCH v5 2/3] serial: 8250: Add Loongson uart driver support
Date: Tue, 30 Sep 2025 15:01:09 +0300 (EEST)	[thread overview]
Message-ID: <0bb67e09-94b2-ed89-2711-b6bda00f6f14@linux.intel.com> (raw)
In-Reply-To: <a985f144-7489-4a99-bcb7-90e7b21d9885@kernel.org>

On Mon, 29 Sep 2025, Jiri Slaby wrote:

> On 24. 09. 25, 8:29, Binbin Zhou wrote:
> > Add the driver for on-chip UART used on Loongson family chips.
> > 
> > The hardware is similar to 8250, but there are the following
> > differences:
> >   - Some chips (such as Loongson-2K2000) have added a fractional division
> >     register to obtain the required baud rate accurately, so the
> >     {get,set}_divisor callback is overridden.
> >   - Due to hardware defects, quirk handling is required for
> >     UART_MCR/UART_MSR.
> 
> So how hard would be to implement this in 8250 using existing (or new)
> callbacks+quirks?

??

Isn't it exactly what this submission did? It implements custom in/out 
functions which handle the xor for the relevant bits?

-- 
 i.

> > --- /dev/null
> > +++ b/drivers/tty/serial/8250/8250_loongson.c
> > @@ -0,0 +1,202 @@
> ...
> > +struct loongson_uart_data {
> > +	int line;
> > +	int mcr_invert;
> > +	int msr_invert;
> 
> These two should be unsigned. They should be u8, actually.
> 
> > +	struct reset_control *rst;
> > +};
> > +
> > +static unsigned int serial_fixup(struct uart_port *p, unsigned int offset,
> > unsigned int val)
> 
> Both 'val' and ret type should be u8.
> 
> > +{
> > +	struct loongson_uart_data *ddata = p->private_data;
> > +
> > +	if (offset == UART_MCR)
> > +		val ^= ddata->mcr_invert;
> > +
> > +	if (offset == UART_MSR)
> > +		val ^= ddata->msr_invert;
> > +
> > +	return val;
> > +}
> > +
> > +static u32 loongson_serial_in(struct uart_port *p, unsigned int offset)
> > +{
> > +	unsigned int val;
> 
> u8
> 
> > +
> > +	val = readb(p->membase + (offset << p->regshift));
> > +
> > +	return serial_fixup(p, offset, val);
> > +}
> 
> thanks,
> 

  parent reply	other threads:[~2025-09-30 12:01 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-24  6:29 [PATCH v5 0/3] uart: Introduce uart driver for the Loongson family Binbin Zhou
2025-09-24  6:29 ` [PATCH v5 1/3] dt-bindings: serial: 8250: Add Loongson uart compatible Binbin Zhou
2025-09-24 19:19   ` Conor Dooley
2025-09-24  6:29 ` [PATCH v5 2/3] serial: 8250: Add Loongson uart driver support Binbin Zhou
2025-09-24 10:22   ` Greg Kroah-Hartman
2025-09-28  2:48     ` Binbin Zhou
2025-09-29  6:19       ` Jiri Slaby
2025-09-30  3:03         ` Binbin Zhou
2025-10-08 12:16           ` Greg Kroah-Hartman
2025-09-29  6:26   ` Jiri Slaby
2025-09-30  3:07     ` Binbin Zhou
2025-09-30 12:01     ` Ilpo Järvinen [this message]
2025-09-30 11:58   ` Ilpo Järvinen
2025-10-09  2:52     ` Binbin Zhou
2025-10-09 11:46       ` Ilpo Järvinen
2025-09-24  6:29 ` [PATCH v5 3/3] LoongArch: dts: Add uart new compatible string Binbin Zhou

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=0bb67e09-94b2-ed89-2711-b6bda00f6f14@linux.intel.com \
    --to=ilpo.jarvinen@linux.intel.com \
    --cc=chenhuacai@kernel.org \
    --cc=chenhuacai@loongson.cn \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=jirislaby@kernel.org \
    --cc=kernel@xen0n.name \
    --cc=krzk+dt@kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=loongarch@lists.linux.dev \
    --cc=robh+dt@kernel.org \
    --cc=zhenghaowei@loongson.cn \
    --cc=zhoubb.aaron@gmail.com \
    --cc=zhoubinbin@loongson.cn \
    /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;
as well as URLs for NNTP newsgroup(s).