Commit 318a7a576bc49aa8b4207e694d3fbd48c663d6ac

Authored by Jean-Jacques Hiblot
Committed by Jaehoon Chung
1 parent aff5d3c83f

mmc: Add a new callback function to perform the 74 clocks cycle sequence

Add a new callback function *send_init_stream* which start a sequence of
at least 74 clock cycles.
The mmc core uses *mmc_send_init_stream* in order to invoke the callback
function. This will be used during power cycle where the specification
requires such a sequence after power up.

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>

Showing 3 changed files with 29 additions and 0 deletions Side-by-side Diff

drivers/mmc/mmc-uclass.c
... ... @@ -51,6 +51,19 @@
51 51 return dm_mmc_set_ios(mmc->dev);
52 52 }
53 53  
  54 +void dm_mmc_send_init_stream(struct udevice *dev)
  55 +{
  56 + struct dm_mmc_ops *ops = mmc_get_ops(dev);
  57 +
  58 + if (ops->send_init_stream)
  59 + ops->send_init_stream(dev);
  60 +}
  61 +
  62 +void mmc_send_init_stream(struct mmc *mmc)
  63 +{
  64 + dm_mmc_send_init_stream(mmc->dev);
  65 +}
  66 +
54 67 int dm_mmc_get_wp(struct udevice *dev)
55 68 {
56 69 struct dm_mmc_ops *ops = mmc_get_ops(dev);
... ... @@ -1198,6 +1198,10 @@
1198 1198 }
1199 1199  
1200 1200 #if !CONFIG_IS_ENABLED(DM_MMC)
  1201 +static void mmc_send_init_stream(struct mmc *mmc)
  1202 +{
  1203 +}
  1204 +
1201 1205 static int mmc_set_ios(struct mmc *mmc)
1202 1206 {
1203 1207 int ret = 0;
... ... @@ -1982,6 +1986,8 @@
1982 1986  
1983 1987 mmc_set_bus_width(mmc, 1);
1984 1988 mmc_set_clock(mmc, 1);
  1989 +
  1990 + mmc_send_init_stream(mmc);
1985 1991  
1986 1992 /* Reset the Card */
1987 1993 err = mmc_go_idle(mmc);
... ... @@ -361,6 +361,14 @@
361 361 int (*set_ios)(struct udevice *dev);
362 362  
363 363 /**
  364 + * send_init_stream() - send the initialization stream: 74 clock cycles
  365 + * This is used after power up before sending the first command
  366 + *
  367 + * @dev: Device to update
  368 + */
  369 + void (*send_init_stream)(struct udevice *dev);
  370 +
  371 + /**
364 372 * get_cd() - See whether a card is present
365 373 *
366 374 * @dev: Device to check
367 375  
... ... @@ -382,11 +390,13 @@
382 390 int dm_mmc_send_cmd(struct udevice *dev, struct mmc_cmd *cmd,
383 391 struct mmc_data *data);
384 392 int dm_mmc_set_ios(struct udevice *dev);
  393 +void dm_mmc_send_init_stream(struct udevice *dev);
385 394 int dm_mmc_get_cd(struct udevice *dev);
386 395 int dm_mmc_get_wp(struct udevice *dev);
387 396  
388 397 /* Transition functions for compatibility */
389 398 int mmc_set_ios(struct mmc *mmc);
  399 +void mmc_send_init_stream(struct mmc *mmc);
390 400 int mmc_getcd(struct mmc *mmc);
391 401 int mmc_getwp(struct mmc *mmc);
392 402