public inbox for linux-mmc@vger.kernel.org
 help / color / mirror / Atom feed
* mmc-utils: ioctl connection timed out with SD cards
@ 2023-04-03 17:51 Dominik 'Rathann' Mierzejewski
  2023-04-03 20:11 ` Christian Löhle
  0 siblings, 1 reply; 9+ messages in thread
From: Dominik 'Rathann' Mierzejewski @ 2023-04-03 17:51 UTC (permalink / raw)
  To: linux-mmc

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
-- 
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

^ permalink raw reply	[flat|nested] 9+ messages in thread

* RE: mmc-utils: ioctl connection timed out with SD cards
  2023-04-03 17:51 mmc-utils: ioctl connection timed out with SD cards Dominik 'Rathann' Mierzejewski
@ 2023-04-03 20:11 ` Christian Löhle
  2023-04-04  6:14   ` Christian Löhle
  2023-04-04 10:08   ` Dominik 'Rathann' Mierzejewski
  0 siblings, 2 replies; 9+ messages in thread
From: Christian Löhle @ 2023-04-03 20:11 UTC (permalink / raw)
  To: Dominik 'Rathann' Mierzejewski, linux-mmc@vger.kernel.org

>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

>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
>-- 
>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


^ permalink raw reply	[flat|nested] 9+ messages in thread

* RE: mmc-utils: ioctl connection timed out with SD cards
  2023-04-03 20:11 ` Christian Löhle
@ 2023-04-04  6:14   ` Christian Löhle
  2023-04-04  9:29     ` Dominik 'Rathann' Mierzejewski
  2023-04-04 10:08   ` Dominik 'Rathann' Mierzejewski
  1 sibling, 1 reply; 9+ messages in thread
From: Christian Löhle @ 2023-04-04  6:14 UTC (permalink / raw)
  To: Christian Löhle, Dominik 'Rathann' Mierzejewski,
	linux-mmc@vger.kernel.org
  Cc: linux-mmc@vger.kernel.org



> 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


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: mmc-utils: ioctl connection timed out with SD cards
  2023-04-04  6:14   ` Christian Löhle
@ 2023-04-04  9:29     ` Dominik 'Rathann' Mierzejewski
  0 siblings, 0 replies; 9+ messages in thread
From: Dominik 'Rathann' Mierzejewski @ 2023-04-04  9:29 UTC (permalink / raw)
  To: linux-mmc@vger.kernel.org

Hello, Christian.

On Tuesday, 04 April 2023 at 08:14, Christian Löhle wrote:
> > 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
-- 
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

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: mmc-utils: ioctl connection timed out with SD cards
  2023-04-03 20:11 ` Christian Löhle
  2023-04-04  6:14   ` Christian Löhle
@ 2023-04-04 10:08   ` Dominik 'Rathann' Mierzejewski
  2023-04-04 11:40     ` Christian Löhle
                       ` (2 more replies)
  1 sibling, 3 replies; 9+ messages in thread
From: Dominik 'Rathann' Mierzejewski @ 2023-04-04 10:08 UTC (permalink / raw)
  To: linux-mmc@vger.kernel.org

On Monday, 03 April 2023 at 22:11, Christian Löhle wrote:
> >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. :)

> 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
-- 
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

^ permalink raw reply	[flat|nested] 9+ messages in thread

* RE: mmc-utils: ioctl connection timed out with SD cards
  2023-04-04 10:08   ` Dominik 'Rathann' Mierzejewski
@ 2023-04-04 11:40     ` Christian Löhle
  2023-04-04 17:18     ` Christian Löhle
  2023-04-04 17:32     ` Christian Löhle
  2 siblings, 0 replies; 9+ messages in thread
From: Christian Löhle @ 2023-04-04 11:40 UTC (permalink / raw)
  To: Dominik 'Rathann' Mierzejewski, linux-mmc@vger.kernel.org

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 <dominik@greysector.net> 
Sent: Dienstag, 4. April 2023 12:09
To: linux-mmc@vger.kernel.org
Subject: Re: mmc-utils: ioctl connection timed out with SD cards

On Monday, 03 April 2023 at 22:11, Christian Löhle wrote:
> >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. :)

> 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
-- 
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


^ permalink raw reply	[flat|nested] 9+ messages in thread

* RE: mmc-utils: ioctl connection timed out with SD cards
  2023-04-04 10:08   ` Dominik 'Rathann' Mierzejewski
  2023-04-04 11:40     ` Christian Löhle
@ 2023-04-04 17:18     ` Christian Löhle
  2023-04-04 17:32     ` Christian Löhle
  2 siblings, 0 replies; 9+ messages in thread
From: Christian Löhle @ 2023-04-04 17:18 UTC (permalink / raw)
  To: Dominik 'Rathann' Mierzejewski, linux-mmc@vger.kernel.org

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

-----Original Message-----
From: Dominik 'Rathann' Mierzejewski <dominik@greysector.net> 
Sent: Tuesday, April 4, 2023 12:09 PM
To: linux-mmc@vger.kernel.org
Subject: Re: mmc-utils: ioctl connection timed out with SD cards

On Monday, 03 April 2023 at 22:11, Christian Löhle wrote:
> >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. :)

> 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
-- 
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


^ permalink raw reply	[flat|nested] 9+ messages in thread

* RE: mmc-utils: ioctl connection timed out with SD cards
  2023-04-04 10:08   ` Dominik 'Rathann' Mierzejewski
  2023-04-04 11:40     ` Christian Löhle
  2023-04-04 17:18     ` Christian Löhle
@ 2023-04-04 17:32     ` Christian Löhle
  2023-04-25 12:41       ` Dominik 'Rathann' Mierzejewski
  2 siblings, 1 reply; 9+ messages in thread
From: Christian Löhle @ 2023-04-04 17:32 UTC (permalink / raw)
  To: Dominik 'Rathann' Mierzejewski, linux-mmc@vger.kernel.org

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 <dominik@greysector.net> 
Sent: Tuesday, April 4, 2023 12:09 PM
To: linux-mmc@vger.kernel.org
Subject: Re: mmc-utils: ioctl connection timed out with SD cards

On Monday, 03 April 2023 at 22:11, Christian Löhle wrote:
> >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. :)

> 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
-- 
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


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: mmc-utils: ioctl connection timed out with SD cards
  2023-04-04 17:32     ` Christian Löhle
@ 2023-04-25 12:41       ` Dominik 'Rathann' Mierzejewski
  0 siblings, 0 replies; 9+ messages in thread
From: Dominik 'Rathann' Mierzejewski @ 2023-04-25 12:41 UTC (permalink / raw)
  To: Christian Löhle; +Cc: linux-mmc@vger.kernel.org

Hi, Christian.

On Tuesday, 04 April 2023 at 19:32, Christian Löhle wrote:
> 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.

> 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
-- 
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

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2023-04-25 12:41 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-04-03 17:51 mmc-utils: ioctl connection timed out with SD cards Dominik 'Rathann' Mierzejewski
2023-04-03 20:11 ` Christian Löhle
2023-04-04  6:14   ` Christian Löhle
2023-04-04  9:29     ` Dominik 'Rathann' Mierzejewski
2023-04-04 10:08   ` Dominik 'Rathann' Mierzejewski
2023-04-04 11:40     ` Christian Löhle
2023-04-04 17:18     ` Christian Löhle
2023-04-04 17:32     ` Christian Löhle
2023-04-25 12:41       ` Dominik 'Rathann' Mierzejewski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox