[MacBookPro10,2] Broadcom BCM57765/57785 SDXC/MMC Card Reader doesn't work for Ultra High Speed SD cards

Bug #1307674 reported by Magnus Hoff on 2014-04-14
66
This bug affects 12 people
Affects Status Importance Assigned to Milestone
linux (Ubuntu)
Medium
Unassigned

Bug Description

I have a Broadcom BCM57765/57785 SDXC/MMC Card Reader internally in my MacBook Pro Retina 13", and it does not work.

WORKAROUND:
  1. Add the following to /etc/modprobe.d/sdhci: options sdhci debug_quirks2=4
  2. Re-generate initrd: sudo update-initramfs -u -k all
  3. Reboot (or reload sdhci module: sudo rmmod sdhci-pci sdhci ; sudo modprobe sdhci ; sudo modprobe sdhci-pci)

Upstream URL: http://thread.gmane.org/gmane.linux.kernel.mmc/27194

ProblemType: Bug
DistroRelease: Ubuntu 14.04
Package: linux-image-3.13.0-24-generic 3.13.0-24.46
ProcVersionSignature: Ubuntu 3.13.0-24.46-generic 3.13.9
Uname: Linux 3.13.0-24-generic x86_64
NonfreeKernelModules: wl
ApportVersion: 2.14.1-0ubuntu2
Architecture: amd64
AudioDevicesInUse:
 USER PID ACCESS COMMAND
 /dev/snd/controlC0: mag 2387 F.... pulseaudio
                      mag 2896 F.... pulseaudio
CurrentDesktop: KDE
Date: Mon Apr 14 21:30:38 2014
HibernationDevice: RESUME=UUID=060f761f-a7ab-442b-9186-51ab74e03896
InstallationDate: Installed on 2013-09-14 (212 days ago)
InstallationMedia: Kubuntu 13.04 "Raring Ringtail" - Release amd64 (20130424)
MachineType: Apple Inc. MacBookPro10,2
ProcFB: 0 inteldrmfb
ProcKernelCmdLine: \EFI\linux\vmlinuz-3.13.0-24-generic ro root=UUID=61126328-c29e-40a6-913f-7f8690a455bc quiet splash $vt_handoff initrd=EFI\linux\initrd.img-3.13.0-24-generic
RelatedPackageVersions:
 linux-restricted-modules-3.13.0-24-generic N/A
 linux-backports-modules-3.13.0-24-generic N/A
 linux-firmware 1.127
SourcePackage: linux
UpgradeStatus: Upgraded to trusty on 2014-04-11 (3 days ago)
dmi.bios.date: 11/16/2012
dmi.bios.vendor: Apple Inc.
dmi.bios.version: MBP102.88Z.0106.B03.1211161133
dmi.board.asset.tag: Base Board Asset Tag#
dmi.board.name: Mac-AFD8A9D944EA4843
dmi.board.vendor: Apple Inc.
dmi.board.version: MacBookPro10,2
dmi.chassis.type: 10
dmi.chassis.vendor: Apple Inc.
dmi.chassis.version: Mac-AFD8A9D944EA4843
dmi.modalias: dmi:bvnAppleInc.:bvrMBP102.88Z.0106.B03.1211161133:bd11/16/2012:svnAppleInc.:pnMacBookPro10,2:pvr1.0:rvnAppleInc.:rnMac-AFD8A9D944EA4843:rvrMacBookPro10,2:cvnAppleInc.:ct10:cvrMac-AFD8A9D944EA4843:
dmi.product.name: MacBookPro10,2
dmi.product.version: 1.0
dmi.sys.vendor: Apple Inc.

Magnus Hoff (maghoff) wrote :
Magnus Hoff (maghoff) wrote :

Title of above mentioned bug is "Bug 73241 - SDHCI PCI driver incompatible with 14e4:16bc / Broadcom BCM57765/57785 SDXC/MMC Card Reader"

This change was made by a bot.

Changed in linux (Ubuntu):
status: New → Confirmed

Would it be possible for you to test the latest upstream kernel? Refer to https://wiki.ubuntu.com/KernelMainlineBuilds . Please test the latest v3.15 kernel[0].

If this bug is fixed in the mainline kernel, please add the following tag 'kernel-fixed-upstream'.

If the mainline kernel does not fix this bug, please add the tag: 'kernel-bug-exists-upstream'.

If you are unable to test the mainline kernel, for example it will not boot, please add the tag: 'kernel-unable-to-test-upstream'.
Once testing of the upstream kernel is complete, please mark this bug as "Confirmed".

Thanks in advance.

[0] http://kernel.ubuntu.com/~kernel-ppa/mainline/v3.15-rc1-trusty/

Changed in linux (Ubuntu):
importance: Undecided → Medium
status: Confirmed → Incomplete
Magnus Hoff (maghoff) wrote :

I have tested with 3.15.0-031500rc1, as requested and it did not fix the problem. It did not change "user observed" behaviour either.

However, it *did* change stuff that appears in dmesg.

Magnus Hoff (maghoff) wrote :
Magnus Hoff (maghoff) wrote :

Rebooting with "irqpoll" as a kernel argument as suggested by dmesg output did not affect the issue.

tags: added: kernel-bug-exists-upstream
Changed in linux (Ubuntu):
status: Incomplete → Confirmed
description: updated
tags: added: kernel-bug-exists-upstream-v3.15-rc1 latest-bios-11-16-2012
removed: kernel-bug-exists-upstream
Changed in linux (Ubuntu):
status: Confirmed → Triaged
Magnus Hoff (maghoff) wrote :

I have now applied the patch found here: https://chromium.googlesource.com/chromiumos/third_party/kernel-next/+/fd1acc54a6b3db4e6503ccc4a9349f28b436031a

The result is that I am successfully able to mount and use my SD card, hooray!

dmesg output looks like this:

[ 77.803116] mmc0: Skipping voltage switch
[ 78.804834] mmc0: new high speed SDHC card at address 59b4
[ 78.808642] mmcblk0: mmc0:59b4 SD32G 29.5 GiB
[ 78.809606] mmcblk0: p1

It looks like I get a steady read rate of 20 MB/s. I *think* the corresponding read rate I get in OS X is about 30 MB/s, which in any event is what the SD card is advertised as supporting.

Magnus Hoff (maghoff) wrote :

Ah, I was cheering prematurely, sorry.

It seems that the mentioned patch did not effect the observed change in behavior, so presumably something has changed in the stock Ubuntu kernel to do this.

The currently observed behavior with stock ubuntu (3.13.0-24-generic) as well as my patched kernel (3.13.0-27-generic with patch) is the following:

 1. After a reboot, I can plug in the card and stuff is working (automatic mouting, etc)
 2. The transfer rate (for reading) seems to be capped at 20 MB/s (I tested with the same rsync command in OS X, and got nearly 50 MB/s. The card is advertised as 30 MB/s)
 3. After removing the card, subsequent inserts of the card do not work. I can only use the card one time after a reboot.
 4. Similarly as 3., with system sleep. If I let the system sleep and then wake it up, the card reader does not work.

----

Observations from dmesg:

When the reader works, I get the following messages in dmesg, which are absent when the reader does not work: "mmc0: Skipping voltage switch". This is followed by "mmc0: new high speed SDHC card at address 59b4". Notice that the card is incorrectly recognized as "high speed SDHC".

When the reader fails, I get the following mesages in dmesg, which are absent when the reader does work: "sdhci: Timeout waiting for Buffer Read Ready interrupt during tuning procedure, falling back to fixed sampling clock". This is followed by "mmc0: new ultra high speed SDR104 SDHC card at address 59b4". Notice that this time, the card is correctly identified as "ultra high speed SDHC".

----

It looks like it might be the case that the driver fails if and only if the card is "ultra high speed", unless the driver mistakenly believes that the card is merely "high speed".

Is it possible to ask the driver to not attempt UHS mode?

Magnus Hoff (maghoff) wrote :

Well. I've now added "options sdhci debug_quirks2=4" to modprobe.d, and this seems to make it treat the card as "high speed" rather than "ultra high speed", which works, although at a poorer speed than theoretically possible.

I can attach and detach the card multiple times, and sleeping and waking the computer does not introduce a problem.

I have no idea what I am doing, though.

description: updated
description: updated
Magnus Hoff (maghoff) wrote :

I wasn't very clear: The mentioned kernel patch is a red herring, it did not cause the changes I observed. I am currently using the stock ubuntu kernel (3.13.0-24-generic) with the kernel module parameter, and the workaround works :)

description: updated
summary: - Broadcom BCM57765/57785 SDXC/MMC Card Reader doesn't work
+ Broadcom BCM57765/57785 SDXC/MMC Card Reader doesn't work for Ultra High
+ Speed SD cards

Magnus Hoff, just to clarify, the patch noted in https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1307674/comments/9 does not change anything, whether or not you engage the WORKAROUND?

Magnus Hoff (maghoff) wrote :

You have understood correctly. The mentioned patch did not change anything, whether or not I engaged the workaround.

That said, to my eyes, the patch looks like it might be related. There are some mentions of broadcom quirks and UHS mode in there. But the bottom line is that I didn't experience any difference with the patch.

Magnus Hoff, if the problem is reproducible with the latest mainline kernel via http://kernel.ubuntu.com/~kernel-ppa/mainline/v3.15-rc6-utopic/ , then the issue you are reporting would be an upstream one. In this case, could you please report this problem through the appropriate channel by following the instructions _verbatim_ at https://wiki.ubuntu.com/Bugs/Upstream/kernel ?

Please provide a direct URL to your e-mail to the mailing list once you have made it so that it may be tracked.

Thank you for your understanding.

Magnus Hoff (maghoff) wrote :

Sure, I'm on it. It looks like I will have to allocate some time for it later, though.

Thanks for helping me out with how to do the reporting :)

Magnus Hoff (maghoff) wrote :

I created the report as specified and sent it to <email address hidden> three days ago. However, since then it has failed to appear in the archives I have found (http://<email address hidden>/maillist.html, http://dir.gmane.org/gmane.linux.kernel.mmc). I have not received an error message via mail.

What is the accepted way to deal with this? Resend the mail?

The mail is 137KB in size. Not especially big for a mail with attachments, but this is all body text. I am not sure if this affects anything, but I thought it was worth mentioning.

Magnus Hoff, vger.kernel.org silently discards html encoded e-mails. If you didn't explicitly set your e-mail to send things as plain text, then that would be why it didn't show up.

Magnus Hoff (maghoff) wrote :

The mail was plaintext all along. It also seems that they discard too large mails. I trimmed it down to 51KB by removing lots of less relevant log data.

The report is now available here: http://<email address hidden>/msg26725.html

description: updated

I have posted a bug report on quite a similar issue with the SD-card reader of the Acer Aspire V5-131 (same Broadcom chip).

It is available here:
https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1327764

summary: - Broadcom BCM57765/57785 SDXC/MMC Card Reader doesn't work for Ultra High
- Speed SD cards
+ [MacBookPro10,2] Broadcom BCM57765/57785 SDXC/MMC Card Reader doesn't
+ work for Ultra High Speed SD cards
rchman (rchman) wrote :

Magnus, I have the same issue with my MBP and went to modify sdhci in modprobe.d but I'm missing that file. Did you do anything special to get that file in there or was it there by default? Any idea how to load sdhci? I'm stuck at that point and would really like to use my SD cards without a clunky adapter. Thanks!

Magnus Hoff (maghoff) wrote :

No, it's not supposed to be there by default. Just create a new file :)

The above workaround works for me, but I need to change the file name to include extension .conf, ex: sdhci.conf

Follow again the WORKAROUND:
  1. Add the following to /etc/modprobe.d/sdhci.conf:
          options sdhci debug_quirks2=4
  2. Re-generate initrd:
         sudo update-initramfs -u -k all
  3. Reboot or reload sdhci module:
         sudo rmmod sdhci-pci sdhci
         sudo modprobe sdhci
         sudo modprobe sdhci-pci

It works fine to me :-)

This bug is confirmed on Ubuntu 15.10 kernal:

Linux ruda-MacBookPro 4.2.0-23-generic #28-Ubuntu SMP Sun Dec 27 17:47:31 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux

Luca Ciavatta (cialu) wrote :

Bug still exist on Ubuntu 16.04 and above workarounds don't work.

Linux andromeda 4.8.0-34-generic #36-Ubuntu SMP Wed Dec 21 17:24:18 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux

Luca Ciavatta (cialu) wrote :

Tried this (a mix of above workarounds) and it worked for the first use of the SD card reader, but if remove the card and put it in again, it isn't recognized. I must do this workaround one more time to make sd card reader working again.

1. Add following to /etc/rc.local:
   setpci -s 00:1c.2 0x50.B=0x41

2. Add to /etc/apm/resume.d/21aspm:
   setpci -s 00:1c.2 0x50.B=0x41

3. Add to /etc/modprobe.d/sdhci:
   options sdhci debug_quirks2=4

4. Regenerate initrd:
   sudo update-initramfs -u -k all

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers

Remote bug watches

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