devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
To: Arnd Bergmann <arnd@arndb.de>
Cc: Jacky Huang <ychuang570808@gmail.com>,
	Rob Herring <robh+dt@kernel.org>,
	krzysztof.kozlowski+dt@linaro.org, Lee Jones <lee@kernel.org>,
	Michael Turquette <mturquette@baylibre.com>,
	Stephen Boyd <sboyd@kernel.org>,
	Philipp Zabel <p.zabel@pengutronix.de>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Jiri Slaby <jirislaby@kernel.org>,
	Tomer Maimon <tmaimon77@gmail.com>,
	Catalin Marinas <catalin.marinas@arm.com>,
	Will Deacon <will@kernel.org>,
	devicetree@vger.kernel.org, linux-clk@vger.kernel.org,
	LKML <linux-kernel@vger.kernel.org>,
	linux-arm-kernel@lists.infradead.org,
	linux-serial <linux-serial@vger.kernel.org>,
	schung@nuvoton.com, mjchen@nuvoton.com,
	Jacky Huang <ychuang3@nuvoton.com>
Subject: Re: [PATCH v10 10/10] tty: serial: Add Nuvoton ma35d1 serial driver support
Date: Tue, 9 May 2023 15:25:41 +0300 (EEST)	[thread overview]
Message-ID: <b9573562-d4d7-3535-fb4d-f2bc694f2a4@linux.intel.com> (raw)
In-Reply-To: <eeeaf258-8f2b-436a-aba0-b32dc90b359f@app.fastmail.com>

[-- Attachment #1: Type: text/plain, Size: 2921 bytes --]

On Tue, 9 May 2023, Arnd Bergmann wrote:

> On Tue, May 9, 2023, at 12:17, Ilpo Järvinen wrote:
> > On Mon, 8 May 2023, Jacky Huang wrote:
> >> +
> >> +#define UART_NR			17
> >> +
> >> +#define UART_REG_RBR		0x00
> >> +#define UART_REG_THR		0x00
> >> +#define UART_REG_IER		0x04
> >> +#define UART_REG_FCR		0x08
> >> +#define UART_REG_LCR		0x0C
> >> +#define UART_REG_MCR		0x10
> >
> > These duplicate include/uapi/linux/serial_reg.h ones, use the std ones 
> > directly.
> >
> > Setup regshift too and use it in serial_in.
> 
> I think this came up in previous reviews, but it turned out that
> only the first six registers are compatible, while the later
> ones are all different, and it's not 8250 compatible.

So use the normal name for compatible ones and HW specific names for the 
others?

It might not be compatible in everything but surely 8250 influence is 
visible here and there.

> It might be helpful to rename the registers to something
> with a prefix other than UART_REG_*, to avoid the confusion
> and possible namespace clash.

That is what I also suggested for the rest of the registers.

-- 
 i.

> >> +/* UART_REG_IER - Interrupt Enable Register */
> >> +#define IER_RDA_IEN		BIT(0)  /* RBR Available Interrupt Enable */
> >> +#define IER_THRE_IEN		BIT(1)  /* THR Empty Interrupt Enable */
> >> +#define IER_RLS_IEN		BIT(2)  /* RX Line Status Interrupt Enable */
> >
> > These look same as UART_IER bits, use the std ones.
> ...
> > Are these same as UART_FCR_CLEAR_* functionality wise? If they're use std 
> > ones.
> 
> Again, I'd think we're better off having a distinct naming for
> them than trying to share the definitions with 8250.
> 
> >> +static struct uart_driver ma35d1serial_reg = {
> >> +	.owner        = THIS_MODULE,
> >> +	.driver_name  = "serial",
> >> +	.dev_name     = "ttyS",
> >> +	.major        = TTY_MAJOR,
> >> +	.minor        = 64,
> >> +	.cons         = MA35D1SERIAL_CONSOLE,
> >> +	.nr           = UART_NR,
> >> +};
> >
> > This doesn't seem necessary, 8250 core will have the uart_driver for you
> > and most of the console stuff too. You just need to setup a few things 
> > correctly (see the setup functions in 8250_early for ideas/examples).
> >...
> >> +
> >> +	ret = uart_add_one_port(&ma35d1serial_reg, &up->port);
> >
> > For 8250, you should be using serial8250_register_8250_port(). See the 
> > other drivers how to setup the console functions.
> 
> Consequently, this should also be kept separate from the serial8250
> driver, I don't see a way to fit the nuvoton code into the existing
> driver without making the resulting driver worse for everyone.
> 
> There is one thing that absolutely needs to be changed though:
> the driver_name/dev_name/major/minor fields all clash with the
> 8250 driver, so you cannot have a kernel that has both drivers
> built-in. All of these should change to get out of the way of the
> existing drivers.
> 
>         Arnd
> 

  reply	other threads:[~2023-05-09 12:26 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-08  2:59 [PATCH v10 00/10] Introduce Nuvoton ma35d1 SoC Jacky Huang
2023-05-08  2:59 ` [PATCH v10 01/10] arm64: Kconfig.platforms: Add config for Nuvoton MA35 platform Jacky Huang
2023-05-08  2:59 ` [PATCH v10 02/10] arm64: defconfig: Add support for Nuvoton MA35 family SoCs Jacky Huang
2023-05-08  2:59 ` [PATCH v10 03/10] dt-bindings: clock: nuvoton: add binding for ma35d1 clock controller Jacky Huang
2023-05-08  3:26   ` Rob Herring
2023-05-08  6:30     ` Krzysztof Kozlowski
2023-05-08  2:59 ` [PATCH v10 04/10] dt-bindings: reset: nuvoton: Document ma35d1 reset control Jacky Huang
2023-05-08  3:26   ` Rob Herring
2023-05-08  2:59 ` [PATCH v10 05/10] dt-bindings: arm: Add initial bindings for Nuvoton platform Jacky Huang
2023-05-08  3:26   ` Rob Herring
2023-05-08  2:59 ` [PATCH v10 06/10] dt-bindings: serial: Document ma35d1 uart controller Jacky Huang
2023-05-08  3:26   ` Rob Herring
2023-05-08  6:31     ` Krzysztof Kozlowski
2023-05-08  7:01       ` Jacky Huang
2023-05-08  8:05         ` Krzysztof Kozlowski
2023-05-08  8:15           ` Jacky Huang
2023-05-08  2:59 ` [PATCH v10 07/10] arm64: dts: nuvoton: Add initial ma35d1 device tree Jacky Huang
2023-05-08  2:59 ` [PATCH v10 08/10] clk: nuvoton: Add clock driver for ma35d1 clock controller Jacky Huang
2023-05-08 10:52   ` Ilpo Järvinen
2023-05-09  0:58     ` Jacky Huang
2023-05-08  2:59 ` [PATCH v10 09/10] reset: Add Nuvoton ma35d1 reset driver support Jacky Huang
2023-05-08  8:20   ` Philipp Zabel
2023-05-08 11:00   ` Ilpo Järvinen
2023-05-09  1:09     ` Jacky Huang
2023-05-08  2:59 ` [PATCH v10 10/10] tty: serial: Add Nuvoton ma35d1 serial " Jacky Huang
2023-05-09 10:17   ` Ilpo Järvinen
2023-05-09 12:14     ` Arnd Bergmann
2023-05-09 12:25       ` Ilpo Järvinen [this message]
2023-05-09 12:32         ` Arnd Bergmann
2023-05-10  1:26           ` Jacky Huang
2023-05-10 10:57             ` Arnd Bergmann

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=b9573562-d4d7-3535-fb4d-f2bc694f2a4@linux.intel.com \
    --to=ilpo.jarvinen@linux.intel.com \
    --cc=arnd@arndb.de \
    --cc=catalin.marinas@arm.com \
    --cc=devicetree@vger.kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=jirislaby@kernel.org \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=lee@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=mjchen@nuvoton.com \
    --cc=mturquette@baylibre.com \
    --cc=p.zabel@pengutronix.de \
    --cc=robh+dt@kernel.org \
    --cc=sboyd@kernel.org \
    --cc=schung@nuvoton.com \
    --cc=tmaimon77@gmail.com \
    --cc=will@kernel.org \
    --cc=ychuang3@nuvoton.com \
    --cc=ychuang570808@gmail.com \
    /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).