Skip to content

Instantly share code, notes, and snippets.

@samgooi4189
Last active April 19, 2024 04:20
Show Gist options
  • Star 22 You must be signed in to star a gist
  • Fork 5 You must be signed in to fork a gist
  • 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
@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