nuttx icon indicating copy to clipboard operation
nuttx copied to clipboard

mmcsd: replace cmd12(stop transimission) with cmd23(set block count)

Open gneworld opened this issue 1 year ago • 1 comments

Summary

Impact

Testing

gneworld avatar Aug 28 '24 07:08 gneworld

Please fill the Summary/Impact/Testing fields. Please include explanation why to replace CMD12 with CMD23, what is the needs or advantage of doing it.

OK, I will add it in the next few days after I have time, thanks

gneworld avatar Aug 29 '24 06:08 gneworld

Please fill the Summary/Impact/Testing fields. Please include explanation why to replace CMD12 with CMD23, what is the needs or advantage of doing it.

CMD12 support should not be replaced or removed. Some cards do not support CMD23. If the cards are removable, this support should be determined at runtime. The driver should check BIT 33 in the SCR register to see if the card supports the command.

ldube avatar Sep 14 '24 14:09 ldube

Please fill the Summary/Impact/Testing fields. Please include explanation why to replace CMD12 with CMD23, what is the needs or advantage of doing it.

CMD12 support should not be replaced or removed. Some cards do not support CMD23. If the cards are removable, this support should be determined at runtime. The driver should check BIT 33 in the SCR register to see if the card supports the command.

@ldube hello ldube, do you mean I should add code like this, and then check if priv->cmd_support is zero or not in mmcsd_writemultiple function ? image

image

gneworld avatar Sep 15 '24 12:09 gneworld

@gneworld Yes, but I would separate CMD20 and CMD23 bits. CMD23 is bit 33 so you should be testing only one bit.

#ifdef CONFIG_CMD23_SUPPORT
   priv->cmd23_support = ...
#endif

CMD23 support should be off by default.

If a user inserts a card without CMD23 support the behavior of the driver should be identical to what we have today whether CONFIG_CMD23_SUPPORT is defined or not.

The value of cmd23_support should be zero for cards without CMD23 support. The value of cmd23_support should be zero for all cards if CONFIG_CMD23_SUPPORT is not enabled. If cmd23_support is zero the sd driver should act like it did before your change.

ldube avatar Sep 15 '24 18:09 ldube

@ldube Are you sure that bit 33 being 1 definitely indicates support for cmd23? Is it possible that some manufacturers use this bit as a flag for supporting other commands?

gneworld avatar Sep 16 '24 01:09 gneworld

image

ldube avatar Sep 16 '24 02:09 ldube

I got that from a 2010 document :( I can't guarantee anything, I have not used this feature. Please double check in a new spec if you can find it.

ldube avatar Sep 16 '24 02:09 ldube

Please fill the Summary/Impact/Testing fields. Please include explanation why to replace CMD12 with CMD23, what is the needs or advantage of doing it.

@acassis

I have fill the Summary/Impact/Testing fields, maybe I should make cmd12 and cmd23 compatible instead of getting rid of it, thanks

gneworld avatar Sep 16 '24 03:09 gneworld

@acassis @ldube please make a review again, thanks

gneworld avatar Sep 16 '24 07:09 gneworld