2011-05-30 11:21:58

by Tomoya MORINAGA

[permalink] [raw]
Subject: [PATCH v2] 8250_pci: add -ENODEV code for Intel EG20T PCH

Intel EG20T PCH has UART device which is compatible with 8250.
Currently, with general configuration, the PCH UART driver is not loaded but
8250 standard driver is loaded.
Therefore, in case of using PCH UART driver, need to disable 8250 pci function.
However, this procedure is not best solution.

This patch, in 8250_pci, if the device is the PCH or the family IOH,
'-ENODEV' is returned.
As a result, disabling 8250-pci processing becomes unnecessary.

Signed-off-by: Tomoya MORINAGA <[email protected]>
---
V2: Delete #ifdef CONFIG_SERIAL_PCH_UART ~ #endif
Use quirk table structure
---
drivers/tty/serial/8250_pci.c | 54 +++++++++++++++++++++++++++++++++++++++++
1 files changed, 54 insertions(+), 0 deletions(-)

diff --git a/drivers/tty/serial/8250_pci.c b/drivers/tty/serial/8250_pci.c
index 738cec9..39c0d62 100644
--- a/drivers/tty/serial/8250_pci.c
+++ b/drivers/tty/serial/8250_pci.c
@@ -2541,6 +2541,53 @@ void pciserial_resume_ports(struct serial_private *priv)
}
EXPORT_SYMBOL_GPL(pciserial_resume_ports);

+static struct pci_serial_quirk eg20t_pch_uart[] __refdata = {
+ {
+ .vendor = PCI_VENDOR_ID_INTEL,
+ .device = 0x8811,
+ },
+ {
+ .vendor = PCI_VENDOR_ID_INTEL,
+ .device = 0x8812,
+ },
+ {
+ .vendor = PCI_VENDOR_ID_INTEL,
+ .device = 0x8813,
+ },
+ {
+ .vendor = PCI_VENDOR_ID_INTEL,
+ .device = 0x8814,
+ },
+ {
+ .vendor = 0x10DB,
+ .device = 0x8027,
+ },
+ {
+ .vendor = 0x10DB,
+ .device = 0x8028,
+ },
+ {
+ .vendor = 0x10DB,
+ .device = 0x8029,
+ },
+ {
+ .vendor = 0x10DB,
+ .device = 0x800C,
+ },
+ {
+ .vendor = 0x10DB,
+ .device = 0x800D,
+ },
+ {
+ .vendor = 0x10DB,
+ .device = 0x800D,
+ },
+ {
+ .vendor = PCI_ANY_ID,
+ .device = PCI_ANY_ID,
+ },
+};
+
/*
* Probe one serial board. Unfortunately, there is no rhyme nor reason
* to the arrangement of serial ports on a PCI card.
@@ -2552,6 +2599,7 @@ pciserial_init_one(struct pci_dev *dev, const struct pci_device_id *ent)
const struct pciserial_board *board;
struct pciserial_board tmp;
int rc;
+ int i;

if (ent->driver_data >= ARRAY_SIZE(pci_boards)) {
printk(KERN_ERR "pci_init_one: invalid driver_data: %ld\n",
@@ -2559,6 +2607,12 @@ pciserial_init_one(struct pci_dev *dev, const struct pci_device_id *ent)
return -EINVAL;
}

+ for (i = 0; eg20t_pch_uart[i].vendor != PCI_ANY_ID; i++) {
+ if (dev->vendor == eg20t_pch_uart[i].vendor &&
+ dev->device == eg20t_pch_uart[i].device)
+ return -ENODEV;
+ }
+
board = &pci_boards[ent->driver_data];

rc = pci_enable_device(dev);
--
1.7.4


2011-05-30 14:51:08

by Greg KH

[permalink] [raw]
Subject: Re: [PATCH v2] 8250_pci: add -ENODEV code for Intel EG20T PCH

On Mon, May 30, 2011 at 08:26:16PM +0900, Tomoya MORINAGA wrote:
> Intel EG20T PCH has UART device which is compatible with 8250.
> Currently, with general configuration, the PCH UART driver is not loaded but
> 8250 standard driver is loaded.
> Therefore, in case of using PCH UART driver, need to disable 8250 pci function.
> However, this procedure is not best solution.
>
> This patch, in 8250_pci, if the device is the PCH or the family IOH,
> '-ENODEV' is returned.
> As a result, disabling 8250-pci processing becomes unnecessary.
>
> Signed-off-by: Tomoya MORINAGA <[email protected]>
> ---
> V2: Delete #ifdef CONFIG_SERIAL_PCH_UART ~ #endif
> Use quirk table structure
> ---
> drivers/tty/serial/8250_pci.c | 54 +++++++++++++++++++++++++++++++++++++++++
> 1 files changed, 54 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/tty/serial/8250_pci.c b/drivers/tty/serial/8250_pci.c
> index 738cec9..39c0d62 100644
> --- a/drivers/tty/serial/8250_pci.c
> +++ b/drivers/tty/serial/8250_pci.c
> @@ -2541,6 +2541,53 @@ void pciserial_resume_ports(struct serial_private *priv)
> }
> EXPORT_SYMBOL_GPL(pciserial_resume_ports);
>
> +static struct pci_serial_quirk eg20t_pch_uart[] __refdata = {
> + {
> + .vendor = PCI_VENDOR_ID_INTEL,
> + .device = 0x8811,
> + },

<snip>

No, you can do this easier with your own init() function that just
returns -ENODEV so the driver doesn't bind to it.

try that, it will get rid of this type of code:

> + for (i = 0; eg20t_pch_uart[i].vendor != PCI_ANY_ID; i++) {
> + if (dev->vendor == eg20t_pch_uart[i].vendor &&
> + dev->device == eg20t_pch_uart[i].device)
> + return -ENODEV;
> + }
> +

Which shouldn't be needed and it should make the patch smaller.

thanks,

greg k-h