[U-Boot] [PATCH 06/33] mmc: add card_busy to query card status
Jaehoon Chung
jh80.chung at samsung.com
Thu May 25 13:02:28 UTC 2017
On 05/15/2017 03:07 PM, Ziyuan Xu wrote:
> Card devices get into busy status since host request speed mode
> switch, if host controller is able to query whether the device is busy,
> try it instead of sending cmd13.
This patch is similar to one of Jean-Jacques's patches.
>
> Signed-off-by: Ziyuan Xu <xzy.xu at rock-chips.com>
> ---
>
> drivers/mmc/mmc-uclass.c | 16 ++++++++++++++++
> drivers/mmc/mmc.c | 13 +++++++++++++
> include/mmc.h | 11 +++++++++++
> 3 files changed, 40 insertions(+)
>
> diff --git a/drivers/mmc/mmc-uclass.c b/drivers/mmc/mmc-uclass.c
> index 9c07871..a300a6d 100644
> --- a/drivers/mmc/mmc-uclass.c
> +++ b/drivers/mmc/mmc-uclass.c
> @@ -38,6 +38,22 @@ int mmc_send_cmd(struct mmc *mmc, struct mmc_cmd *cmd, struct mmc_data *data)
> return dm_mmc_send_cmd(mmc->dev, cmd, data);
> }
>
> +bool mmc_card_busy(struct mmc *mmc)
> +{
> + struct dm_mmc_ops *ops = mmc_get_ops(mmc->dev);
> +
> + if (!ops->card_busy)
> + return -ENOSYS;
return is ENOSYS but this function is return bool type..fix it.
> + return ops->card_busy(mmc->dev);
> +}
> +
> +bool mmc_can_card_busy(struct mmc *mmc)
> +{
> + struct dm_mmc_ops *ops = mmc_get_ops(mmc->dev);
> +
> + return !!ops->card_busy;
> +}
> +
> int dm_mmc_set_ios(struct udevice *dev)
> {
> struct dm_mmc_ops *ops = mmc_get_ops(dev);
> diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c
> index 0b30172..13d8f04 100644
> --- a/drivers/mmc/mmc.c
> +++ b/drivers/mmc/mmc.c
> @@ -1156,6 +1156,19 @@ static void mmc_set_ios(struct mmc *mmc)
> if (mmc->cfg->ops->set_ios)
> mmc->cfg->ops->set_ios(mmc);
> }
> +
> +static bool mmc_card_busy(struct mmc *mmc)
> +{
> + if (!mmc->cfg->ops->card_busy)
> + return -ENOSYS;
> +
> + return mmc->cfg->ops->card_busy(mmc);
ditto.
> +}
> +
> +static bool mmc_can_card_busy(struct mmc *)
> +{
> + return !!mmc->cfg->ops->card_busy;
> +}
> #endif
>
> void mmc_set_clock(struct mmc *mmc, uint clock)
> diff --git a/include/mmc.h b/include/mmc.h
> index 060c1f8..9bed935 100644
> --- a/include/mmc.h
> +++ b/include/mmc.h
> @@ -357,6 +357,14 @@ struct dm_mmc_ops {
> struct mmc_data *data);
>
> /**
> + * card_busy() - Query the card device status
> + *
> + * @dev: Device to update
> + * @return true if card device is busy
> + */
> + bool (*card_busy)(struct udevice *dev);
> +
> + /**
> * set_ios() - Set the I/O speed/width for an MMC device
> *
> * @dev: Device to update
> @@ -390,12 +398,15 @@ int dm_mmc_get_cd(struct udevice *dev);
> int dm_mmc_get_wp(struct udevice *dev);
>
> /* Transition functions for compatibility */
> +bool mmc_card_busy(struct mmc *mmc);
> +bool mmc_can_card_busy(struct mmc *mmc);
> int mmc_set_ios(struct mmc *mmc);
> int mmc_getcd(struct mmc *mmc);
> int mmc_getwp(struct mmc *mmc);
>
> #else
> struct mmc_ops {
> + bool (*card_busy)(struct mmc *mmc);
> int (*send_cmd)(struct mmc *mmc,
> struct mmc_cmd *cmd, struct mmc_data *data);
> int (*set_ios)(struct mmc *mmc);
>
More information about the U-Boot
mailing list