]> git.ipfire.org Git - people/ms/u-boot.git/commitdiff
mmc: Add a new callback function to perform the 74 clocks cycle sequence
authorJean-Jacques Hiblot <jjhiblot@ti.com>
Thu, 21 Sep 2017 14:30:01 +0000 (16:30 +0200)
committerJaehoon Chung <jh80.chung@samsung.com>
Fri, 12 Jan 2018 09:11:04 +0000 (18:11 +0900)
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>
drivers/mmc/mmc-uclass.c
drivers/mmc/mmc.c
include/mmc.h

index 5dda20cda5e7c06189319590342a02a0f332bd26..9c6a8ba476004d32589fd7b90a01e0b5a1f90b96 100644 (file)
@@ -51,6 +51,19 @@ int mmc_set_ios(struct mmc *mmc)
        return dm_mmc_set_ios(mmc->dev);
 }
 
+void dm_mmc_send_init_stream(struct udevice *dev)
+{
+       struct dm_mmc_ops *ops = mmc_get_ops(dev);
+
+       if (ops->send_init_stream)
+               ops->send_init_stream(dev);
+}
+
+void mmc_send_init_stream(struct mmc *mmc)
+{
+       dm_mmc_send_init_stream(mmc->dev);
+}
+
 int dm_mmc_get_wp(struct udevice *dev)
 {
        struct dm_mmc_ops *ops = mmc_get_ops(dev);
index 24b5e16a3bfe0ecf7aaa3c29220316aaaacc5963..1875b31ad1fbe302a7de5a0a728d8bf44a71daea 100644 (file)
@@ -1198,6 +1198,10 @@ static inline int bus_width(uint cap)
 }
 
 #if !CONFIG_IS_ENABLED(DM_MMC)
+static void mmc_send_init_stream(struct mmc *mmc)
+{
+}
+
 static int mmc_set_ios(struct mmc *mmc)
 {
        int ret = 0;
@@ -1983,6 +1987,8 @@ int mmc_start_init(struct mmc *mmc)
        mmc_set_bus_width(mmc, 1);
        mmc_set_clock(mmc, 1);
 
+       mmc_send_init_stream(mmc);
+
        /* Reset the Card */
        err = mmc_go_idle(mmc);
 
index e5249637c85143ac79392a5a0d74f1c72465fe92..bd096aeb2181ae2e66cb7d07b383165634d69b66 100644 (file)
@@ -360,6 +360,14 @@ struct dm_mmc_ops {
         */
        int (*set_ios)(struct udevice *dev);
 
+       /**
+        * send_init_stream() - send the initialization stream: 74 clock cycles
+        * This is used after power up before sending the first command
+        *
+        * @dev:        Device to update
+        */
+       void (*send_init_stream)(struct udevice *dev);
+
        /**
         * get_cd() - See whether a card is present
         *
@@ -382,11 +390,13 @@ struct dm_mmc_ops {
 int dm_mmc_send_cmd(struct udevice *dev, struct mmc_cmd *cmd,
                    struct mmc_data *data);
 int dm_mmc_set_ios(struct udevice *dev);
+void dm_mmc_send_init_stream(struct udevice *dev);
 int dm_mmc_get_cd(struct udevice *dev);
 int dm_mmc_get_wp(struct udevice *dev);
 
 /* Transition functions for compatibility */
 int mmc_set_ios(struct mmc *mmc);
+void mmc_send_init_stream(struct mmc *mmc);
 int mmc_getcd(struct mmc *mmc);
 int mmc_getwp(struct mmc *mmc);