Skip to contentSkip to conversation

mmc-utils: ioctl connection timed out with SD cards

DISCUSSION Dominik 'Rathann' Mierzejewski 2 participants 9 messages Apr 3, 2023 – Apr 25, 2023 MMC, SD and SDIO

lore
Share & tools
lore
#0 lore raw

Hello,
is the mmc tool from mmc-utils supposed to work with SD cards? I tried mmc status get /dev/mmcblkN with three different SD cards on two different machines (Pinebook Pro and a Sony laptop) and I get the same error on both:

# mmc status get /dev/mmcblk0
ioctl: Connection timed out
Could not read response to SEND_STATUS from /dev/mmcblk0

dmesg on the Sony machine shows:

[ 1291.196547] mmc0: new SD card at address aaaa
[ 1291.196834] mmcblk0: mmc0:aaaa SD01G 969 MiB 
[ 1291.200263]  mmcblk0: p1 p2 p3
[ 1306.273160] rtsx_pci_sdmmc rtsx_pci_sdmmc.0: __mmc_blk_ioctl_cmd: cmd error -110
[ 1306.276978]  mmcblk0: p1 p2 p3

I'm able to get status of the internal eMMC device on Pinebook Pro with no errors. extcsd read works fine, too.

I'm running Fedora 38 with kernel 6.2.9 on both machines if that helps.

Regards,
Dominik

Signature · 4 lines
Fedora   https://getfedora.org  |  RPM Fusion  http://rpmfusion.org
There should be a science of discontent. People need hard times and
oppression to develop psychic muscles.
        -- from "Collected Sayings of Muad'Dib" by the Princess Irulan
#1 lore raw
Quoted 2 lines

Hello,
is the mmc tool from mmc-utils supposed to work with SD cards?

Not really no, but status get is pretty much the one thing that should work, apart from register reads that don't issue anything. I'm using RK3399 on SD too and it works okay for me, will try updating tomorrow.
Could you show the debug prints to see the mmc command / responses?
Ideally for anything in mmc/core

Quoted 6 lines

I tried mmc status get /dev/mmcblkN with three different SD cards on two different machines (Pinebook Pro and a Sony laptop) and I get the same error on both:

# mmc status get /dev/mmcblk0
ioctl: Connection timed out
Could not read response to SEND_STATUS from /dev/mmcblk0

dmesg on the Sony machine shows:

Quoted 14 lines
[ 1291.196547] mmc0: new SD card at address aaaa [ 1291.196834] mmcblk0: mmc0:aaaa SD01G 969 MiB [ 1291.200263]  mmcblk0: p1 p2 p3 [ 1306.273160] rtsx_pci_sdmmc rtsx_pci_sdmmc.0: __mmc_blk_ioctl_cmd: cmd error -110 [ 1306.276978]  mmcblk0: p1 p2 p3

I'm able to get status of the internal eMMC device on Pinebook Pro with no errors. extcsd read works fine, too.

I'm running Fedora 38 with kernel 6.2.9 on both machines if that helps.

Regards,
Dominik

Signature · 3 lines
Fedora   https://getfedora.org  |  RPM Fusion  http://rpmfusion.org
There should be a science of discontent. People need hard times and oppression to develop psychic muscles.
       -- from "Collected Sayings of Muad'Dib" by the Princess Irulan

Hyperstone GmbH | Reichenaustr. 39a | 78467 Konstanz Managing Director: Dr. Jan Peter Berns. Commercial register of local courts: Freiburg HRB381782

#2 lore raw
Quoted 8 lines

Hello,
is the mmc tool from mmc-utils supposed to work with SD cards?
I tried mmc status get /dev/mmcblkN with three different SD cards on two different machines (Pinebook Pro and a Sony laptop) and I get the same error on both:

# mmc status get /dev/mmcblk0
ioctl: Connection timed out
Could not read response to SEND_STATUS from /dev/mmcblk0

Could you try something like
sudo dd if=/dev/mmcblk0 of=/dev/null count=1 iflag=direct; sudo mmc status get /dev/mmcblk0 just to rule out anything in the autosuspend direction?

Hyperstone GmbH | Reichenaustr. 39a | 78467 Konstanz Managing Director: Dr. Jan Peter Berns. Commercial register of local courts: Freiburg HRB381782

#3 lore raw

Hello, Christian.

Quoted 11 lines · Christian Löhle
Quoted 7 lines

is the mmc tool from mmc-utils supposed to work with SD cards? I tried mmc status get /dev/mmcblkN with three different SD cards on two different machines (Pinebook Pro and a Sony laptop) and I get the same error on both:

# mmc status get /dev/mmcblk0
ioctl: Connection timed out
Could not read response to SEND_STATUS from /dev/mmcblk0

Could you try something like
sudo dd if=/dev/mmcblk0 of=/dev/null count=1 iflag=direct; sudo mmc status get /dev/mmcblk0 just to rule out anything in the autosuspend direction?

I did, same error:

$ sudo dd if=/dev/mmcblk0 of=/dev/null count=1 iflag=direct; sudo mmc status get /dev/mmcblk0
1+0 records in
1+0 records out
512 bytes copied, 0.000832209 s, 615 kB/s
ioctl: Connection timed out
Could not read response to SEND_STATUS from /dev/mmcblk0

And there's a corresponding

[ 3540.312203] rtsx_pci_sdmmc rtsx_pci_sdmmc.0: __mmc_blk_ioctl_cmd: cmd error -110

in dmesg.

This is on a third machine, a Dell laptop (though the SD card reader is driven by the same rtsx_pci_sdmmc driver as in the Sony case).

Regards,
Dominik

Signature · 4 lines
Fedora   https://getfedora.org  |  RPM Fusion  http://rpmfusion.org
There should be a science of discontent. People need hard times and
oppression to develop psychic muscles.
        -- from "Collected Sayings of Muad'Dib" by the Princess Irulan
#4 lore raw
In reply to Christian Löhle
Quoted 4 lines · Christian Löhle
Quoted 2 lines

Hello,
is the mmc tool from mmc-utils supposed to work with SD cards?

Not really no, but status get is pretty much the one thing that should work, apart from register reads that don't issue anything.

I see. I thought any /dev/mmcblk? device would be supported. The documentation doesn't make this clear. :)

Quoted 4 lines

I'm using RK3399 on SD too and it works okay for me, will try updating tomorrow.
Could you show the debug prints to see the mmc command / responses? Ideally for anything in mmc/core

Will something like:

# alias ddcmd='echo $* > /proc/dynamic_debug/control'
# ddcmd 'module mmc_core +p'
# ddcmd 'module rtsx_pci_sdmmc +p'
# mmc status get /dev/mmcblk0
# dmesg | grep -E 'mmc_core|rtsx_pci_sdmmc'

suffice?

Regards,
Dominik

Signature · 4 lines
Fedora   https://getfedora.org  |  RPM Fusion  http://rpmfusion.org
There should be a science of discontent. People need hard times and
oppression to develop psychic muscles.
        -- from "Collected Sayings of Muad'Dib" by the Princess Irulan
#5 lore raw

Looks ok to me but haven't tried it yet, I would be especially looking for e.g. mmc_request_done log, I would expect at least a mmc_command structure shown there there with Opcode 13 and some resp[0,1,2,3] values. If you see that than I'd say that is good.

-----Original Message-----
From: Dominik 'Rathann' Mierzejewski <[email protected]>
Sent: Dienstag, 4. April 2023 12:09
To: [email protected]
Subject: Re: mmc-utils: ioctl connection timed out with SD cards

Quoted 4 lines · Christian Löhle
Quoted 2 lines

Hello,
is the mmc tool from mmc-utils supposed to work with SD cards?

Not really no, but status get is pretty much the one thing that should work, apart from register reads that don't issue anything.

I see. I thought any /dev/mmcblk? device would be supported. The documentation doesn't make this clear. :)

Quoted 4 lines

I'm using RK3399 on SD too and it works okay for me, will try updating tomorrow.
Could you show the debug prints to see the mmc command / responses? Ideally for anything in mmc/core

Will something like:

# alias ddcmd='echo $* > /proc/dynamic_debug/control'
# ddcmd 'module mmc_core +p'
# ddcmd 'module rtsx_pci_sdmmc +p'
# mmc status get /dev/mmcblk0
# dmesg | grep -E 'mmc_core|rtsx_pci_sdmmc'

suffice?

Regards,
Dominik

Signature · 7 lines
Fedora   https://getfedora.org  |  RPM Fusion  http://rpmfusion.org
There should be a science of discontent. People need hard times and oppression to develop psychic muscles.
        -- from "Collected Sayings of Muad'Dib" by the Princess Irulan

Hyperstone GmbH | Reichenaustr. 39a  | 78467 Konstanz
Managing Director: Dr. Jan Peter Berns.
Commercial register of local courts: Freiburg HRB381782
#6 lore raw
In reply to Dominik 'Rathann' Mierzejewski

Nevermind, I can reproduce the issue on my own Pinebook Pro, Ill take a look at it tomorrow.

-----Original Message-----
From: Dominik 'Rathann' Mierzejewski <[email protected]>
Sent: Tuesday, April 4, 2023 12:09 PM
To: [email protected]
Subject: Re: mmc-utils: ioctl connection timed out with SD cards

Quoted 4 lines · Christian Löhle
Quoted 2 lines

Hello,
is the mmc tool from mmc-utils supposed to work with SD cards?

Not really no, but status get is pretty much the one thing that should work, apart from register reads that don't issue anything.

I see. I thought any /dev/mmcblk? device would be supported. The documentation doesn't make this clear. :)

Quoted 4 lines

I'm using RK3399 on SD too and it works okay for me, will try updating tomorrow.
Could you show the debug prints to see the mmc command / responses? Ideally for anything in mmc/core

Will something like:

# alias ddcmd='echo $* > /proc/dynamic_debug/control'
# ddcmd 'module mmc_core +p'
# ddcmd 'module rtsx_pci_sdmmc +p'
# mmc status get /dev/mmcblk0
# dmesg | grep -E 'mmc_core|rtsx_pci_sdmmc'

suffice?

Regards,
Dominik

Signature · 7 lines
Fedora   https://getfedora.org  |  RPM Fusion  http://rpmfusion.org
There should be a science of discontent. People need hard times and oppression to develop psychic muscles.
        -- from "Collected Sayings of Muad'Dib" by the Princess Irulan

Hyperstone GmbH | Reichenaustr. 39a  | 78467 Konstanz
Managing Director: Dr. Jan Peter Berns.
Commercial register of local courts: Freiburg HRB381782
#7 lore raw
In reply to Dominik 'Rathann' Mierzejewski

The problem is the harcoded 0x0001 as RCA, sdcards have whatever the vendor thinks is right.
I can send a fix for that tomorrow, but generally mmc-utils isn't much useful for SD cards, most mmc-utils features are eMMC-only features anyway. Softreset works as expected, for byte-addressed we can use grouped wp.
I was thinking about adding TMP_WRITE_PROTECT for both, maybe unlock, too.
And also adapt erase.
Apart from that do you have any features that you can think of?
SD just doesn't have that many features that are used outside of normal IO operation.
Another candidate would be FULE, but cards that support it are rare.

Regards,
Christian

-----Original Message-----
From: Dominik 'Rathann' Mierzejewski <[email protected]>
Sent: Tuesday, April 4, 2023 12:09 PM
To: [email protected]
Subject: Re: mmc-utils: ioctl connection timed out with SD cards

Quoted 4 lines · Christian Löhle
Quoted 2 lines

Hello,
is the mmc tool from mmc-utils supposed to work with SD cards?

Not really no, but status get is pretty much the one thing that should work, apart from register reads that don't issue anything.

I see. I thought any /dev/mmcblk? device would be supported. The documentation doesn't make this clear. :)

Quoted 4 lines

I'm using RK3399 on SD too and it works okay for me, will try updating tomorrow.
Could you show the debug prints to see the mmc command / responses? Ideally for anything in mmc/core

Will something like:

# alias ddcmd='echo $* > /proc/dynamic_debug/control'
# ddcmd 'module mmc_core +p'
# ddcmd 'module rtsx_pci_sdmmc +p'
# mmc status get /dev/mmcblk0
# dmesg | grep -E 'mmc_core|rtsx_pci_sdmmc'

suffice?

Regards,
Dominik

Signature · 7 lines
Fedora   https://getfedora.org  |  RPM Fusion  http://rpmfusion.org
There should be a science of discontent. People need hard times and oppression to develop psychic muscles.
        -- from "Collected Sayings of Muad'Dib" by the Princess Irulan

Hyperstone GmbH | Reichenaustr. 39a  | 78467 Konstanz
Managing Director: Dr. Jan Peter Berns.
Commercial register of local courts: Freiburg HRB381782
#8 lore raw

Hi, Christian.

Quoted 9 lines · Christian Löhle

The problem is the harcoded 0x0001 as RCA, sdcards have whatever the vendor thinks is right.
I can send a fix for that tomorrow, but generally mmc-utils isn't much useful for SD cards, most mmc-utils features are eMMC-only features anyway.
Softreset works as expected, for byte-addressed we can use grouped wp. I was thinking about adding TMP_WRITE_PROTECT for both, maybe unlock, too. And also adapt erase.
Apart from that do you have any features that you can think of?

Not really. I'm not familiar with SD card internals or MMC internals, for that matter. I think you've already done more than I expected after my rather naive e-mail, so thank you very much. If mmc-utils can be fixed to give meaningful error messages when someone tries to use them on SD cards after being confused by the device naming of the kernel like myself then I'm happy with that.

Quoted 2 lines

SD just doesn't have that many features that are used outside of normal IO operation.

I see. Thanks for the insight.

Best regards,
Dominik

Signature · 4 lines
Fedora   https://getfedora.org  |  RPM Fusion  http://rpmfusion.org
There should be a science of discontent. People need hard times and
oppression to develop psychic muscles.
        -- from "Collected Sayings of Muad'Dib" by the Princess Irulan