mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Kumaravel Thiagarajan <kumaravel.thiagarajan@microchip.com>
Cc: linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org,
	gregkh@linuxfoundation.org, jirislaby@kernel.org,
	ilpo.jarvinen@linux.intel.com, macro@orcam.me.uk,
	cang1@live.co.uk, colin.i.king@gmail.com,
	phil.edworthy@renesas.com, biju.das.jz@bp.renesas.com,
	geert+renesas@glider.be, lukas@wunner.de,
	u.kleine-koenig@pengutronix.de, wander@redhat.com,
	etremblay@distech-controls.com, jk@ozlabs.org,
	Tharun Kumar P <tharunkumar.pasumarthi@microchip.com>
Subject: Re: [PATCH v7 tty-next 2/4] serial: 8250_pci1xxxx: Add driver for quad-uart support
Date: Wed, 7 Dec 2022 22:01:22 +0200	[thread overview]
Message-ID: <Y5DxEszrq0rXVqvl@smile.fi.intel.com> (raw)
In-Reply-To: <20221207235305.695541-3-kumaravel.thiagarajan@microchip.com>

On Thu, Dec 08, 2022 at 05:23:03AM +0530, Kumaravel Thiagarajan wrote:
> pci1xxxx is a PCIe switch with a multi-function endpoint on one of
> its downstream ports. Quad-uart is one of the functions in the
> multi-function endpoint. This driver loads for the quad-uart and
> enumerates single or multiple instances of uart based on the PCIe
> subsystem device ID.

...

> +static int pci1xxxx_get_physical_port(int subsys_dev, int port)
> +{
> +	static int logical_to_physical_port_idx[][MAX_PORTS] = {
> +		{0, 1, 2, 3},   /* PCI12000 PCI11010 PCI11101 PCI11400 PCI11414 */
> +		{0, 1, 2, 3},   /* PCI4p */
> +		{0, 1, 2, -1},  /* PCI3p012 */
> +		{0, 1, 3, -1},  /* PCI3p013 */
> +		{0, 2, 3, -1},  /* PCI3p023 */
> +		{1, 2, 3, -1},  /* PCI3p123 */
> +		{0, 1, -1, -1}, /* PCI2p01 */
> +		{0, 2, -1, -1}, /* PCI2p02 */
> +		{0, 3, -1, -1}, /* PCI2p03 */
> +		{1, 2, -1, -1}, /* PCI2p12 */
> +		{1, 3, -1, -1}, /* PCI2p13 */
> +		{2, 3, -1, -1}, /* PCI2p23 */
> +		{0, -1, -1, -1},/* PCI1p0 */
> +		{1, -1, -1, -1},/* PCI1p1 */
> +		{2, -1, -1, -1},/* PCI1p2 */
> +		{3, -1, -1, -1},/* PCI1p3 */

You can make columns nicely indented, but it is up to you,

		...
		{0,  1,  2,  3}, /* PCI4p */
		...
		{1,  2,  3, -1}, /* PCI3p123 */
		...
		{2,  3, -1, -1}, /* PCI2p23 */
		{0, -1, -1, -1}, /* PCI1p0 */
		...

> +	};
> +
> +	return logical_to_physical_port_idx[subsys_dev][port];
> +}

...

> +	priv->membase = pcim_iomap(pdev, 0, 0);

Is any of those card can have an IO bar (instead of MEM)?

> +	if (!priv->membase)
> +		return -ENOMEM;

...

> +	if (num_vectors == 4)
> +		writeb(UART_PCI_CTRL_SET_MULTIPLE_MSI,
> +		       priv->membase + UART_PCI_CTRL_REG);

If you set this unconditionally when num_vectors < 4, would it still work?

> +	else
> +		uart.port.irq = pci_irq_vector(pdev, 0);

I would move this to the below...

...

> +		if (num_vectors == 4)
> +			uart.port.irq = pci_irq_vector(priv->pdev, port_idx);

...here as IRQ assignment to be seen at one place.

-- 
With Best Regards,
Andy Shevchenko



  reply	other threads:[~2022-12-07 20:03 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-07 23:53 [PATCH v7 tty-next 0/4] serial: 8250_pci1xxxx: Add driver for the pci1xxxx's quad-uart function Kumaravel Thiagarajan
2022-12-07 23:53 ` [PATCH v7 tty-next 1/4] serial: 8250_pci: Add serial8250_pci_setup_port definition in 8250_pcilib.c Kumaravel Thiagarajan
2022-12-07 11:36   ` Andy Shevchenko
2022-12-07 23:53 ` [PATCH v7 tty-next 2/4] serial: 8250_pci1xxxx: Add driver for quad-uart support Kumaravel Thiagarajan
2022-12-07 20:01   ` Andy Shevchenko [this message]
2022-12-10 11:19     ` Tharunkumar.Pasumarthi
2022-12-07 23:53 ` [PATCH v7 tty-next 3/4] serial: 8250_pci1xxxx: Add RS485 support to quad-uart driver Kumaravel Thiagarajan
2022-12-07 11:53   ` Ilpo Järvinen
2022-12-07 23:53 ` [PATCH v7 tty-next 4/4] serial: 8250_pci1xxxx: Add power management functions " Kumaravel Thiagarajan

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=Y5DxEszrq0rXVqvl@smile.fi.intel.com \
    --to=andriy.shevchenko@linux.intel.com \
    --cc=biju.das.jz@bp.renesas.com \
    --cc=cang1@live.co.uk \
    --cc=colin.i.king@gmail.com \
    --cc=etremblay@distech-controls.com \
    --cc=geert+renesas@glider.be \
    --cc=gregkh@linuxfoundation.org \
    --cc=ilpo.jarvinen@linux.intel.com \
    --cc=jirislaby@kernel.org \
    --cc=jk@ozlabs.org \
    --cc=kumaravel.thiagarajan@microchip.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=lukas@wunner.de \
    --cc=macro@orcam.me.uk \
    --cc=phil.edworthy@renesas.com \
    --cc=tharunkumar.pasumarthi@microchip.com \
    --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 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®