Re: 2.6.22-rc: regression: no irda0 interface (2.6.21 was OK), smsc does not find chip

From: Samuel Ortiz
Date: Thu Jun 07 2007 - 16:55:28 EST


Hi Bjorn,

On 6/7/2007, "Bjorn Helgaas" <bjorn.helgaas@xxxxxx> wrote:

>On Wednesday 06 June 2007 02:45:01 pm Andrey Borzenkov wrote:
>> On Wednesday 06 June 2007, Bjorn Helgaas wrote:
>> > On Tuesday 05 June 2007 09:29:11 pm Andrey Borzenkov wrote:
>> > > On Wednesday 06 June 2007, Bjorn Helgaas wrote:
>> > > > Something's wrong with this strategy. The BIOS is telling us that an
>> > > > SMCf010 device is present, active, and responds at io ports 0x100-0x107
>> > > > and 0x2e8-0x2ef. The fact that it happens to be on the other side of
>> > > > an ISA or LPC bridge should be immaterial to the OS driver.
>> > >
>> > > I thought this as well.
>> >
>> > If this is really true, it also means we shouldn't twiddle with the
>> > bridge. If the BIOS left us a working setup, the preconfiguration
>> > is certainly going to change it to something incompatible with the
>> > PNP info.
>> >
>> > What if we try the following patch, which keeps the FIR/SIR swap and
>> > just removes the preconfiguration?
>>
>> I already tried different patch but with similar effect (switch off
>> preconfiguration) - it does not work. I am beginning to doubt whether drier
>> works on my system at all (i.e. before PnP change); have to find time to
>> test.
>
>OK. My patch wasn't the right approach anyway. Attached is what I
>think we should do instead -- do the preconfig if we're not using PNP.
Thats sounds good, yes.
Maybe we should also run the legacy probe when the PnP one fails. I
don't know how the preconfiguration stuff will behave with the device
being PnP enabled, but with your patch Andrey will still need to
modprobe smsc-ircc with smsc_nopnp.

So, here is the patch I propose (I had to move smsc_ircc_legacy_probe()
a bit earlier in the code to avoid forward declaration, but it's
basically your patch plus a call to smsc_ircc_legacy_probe() from the
pnp_probe() routine):


diff --git a/drivers/net/irda/smsc-ircc2.c b/drivers/net/irda/smsc-ircc2.c
index 9043bf4..1d7ab3f 100644
--- a/drivers/net/irda/smsc-ircc2.c
+++ b/drivers/net/irda/smsc-ircc2.c
@@ -366,6 +366,44 @@ static inline void register_bank(int iobase, int bank)
iobase + IRCC_MASTER);
}

+
+static int __init smsc_ircc_legacy_probe(void)
+{
+ int ret = 0;
+
+#ifdef CONFIG_PCI
+ if (smsc_ircc_preconfigure_subsystems(ircc_cfg, ircc_fir, ircc_sir,
+ ircc_dma, ircc_irq) < 0) {
+ /* Ignore errors from preconfiguration */
+ IRDA_ERROR("%s, Preconfiguration failed !\n", driver_name);
+ }
+#endif
+
+ 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;
+}
+
/* PNP hotplug support */
static const struct pnp_device_id smsc_ircc_pnp_table[] = {
{ .id = "SMCf010", .driver_data = 0 },
@@ -391,9 +429,14 @@ static int __init smsc_ircc_pnp_probe(struct pnp_dev *dev,
dma = pnp_dma(dev, 0);
irq = pnp_irq(dev, 0);

- if (smsc_ircc_open(firbase, sirbase, dma, irq))
- return -ENODEV;
-
+ if (smsc_ircc_open(firbase, sirbase, dma, irq)) {
+ IRDA_ERROR("PnP probe failed\n");
+ if (smsc_ircc_legacy_probe()) {
+ IRDA_ERROR("Legacy probe failed\n");
+ return -ENODEV;
+ }
+ }
+
return 0;
}

@@ -412,35 +455,6 @@ static struct pnp_driver smsc_ircc_pnp_driver = {
*
*******************************************************************************/

-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 ()
*
@@ -459,13 +473,6 @@ static int __init smsc_ircc_init(void)
return ret;
}

-#ifdef CONFIG_PCI
- if (smsc_ircc_preconfigure_subsystems(ircc_cfg, ircc_fir, ircc_sir, ircc_dma, ircc_irq) < 0) {
- /* Ignore errors from preconfiguration */
- IRDA_ERROR("%s, Preconfiguration failed !\n", driver_name);
- }
-#endif
-
dev_count = 0;

if (smsc_nopnp || !pnp_platform_devices ||

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