Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

[patch 0/5] PNP: convert x86 legacy serial to platform devs, add SMC IR PNP probe

0 views
Skip to first unread message

Bjorn Helgaas

unread,
Apr 4, 2007, 6:50:08 PM4/4/07
to
This series converts i386 and x86_64 legacy serial ports to be platform
devices and prevents probing for them if we have PNP.

This prevents double discovery, where a device was found both by the
legacy probe and by 8250_pnp.

This also prevents the serial driver from claiming IRDA devices (unless
they have a UART PNP ID). The serial legacy probe sometimes assumed the
wrong IRQ, so the user had to use "setserial" to fix it.

Removing the need for setserial to make IRDA devices work seems good,
but it does break some things. In particular, you may need to keep
setserial from poking legacy UART stuff back in by doing something like
"dpkg-reconfigure setserial" with the "kernel" option. Otherwise, the
setserial-discovered "UART" will claim resources and prevent the IRDA
driver from loading.

--
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majo...@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

Bjorn Helgaas

unread,
Apr 4, 2007, 6:50:09 PM4/4/07
to
x86-change-legacy-serial-to-platform.patch

Bjorn Helgaas

unread,
Apr 4, 2007, 6:50:10 PM4/4/07
to
smsc-ircc2-add-pnp-probe.patch

Bjorn Helgaas

unread,
Apr 4, 2007, 6:50:10 PM4/4/07
to
pnp-platform-devs.patch

Randy Dunlap

unread,
Apr 4, 2007, 7:30:07 PM4/4/07
to
On Wed, 04 Apr 2007 16:45:40 -0600 Bjorn Helgaas wrote:

> Index: w/drivers/net/irda/smsc-ircc2.c
> ===================================================================
> --- w.orig/drivers/net/irda/smsc-ircc2.c 2007-04-04 13:45:18.000000000 -0600
> +++ w/drivers/net/irda/smsc-ircc2.c 2007-04-04 13:47:00.000000000 -0600
> @@ -79,6 +79,10 @@
> MODULE_DESCRIPTION("SMC IrCC SIR/FIR controller driver");
> MODULE_LICENSE("GPL");
>
> +static int smsc_nopnp;
> +module_param_named(nopnp, smsc_nopnp, bool, 0);
> +MODULE_PARM_DESC(nopnp, "Do not use PNP to detect controller settings");

Document this parameter (like you did "legacy_serial.force" in the
other patch -- thanks).

> #define DMA_INVAL 255
> static int ircc_dma = DMA_INVAL;
> module_param(ircc_dma, int, 0);


---
~Randy
*** Remember to use Documentation/SubmitChecklist when testing your code ***

Bjorn Helgaas

unread,
Apr 5, 2007, 2:50:09 PM4/5/07
to
On Wednesday 04 April 2007 17:16, Randy Dunlap wrote:
> On Wed, 04 Apr 2007 16:45:40 -0600 Bjorn Helgaas wrote:
> > +static int smsc_nopnp;
> > +module_param_named(nopnp, smsc_nopnp, bool, 0);
> > +MODULE_PARM_DESC(nopnp, "Do not use PNP to detect controller settings");
>
> Document this parameter (like you did "legacy_serial.force" in the
> other patch -- thanks).

Thanks for the reminder. Here's an updated patch with documentation.


Subject: smsc-ircc2: add PNP support

Claim devices using PNP, unless the user explicitly specified device
addresses. This can be disabled with the "smsc-ircc2.nopnp" option.

This removes the need for probing legacy addresses and helps untangle
IR devices from serial8250 devices.

Sometimes the SMC device is at a legacy COM port address but does not
use the legacy COM IRQ. In this case, claiming the device using PNP
rather than 8250 legacy probe means we can automatically use the
correct IRQ rather than forcing the user to use "setserial" to set the
IRQ manually.

If the PNP claim doesn't work, make sure you don't have a setserial init
script, e.g., /etc/init.d/setserial, configured to poke in legacy COM
port resources for the IRDA device. That causes the serial driver to
claim resources needed by this driver.

Based on this patch by Ville Syrjälä:
http://www.hpl.hp.com/personal/Jean_Tourrilhes/IrDA/ir260_smsc_pnp.diff

Signed-off-by: Bjorn Helgaas <bjorn....@hp.com>

Index: w/drivers/net/irda/smsc-ircc2.c
===================================================================
--- w.orig/drivers/net/irda/smsc-ircc2.c 2007-04-04 13:45:18.000000000 -0600
+++ w/drivers/net/irda/smsc-ircc2.c 2007-04-04 13:47:00.000000000 -0600
@@ -79,6 +79,10 @@
MODULE_DESCRIPTION("SMC IrCC SIR/FIR controller driver");
MODULE_LICENSE("GPL");

+static int smsc_nopnp;
+module_param_named(nopnp, smsc_nopnp, bool, 0);
+MODULE_PARM_DESC(nopnp, "Do not use PNP to detect controller settings");

+


#define DMA_INVAL 255
static int ircc_dma = DMA_INVAL;
module_param(ircc_dma, int, 0);

@@ -362,7 +366,6 @@
iobase + IRCC_MASTER);
}

-#ifdef CONFIG_PNP
/* PNP hotplug support */
static const struct pnp_device_id smsc_ircc_pnp_table[] = {
{ .id = "SMCf010", .driver_data = 0 },
@@ -370,7 +373,35 @@
{ }
};
MODULE_DEVICE_TABLE(pnp, smsc_ircc_pnp_table);
-#endif
+
+static int pnp_driver_registered;
+
+static int __init smsc_ircc_pnp_probe(struct pnp_dev *dev,
+ const struct pnp_device_id *dev_id)
+{
+ unsigned int firbase, sirbase;
+ u8 dma, irq;
+
+ if (!(pnp_port_valid(dev, 0) && pnp_port_valid(dev, 1) &&
+ pnp_dma_valid(dev, 0) && pnp_irq_valid(dev, 0)))
+ return -EINVAL;
+
+ sirbase = pnp_port_start(dev, 0);
+ firbase = pnp_port_start(dev, 1);
+ dma = pnp_dma(dev, 0);
+ irq = pnp_irq(dev, 0);
+
+ if (smsc_ircc_open(firbase, sirbase, dma, irq))
+ return -ENODEV;
+
+ return 0;
+}
+
+static struct pnp_driver smsc_ircc_pnp_driver = {
+ .name = "smsc-ircc2",
+ .id_table = smsc_ircc_pnp_table,
+ .probe = smsc_ircc_pnp_probe,
+};


/*******************************************************************************
@@ -381,6 +412,35 @@
*
*******************************************************************************/

+static int __init smsc_ircc_legacy_probe(void)
+{
+ int ret = 0;
+
+ if (ircc_fir > 0 && ircc_sir > 0) {
+ IRDA_MESSAGE(" Overriding FIR address 0x%04x\n", ircc_fir);
+ IRDA_MESSAGE(" Overriding SIR address 0x%04x\n", ircc_sir);
+
+ if (smsc_ircc_open(ircc_fir, ircc_sir, ircc_dma, ircc_irq))
+ ret = -ENODEV;
+ } else {
+ ret = -ENODEV;
+
+ /* try user provided configuration register base address */
+ if (ircc_cfg > 0) {
+ IRDA_MESSAGE(" Overriding configuration address "
+ "0x%04x\n", ircc_cfg);
+ if (!smsc_superio_fdc(ircc_cfg))
+ ret = 0;
+ if (!smsc_superio_lpc(ircc_cfg))
+ ret = 0;
+ }
+
+ if (smsc_ircc_look_for_chips() > 0)
+ ret = 0;
+ }
+ return ret;
+}
+
/*
* Function smsc_ircc_init ()
*
@@ -408,31 +468,20 @@

dev_count = 0;

- if (ircc_fir > 0 && ircc_sir > 0) {
- IRDA_MESSAGE(" Overriding FIR address 0x%04x\n", ircc_fir);
- IRDA_MESSAGE(" Overriding SIR address 0x%04x\n", ircc_sir);
-
- if (smsc_ircc_open(ircc_fir, ircc_sir, ircc_dma, ircc_irq))
- ret = -ENODEV;
+ if (smsc_nopnp || !pnp_platform_devices ||
+ ircc_cfg || ircc_fir || ircc_sir ||
+ ircc_dma != DMA_INVAL || ircc_irq != IRQ_INVAL) {
+ ret = smsc_ircc_legacy_probe();
} else {
- ret = -ENODEV;
-
- /* try user provided configuration register base address */
- if (ircc_cfg > 0) {
- IRDA_MESSAGE(" Overriding configuration address "
- "0x%04x\n", ircc_cfg);
- if (!smsc_superio_fdc(ircc_cfg))
- ret = 0;
- if (!smsc_superio_lpc(ircc_cfg))
- ret = 0;
- }
-
- if (smsc_ircc_look_for_chips() > 0)
- ret = 0;
+ if (pnp_register_driver(&smsc_ircc_pnp_driver) == 0)
+ pnp_driver_registered = 1;
}

- if (ret)
+ if (ret) {
+ if (pnp_driver_registered)
+ pnp_unregister_driver(&smsc_ircc_pnp_driver);
platform_driver_unregister(&smsc_ircc_driver);
+ }

return ret;
}
@@ -1842,6 +1891,9 @@
smsc_ircc_close(dev_self[i]);
}

+ if (pnp_driver_registered)
+ pnp_unregister_driver(&smsc_ircc_pnp_driver);
+
platform_driver_unregister(&smsc_ircc_driver);
}

Index: w/Documentation/kernel-parameters.txt
===================================================================
--- w.orig/Documentation/kernel-parameters.txt 2007-04-05 11:56:34.000000000 -0600
+++ w/Documentation/kernel-parameters.txt 2007-04-05 12:07:53.000000000 -0600
@@ -1557,6 +1557,17 @@
smart2= [HW]
Format: <io1>[,<io2>[,...,<io8>]]

+ smsc-ircc2.nopnp [HW] Don't use PNP to discover SMC devices
+ smsc-ircc2.ircc_cfg= [HW] Device configuration I/O port
+ smsc-ircc2.ircc_sir= [HW] SIR base I/O port
+ smsc-ircc2.ircc_fir= [HW] FIR base I/O port
+ smsc-ircc2.ircc_irq= [HW] IRQ line
+ smsc-ircc2.ircc_dma= [HW] DMA channel
+ smsc-ircc2.ircc_transceiver= [HW] Transceiver type:
+ 0: Toshiba Satellite 1800 (GP data pin select)
+ 1: Fast pin select (default)
+ 2: ATC IRMode
+
snd-ad1816a= [HW,ALSA]

snd-ad1848= [HW,ALSA]

0 new messages