Commit 918a92c2 authored by Jean-Jacques Hiblot's avatar Jean-Jacques Hiblot Committed by Jason Liu

mmc: Add a execute_tuning() callback to the mmc operations.

Tuning is a mandatory step in the initialization of SDR104 and HS200 modes.
This callback execute the tuning process.
Signed-off-by: default avatarJean-Jacques Hiblot <jjhiblot@ti.com>
parent 55d51394
......@@ -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)
......
......@@ -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);
}
#endif
int mmc_send_status(struct mmc *mmc, int timeout)
......
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment