All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Biju Das <biju.das.jz@bp.renesas.com>
Cc: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>,
	"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
	"Jiri Slaby" <jirislaby@kernel.org>,
	"Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>,
	"Maciej W. Rozycki" <macro@orcam.me.uk>,
	"Eric Tremblay" <etremblay@distech-controls.com>,
	"Wander Lairson Costa" <wander@redhat.com>,
	linux-serial <linux-serial@vger.kernel.org>,
	"Geert Uytterhoeven" <geert+renesas@glider.be>,
	"Fabrizio Castro" <fabrizio.castro.jz@renesas.com>,
	"linux-renesas-soc@vger.kernel.org"
	<linux-renesas-soc@vger.kernel.org>
Subject: Re: [PATCH 1/3] serial: 8250: Identify Renesas RZ/V2M 16750 UART
Date: Fri, 10 Feb 2023 12:59:02 +0200	[thread overview]
Message-ID: <Y+YjdghwT2msRriZ@smile.fi.intel.com> (raw)
In-Reply-To: <OS0PR01MB5922C55E79014C84C742AE0886DE9@OS0PR01MB5922.jpnprd01.prod.outlook.com>

On Fri, Feb 10, 2023 at 07:14:54AM +0000, Biju Das wrote:
> > Subject: Re: [PATCH 1/3] serial: 8250: Identify Renesas RZ/V2M 16750 UART
> > On Thu, Feb 09, 2023 at 02:28:55PM +0000, Biju Das wrote:
> > > > From: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
> > > > Sent: Thursday, February 9, 2023 2:09 PM On Thu, 9 Feb 2023, Biju
> > > > Das wrote:

...

> > > > > +	[PORT_16750] = {
> > > > > +		.name		= "Renesas RZ/V2M 16750",
> > > > > +		.fifo_size	= 64,
> > > > > +		.tx_loadsz	= 64,
> > > > > +		.fcr		= UART_FCR_ENABLE_FIFO | UART_FCR_R_TRIG_10 |
> > > > > +				  UART_FCR7_64BYTE,
> > > > > +		.rxtrig_bytes	= {1, 16, 32, 56},
> > > > > +		.flags		= UART_CAP_FIFO | UART_CAP_AFE,
> > > > > +	},
> > > >
> > > > Eh, how can you reuse [PORT_16750] again in the initializer like that?
> > >
> > > Oops. Missed it. Is it ok to introduce PORT_RENESAS_16750_F64 instead
> > > as PORT_16750 is used by TI16750?
> > 
> > What the difference to the 16750 from TI that prevents you from using it?
> 
> Mostly it is identical.
> 
> The main difference is detection method, and we don't have UART_IERX_SLEEP bit in IER.
> 
> On TI, it sets bit 5 of the IIR when 64-byte FIFO mode is enabled when DLAB is set.
> 
> Whereas in our case DLAB does n't have any role for Identification, 
> 
> It set bit 5 of the IIR when 64 byte FIFO mode is enabled.
> and it clears bit 5 of the IIR when 64 byte FIFO mode is disabled.

So the question here is do these minor deviations affect the actual functionality?

Note, on Intel hardware we use directly TI16750 while we have no sleep
functionality available IIRC. Ilpo may correct me if I'm wrong.

> Other than that, when I use PORT_16750 type and capabilities in 8250_em driver and 
> add identification method for Renesas UART in 8250_port driver,
> 
> It detected as PORT_16750 UART, but I get below prints during autoconf which is confusing for the end user
> 
> [    0.214926] serial8250-em a4040000.serial: detected caps 00000900 should be 00000d00
> [    0.214975] a4040000.serial: ttyS0 at MMIO 0xa4040000 (irq = 24, base_baud = 3000000) is a TI16750
> 
> 
> Modification in 8250_em driver
> 
> +		    up.port.type = PORT_16750;
> +               up.port.name            = "Renesas RZ/V2M 16750";
> +               up.port.fifosize        = 64;
> +               up.tx_loadsz = 64;
> +               up.capabilities = UART_CAP_FIFO | UART_CAP_AFE;
> 
> Identification method in 8250_port.c driver
> 
> +       /*
> +        * No EFR.  Try to detect a Renesas RZ/V2M 16750, which only sets bit 5
> +        * of the IIR when 64 byte FIFO mode is enabled.
> +        * Try setting/clear bit5 of FCR.
> +        */
> +       serial_out(up, UART_FCR, UART_FCR_ENABLE_FIFO);
> +       status1 = serial_in(up, UART_IIR) & (UART_IIR_64BYTE_FIFO | UART_IIR_FIFO_ENABLED);
> +
> +       serial_out(up, UART_FCR, UART_FCR_ENABLE_FIFO | UART_FCR7_64BYTE);
> +       status2 = serial_in(up, UART_IIR) & (UART_IIR_64BYTE_FIFO | UART_IIR_FIFO_ENABLED);
> +
> +       if (status1 == UART_IIR_FIFO_ENABLED_16550A &&
> +           status2 == (UART_IIR_64BYTE_FIFO | UART_IIR_FIFO_ENABLED_16550A)) {
> +               up->port.type = PORT_16750;
> +               up->capabilities |= UART_CAP_AFE;
> +               return;
> +       }

What I don't like is increasing quirks in the 8250_port. Can't you simply use FIXED_PORT facility?
Again, look how 8250_mid is written.

-- 
With Best Regards,
Andy Shevchenko



  reply	other threads:[~2023-02-10 10:59 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-09 13:26 [PATCH 0/3] Add Identification and 64 bit fifo support to Renesas RZ/V2M 16750 UART Biju Das
2023-02-09 13:26 ` [PATCH 1/3] serial: 8250: Identify " Biju Das
2023-02-09 14:08   ` Ilpo Järvinen
2023-02-09 14:28     ` Biju Das
2023-02-09 21:52       ` Andy Shevchenko
2023-02-10  7:14         ` Biju Das
2023-02-10 10:59           ` Andy Shevchenko [this message]
2023-02-10 11:53             ` Biju Das
2023-02-10 15:56               ` Andy Shevchenko
2023-02-09 13:26 ` [PATCH 2/3] serial: 8250_em: Use dev_err_probe() Biju Das
2023-02-09 17:49   ` Geert Uytterhoeven
2023-02-10 12:19     ` Biju Das
2023-02-09 13:26 ` [PATCH 3/3] serial: 8250_em: Add serial8250_rzv2m_reg_update() Biju Das
2023-02-09 14:29   ` Ilpo Järvinen
2023-02-10 13:47     ` Biju Das
2023-02-09 17:53   ` Geert Uytterhoeven
2023-02-10 13:49     ` Biju Das
2023-02-10 13:56       ` Ilpo Järvinen
2023-02-10 14:51         ` Biju Das

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=Y+YjdghwT2msRriZ@smile.fi.intel.com \
    --to=andriy.shevchenko@linux.intel.com \
    --cc=biju.das.jz@bp.renesas.com \
    --cc=etremblay@distech-controls.com \
    --cc=fabrizio.castro.jz@renesas.com \
    --cc=geert+renesas@glider.be \
    --cc=gregkh@linuxfoundation.org \
    --cc=ilpo.jarvinen@linux.intel.com \
    --cc=jirislaby@kernel.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=macro@orcam.me.uk \
    --cc=u.kleine-koenig@pengutronix.de \
    --cc=wander@redhat.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.