Browse Source

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: Jean-Jacques Hiblot <jjhiblot@ti.com>
(cherry picked from commit 252ac4a089)
Jean-Jacques Hiblot 4 years ago
committed by Peng Fan
parent
commit
3d9290247b
3 changed files with 31 additions and 0 deletions
  1. +14
    -0
      drivers/mmc/mmc-uclass.c
  2. +5
    -0
      drivers/mmc/mmc.c
  3. +12
    -0
      include/mmc.h

+ 14
- 0
drivers/mmc/mmc-uclass.c View File

@ -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)


+ 5
- 0
drivers/mmc/mmc.c View File

@ -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)


+ 12
- 0
include/mmc.h View File

@ -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


Loading…
Cancel
Save