mmc: dw_mmc: move controller reset before driver init
authorliwei <[email protected]>
Fri, 11 Aug 2017 08:06:23 +0000 (16:06 +0800)
committerUlf Hansson <[email protected]>
Wed, 30 Aug 2017 12:01:56 +0000 (14:01 +0200)
This commit modifies dw_mci_probe(), it moves reset assertion before
drv_data->init(host)

Some driver needs to access controller registers in its .init() ops. So,
in order to make such access safe, we should do controller reset before
.init() being called.

Signed-off-by: Wei Li <[email protected]>
Signed-off-by: Guodong Xu <[email protected]>
Signed-off-by: Chen Jun <[email protected]>
Reviewed-by: Shawn Lin <[email protected]>
Signed-off-by: Jaehoon Chung <[email protected]>
Signed-off-by: Ulf Hansson <[email protected]>
drivers/mmc/host/dw_mmc.c

index b9640c7ac1cc515c71716d57f035dbc9631fafb0..5ccf46501ce1dab555d934d6aac88b6805e1ed99 100644 (file)
@@ -3067,6 +3067,12 @@ int dw_mci_probe(struct dw_mci *host)
                goto err_clk_ciu;
        }
 
+       if (!IS_ERR(host->pdata->rstc)) {
+               reset_control_assert(host->pdata->rstc);
+               usleep_range(10, 50);
+               reset_control_deassert(host->pdata->rstc);
+       }
+
        if (drv_data && drv_data->init) {
                ret = drv_data->init(host);
                if (ret) {
@@ -3076,12 +3082,6 @@ int dw_mci_probe(struct dw_mci *host)
                }
        }
 
-       if (!IS_ERR(host->pdata->rstc)) {
-               reset_control_assert(host->pdata->rstc);
-               usleep_range(10, 50);
-               reset_control_deassert(host->pdata->rstc);
-       }
-
        setup_timer(&host->cmd11_timer,
                    dw_mci_cmd11_timer, (unsigned long)host);