Skip to content

Instantly share code, notes, and snippets.

@samgooi4189
Last active November 3, 2024 04:57
Show Gist options
  • Save samgooi4189/2e6e18fd1d562acaf39246e5e386d7cb to your computer and use it in GitHub Desktop.
Save samgooi4189/2e6e18fd1d562acaf39246e5e386d7cb to your computer and use it in GitHub Desktop.
Fixing Broadcom Corporation BCM57765/57785 SDXC/MMC Card Reader
Follow the WORKAROUND:
1. Add a comand to /etc/rc.local, add the following line above "exit 0":
setpci -s 00:1c.2 0x50.B=0x41
2. Add the same comand to /etc/apm/resume.d/21aspm (which does not exist yet):
setpci -s 00:1c.2 0x50.B=0x41
3. Add the following to /etc/modprobe.d/sdhci.conf:
options sdhci debug_quirks2=4
4. Re-generate initrd:
sudo update-initramfs -u -k all
5. Reboot or reload sdhci module:
sudo rmmod sdhci-pci sdhci
sudo modprobe sdhci
sudo modprobe sdhci-pci
If SD card still not detected after reboot, type this in command line:
$ sudo setpci -s 00:1c.2 0x50.B=0x41
Tested on Acer V5-171
Reference:
https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1307674
https://wiki.allensmith.net/kb:linux:14lts-bcm57765-bmc57785
@enrigo
Copy link

enrigo commented Mar 19, 2020

Hi,
the fix doesn't work 100% on my ACER AO 756 running Leap 15.1:

  • mount: ok
  • read: ok
  • write: only few and small files at a time. If I increase the size and/or the nr. of files to be copied on the SD card, the process starts but after a while it hangs.
    Any hint?

@Orynik
Copy link

Orynik commented Aug 13, 2020

Thank you very much!
But in my case me needed in the 3rd paragraph change command by:
options sdhci debug_quirks=0x40 debug_quirks2=0x4

@gitpalashub
Copy link

Thank You so much!
Worked on Apire V3-571 running Xubuntu 18.04.

Plus for first step of this solution, /etc/rc.local don't existis on 18.04, so first create sudo touch /etc/rc.local and make it executable sudo chmod +x /etc/rc.local

After just edit /etc/rc.local and add the content of first step like bellow:

#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.

setpci -s 00:1c.2 0x50.B=0x41

exit 0

[]'s

I was having the same problem, there was no such file as "rc.local". As soon as I created the file, my SDHC card showed up. It was quite frustrating. But the thing with linux is that we get to learn new things.

@scm-unimelb
Copy link

Thank you. Worked on iMac14,2 after trying many other solutions to make SD card / reader recognisable....

Kernel: 5.4.0-47-generic x86_64 bits: 64 compiler: gcc v: 7.5.0
Desktop: Cinnamon 4.4.8 wm: muffin dm: LightDM Distro: Linux Mint 19.3 Tricia
base: Ubuntu 18.04 bionic

@guilbep
Copy link

guilbep commented Oct 22, 2020

Thank you. Worked perfectly on mac mini 5,1 mid-2011. Also thanks @viniciusdaniel https://gist.github.com/samgooi4189/2e6e18fd1d562acaf39246e5e386d7cb#gistcomment-3066660

Kernel 5.4.0-52-generic x86_64
Base: Ubuntu 20.04.1 LTS

lshw

    description: Lunch Box Computer
    product: Macmini5,1 (System SKU#)
    vendor: Apple Inc.
    version: 1.0

@wandercn
Copy link

感谢,我使用 options sdhci debug_quirks=0x40 debug_quirks2=0x4 解决了问题,就是写的速度比慢点,好歹能用。
我的环境:
`
Distributor ID: Ubuntu
Description: Ubuntu 20.04.4 LTS
Release: 20.04
Codename: focal

macbookpro 13 retina late 2012 + Ubuntu20.0.4
`

lsm@lsm-MacBookPro:~$ lspci|grep SD
02:00.1 SD Host controller: Broadcom Inc. and subsidiaries BCM57765/57785 SDXC/MMC Card Reader (rev 21)
获取到SD卡槽的编号为02:00.1 ,从上面的命令查询的结果的开头编号部分,如下的命令里会使用到这个编号02:00.1。
`Follow the WORKAROUND:

  1. Add a comand to /etc/rc.local, add the following line above "exit 0": (这步我省略了)
    setpci -s 02:00.1 0x50.B=0x41
  2. Add the same comand to /etc/apm/resume.d/21aspm (which does not exist yet):
    setpci -s 02:00.1 0x50.B=0x41
  3. Add the following to /etc/modprobe.d/sdhci.conf:
    options sdhci debug_quirks=0x40 debug_quirks2=0x4
  4. Re-generate initrd:
    sudo update-initramfs -u -k all
  5. Reboot or reload sdhci module:
    sudo rmmod sdhci-pci sdhci
    sudo modprobe sdhci
    sudo modprobe sdhci-pci

`

@lusacramento
Copy link

Obrigado! Resolveu no meu Mac Book Pro 2011/2012 late

@ancho85
Copy link

ancho85 commented Aug 15, 2022

for setpci to work, secure boot must be disabled at bios level.

@thanksmintmate
Copy link

Guy you have a paid beer if you come to Milan Italy. It worked also on a Acer AO756 , you are great!!!

@rjhornsby
Copy link

thanks! Got a 2011 Macbook pro (8,1) working because of this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment