Irda: nsc-ircc needs module options to work correctly

Bug #21025 reported by Mika Fischer
10
Affects Status Importance Assigned to Milestone
linux-source-2.6.15 (Ubuntu)
Fix Released
Low
Ben Collins

Bug Description

Hi!

This is an IBM ThinkPad R40 2722-CDG.

The irda auto-configuration works so far. It loads the right module (nsc-ircc).

Unfortunately my Irda port works correctly only if I add the following module
options:
io=0x2f8 irq=3 dma=3

io and irq can be easily gotten from the corresponding serial port. I don't know
where to get the dma port from, though...

With these options the device works correctly.

If I leave out the any of the three options (io, irq, dma), dmesg gives me:
[ 3444.211480] pnp: Device 00:0a disabled.
[ 3444.213477] pnp: Device 00:0a activated.
[ 3444.264198] irda_init()
[ 3444.264233] NET: Registered protocol family 23
[ 3444.275679] nsc-ircc, Found chip at base=0x02e
[ 3444.275712] nsc-ircc, driver loaded (Dag Brattli)
[ 3444.283080] IrDA: Registered device irda0
[ 3444.283092] nsc-ircc, Using dongle: IBM31T1100 or Temic TFDS6000/TFDS6500
[ 3519.263493] nsc-ircc, unable to allocate dma=0

Let me know if you need more info.

Revision history for this message
Mika Fischer (zoop) wrote :

This also kills the parallel port which is really using DMA 0...

So perhaps you could check if DMA 0 is in use and if so use DMA 3...

Revision history for this message
Ben Collins (ben-collins) wrote :

Can you send me the output is lspnp?

Revision history for this message
Mika Fischer (zoop) wrote :

This is on dapper with kernel 2.6.15-7.9

mika@linuxbox:~$ sudo lspnp
lspnp: /proc/bus/pnp not available

mika@linuxbox:~$ dmesg | grep -i pnp
[17179570.544000] pnp: PnP ACPI init
[17179570.548000] pnp: PnP ACPI: found 13 devices
[17179570.548000] PnPBIOS: Disabled by ACPI PNP
[17179570.560000] isapnp: Scanning for PnP cards...
[17179570.912000] isapnp: No Plug & Play device found
[17179570.928000] PNP: PS/2 Controller [PNP0303:KBD,PNP0f13:MOU] at 0x60,0x64
irq 1,12
[17179570.932000] pnp: Device 00:09 activated.
[17179585.156000] parport: PnPBIOS parport detected.

Anything more I can do?

Revision history for this message
Ben Collins (ben-collins) wrote :

Please try booting with pnpacpi=off, so that pnpbios can take over.

Revision history for this message
Mika Fischer (zoop) wrote :

mika@linuxbox:~$ sudo lspnp
01 PNP0c02 Motherboard resources
02 PNP0c01 System board
03 PNP0200 AT DMA controller
04 PNP0000 AT programmable interrupt controller
05 PNP0100 AT system timer
06 PNP0b00 AT real-time clock
07 PNP0303 IBM enhanced keyboard (101/102-key, PS/2 mouse support)
08 PNP0c04 Math coprocessor
09 PNP0800 AT-style speaker sound
0a PNP0a03 PCI bus
0b PNP0c02 Motherboard resources
0c INT0800 memory controller: flash
0d PNP0c02 Motherboard resources
0e PNP0c02 Motherboard resources
11 IBM0057 input device: mouse
12 PNP0501 16550A-compatible COM port
13 IBM0071 IBM Thinkpad infrared port
17 PNP0401 ECP printer port
19 PNP0e03 Intel 82365-compatible CardBus controller

mika@linuxbox:~$ sudo lspnp -v
[...]
13 IBM0071 IBM Thinkpad infrared port
        dma 3
        io 0x02f8-0x02ff
        irq 3

17 PNP0401 ECP printer port
        dma 0
        io 0x03bc-0x03bf
        io 0x07bc-0x07bf
        irq 7
[...]

I hope this helps. Let me know if I can help in any other way.

Revision history for this message
Ben Collins (ben-collins) wrote :

Can you tell me if after booting with pnpacpi=off, if the problem is resolved?

If so, can you boot without the pnpacpi option, and run this command:

cat /sys/bus/pnp/devices/00:13/resources

Thanks

Revision history for this message
Mika Fischer (zoop) wrote :

After checking again it seems that the problem does not occur anymore.
The way /etc/init.d/irda-setup loads the module works now as the driver finds the right dma channel by itself.
So the kernel/driver is OK now.

There is another problem however: It seems that something is loading the module without the dongle_id parameter.
Perhaps it has something to do with the udev/hotplug thing.

If I unload the module after booting and reload with dongle_id=0x09 everything is OK.

Here the output at boot:
17179586.172000] nsc_ircc_pnp_probe() : Found cfg_base 0x000 ; firbase 0x2F8 ; irq 3 ; dma 3.
[17179586.172000] nsc-ircc, Found chip at base=0x000
[17179586.172000] nsc-ircc, driver loaded (Dag Brattli)
[17179586.172000] nsc_ircc_open(), can't get iobase of 0x2f8
[17179586.172000] nsc-ircc, Found chip at base=0x02e
[17179586.172000] nsc-ircc, driver loaded (Dag Brattli)
[17179586.172000] nsc_ircc_open(), can't get iobase of 0x2f8

And here when loading with dongle_id=0x09:
[17180315.692000] nsc_ircc_pnp_probe() : Found cfg_base 0x000 ; firbase 0x2F8 ; irq 3 ; dma 3.
[17180315.692000] nsc-ircc, Found chip at base=0x000
[17180315.692000] nsc-ircc, driver loaded (Dag Brattli)
[17180315.696000] IrDA: Registered device irda0
[17180315.696000] nsc-ircc, Using dongle: IBM31T1100 or Temic TFDS6000/TFDS6500
[17180315.696000] nsc-ircc, Found chip at base=0x02e
[17180315.696000] nsc-ircc, driver loaded (Dag Brattli)
[17180315.696000] nsc_ircc_open(), can't get iobase of 0x2f8

Feel free to reassign/retitle.

Revision history for this message
Ben Collins (ben-collins) wrote :

> [17179586.172000] nsc_ircc_pnp_probe() : Found cfg_base 0x000 ; firbase 0x2F8
; irq 3 ; dma 3.
> [17179586.172000] nsc-ircc, Found chip at base=0x000
> [17179586.172000] nsc-ircc, driver loaded (Dag Brattli)
> [17179586.172000] nsc_ircc_open(), can't get iobase of 0x2f8
> [17179586.172000] nsc-ircc, Found chip at base=0x02e
> [17179586.172000] nsc-ircc, driver loaded (Dag Brattli)
> [17179586.172000] nsc_ircc_open(), can't get iobase of 0x2f8

Something still isn't right. There is no "IrDa: Registered device ..." line. And
the 0x2f8 being held is odd too. Can you do:

cat /proc/ioports

please.

Revision history for this message
Mika Fischer (zoop) wrote :
Download full text (3.3 KiB)

I guess the thing that loads the module with the wrong options is /sbin/udevplug.
Because the module is already loaded when irda-setup is run it can't load the module.
dmesg says:
[17179599.280000] serial8250: too much work for irq3
[17179599.280000] serial8250: too much work for irq3
[17179599.616000] pnp: Device 00:0a cannot be configured because it is in use.
[17179599.616000] pnp: Device 00:0a cannot be configured because it is in use.
[17179599.616000] serial8250: too much work for irq3
[17179599.620000] serial8250: too much work for irq3

Here is the output that you wanted.

mika@linuxbox:~$ cat /proc/ioports
0000-001f : dma1
0020-0021 : pic1
0040-0043 : timer0
0050-0053 : timer1
0060-006f : keyboard
0070-0077 : rtc
0080-008f : dma page reg
00a0-00a1 : pic2
00c0-00df : dma2
00f0-00ff : fpu
01f0-01f7 : ide0
03bc-03be : parport0
03c0-03df : vga+
03f6-03f6 : ide0
03f8-03ff : serial
07bc-07be : parport0
0cf8-0cff : PCI conf1
1000-107f : 0000:00:1f.0
  1000-107f : motherboard
    1000-1003 : PM1a_EVT_BLK
    1004-1005 : PM1a_CNT_BLK
    1008-100b : PM_TMR
    1010-1015 : ACPI CPU throttle
    1020-1020 : PM2_CNT_BLK
    1028-102f : GPE0_BLK
1180-11bf : 0000:00:1f.0
  1180-11bf : motherboard
1600-167f : motherboard
1800-181f : 0000:00:1d.0
  1800-181f : uhci_hcd
1820-183f : 0000:00:1d.1
  1820-183f : uhci_hcd
1840-185f : 0000:00:1d.2
  1840-185f : uhci_hcd
1860-186f : 0000:00:1f.1
  1860-1867 : ide0
  1868-186f : ide1
1880-189f : 0000:00:1f.3
18c0-18ff : 0000:00:1f.5
  18c0-18ff : Intel 82801DB-ICH4
1c00-1cff : 0000:00:1f.5
  1c00-1cff : Intel 82801DB-ICH4
2000-207f : 0000:00:1f.6
2400-24ff : 0000:00:1f.6
3000-3fff : PCI Bus #01
  3000-30ff : 0000:01:00.0
4000-8fff : PCI Bus #02
  4000-40ff : PCI CardBus #03
  4400-44ff : PCI CardBus #03
  8000-803f : 0000:02:08.0
    8000-803f : e100

This is right after booting. If I do "sudo rmmod nsc-ircc; sudo /etc/init.d/irda-setup start" then it gives
the following:
mika@linuxbox:~$ cat /proc/ioports
0000-001f : dma1
0020-0021 : pic1
0040-0043 : timer0
0050-0053 : timer1
0060-006f : keyboard
0070-0077 : rtc
0080-008f : dma page reg
00a0-00a1 : pic2
00c0-00df : dma2
00f0-00ff : fpu
01f0-01f7 : ide0
02f8-02ff : nsc-ircc
03bc-03be : parport0
03c0-03df : vga+
03f6-03f6 : ide0
03f8-03ff : serial
07bc-07be : parport0
0cf8-0cff : PCI conf1
1000-107f : 0000:00:1f.0
  1000-107f : motherboard
    1000-1003 : PM1a_EVT_BLK
    1004-1005 : PM1a_CNT_BLK
    1008-100b : PM_TMR
    1010-1015 : ACPI CPU throttle
    1020-1020 : PM2_CNT_BLK
    1028-102f : GPE0_BLK
1180-11bf : 0000:00:1f.0
  1180-11bf : motherboard
1600-167f : motherboard
1800-181f : 0000:00:1d.0
  1800-181f : uhci_hcd
1820-183f : 0000:00:1d.1
  1820-183f : uhci_hcd
1840-185f : 0000:00:1d.2
  1840-185f : uhci_hcd
1860-186f : 0000:00:1f.1
  1860-1867 : ide0
  1868-186f : ide1
1880-189f : 0000:00:1f.3
18c0-18ff : 0000:00:1f.5
  18c0-18ff : Intel 82801DB-ICH4
1c00-1cff : 0000:00:1f.5
  1c00-1cff : Intel 82801DB-ICH4
2000-207f : 0000:00:1f.6
2400-24ff : 0000:00:1f.6
3000-3fff : PCI Bus #01
...

Read more...

Revision history for this message
Ben Collins (ben-collins) wrote :

Ok, rmmod nsc-ircc, and then do "modprobe nsc-ircc" and send me the dmesg
please. The irda scripts are not what's finding the resources. PNPBios and
PNPACPI should be doing that (the driver asks them for the resources on the
device). Also, the driver probes to find out the dongle type, so it should also
not have to be passed.

Revision history for this message
Mika Fischer (zoop) wrote :

[17179760.324000] pnp: Device 00:0a disabled.
[17179777.644000] pnp: Device 00:0a activated.
[17179777.644000] nsc_ircc_pnp_probe() : Found cfg_base 0x000 ; firbase 0x2F8 ; irq 3 ; dma 3.
[17179777.644000] nsc-ircc, Found chip at base=0x000
[17179777.644000] nsc-ircc, driver loaded (Dag Brattli)
[17179777.644000] IrDA: Registered device irda0
[17179777.644000] nsc-ircc, Found dongle: HP HSDL-1100/HSDL-2100
[17179777.644000] nsc-ircc, Found chip at base=0x02e
[17179777.644000] nsc-ircc, driver loaded (Dag Brattli)
[17179777.644000] nsc_ircc_open(), can't get iobase of 0x2f8

This seems as if it would work but it is the wrong dongle and it doesn't see my mobile phone that way.

Still, it's strange that on boot it doesn't detect a dongle at all.

Revision history for this message
Ben Collins (ben-collins) wrote :

Looks like we are getting close. I suspect you will just need to add a file
/etc/modprobe.d/nsc-ircc, with this in it:

options nsc-ircc dongle_id=9

That will make things automatic for you.

All the code is there to detect this properly. The only way it wouldn't work is
if the hardware is returning the wrong information, which is what I suspect is
happening with the dongle_id (it reads the type right from the devices ioports).

I'm going to consider this closed.

Revision history for this message
Mika Fischer (zoop) wrote :

I'm afraid it did not work.

On boot I still get:
[17179586.624000] nsc_ircc_pnp_probe() : Found cfg_base 0x000 ; firbase 0x2F8 ; irq 3 ; dma
3.
[17179586.624000] nsc-ircc, Found chip at base=0x000
[17179586.624000] nsc-ircc, driver loaded (Dag Brattli)
[17179586.624000] nsc_ircc_open(), can't get iobase of 0x2f8
[17179586.624000] nsc-ircc, Found chip at base=0x02e
[17179586.624000] nsc-ircc, driver loaded (Dag Brattli)
[17179586.624000] nsc_ircc_open(), can't get iobase of 0x2f8

after rmmod and modprobe it works correctly with the file in /etc/modprobe.d/

I'm reopening the bug.

Revision history for this message
Ben Collins (ben-collins) wrote :

I can safely blame that part on irda-utils then :)

Since it works (as much as expected) using modprobe, then irda-utils must be
doing something to break it.

Revision history for this message
Mika Fischer (zoop) wrote :

Hi, Ben!

I don't think it's irda-utils (namely /etc/rcS.d/S47irda-setup).

The module gets loaded in /etc/rcS.d/S10udev which calls /sbin/udevplug

I suspect that this loads the module and now after thinking about it again I suspect it even loads it with
the right parameters (from /etc/modprobe.d/nsc-ircc) and the real reason why it doesn't work is that the
serial UART needs to be deactivated before the module is loaded.

Anyway at the time S47irda-setup is run, the module is already loaded and in a non-working condition so it
can't really be blamed.

What could be tried is to blacklist all FIR-modules so that udev leaves them alone and irda-setup can do
it's job which is a bit more that just modprobing the right module.

Another option could be to instruct modprobe to disable the uart before loading a FIR module.

If you can tell me how to do either of the above I'm willing to test that.

And thanks for the effort of investigating this bug :)

Cheers,
 Mika

Revision history for this message
Ben Collins (ben-collins) wrote :

Honeslty, I'm not too sure how all the interactions need to be setup. I'll let
the udev/irda guys figure it out.

Matt Zimmerman (mdz)
Changed in irda-utils:
assignee: nobody → keybuk
Revision history for this message
Matthew Garrett (mjg59) wrote : NSC PNP fixup

Can you try this patch and see if it helps? nsc-ircc is requesting the region when it allocates itself as a PNP device, and then tries to request it again which fails...

Revision history for this message
Scott James Remnant (Canonical) (canonical-scott) wrote :

Matthew, what do you think should be done here? I know you've played with irda a lot, I know next to nothing about it -- I don't even have a computer which has a working irda port!

Revision history for this message
Matthew Garrett (mjg59) wrote :

It's a bug in the PnP patches for the driver - it tries to register its ioports twice.

Changed in linux-source-2.6.15:
assignee: keybuk → kernel-team
Revision history for this message
Mika Fischer (zoop) wrote :

This bug is fixed in dapper and can be closed. Thanks a lot.

Revision history for this message
Ben Collins (ben-collins) wrote :

Thanks

Changed in linux-source-2.6.15:
assignee: kernel-team → ben-collins
status: Unconfirmed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.