Bug 11919 - yenta o2 cardreader doesn't work in 2.6.27
Summary: yenta o2 cardreader doesn't work in 2.6.27
Status: REJECTED INVALID
Alias: None
Product: Drivers
Classification: Unclassified
Component: MMC/SD (show other bugs)
Hardware: All Linux
: P1 high
Assignee: drivers_mmc-sd
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-10-31 04:22 UTC by Oleg Mikheev
Modified: 2008-12-04 12:25 UTC (History)
1 user (show)

See Also:
Kernel Version: 2.6.27.*
Subsystem:
Regression: ---
Bisected commit-id:


Attachments
2.6.26 lspci -v, cat /proc/interrupts, modinfo sdhci (2.05 KB, text/plain)
2008-12-02 08:12 UTC, Oleg Mikheev
Details
2.6.27 lspci -v, cat /proc/interrupts, modinfo sdhci (1.43 KB, text/plain)
2008-12-02 08:12 UTC, Oleg Mikheev
Details

Description Oleg Mikheev 2008-10-31 04:22:14 UTC
Latest working kernel version: 2.6.26
Earliest failing kernel version: 2.6.27 (?)
Distribution: vanilla
Problem Description:

My laptop runs Gentoo on vanilla kernel.
2.6.27 doesn't work with my O2 integrated SD card reader.

When I insert SD card on 2.6.26 (and actually all previous
kernels with O2 support) it created a new device,
*dmesg* output was:

mmc0: new SDHC card at address 0001
mmcblk0: mmc0:0001 SDC 3935232KiB
 mmcblk0: p1

When I load 2.6.27.* on exactly the same configuration and
try to insert my SD card nothing happens at all, no messages
in dmesg.

*ver_linux* for 2.6.26:

Linux xxx 2.6.26.3 #4 Thu Aug 21 00:55:39 MSD 2008 i686 Intel(R)
Celeron(R) M processor 1.00GHz GenuineIntel GNU/Linux

Gnu C                  4.1.2
Gnu make               3.81
binutils               2.18
util-linux             2.13.1.1
mount                  2.13.1.1
module-init-tools      3.4
e2fsprogs              1.40.9
PPP                    2.4.4
Linux C Library        2.6.1
Dynamic linker (ldd)   2.6.1
Procps                 3.2.7
Net-tools              1.60
Kbd                    1.13
Sh-utils               6.10
udev                   124
wireless-tools         29
Modules Loaded         rt2500pci rt2x00pci rt2x00lib mac80211 nls_utf8
nls_cp866 sg sd_mod usb_storage vfat fat mmc_block rfcomm l2cap
snd_pcm_oss snd_mixer_oss snd_seq_dummy snd_seq_oss snd_seq_midi_event
snd_seq snd_seq_device hci_usb bluetooth arc4 ecb crypto_blkcipher
firewire_ohci rfkill input_polldev firewire_core eeprom_93cx6 serio_raw
snd_intel8x0m ehci_hcd sdhci crc_itu_t uhci_hcd mmc_core


*ver_linux* for 2.6.27:

Linux xxx 2.6.27.3 #4 Thu Oct 23 08:49:20 MSD 2008 i686 Intel(R)
Celeron(R) M processor 1.00GHz GenuineIntel GNU/Linux

Gnu C                  4.1.2
Gnu make               3.81
binutils               2.18
util-linux             2.13.1.1
mount                  2.13.1.1
module-init-tools      3.4
e2fsprogs              1.40.9
PPP                    2.4.4
Linux C Library        2.6.1
Dynamic linker (ldd)   2.6.1
Procps                 3.2.7
Net-tools              1.60
Kbd                    1.13
Sh-utils               6.10
udev                   124
wireless-tools         29
Modules Loaded         rfcomm l2cap snd_pcm_oss snd_mixer_oss
snd_seq_dummy snd_seq_oss snd_seq_midi_event snd_seq snd_seq_device
hci_usb bluetooth arc4 ecb crypto_blkcipher rt2500pci rt2x00pci
rt2x00lib rfkill firewire_ohci serio_raw firewire_core crc_itu_t
snd_intel8x0m mac80211 eeprom_93cx6 uhci_hcd ehci_hcd


*lspci* is exactly the same between 2.6.27 and 2.6.26:

00:00.0 Host bridge: Intel Corporation 82852/82855 GM/GME/PM/GMV
Processor to I/O Controller (rev 02)
00:00.1 System peripheral: Intel Corporation 82852/82855 GM/GME/PM/GMV
Processor to I/O Controller (rev 02)
00:00.3 System peripheral: Intel Corporation 82852/82855 GM/GME/PM/GMV
Processor to I/O Controller (rev 02)
00:02.0 VGA compatible controller: Intel Corporation 82852/855GM
Integrated Graphics Device (rev 02)
00:02.1 Display controller: Intel Corporation 82852/855GM Integrated
Graphics Device (rev 02)
00:1d.0 USB Controller: Intel Corporation 82801DB/DBL/DBM
(ICH4/ICH4-L/ICH4-M) USB UHCI Controller #1 (rev 03)
00:1d.1 USB Controller: Intel Corporation 82801DB/DBL/DBM
(ICH4/ICH4-L/ICH4-M) USB UHCI Controller #2 (rev 03)
00:1d.2 USB Controller: Intel Corporation 82801DB/DBL/DBM
(ICH4/ICH4-L/ICH4-M) USB UHCI Controller #3 (rev 03)
00:1d.7 USB Controller: Intel Corporation 82801DB/DBM (ICH4/ICH4-M) USB2
EHCI Controller (rev 03)
00:1e.0 PCI bridge: Intel Corporation 82801 Mobile PCI Bridge (rev 83)
00:1f.0 ISA bridge: Intel Corporation 82801DBM (ICH4-M) LPC Interface
Bridge (rev 03)
00:1f.1 IDE interface: Intel Corporation 82801DBM (ICH4-M) IDE
Controller (rev 03)
00:1f.3 SMBus: Intel Corporation 82801DB/DBL/DBM (ICH4/ICH4-L/ICH4-M)
SMBus Controller (rev 03)
00:1f.5 Multimedia audio controller: Intel Corporation 82801DB/DBL/DBM
(ICH4/ICH4-L/ICH4-M) AC'97 Audio Controller (rev 03)
00:1f.6 Modem: Intel Corporation 82801DB/DBL/DBM (ICH4/ICH4-L/ICH4-M)
AC'97 Modem Controller (rev 03)
01:04.0 Network controller: RaLink RT2500 802.11g Cardbus/mini-PCI (rev 01)
01:05.0 CardBus bridge: O2 Micro, Inc. OZ711MP1/MS1 MemoryCardBus
Controller (rev 21)
01:05.2 SD Host controller: O2 Micro, Inc. Integrated MMC/SD Controller
(rev 01)
01:05.3 Bridge: O2 Micro, Inc. Integrated MS/xD Controller (rev 01)
01:05.4 FireWire (IEEE 1394): O2 Micro, Inc. Firewire (IEEE 1394) (rev 02)
01:06.0 Ethernet controller: Realtek Semiconductor Co., Ltd.
RTL-8139/8139C/8139C+ (rev 10)


*dmesg* related to Yenta is also the same for 2.6.27 and 2.6.26::

Yenta: CardBus bridge found at 0000:01:05.0 [14ff:0617]
Yenta O2: res at 0x94/0xD4: 00/ea
Yenta O2: enabling read prefetch/write burst
Yenta: ISA IRQ mask 0x0eb8, PCI irq 16
Socket status: 30000006
Yenta: Raising subordinate bus# of parent bus (#01) from #01 to #05

I don't have a clue how to trace this problem and where to look
for more debug information. No errors reported anywhere, it just
doesn't work.
Or maybe there is some new option in kernel config that I needed to
set for cardreader to work?

Thanks
Comment 1 Stefan Richter 2008-12-01 14:16:14 UTC
I don't know MMC/SD, but anyway:
You could have a look whether "lspci -v" shows the same "Kernel driver in use: ..." under 2.6.26 and 2.6.27.  Furthermore, check in /proc/interrupts whether the respective driver receives interrupts when you insert a card.
Comment 2 Oleg Mikheev 2008-12-01 23:44:04 UTC
Stefan, yes - there is difference in driver in IRQ reported.
For 2.6.26 it is:
01:05.2 SD Host controller: O2 Micro, Inc. Integrated MMC/SD Controller (rev 01)
	Subsystem: TWINHEAD INTERNATIONAL Corp Device 0617
	Flags: slow devsel, IRQ 16
	Memory at fe8ff800 (32-bit, non-prefetchable) [size=256]
	Capabilities: [a0] Power Management version 2
	Kernel driver in use: sdhci
	Kernel modules: sdhci


for 2.6.27:
01:05.2 SD Host controller: O2 Micro, Inc. Integrated MMC/SD Controller (rev 01)
	Subsystem: TWINHEAD INTERNATIONAL Corp Device 0617
	Flags: slow devsel, IRQ 10
	Memory at fe8ff800 (32-bit, non-prefetchable) [size=256]
	Capabilities: [a0] Power Management version 2

Thanks for your assistance!
But what could cause this?
Comment 3 Stefan Richter 2008-12-02 00:16:04 UTC
IRQ 16 -> IRQ 10 is not necessarily a problem sources.  But is there really no "Kernel driver in use" and "Kernel modules: sdhci" reported in 2.6.27?  If so, perhaps your kernel config simply lost the necessary option.
Comment 4 Oleg Mikheev 2008-12-02 00:33:24 UTC
lspci -v |grep sdhci gives nothing

I also double checked Yenta/O2-related kernel options.
And I can successfully manually probe sdhci, so it's definitely there.
It produces the next dmesg:

Dec  2 10:39:26 averamihel kernel: sdhci: Secure Digital Host Controller Interface driver
Dec  2 10:39:26 averamihel kernel: sdhci: Copyright(c) Pierre Ossman
Comment 5 Stefan Richter 2008-12-02 03:15:58 UTC
Yenta is something different (PCI to CardBus bridge, AFAIK a fully separate chip function).

So you can modprobe sdhci --- but does the kernel actually bind it to the controller?  *If* lspci does *not* show the sdhci driver as active driver for the SD controller even after you modprobe'd sdhci, then
  - either the kernel's driver matching routine did not see any match between the driver's ID table and the chip's ID,
  - or there was a match and sdhci's probe function was called, but the probe failed.
Comment 6 Oleg Mikheev 2008-12-02 07:34:39 UTC
Probe didn't fail as far as I can tell - since lsmod shows the module and some dependent modules:

lsmod|grep sdhci
sdhci                  13380  0 
mmc_core               41044  1 sdhci

So your first guess is probably more realistic.
Now I need to know how does kernel match drivers to devices :)
Comment 7 Stefan Richter 2008-12-02 07:48:32 UTC
lsmod doesn't say anything about whether a probe was executed and if yes, whether it succeeded.  You can insert as many modules into the kernel as you like, without having any hardware for them.

Just look at:
# lspci -v
# cat /proc/interrupts

Only they show whether sdhci was bound to a device or not.
Comment 8 Stefan Richter 2008-12-02 07:51:00 UTC
Also report
# modinfo sdhci
under 2.6.26 and 2.6.27.
Comment 9 Oleg Mikheev 2008-12-02 08:12:03 UTC
Created attachment 19100 [details]
2.6.26 lspci -v, cat /proc/interrupts, modinfo sdhci
Comment 10 Oleg Mikheev 2008-12-02 08:12:32 UTC
Created attachment 19101 [details]
2.6.27 lspci -v, cat /proc/interrupts, modinfo sdhci
Comment 11 Stefan Richter 2008-12-02 10:24:10 UTC
Thanks.

See how sdhci in 2.6.27.7 (your one, at least) shows a serious lack of module aliases?  These aliases are generated during the kernel build process from a drivers device ID table --- the table which is used by the kernel's driver core (or in that case maybe the PCI core) to match drivers with devices as prerequisite for driver binding.

Furthermore, your lspci confirms that sdhci is not bound to the SD controller, and the interrupts table shows that the SD controller's interrupt was not enabled and served by any driver.

Since your other drivers kept working, a general problem with your kernel build seems unlikely.

Now, a quick look into the git history of drivers/mmc/host/sdhci.c between v2.6.26 and v2.6.27 immediately shows one commit which touched sdhci's device ID table:
http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commitdiff;h=b8c86fc5d8deaa5a6dc49c2c1ed144e6838bf0f3

Look at the diff of Kconfig.  Did you enable the *new* configuration option MMC_SDHCI_PCI alias "SDHCI support on PCI bus"?  I guess not, and enabling this would fix sdhci for you.

Pierre, maybe the sentence "If unsure, say N" in MMC_SDHCI_PCI's help text was not so helpful after all.
Comment 12 Oleg Mikheev 2008-12-02 11:09:43 UTC
Stefan,

Thank you so much, SD card reader works great after I enabled that option!
Also thanks for the knowledge about kernel and drivers, I'm sure it will help me in case my Linux misbehaves again :)
Should this bug be rejected now?
Comment 13 Stefan Richter 2008-12-02 11:31:03 UTC
I close this and remove the status as regression --- even though it actually can be considered a regression.  (A kernel build option which worked in 2.6.26 does not give the same result in 2.6.27 anymore, unless a new other option is switched on too.)  However, since the change that caused it had a good reason (make the sdhci base driver independent of the type of local bus attachment) and the old and new Kconfig options have help texts which are clear enough to at least those people who know that their SD controller is PCI-attached, we can leave it at "not a bug".

I hope that other people who encounter the same issue find your LKML post and thus the link to this bug entry.  Thanks for the report and the patience to resolve this.
Comment 14 Pierre Ossman 2008-12-03 23:05:13 UTC
Kconfig is unfortunately a bit of a pain when it comes down to making it easy to use. On one end there's people wanting defaults that give you proper support for your hardware. And on the other end, there's people that want everything machine specific to be off by default so that you don't get a lot of crud in the kernel. Right now it is the latter that is the dominating principle. Changing just sdhci would cause more confusion than it would solve.

I can have a look at making it clearer though. Something like "if you have a PC with an SD/MMC reader, you probably want this driver".

And a big thanks for the help Stefan. It's good to know that there are others that can help out when my time is limited. :)
Comment 15 Oleg Mikheev 2008-12-04 01:32:45 UTC
As I indicated in my initial bug report I did suspect that some new option needed to be set. So the problem was really not with the driver or kernel, but with the config tool (I'm using gconfig). In my gconfig majority of options are displayed with (NEW) flag, so it's almost impossible to tell which option is really new for the release (or for the new patch).
Or, as usual, there is a good change that I'm not doing configuration the right way. I'm just copying my .config file from previous release to a new one. I tried to use diff between old and new .configs but it makes no sense b/c options often change their location in the file.
Comment 16 Stefan Richter 2008-12-04 12:25:43 UTC
Oleg,
I mostly use "make oldconfig" after copying .config from my previous to a next kernel.  This is text-based and stops at every new option, where you can type h (if the option has a help text as it should), then y or m or n.

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