[U-Boot] [PATCH 17/22] mmc: Add a execute_tuning() callback to the mmc operations.

Jaehoon Chung jh80.chung at samsung.com
Thu May 25 12:37:40 UTC 2017


On 05/13/2017 03:16 AM, Jean-Jacques Hiblot wrote:
> Tuning is a mandatory step in the initialization of SDR104 and HS200 modes.
> This callback execute the tuning process.
> 
> Signed-off-by: Jean-Jacques Hiblot <jjhiblot at ti.com>
> ---
>  drivers/mmc/mmc-uclass.c | 14 ++++++++++++++
>  drivers/mmc/mmc.c        |  5 +++++
>  include/mmc.h            | 12 ++++++++++++
>  3 files changed, 31 insertions(+)
> 
> diff --git a/drivers/mmc/mmc-uclass.c b/drivers/mmc/mmc-uclass.c
> index e1f7995..b7433cf 100644
> --- a/drivers/mmc/mmc-uclass.c
> +++ b/drivers/mmc/mmc-uclass.c
> @@ -93,6 +93,20 @@ int mmc_getcd(struct mmc *mmc)
>  {
>  	return dm_mmc_get_cd(mmc->dev);
>  }
> +
> +int dm_mmc_execute_tuning(struct udevice *dev, uint opcode)
> +{
> +	struct dm_mmc_ops *ops = mmc_get_ops(dev);
> +
> +	if (!ops->execute_tuning)
> +		return -ENOSYS;
> +	return ops->execute_tuning(dev, opcode);
> +}
> +
> +int mmc_execute_tuning(struct mmc *mmc, uint opcode)
> +{
> +	return dm_mmc_execute_tuning(mmc->dev, opcode);
> +}
>  #endif
>  
>  struct mmc *mmc_get_mmc_dev(struct udevice *dev)
> diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c
> index 415484e..d7d1c91 100644
> --- a/drivers/mmc/mmc.c
> +++ b/drivers/mmc/mmc.c
> @@ -219,6 +219,11 @@ int mmc_send_cmd(struct mmc *mmc, struct mmc_cmd *cmd, struct mmc_data *data)
>  
>  	return ret;
>  }
> +
> +int mmc_execute_tuning(struct mmc *mmc, uint opcode)
> +{
> +	return mmc->cfg->ops->execute_tuning(mmc, opcode);

Doesn't need to check about execute_tuing callback function?

> +}
>  #endif
>  
>  int mmc_send_status(struct mmc *mmc, int timeout)
> diff --git a/include/mmc.h b/include/mmc.h
> index 097a685..dab68c5 100644
> --- a/include/mmc.h
> +++ b/include/mmc.h
> @@ -375,6 +375,15 @@ struct dm_mmc_ops {
>  	 * @return 0 if write-enabled, 1 if write-protected, -ve on error
>  	 */
>  	int (*get_wp)(struct udevice *dev);
> +
> +	/**
> +	 * execute_tuning() - Start the tuning process
> +	 *
> +	 * @dev:	Device to start the tuning
> +	 * @opcode:	Command opcode to send
> +	 * @return 0 if OK, -ve on error
> +	 */
> +	int (*execute_tuning)(struct udevice *dev, uint opcode);
>  };
>  
>  #define mmc_get_ops(dev)        ((struct dm_mmc_ops *)(dev)->driver->ops)
> @@ -385,12 +394,14 @@ int dm_mmc_set_ios(struct udevice *dev);
>  int dm_mmc_set_vdd(struct udevice *dev, bool enable);
>  int dm_mmc_get_cd(struct udevice *dev);
>  int dm_mmc_get_wp(struct udevice *dev);
> +int dm_mmc_execute_tuning(struct udevice *dev, uint opcode);
>  
>  /* Transition functions for compatibility */
>  int mmc_set_ios(struct mmc *mmc);
>  int mmc_set_vdd(struct mmc *mmc, bool enable);
>  int mmc_getcd(struct mmc *mmc);
>  int mmc_getwp(struct mmc *mmc);
> +int mmc_execute_tuning(struct mmc *mmc, uint opcode);
>  
>  #else
>  struct mmc_ops {
> @@ -401,6 +412,7 @@ struct mmc_ops {
>  	int (*set_vdd)(struct mmc *mmc, bool enable);
>  	int (*getcd)(struct mmc *mmc);
>  	int (*getwp)(struct mmc *mmc);
> +	int (*execute_tuning)(struct mmc *mmc, uint opcode);
>  };
>  #endif
>  
> 



More information about the U-Boot mailing list