MacBookPro8,1 mmc card reader had a flash of reliability

Issues and / or general discussion relating to Puppy

Moderator: Forum moderators

Post Reply
jfw01
Posts: 19
Joined: Thu Aug 12, 2021 3:16 am
Location: New Zealand
Has thanked: 3 times
Been thanked: 2 times

MacBookPro8,1 mmc card reader had a flash of reliability

Post by jfw01 »

This post is a cousin to: https://www.forum.puppylinux.com/viewto ... dhc#p48466

I am using a MacBookPro8,1 laptop with a Broadcom SD-card slot:
# lspci | fgrep -i mmc
02:00.1 SD Host controller: Broadcom Inc. and subsidiaries BCM57765/57785 SDXC/MMC Card Reader (rev 10)

OSX 10.6.8 will read and write at least two SD cards in that slot,
an older micro 32GB in a shim, and a newer 64GB.
Both cards will read and write satisfactorily on puppy in a Transcend-branded SD-card to USB dongle.

When I insert them directly into either puppy Bionic or puppy Fossa,
I get missed interrupts in dmesg, performance that varies between
abysmal and nonexistent, and insufficient reliability to use.

Sample errors from UPupFF+D 21.02+9 (kernel 5.4.81-pup32),
loading the older, smaller card first,
and getting unexpected reliability from the newer card:

Code: Select all

[  345.455480] mmc0: new ultra high speed SDR104 SDHC card at address 0001
[  345.456122] mmcblk0: mmc0:0001 EB1QT 29.8 GiB 
[  355.643379] mmc0: Timeout waiting for hardware interrupt.
[  355.643383] mmc0: sdhci: ============ SDHCI REGISTER DUMP ===========
[  355.643461] mmc0: sdhci: Sys addr:  0x000010c8 | Version:  0x00001502
[  355.643467] mmc0: sdhci: Blk size:  0x00007200 | Blk cnt:  0x00000000
[  355.643474] mmc0: sdhci: Argument:  0x00000000 | Trn mode: 0x0000003b
[  355.643480] mmc0: sdhci: Present:   0x1fff0000 | Host ctl: 0x0000001f
[  355.643486] mmc0: sdhci: Power:     0x0000000f | Blk gap:  0x00000000
[  355.643492] mmc0: sdhci: Wake-up:   0x00000000 | Clock:    0x00000007
[  355.643498] mmc0: sdhci: Timeout:   0x0000000a | Int stat: 0x00000000
[  355.643505] mmc0: sdhci: Int enab:  0x03ff008b | Sig enab: 0x03ff008b
[  355.643511] mmc0: sdhci: ACmd stat: 0x00000000 | Slot int: 0x00000000
[  355.643517] mmc0: sdhci: Caps:      0x176ec8b0 | Caps_1:   0x03002177
[  355.643523] mmc0: sdhci: Cmd:       0x0000123a | Max curr: 0x00000000
[  355.643529] mmc0: sdhci: Resp[0]:   0x00000900 | Resp[1]:  0x00000900
[  355.643536] mmc0: sdhci: Resp[2]:   0x00000900 | Resp[3]:  0x00000900
[  355.643539] mmc0: sdhci: Host ctl2: 0x0000804b
[  355.643549] mmc0: sdhci: ADMA Err:  0x00000001 | ADMA Ptr: 0x000000002e2bd204
[  355.643550] mmc0: sdhci: ============================================
[  355.643582] mmc0: Unexpected interrupt 0x04000000.
[  355.643584] mmc0: sdhci: ============ SDHCI REGISTER DUMP ===========
[  355.643590] mmc0: sdhci: Sys addr:  0x00000000 | Version:  0x00001502
[  355.643596] mmc0: sdhci: Blk size:  0x00007200 | Blk cnt:  0x00000000
[  355.643602] mmc0: sdhci: Argument:  0x00000000 | Trn mode: 0x00000033
[  355.643608] mmc0: sdhci: Present:   0x1fff0001 | Host ctl: 0x0000001e
[  355.643615] mmc0: sdhci: Power:     0x0000000f | Blk gap:  0x00000000
[  355.643622] mmc0: sdhci: Wake-up:   0x00000000 | Clock:    0x00000007
[  355.643629] mmc0: sdhci: Timeout:   0x0000000a | Int stat: 0x00000000
[  355.643635] mmc0: sdhci: Int enab:  0x03ff008b | Sig enab: 0x03ff008b
[  355.643643] mmc0: sdhci: ACmd stat: 0x00000000 | Slot int: 0x00000000
[  355.643653] mmc0: sdhci: Caps:      0x176ec8b0 | Caps_1:   0x03002177
[  355.643659] mmc0: sdhci: Cmd:       0x00000d1a | Max curr: 0x00000000
[  355.643665] mmc0: sdhci: Resp[0]:   0x00400900 | Resp[1]:  0x00000000
[  355.643670] mmc0: sdhci: Resp[2]:   0x00000000 | Resp[3]:  0x00000000
[  355.643674] mmc0: sdhci: Host ctl2: 0x0000800b
[  355.643683] mmc0: sdhci: ADMA Err:  0x00000001 | ADMA Ptr: 0x000000002e2bd204
[  355.643685] mmc0: sdhci: ============================================
[  361.879131] mmc0: card 0001 removed
[  405.050552] mmc0: Skipping voltage switch
[  406.847875] mmc0: new high speed SDXC card at address aaaa
[  406.848410] mmcblk0: mmc0:aaaa SD64G 59.5 GiB (ro)
[  406.849496]  mmcblk0: p1 p2 p3

Sample errors, loading the newer card first:

Code: Select all

[  537.157644] mmc0: new ultra high speed SDR104 SDXC card at address aaaa
[  537.158977] mmcblk0: mmc0:aaaa SD64G 59.5 GiB 
[  547.415593] mmc0: Timeout waiting for hardware interrupt.
[  547.415600] mmc0: sdhci: ============ SDHCI REGISTER DUMP ===========
[  547.415639] mmc0: sdhci: Sys addr:  0x000010c8 | Version:  0x00001502
[  547.415647] mmc0: sdhci: Blk size:  0x00007200 | Blk cnt:  0x00000000
[  547.415654] mmc0: sdhci: Argument:  0x00000000 | Trn mode: 0x0000003b
[  547.415661] mmc0: sdhci: Present:   0x1fff0000 | Host ctl: 0x0000001f
[  547.415668] mmc0: sdhci: Power:     0x0000000f | Blk gap:  0x00000000
[  547.415675] mmc0: sdhci: Wake-up:   0x00000000 | Clock:    0x00000007
[  547.415682] mmc0: sdhci: Timeout:   0x0000000a | Int stat: 0x00000000
[  547.415689] mmc0: sdhci: Int enab:  0x03ff008b | Sig enab: 0x03ff008b
[  547.415695] mmc0: sdhci: ACmd stat: 0x00000000 | Slot int: 0x00000000
[  547.415703] mmc0: sdhci: Caps:      0x176ec8b0 | Caps_1:   0x03002177
[  547.415710] mmc0: sdhci: Cmd:       0x0000123a | Max curr: 0x00000000
[  547.415717] mmc0: sdhci: Resp[0]:   0x00000900 | Resp[1]:  0x00000900
[  547.415723] mmc0: sdhci: Resp[2]:   0x00000900 | Resp[3]:  0x00000900
[  547.415728] mmc0: sdhci: Host ctl2: 0x0000804b
[  547.415738] mmc0: sdhci: ADMA Err:  0x00000001 | ADMA Ptr: 0x000000002ea68204
[  547.415740] mmc0: sdhci: ============================================
[  547.415816] mmc0: Unexpected interrupt 0x04000000.
[  547.415825] mmc0: sdhci: ============ SDHCI REGISTER DUMP ===========
[  547.415835] mmc0: sdhci: Sys addr:  0x00000000 | Version:  0x00001502
[  547.415843] mmc0: sdhci: Blk size:  0x00007200 | Blk cnt:  0x00000000
[  547.415851] mmc0: sdhci: Argument:  0x00000000 | Trn mode: 0x00000033
[  547.415859] mmc0: sdhci: Present:   0x1fff0000 | Host ctl: 0x0000001e
[  547.415868] mmc0: sdhci: Power:     0x0000000f | Blk gap:  0x00000000
[  547.415878] mmc0: sdhci: Wake-up:   0x00000000 | Clock:    0x00000007
[  547.415886] mmc0: sdhci: Timeout:   0x0000000a | Int stat: 0x00000001
[  547.415895] mmc0: sdhci: Int enab:  0x03ff008b | Sig enab: 0x03ff008b
[  547.415902] mmc0: sdhci: ACmd stat: 0x00000000 | Slot int: 0x00000001
[  547.415911] mmc0: sdhci: Caps:      0x176ec8b0 | Caps_1:   0x03002177
[  547.415919] mmc0: sdhci: Cmd:       0x00000d1a | Max curr: 0x00000000
[  547.415927] mmc0: sdhci: Resp[0]:   0x00400900 | Resp[1]:  0x00000000
[  547.415935] mmc0: sdhci: Resp[2]:   0x00000000 | Resp[3]:  0x00000000
[  547.415942] mmc0: sdhci: Host ctl2: 0x0000800b
[  547.415954] mmc0: sdhci: ADMA Err:  0x00000001 | ADMA Ptr: 0x000000002ea68204
[  547.415956] mmc0: sdhci: ============================================

EDIT:
All of the insertions which share bad performance, share the absence of:
[ 405.050552] mmc0: Skipping voltage switch

I now have a procedure for forcing that message.

  • Follow dmesg (eg dmesg -w on fossa; not available on bionic
    Insert the card.
    Wait for the pair of messages about interrupts.
    Pull and push the card (probably within about 5 seconds).
    When the insertion is recognized, the convenient message appears also.

My theory of the fault is that 'switching the power' traumatizes the card, and that commands are being sent before it is ready to receive them.

Sample output from this procedure:

Code: Select all

[ 5877.056869] mmc0: sdhci: ============ SDHCI REGISTER DUMP ===========
<snip>
[ 5877.056995] mmc0: sdhci: ============================================
[ 5881.171193] mmc0: card aaaa removed
[ 5891.224821] mmc0: Skipping voltage switch
[ 5892.515853] mmc0: new high speed SDXC card at address aaaa
[ 5892.516330] mmcblk0: mmc0:aaaa SD64G 59.5 GiB 
[ 5892.520082]  mmcblk0: p1 p2 p3                                       [i]partitions are visible because the card is readable[/i]

EDIT2:
This: https://www.kingston.com/datasheets/SDC ... 4gb_us.pdf specifies bring-up procedures for a particular vendor's SD cards, including delays after power-on.

Please advise the next steps in debugging this, ideally on puppy Fossa.

User avatar
Phoenix
Posts: 339
Joined: Fri Feb 12, 2021 2:03 am
Location: Canada
Has thanked: 4 times
Been thanked: 48 times

Re: MacBookPro8,1 mmc card reader had a flash of reliability

Post by Phoenix »

This was an issue before, and solved here: https://askubuntu.com/questions/1297047 ... ard-reader

The write rates will be akin to USB 2.0 speeds though.

Code: Select all

rmmod sdhci_pci sdhci
modprobe sdhci debug_quirks2=4
modprobe sdhci_pci

It's not permanent though, so it will need to be called every time. (via /etc/init.d or /etc/rc.d or the Startup directory in root)

IRC: firepup | Time to hack Puppy!

jfw01
Posts: 19
Joined: Thu Aug 12, 2021 3:16 am
Location: New Zealand
Has thanked: 3 times
Been thanked: 2 times

Re: MacBookPro8,1 mmc card reader had a flash of reliability

Post by jfw01 »

Thanks; it's definitely the same fault.

The naive version of the fix (in a shell) is not working for me in already-running puppy Fossa 32:

Code: Select all

+ rmmod sdhci_pci sdhci
rmmod: ERROR: Module sdhci_pci is builtin.
rmmod: ERROR: Module sdhci is builtin.
+ modprobe sdhci 'debug_quirks2=4'
+ modprobe sdhci_pci

and the usual dmesg and general failure.

I have also put it into rc.local, after which I had the usual symptoms.

When I put:
sdhci.debug_quirks2=4
on the kernel command-line, as recommended here:
https://www.kernel.org/doc/html/v4.14/a ... eters.html
things seem good.

Beyond editing grub.cfg and remastering, is there a more permanent fix within the file-system, or is the next step a kernel rebuild?

If the second, is there a good plan for building a kernel with github actions, with the configuration done in the middle, on a constrained puppy machine?

(If not, I'm trying to imagine it, and I think that it starts with turning the source tree into an sfs, and mounting it somewhere with a read-write layer on top, then making the read-write layer into an sfs and taking it back to github.)

User avatar
Phoenix
Posts: 339
Joined: Fri Feb 12, 2021 2:03 am
Location: Canada
Has thanked: 4 times
Been thanked: 48 times

Re: MacBookPro8,1 mmc card reader had a flash of reliability

Post by Phoenix »

It's not been fixed.. at all, even with the 5th mainline kernels. Your only options is to keep passing that value in. I would suggest looking at Woof-CE https://github.com/puppylinux-woof-CE/woof-CE if you want to get into kernel stuff. It packages everything including kernel sources (they auto delete after 14 days, so make sure you keep them!)

IRC: firepup | Time to hack Puppy!

jfw01
Posts: 19
Joined: Thu Aug 12, 2021 3:16 am
Location: New Zealand
Has thanked: 3 times
Been thanked: 2 times

Re: MacBookPro8,1 mmc card reader had a flash of reliability

Post by jfw01 »

I've recently discovered that the debug_quirks2 workaround works only if the wifi is on.

That suggests that either:

  • requests are numbered and the SD controller ignores some numbers, which get allocated to the wifi, or

  • there is some power interaction between the two pieces of hardware.

These theories don't explain the flashes of reliability without the workaround.

Post Reply

Return to “Users”