All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] pch_uart: Add MSI support
@ 2011-06-22  9:50 Alexander Stein
  2011-06-23  0:14 ` Tomoya MORINAGA
  2011-06-23  0:34 ` [PATCH] pch_uart: Add MSI support Roland Dreier
  0 siblings, 2 replies; 13+ messages in thread
From: Alexander Stein @ 2011-06-22  9:50 UTC (permalink / raw)
  To: Alan Cox; +Cc: linux-serial, linux-kernel, Tomoya MORINAGA, Alexander Stein

Signed-off-by: Alexander Stein <alexander.stein@systec-electronic.com>
---
 drivers/tty/serial/pch_uart.c |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/drivers/tty/serial/pch_uart.c b/drivers/tty/serial/pch_uart.c
index 4652109..9db9773 100644
--- a/drivers/tty/serial/pch_uart.c
+++ b/drivers/tty/serial/pch_uart.c
@@ -234,6 +234,7 @@ struct eg20t_port {
 	int				tx_dma_use;
 	void				*rx_buf_virt;
 	dma_addr_t			rx_buf_dma;
+	int				use_msi;
 };
 
 /**
@@ -1429,6 +1430,12 @@ static struct eg20t_port *pch_uart_init_port(struct pci_dev *pdev,
 		goto init_port_hal_free;
 	}
 
+	ret = pci_enable_msi(pdev);
+	if (ret)
+		priv->use_msi = 0;
+	else
+		priv->use_msi = 1;
+
 	iobase = pci_resource_start(pdev, 0);
 	mapbase = pci_resource_start(pdev, 1);
 	priv->mapbase = mapbase;
@@ -1485,6 +1492,9 @@ static void pch_uart_pci_remove(struct pci_dev *pdev)
 	struct eg20t_port *priv;
 
 	priv = (struct eg20t_port *)pci_get_drvdata(pdev);
+
+	if (priv->use_msi)
+		pci_disable_msi(pdev);
 	pch_uart_exit_port(priv);
 	pci_disable_device(pdev);
 	kfree(priv);
@@ -1568,6 +1578,8 @@ static int __devinit pch_uart_pci_probe(struct pci_dev *pdev,
 	return ret;
 
 probe_disable_device:
+	if (priv->use_msi)
+		pci_disable_msi(pdev);
 	pci_disable_device(pdev);
 probe_error:
 	return ret;
-- 
1.7.3.4


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* Re: [PATCH] pch_uart: Add MSI support
  2011-06-22  9:50 [PATCH] pch_uart: Add MSI support Alexander Stein
@ 2011-06-23  0:14 ` Tomoya MORINAGA
  2011-06-23  7:00   ` [PATCH v2] " Alexander Stein
  2011-07-19  4:15   ` serial/pch_uart: AT command behavior Tomoya MORINAGA
  2011-06-23  0:34 ` [PATCH] pch_uart: Add MSI support Roland Dreier
  1 sibling, 2 replies; 13+ messages in thread
From: Tomoya MORINAGA @ 2011-06-23  0:14 UTC (permalink / raw)
  To: Alexander Stein; +Cc: Alan Cox, linux-serial, linux-kernel

(2011/06/22 18:50), Alexander Stein wrote:
> Signed-off-by: Alexander Stein<alexander.stein@systec-electronic.com>
> ---
>   drivers/tty/serial/pch_uart.c |   12 ++++++++++++
>   1 files changed, 12 insertions(+), 0 deletions(-)
> 
> diff --git a/drivers/tty/serial/pch_uart.c b/drivers/tty/serial/pch_uart.c
> index 4652109..9db9773 100644
> --- a/drivers/tty/serial/pch_uart.c
> +++ b/drivers/tty/serial/pch_uart.c
> @@ -234,6 +234,7 @@ struct eg20t_port {
>   	int				tx_dma_use;
>   	void				*rx_buf_virt;
>   	dma_addr_t			rx_buf_dma;
> +	int				use_msi;
>   };
> 
>   /**
> @@ -1429,6 +1430,12 @@ static struct eg20t_port *pch_uart_init_port(struct pci_dev *pdev,
>   		goto init_port_hal_free;
>   	}
> 
> +	ret = pci_enable_msi(pdev);
> +	if (ret)
> +		priv->use_msi = 0;
> +	else
> +		priv->use_msi = 1;
> +
>   	iobase = pci_resource_start(pdev, 0);
>   	mapbase = pci_resource_start(pdev, 1);
>   	priv->mapbase = mapbase;
> @@ -1485,6 +1492,9 @@ static void pch_uart_pci_remove(struct pci_dev *pdev)
>   	struct eg20t_port *priv;
> 
>   	priv = (struct eg20t_port *)pci_get_drvdata(pdev);
> +
> +	if (priv->use_msi)
> +		pci_disable_msi(pdev);
>   	pch_uart_exit_port(priv);
>   	pci_disable_device(pdev);
>   	kfree(priv);
> @@ -1568,6 +1578,8 @@ static int __devinit pch_uart_pci_probe(struct pci_dev *pdev,
>   	return ret;
> 
>   probe_disable_device:
> +	if (priv->use_msi)
> +		pci_disable_msi(pdev);
>   	pci_disable_device(pdev);
>   probe_error:
>   	return ret;

Thank you for your updating.

-- 
tomoya
OKI SEMICONDUCTOR CO., LTD.

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH] pch_uart: Add MSI support
  2011-06-22  9:50 [PATCH] pch_uart: Add MSI support Alexander Stein
  2011-06-23  0:14 ` Tomoya MORINAGA
@ 2011-06-23  0:34 ` Roland Dreier
  1 sibling, 0 replies; 13+ messages in thread
From: Roland Dreier @ 2011-06-23  0:34 UTC (permalink / raw)
  To: Alexander Stein; +Cc: Alan Cox, linux-serial, linux-kernel, Tomoya MORINAGA

On Wed, Jun 22, 2011 at 2:50 AM, Alexander Stein
<alexander.stein@systec-electronic.com> wrote:
> +       if (priv->use_msi)
> +               pci_disable_msi(pdev);

Trivial nit: pci_disable_msi() is safe even if you didn't enable msi.
So you can drop the use_msi flag (the PCI layer has dev->msi_enabled
internally to track this), and just always call pci_disable_msi().

 - R.

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH v2] pch_uart: Add MSI support
  2011-06-23  0:14 ` Tomoya MORINAGA
@ 2011-06-23  7:00   ` Alexander Stein
  2011-06-23  7:16     ` Clemens Ladisch
  2011-07-01 22:32     ` Greg KH
  2011-07-19  4:15   ` serial/pch_uart: AT command behavior Tomoya MORINAGA
  1 sibling, 2 replies; 13+ messages in thread
From: Alexander Stein @ 2011-06-23  7:00 UTC (permalink / raw)
  To: Tomoya MORINAGA; +Cc: Alan Cox, linux-serial, linux-kernel, Alexander Stein

Signed-off-by: Alexander Stein <alexander.stein@systec-electronic.com>
---
Changes in v2:
* msi_enabled is stored in pci_dev already, skip it in our code

 drivers/tty/serial/pch_uart.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/drivers/tty/serial/pch_uart.c b/drivers/tty/serial/pch_uart.c
index a3d0c9e..ab34576 100644
--- a/drivers/tty/serial/pch_uart.c
+++ b/drivers/tty/serial/pch_uart.c
@@ -1578,6 +1578,8 @@ static struct eg20t_port *pch_uart_init_port(struct pci_dev *pdev,
 		goto init_port_hal_free;
 	}
 
+	pci_enable_msi(pdev);
+
 	iobase = pci_resource_start(pdev, 0);
 	mapbase = pci_resource_start(pdev, 1);
 	priv->mapbase = mapbase;
@@ -1640,6 +1642,8 @@ static void pch_uart_pci_remove(struct pci_dev *pdev)
 	struct eg20t_port *priv;
 
 	priv = (struct eg20t_port *)pci_get_drvdata(pdev);
+
+	pci_disable_msi(pdev);
 #ifdef CONFIG_SERIAL_PCH_UART_CONSOLE
 	pch_uart_ports[priv->port.line] = NULL;
 #endif
@@ -1726,6 +1730,7 @@ static int __devinit pch_uart_pci_probe(struct pci_dev *pdev,
 	return ret;
 
 probe_disable_device:
+	pci_disable_msi(pdev);
 	pci_disable_device(pdev);
 probe_error:
 	return ret;
-- 
1.7.3.4


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* Re: [PATCH v2] pch_uart: Add MSI support
  2011-06-23  7:00   ` [PATCH v2] " Alexander Stein
@ 2011-06-23  7:16     ` Clemens Ladisch
  2011-06-23  7:37       ` Alexander Stein
  2011-07-01 22:32     ` Greg KH
  1 sibling, 1 reply; 13+ messages in thread
From: Clemens Ladisch @ 2011-06-23  7:16 UTC (permalink / raw)
  To: Alexander Stein; +Cc: Tomoya MORINAGA, Alan Cox, linux-serial, linux-kernel

Alexander Stein wrote:
> +++ b/drivers/tty/serial/pch_uart.c
> @@ -1578,6 +1578,8 @@ static struct eg20t_port *pch_uart_init_port(struct pci_dev *pdev,
>  
> +	pci_enable_msi(pdev);

Pretty much every driver that tries this eventually ends up with
a blacklist of devices that don't implement MSI correctly.
Did you test this with all the models that are supported by this driver?


Regards,
Clemens

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v2] pch_uart: Add MSI support
  2011-06-23  7:16     ` Clemens Ladisch
@ 2011-06-23  7:37       ` Alexander Stein
  0 siblings, 0 replies; 13+ messages in thread
From: Alexander Stein @ 2011-06-23  7:37 UTC (permalink / raw)
  To: Clemens Ladisch; +Cc: Tomoya MORINAGA, Alan Cox, linux-serial, linux-kernel

On Thursday 23 June 2011 09:16:38 Clemens Ladisch wrote:
> Alexander Stein wrote:
> > +++ b/drivers/tty/serial/pch_uart.c
> > @@ -1578,6 +1578,8 @@ static struct eg20t_port *pch_uart_init_port(struct
> > pci_dev *pdev,
> > 
> > +	pci_enable_msi(pdev);
> 
> Pretty much every driver that tries this eventually ends up with
> a blacklist of devices that don't implement MSI correctly.
> Did you test this with all the models that are supported by this driver?

I don't have all models supported by this driver. So I could only test with 
this one:
#lspci -v -s 02:0a.1
02:0a.1 Serial controller: Intel Corporation Device 8811 (prog-if 02 [16550])
        Subsystem: Intel Corporation Device 8811
        Flags: bus master, fast devsel, latency 0, IRQ 40
        I/O ports at 9040 [size=8]
        Memory at 9fefb2f0 (32-bit, non-prefetchable) [size=16]
        Capabilities: [40] MSI: Mask- 64bit- Count=1/1 Enable+
        Capabilities: [50] Power Management version 2
        Kernel driver in use: pch_uart

There are 3 more for the other ports.

Regards,
Alexander

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v2] pch_uart: Add MSI support
  2011-06-23  7:00   ` [PATCH v2] " Alexander Stein
  2011-06-23  7:16     ` Clemens Ladisch
@ 2011-07-01 22:32     ` Greg KH
  2011-07-04  6:58       ` [PATCH v3] " Alexander Stein
  1 sibling, 1 reply; 13+ messages in thread
From: Greg KH @ 2011-07-01 22:32 UTC (permalink / raw)
  To: Alexander Stein; +Cc: Tomoya MORINAGA, Alan Cox, linux-serial, linux-kernel

On Thu, Jun 23, 2011 at 09:00:05AM +0200, Alexander Stein wrote:
> Signed-off-by: Alexander Stein <alexander.stein@systec-electronic.com>
> ---
> Changes in v2:
> * msi_enabled is stored in pci_dev already, skip it in our code

This doesn't apply to my tree, what kernel tree is it against?

greg k-h

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH v3] pch_uart: Add MSI support
  2011-07-01 22:32     ` Greg KH
@ 2011-07-04  6:58       ` Alexander Stein
  2011-07-22 12:39         ` Tomoya MORINAGA
  0 siblings, 1 reply; 13+ messages in thread
From: Alexander Stein @ 2011-07-04  6:58 UTC (permalink / raw)
  To: Greg KH
  Cc: Tomoya MORINAGA, Alan Cox, linux-serial, linux-kernel, Alexander Stein

Signed-off-by: Alexander Stein <alexander.stein@systec-electronic.com>
---
Hello Greg,

I'm sorry. This patch was based some other patches, like console support.

Changes in v3:
* Rebased to current git master

 drivers/tty/serial/pch_uart.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/drivers/tty/serial/pch_uart.c b/drivers/tty/serial/pch_uart.c
index 4652109..d3ba85b 100644
--- a/drivers/tty/serial/pch_uart.c
+++ b/drivers/tty/serial/pch_uart.c
@@ -1429,6 +1429,8 @@ static struct eg20t_port *pch_uart_init_port(struct pci_dev *pdev,
 		goto init_port_hal_free;
 	}
 
+	pci_enable_msi(pdev);
+
 	iobase = pci_resource_start(pdev, 0);
 	mapbase = pci_resource_start(pdev, 1);
 	priv->mapbase = mapbase;
@@ -1485,6 +1487,8 @@ static void pch_uart_pci_remove(struct pci_dev *pdev)
 	struct eg20t_port *priv;
 
 	priv = (struct eg20t_port *)pci_get_drvdata(pdev);
+
+	pci_disable_msi(pdev);
 	pch_uart_exit_port(priv);
 	pci_disable_device(pdev);
 	kfree(priv);
@@ -1568,6 +1572,7 @@ static int __devinit pch_uart_pci_probe(struct pci_dev *pdev,
 	return ret;
 
 probe_disable_device:
+	pci_disable_msi(pdev);
 	pci_disable_device(pdev);
 probe_error:
 	return ret;
-- 
1.7.3.4


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* serial/pch_uart: AT command behavior
  2011-06-23  0:14 ` Tomoya MORINAGA
  2011-06-23  7:00   ` [PATCH v2] " Alexander Stein
@ 2011-07-19  4:15   ` Tomoya MORINAGA
  2011-07-19  9:06     ` Alan Cox
  1 sibling, 1 reply; 13+ messages in thread
From: Tomoya MORINAGA @ 2011-07-19  4:15 UTC (permalink / raw)
  To: Alan Cox, linux-serial, linux-kernel
  Cc: Alexander Stein, toshiharu-linux, Ewe, Kok Howg, Wang, Qi, Wang,
	Yong Y, Clark, Joel

Hi,

I have a question for UART driver AT command behavior.
When installing pch_uart, AT command "AT+GCAP^M" are sent for 4 times.
This command is sent first install only.
(After the above, removing pch_uart and installing pch_uart again,
this command is not sent.)

Let me know the behavior is normal or not ?

Thanks,
-- 
tomoya
OKI SEMICONDUCTOR CO., LTD.

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: serial/pch_uart: AT command behavior
  2011-07-19  4:15   ` serial/pch_uart: AT command behavior Tomoya MORINAGA
@ 2011-07-19  9:06     ` Alan Cox
  2011-07-20  0:14       ` Tomoya MORINAGA
  0 siblings, 1 reply; 13+ messages in thread
From: Alan Cox @ 2011-07-19  9:06 UTC (permalink / raw)
  To: Tomoya MORINAGA
  Cc: Alan Cox, linux-serial, linux-kernel, Alexander Stein,
	toshiharu-linux, Ewe, Kok Howg, Wang, Qi, Wang, Yong Y, Clark,
	Joel

On Tue, 19 Jul 2011 13:15:57 +0900
Tomoya MORINAGA <tomoya-linux@dsn.okisemi.com> wrote:

> Hi,
> 
> I have a question for UART driver AT command behavior.
> When installing pch_uart, AT command "AT+GCAP^M" are sent for 4 times.
> This command is sent first install only.
> (After the above, removing pch_uart and installing pch_uart again,
> this command is not sent.)
> 
> Let me know the behavior is normal or not ?

As your distribution, it isn't the kernel.

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: serial/pch_uart: AT command behavior
  2011-07-19  9:06     ` Alan Cox
@ 2011-07-20  0:14       ` Tomoya MORINAGA
  2011-07-20 12:49         ` Alan Cox
  0 siblings, 1 reply; 13+ messages in thread
From: Tomoya MORINAGA @ 2011-07-20  0:14 UTC (permalink / raw)
  To: Alan Cox
  Cc: Alan Cox, linux-serial, linux-kernel, Alexander Stein,
	toshiharu-linux, Ewe, Kok Howg, Wang, Qi, Wang, Yong Y, Clark,
	Joel

(2011/07/19 18:06), Alan Cox wrote:
> On Tue, 19 Jul 2011 13:15:57 +0900
> Tomoya MORINAGA<tomoya-linux@dsn.okisemi.com>  wrote:
>
>> Hi,
>>
>> I have a question for UART driver AT command behavior.
>> When installing pch_uart, AT command "AT+GCAP^M" are sent for 4 times.
>> This command is sent first install only.
>> (After the above, removing pch_uart and installing pch_uart again,
>> this command is not sent.)
>>
>> Let me know the behavior is normal or not ?
>
> As your distribution, it isn't the kernel.
>
Thank you for your information.
The above behavior looks Fedora's.
In fact,I confirmed MeeGo doesn't send any AT command message.

Thanks,

-- 
tomoya
OKI SEMICONDUCTOR CO., LTD.

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: serial/pch_uart: AT command behavior
  2011-07-20  0:14       ` Tomoya MORINAGA
@ 2011-07-20 12:49         ` Alan Cox
  0 siblings, 0 replies; 13+ messages in thread
From: Alan Cox @ 2011-07-20 12:49 UTC (permalink / raw)
  To: Tomoya MORINAGA
  Cc: Alan Cox, linux-serial, linux-kernel, Alexander Stein,
	toshiharu-linux, Ewe, Kok Howg, Wang, Qi, Wang, Yong Y, Clark,
	Joel

On Wed, 20 Jul 2011 09:14:42 +0900
Tomoya MORINAGA <tomoya-linux@dsn.okisemi.com> wrote:

> (2011/07/19 18:06), Alan Cox wrote:
> > On Tue, 19 Jul 2011 13:15:57 +0900
> > Tomoya MORINAGA<tomoya-linux@dsn.okisemi.com>  wrote:
> >
> >> Hi,
> >>
> >> I have a question for UART driver AT command behavior.
> >> When installing pch_uart, AT command "AT+GCAP^M" are sent for 4 times.
> >> This command is sent first install only.
> >> (After the above, removing pch_uart and installing pch_uart again,
> >> this command is not sent.)
> >>
> >> Let me know the behavior is normal or not ?
> >
> > As your distribution, it isn't the kernel.
> >
> Thank you for your information.
> The above behavior looks Fedora's.
> In fact,I confirmed MeeGo doesn't send any AT command message.

AT+GCAP is apparently 'serial plug and play' so I assume this is part of
the Fedora autodetection/udev logic.

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v3] pch_uart: Add MSI support
  2011-07-04  6:58       ` [PATCH v3] " Alexander Stein
@ 2011-07-22 12:39         ` Tomoya MORINAGA
  0 siblings, 0 replies; 13+ messages in thread
From: Tomoya MORINAGA @ 2011-07-22 12:39 UTC (permalink / raw)
  To: Alexander Stein; +Cc: Greg KH, Alan Cox, linux-serial, linux-kernel

(2011/07/04 15:58), Alexander Stein wrote:
> Signed-off-by: Alexander Stein<alexander.stein@systec-electronic.com>
> ---
> Hello Greg,
> 
> I'm sorry. This patch was based some other patches, like console support.
> 
> Changes in v3:
> * Rebased to current git master
> 
>   drivers/tty/serial/pch_uart.c |    5 +++++
>   1 files changed, 5 insertions(+), 0 deletions(-)
> 
> diff --git a/drivers/tty/serial/pch_uart.c b/drivers/tty/serial/pch_uart.c
> index 4652109..d3ba85b 100644
> --- a/drivers/tty/serial/pch_uart.c
> +++ b/drivers/tty/serial/pch_uart.c
> @@ -1429,6 +1429,8 @@ static struct eg20t_port *pch_uart_init_port(struct pci_dev *pdev,
>   		goto init_port_hal_free;
>   	}
> 
> +	pci_enable_msi(pdev);
> +
>   	iobase = pci_resource_start(pdev, 0);
>   	mapbase = pci_resource_start(pdev, 1);
>   	priv->mapbase = mapbase;
> @@ -1485,6 +1487,8 @@ static void pch_uart_pci_remove(struct pci_dev *pdev)
>   	struct eg20t_port *priv;
> 
>   	priv = (struct eg20t_port *)pci_get_drvdata(pdev);
> +
> +	pci_disable_msi(pdev);
>   	pch_uart_exit_port(priv);
>   	pci_disable_device(pdev);
>   	kfree(priv);
> @@ -1568,6 +1572,7 @@ static int __devinit pch_uart_pci_probe(struct pci_dev *pdev,
>   	return ret;
> 
>   probe_disable_device:
> +	pci_disable_msi(pdev);
>   	pci_disable_device(pdev);
>   probe_error:
>   	return ret;


Using this patch, PCH_UART doesn't work all.
For using MSI, I think, need bus master enable(pci_set_master) ?

Best Regards,
-- 
tomoya
OKI SEMICONDUCTOR CO., LTD.

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2011-07-22 12:39 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-06-22  9:50 [PATCH] pch_uart: Add MSI support Alexander Stein
2011-06-23  0:14 ` Tomoya MORINAGA
2011-06-23  7:00   ` [PATCH v2] " Alexander Stein
2011-06-23  7:16     ` Clemens Ladisch
2011-06-23  7:37       ` Alexander Stein
2011-07-01 22:32     ` Greg KH
2011-07-04  6:58       ` [PATCH v3] " Alexander Stein
2011-07-22 12:39         ` Tomoya MORINAGA
2011-07-19  4:15   ` serial/pch_uart: AT command behavior Tomoya MORINAGA
2011-07-19  9:06     ` Alan Cox
2011-07-20  0:14       ` Tomoya MORINAGA
2011-07-20 12:49         ` Alan Cox
2011-06-23  0:34 ` [PATCH] pch_uart: Add MSI support Roland Dreier

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.