RE: [PATCH 01/12] mmc: sdhci: add support for auto CMD23

Nath, Arindam
2011-02-18T12:09:00Z

Hi Arnd,

> -----Original Message-----
> From: Arnd Bergmann [mailto:arnd@arndb.de]
> Sent: Friday, February 18, 2011 4:21 PM
> To: zhangfei gao
> Cc: Nath, Arindam; cjb@laptop.org; linux-mmc@vger.kernel.org; Su,
> Henry; Lu, Aaron; anath.amd@gmail.com
> Subject: Re: [PATCH 01/12] mmc: sdhci: add support for auto CMD23
>
> On Friday 18 February 2011 11:45:27 zhangfei gao wrote:
> > On Tue, Feb 15, 2011 at 4:34 AM, Arindam Nath <arindam.nath@amd.com>
> wrote:
> > > Host Controller v3.00 and later support Auto CMD23 in the Transfer
> > > Mode register. Since Auto CMD23 can be used with or without DMA,
> > > and if used with DMA, it should only be ADMA, we check against
> > > SDHCI_USE_SDMA not being set. This flag is reset when
> SDHCI_USE_ADMA
> > > is set.
> > >
> > > A new definition for SDHCI_ARGUMENT2 register has been added
> > > in v3.00 spec, which is the same as SDHCI_DMA_ADDRESS. We program
> the
> > > block count for CMD23 in SDHCI_ARGUMENT2, so we don't need CMD12 to
> > > stop multiple block transfers. But during error recovery procedure,
> > > we will need to send Abort command, so we use a global variable
> > > abort_cmd to save the stop command to be used later.
> > >
> > > Two bits are added to SCR register as per the Physical Layer Spec
> v3.01,
> > > which specify whether the card supports CMD20 and/or CMD23. We use
> this
> > > as one of the conditions to decide whether to enable Auto CMD23 or
> not.
> > >
> > > Signed-off-by: Arindam Nath <arindam.nath@amd.com>
>
> Why are you doing this in the SDHC code and not in the block driver
> code?
>
> AFAICT, whether CMD23 can be used or not is primarily a decision based
> on
> the card, and the block driver might want issue it for a longer range
> if it needs to split a block request into multiple MMC requests.

Thanks for the comments. Yes, whether a card supports CMD23 depends on the card, but Auto CMD23 is a feature added to the Host Controller v3.00 just like Auto CMD12. I am already doing a check inside sdhci_host_auto_cmd23_supported() whether the card supports CMD23, and whether the request is for multiple block transfers. Also I tried to make my implementation consistent with Auto CMD12 implementation already there in the sdhc code.

Regards,
Arindam