Bug 207910 - problem to detect modem on multifunction pcmcia cards
Summary: problem to detect modem on multifunction pcmcia cards
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Fedora
Classification: Fedora
Component: kernel
Version: rawhide
Hardware: i386
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Kernel Maintainer List
QA Contact: Brian Brock
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2006-09-25 11:12 UTC by Fabrice Bellet
Modified: 2007-11-30 22:11 UTC (History)
2 users (show)

Fixed In Version: 2.6.20-1.2925.fc6
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2007-03-15 21:33:52 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)
linux-2.6.17-pcmcia-rescan-when-rewriting-cis.patch (346 bytes, patch)
2006-10-01 18:58 UTC, Fabrice Bellet
no flags Details | Diff
linux-2.6.17-pcmcia-delete-devices-after-cis-update.patch (536 bytes, patch)
2006-10-01 19:16 UTC, Fabrice Bellet
no flags Details | Diff
start over after CIS override (2.91 KB, patch)
2006-11-03 15:56 UTC, Dominik Brodowski
no flags Details | Diff
log with 3cxem556-b multifunction card, kernel-2.6.19-rc4-git7 + dominik patch (7.44 KB, text/plain)
2006-11-06 13:08 UTC, Fabrice Bellet
no flags Details

Description Fabrice Bellet 2006-09-25 11:12:16 UTC
The pcmcia subsystem fails to detect the modem part of a multifunction pcmcia
card (3com megahertz 3cxem556b net+modem). This card worked fine with pcmcia-cs,
and the problem appeared in FC5 and also in rawhide, with pcmciautils. I tested
this case with two laptops, a T60p with FC5 fully updated, and a T40 running
rawhide. This is what I obtain, when I insert the card (pccardctl eject ;
pccardctl insert), there's no trace of the modem function:

Sep 24 22:47:02 localhost kernel: pccard: PCMCIA card inserted into slot 0
Sep 24 22:47:02 localhost kernel: pcmcia: registering new device pcmcia0.0
Sep 24 22:47:02 localhost kernel: eth0: 3Com 3c589, io 0x300, irq 3, hw_addr
00:00:86:36:E0:9F
Sep 24 22:47:02 localhost kernel:   8K FIFO split 5:3 Rx:Tx, auto xcvr

I grabbed the cis file from the old pcmcia-cs package, and put it in
/lib/firmware/3CXEM556.cis to make udev helper functions happy.

I also recompiled cardmgr from the latest pcmcia-cs tarball, and went a bit
further, when launching cardmgr, the modem capabilities are detected by the
kernel, the serial_cs module is loaded, the /dev/modem is created:

pcmcia: Detected deprecated PCMCIA ioctl usage from process: cardmgr.
pcmcia: This interface will soon be removed from the kernel; please expect
breakage unless you upgrade to new tools.
pcmcia: see http://www.kernel.org/pub/linux/utils/kernel/pcmcia/pcmcia.html for
details.
pcmcia: registering new device pcmcia0.1
0.1: ttyS0 at I/O 0x3f8 (irq = 3) is a 16550A
eth0: interrupt(s) dropped!
2.6. kernels use pcmciamtd instead of memory_cs.c and do not require special
MTD handling any more.

The modem is detected, but doesn't respond to any at commands (same irq thatn
network ? conflict with pcmciautils ? maybe). But as pcmcia-cs is deprecated,
this is certainly not the way to solve this issue. Anyway, this demonstrates
that the modem function is available, and probably should work out-of-the-box
with kernel support+pcmciautils.

[root@bonobo pcmcia]# find /sys/bus/pcmcia/
/sys/bus/pcmcia/
/sys/bus/pcmcia/drivers
/sys/bus/pcmcia/drivers/3c589_cs
/sys/bus/pcmcia/drivers/3c589_cs/bind
/sys/bus/pcmcia/drivers/3c589_cs/unbind
/sys/bus/pcmcia/drivers/3c589_cs/module
/sys/bus/pcmcia/drivers/3c589_cs/0.0
/sys/bus/pcmcia/devices
/sys/bus/pcmcia/devices/0.0
[root@bonobo pcmcia]# find /sys/class/pcmcia_socket/
/sys/class/pcmcia_socket/
/sys/class/pcmcia_socket/pcmcia_socket0
/sys/class/pcmcia_socket/pcmcia_socket0/available_resources_mem
/sys/class/pcmcia_socket/pcmcia_socket0/available_resources_io
/sys/class/pcmcia_socket/pcmcia_socket0/cis
/sys/class/pcmcia_socket/pcmcia_socket0/available_resources_setup_done
/sys/class/pcmcia_socket/pcmcia_socket0/card_irq_mask
/sys/class/pcmcia_socket/pcmcia_socket0/card_eject
/sys/class/pcmcia_socket/pcmcia_socket0/card_pm_state
/sys/class/pcmcia_socket/pcmcia_socket0/card_insert
/sys/class/pcmcia_socket/pcmcia_socket0/card_vcc
/sys/class/pcmcia_socket/pcmcia_socket0/card_vpp
/sys/class/pcmcia_socket/pcmcia_socket0/card_voltage
/sys/class/pcmcia_socket/pcmcia_socket0/card_type
/sys/class/pcmcia_socket/pcmcia_socket0/device
/sys/class/pcmcia_socket/pcmcia_socket0/uevent

Any hint on how I can investigate further on this issue ?

Comment 1 Fabrice Bellet 2006-09-30 16:46:26 UTC
I inserted some debug statements with jprobes in the pcmcia code, and I have a
better view of what certainly occurs: when powered up, the pcmcia card shows a
single function (network), so the 3c589_cs is loaded. Then the 3CXEM556.cis
firmware is loaded by the network driver, that overrides the cards buggy cis.
Now the cis tells that the card has multifunctions (network+modem), but it's too
late, because there's no pcmcia_bus_rescan() occuring after the new cis has been
loaded. Does it make sense ?

Comment 2 Fabrice Bellet 2006-10-01 18:58:29 UTC
Created attachment 137504 [details]
linux-2.6.17-pcmcia-rescan-when-rewriting-cis.patch

The ret variable is not supposed to be zero here, because it is initialised to
the value of count (size of the cis file), and is only modified when
pcmcia_replace_cis() fails (-EIO). This patch forces a pcmcia_bus_rescan() when
writing a new cis file through the /sys/ interface.

Comment 3 Fabrice Bellet 2006-10-01 19:16:33 UTC
Created attachment 137505 [details]
linux-2.6.17-pcmcia-delete-devices-after-cis-update.patch

When a new cis file is loaded, pcmcia_bus_rescan() is called, and nothing will
occur if the previous cis already provided a function that got registered. 
This is the case with the megahertz 3CXEM556 B network/modem card : initially,
only the network function is advertized by the card.

Maybe we can assume that the previous registered information simply needs to be
dropped, before re-adding the card _from scratch_. This is what this patch
proposes. 

It works for me : the modem function is correctly detected, I just need to
manually launch pcmcia-socket-startup, so pcmcia_bus_rescan() is called after
the new cis file has been loaded, triggered by the 3c589_cs module.

But : there's still an IRQ conflict between network and modem functions, that
cannot be used simultaneously. This is not really a problem, because a
workaround consists simply to disable the network device, and to autoconfigure
the serial port :

  # ifconfig eth0 down
  # setserial autoconfig auto_irq /dev/ttyS0

Comment 4 Dominik Brodowski 2006-11-03 15:56:58 UTC
Created attachment 140264 [details]
start over after CIS override

Many thanks for debugging this issue. The attached patch should address it in a
slightly different way; for only in the "replace CIS" codepath devices will be
removed and re-added.

Comment 5 Fabrice Bellet 2006-11-06 13:06:27 UTC
It works for me (2.6.19-rc4-git7). The pre-required steps now to make the modem
function of my pcmcia card usable are :

  - prevents the network driver from being loaded (install 3c589_cs /bin/true in
modprobe.conf), else there's irq conflict between network and modem function
(see following log, "pcmcia: request for exclusive IRQ could not be fulfilled")

  - manually load the CIS file via sysfs (cat /lib/firmware/3CXEM556.cis >
/sys/class/pcmcia_socket/pcmcia_socket0/cis), altough the CIS has already been
loaded by the network driver from another code path (see following log too, "ds:
trying to load firmware 3CXEM556.cis").

I'm wondering if the setup process could be somewhat automatized via the generic
udev rules (does it make sense to blacklist this card in pcmcia-check-broken-cis
for example ?) 

Comment 6 Fabrice Bellet 2006-11-06 13:08:34 UTC
Created attachment 140463 [details]
log with 3cxem556-b multifunction card, kernel-2.6.19-rc4-git7 + dominik patch

Comment 7 Romano Giannetti 2006-11-14 12:05:20 UTC
Please see 
https://launchpad.net/distros/ubuntu/+source/linux-source-2.6.17/+bug/52510

It is fixed for me now! Thanks to all the people involved!


Comment 8 Fabrice Bellet 2007-03-15 21:31:06 UTC
Now it works fine with kernel-2.6.20-1.2925.fc6


Note You need to log in before you can comment on or make changes to this bug.