Bug 8052

Summary: tifm_7xx1 broken as of 2.6.20
Product: Drivers Reporter: Andreas Steinmetz (ast)
Component: MMC/SDAssignee: Alex Dubov (oakad)
Status: CLOSED CODE_FIX    
Severity: high CC: gentoo_bugzilla, kernel, ynvich
Priority: P2    
Hardware: i386   
OS: Linux   
Kernel Version: 2.6.20.1 Subsystem:
Regression: --- Bisected commit-id:
Bug Depends on: 8411    
Bug Blocks: 8393    
Attachments: Smiffy's debug logs from 2.6.21-rc4
Possible fix for 2.6.21 compilation
Driver release 0.8e

Description Andreas Steinmetz 2007-02-21 16:51:34 UTC
As sent to lkml on 2007/02/07:

Hi,
I do have a problem with tifm_7xx1 and 2.6.20. First of all, the device
is working with 2.6.18.2 and the out of tree tifm-0.6 release. In this
case except for the first card insertion after suspend/reboot I do get
the following messages:

tifm_7xx1: sd card detected in socket 3
mmcblk0: mmc0:7d7f SD01G 1006080KiB
 mmcblk0: p1

With 2.6.20, however, I always do get only the following which is the
same as for 2.6.18.2 on first card insert after reboot/suspend:

tifm_7xx1: sd card detected in socket 3

Am I doing something wrong here or is there a problem?

Relevant modules loaded with 2.6.20:

mmc_block               7944  0
tifm_sd                10824  0
tifm_7xx1               7296  0
sdhci                  17548  0
tifm_core               7960  2 tifm_sd,tifm_7xx1
mmc_core               24096  3 mmc_block,tifm_sd,sdhci

Note: even though the mmc owner did direct me to the tifm maintainer, there is
on the one hand no tifm maintainer either in bugzilla, nor in MAINTAINERS, nor
did the tifm maintainer provide or propose any patch.

Thus I stick with the mmc maintainer. If this bug is closed without resolution
I'm going to reopen it as long a this issue isn't solved.
Comment 1 Smiffy 2007-03-25 14:18:57 UTC
I can confirm this bug; I have had a bug open on the Gentoo Bugzilla
http://bugs.gentoo.org/show_bug.cgi?id=171123 as moving from the 2.6.19 series
to 2.6.20 series broke the tifm MMC/SD functionality on my Thinkpad Z61m.

After some testing (lots of dmsg dumps posted to Gentoo bug), I have been asked
to submit this here as an upstream bug and I am posting against this one, as it
would appear to me to be the same issue.

As part of the testing process, I was asked to test with 2.6.21-rc4 which I can
confirm is still broken.
Comment 2 Daniel Drake 2007-03-25 16:26:37 UTC
Created attachment 10938 [details]
Smiffy's debug logs from 2.6.21-rc4

2.6.21-rc4 seems to do better than 2.6.20: the logs here suggest that media has
been detected, but then it decides that the card is not responding and gives
up.
Comment 3 Alex Dubov 2007-03-25 18:40:02 UTC
The problems in question are probably fixed in the external version.
http://download.berlios.de/tifmxx/tifm-0.8d.tar.bz2

It was not submitted, because mmc maintainer is busy with other matters. All 
differences in behaviour between 2.6.20 and 2.6.21 are purely accidental.
Comment 4 Smiffy 2007-03-25 22:02:13 UTC
I have tried to build the external version mentioned, but got an error:

tifm_sd.c: In function 'tifm_sd_probe':
tifm_sd.c:987: error: 'struct mmc_host' has no member named 'max_sectors'

As I know no more about kernel modules other than how to type "make", I can test
no further with this.

I did this against 2.6.21-rc4, if that is of any significance.
Comment 5 Alex Dubov 2007-03-26 19:20:05 UTC
Yes, it will compile only against 2.6.20. 2.6.21 has incompatible changes and 
unless mmc maintainer will be willing to process my patches sooner, I'll only 
fix this on 2.6.21 release (-rc kernels change so fast that chasing them with 
out-of-tree driver is pointless).
Comment 6 Smiffy 2007-03-26 20:20:54 UTC
OK, I have tried again with 2.6.20 (Gentoo 2.6.20-r3), with MMC Support checked
in the kernel config (built-in) and TI Flash Media MMC/SD Interface support
unchecked completely.

Make gives me some warnings:

make -C /lib/modules/2.6.20-gentoo-r3/build M=/home/smith/tmp/tifm
make[1]: Entering directory `/usr/src/linux-2.6.20-gentoo-r3'
  Building modules, stage 2.
  MODPOST 3 modules
WARNING: /home/smith/tmp/tifm/tifm_core: 'tifm_alloc_adapter' exported twice.
Previous export was in vmlinux
WARNING: /home/smith/tmp/tifm/tifm_core: 'tifm_add_adapter' exported twice.
Previous export was in vmlinux
WARNING: /home/smith/tmp/tifm/tifm_core: 'tifm_remove_adapter' exported twice.
Previous export was in vmlinux
WARNING: /home/smith/tmp/tifm/tifm_core: 'tifm_free_adapter' exported twice.
Previous export was in vmlinux
WARNING: /home/smith/tmp/tifm/tifm_core: 'tifm_free_device' exported twice.
Previous export was in vmlinux
WARNING: /home/smith/tmp/tifm/tifm_core: 'tifm_alloc_device' exported twice.
Previous export was in vmlinux
WARNING: /home/smith/tmp/tifm/tifm_core: 'tifm_eject' exported twice. Previous
export was in vmlinux
WARNING: /home/smith/tmp/tifm/tifm_core: 'tifm_map_sg' exported twice. Previous
export was in vmlinux
WARNING: /home/smith/tmp/tifm/tifm_core: 'tifm_unmap_sg' exported twice.
Previous export was in vmlinux
WARNING: /home/smith/tmp/tifm/tifm_core: 'tifm_register_driver' exported twice.
Previous export was in vmlinux
WARNING: /home/smith/tmp/tifm/tifm_core: 'tifm_unregister_driver' exported
twice. Previous export was in vmlinux
make[1]: Leaving directory `/usr/src/linux-2.6.20-gentoo-r3'

If I do modprobe tifm_7xx1, I get the following error which would appear to
reflect the above:

tifm_core: exports duplicate symbol tifm_alloc_adapter (owned by kernel)
tifm_7xx1: Unknown symbol tifm_queue_work

Comment 7 Smiffy 2007-03-26 20:37:14 UTC
It appears that the above build/modprobe errors were due to the fact that
menuconfig had left a couple of TIFM bits with value 'y', after I thought I had
disabled it.

I have now edited .config manually, rebuilt the kernel, successfully built and
modprobed the modules and now get in dmesg:

tifm_core: MMC/SD card detected in socket 0:1
mmcblk0: mmc0:b368 SD064 61312KiB
 mmcblk0: p1

...and best of all:

brw-rw---- 1 root  disk  254,   0 Mar 27 13:03 mmcblk0
brw-rw---- 1 root  disk  254,   1 Mar 27 13:03 mmcblk0p1

So, I can confirm this to work with the Gentoo-patched 2.6.20-r3 kernel.
Comment 8 Daniel Drake 2007-03-27 17:25:07 UTC
Alex, is it possible to isolate the fix for this bug from the above tarball?
Also, if you have time I would suggest that you send a patch to upgrade the
driver to Andrew Morton for -mm inclusion while Pierre is busy. That way the
fixed version at least gets some air time (and I would have found it before
suggesting that Smiffy took his issue to this bug tracker).
Comment 9 Daniel Drake 2007-03-27 17:43:49 UTC
oh and if it's too much work to isolate the specific fix, I am happy to take
care of the 2.6.21 port and -mm submission, as I am planning to backport this to
Gentoo's 2.6.20 and 2.6.21 kernel trees anyway.
Comment 10 Alex Dubov 2007-03-27 20:03:36 UTC
Created attachment 10969 [details]
Possible fix for 2.6.21 compilation

The fix for 2.6.21 kernels may be as simple as this (other problems may surface
though).
Comment 11 Daniel Drake 2007-03-28 07:01:03 UTC
I was more curious if the fix for this specific bug is available as an
individual isolated patch, which is the nicer approach to take at fixing this in
2.6.20/2.6.21
Comment 12 Alex Dubov 2007-03-28 17:52:58 UTC
Unfortunately, "tifm_7xx1 broken as of 2.6.20" does not constitutes a "specific 
bug". You may even notice that I have not asked for any clarification on its 
behalf.
In fact, there were several problems in 0.7 that together prevented many cards 
from working. The irony is that 0.7 had spent a whole release cycle in the -mm 
before going to the mainstream and there were no bug reports for it during that 
time (that's, of course, because 0.6 was rather stable - lets hope the same 
will be true for 0.8).
Comment 13 Sergey Yanovich 2007-04-28 09:18:09 UTC
*** Bug 8352 has been marked as a duplicate of this bug. ***
Comment 14 Sergey Yanovich 2007-04-28 09:24:11 UTC
Created attachment 11312 [details]
Driver release 0.8e

This is a diff against v2.6.21.1. It is practically fine. I will file a
dependent bug with details.

Alex, I think you can mark this bug resolved.
Comment 15 Sergey Yanovich 2007-04-28 12:23:44 UTC
The source for release 0.8e can be downloaded at:
http://download.berlios.de/tifmxx/tifm-0.8e.tar.bz2
Comment 16 Alex Dubov 2007-04-28 20:59:23 UTC
This bug will be marked as resolved when the driver will be available in the 
main kernel tree. Otherwise, the bug remains valid, to my opinion.
Comment 17 Daniel Drake 2007-05-19 20:58:00 UTC
This is fixed in Linus' tree, 2.6.22-rc1 confirmed working on downstream gentoo
bug. Thanks.