Skip to content

Commit 0662d79

Browse files
author
Ulf Hansson
committed
Merge branch 'fixes' into next
2 parents 9537068 + 3e5a8e8 commit 0662d79

1 file changed

Lines changed: 42 additions & 0 deletions

File tree

drivers/mmc/host/sdhci-msm.c

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
#include <linux/regulator/consumer.h>
1818
#include <linux/interconnect.h>
1919
#include <linux/pinctrl/consumer.h>
20+
#include <linux/reset.h>
2021

2122
#include "sdhci-pltfm.h"
2223
#include "cqhci.h"
@@ -2507,6 +2508,43 @@ static inline void sdhci_msm_get_of_property(struct platform_device *pdev,
25072508
of_property_read_u32(node, "qcom,dll-config", &msm_host->dll_config);
25082509
}
25092510

2511+
static int sdhci_msm_gcc_reset(struct device *dev, struct sdhci_host *host)
2512+
{
2513+
struct reset_control *reset;
2514+
int ret = 0;
2515+
2516+
reset = reset_control_get_optional_exclusive(dev, NULL);
2517+
if (IS_ERR(reset))
2518+
return dev_err_probe(dev, PTR_ERR(reset),
2519+
"unable to acquire core_reset\n");
2520+
2521+
if (!reset)
2522+
return ret;
2523+
2524+
ret = reset_control_assert(reset);
2525+
if (ret) {
2526+
reset_control_put(reset);
2527+
return dev_err_probe(dev, ret, "core_reset assert failed\n");
2528+
}
2529+
2530+
/*
2531+
* The hardware requirement for delay between assert/deassert
2532+
* is at least 3-4 sleep clock (32.7KHz) cycles, which comes to
2533+
* ~125us (4/32768). To be on the safe side add 200us delay.
2534+
*/
2535+
usleep_range(200, 210);
2536+
2537+
ret = reset_control_deassert(reset);
2538+
if (ret) {
2539+
reset_control_put(reset);
2540+
return dev_err_probe(dev, ret, "core_reset deassert failed\n");
2541+
}
2542+
2543+
usleep_range(200, 210);
2544+
reset_control_put(reset);
2545+
2546+
return ret;
2547+
}
25102548

25112549
static int sdhci_msm_probe(struct platform_device *pdev)
25122550
{
@@ -2554,6 +2592,10 @@ static int sdhci_msm_probe(struct platform_device *pdev)
25542592

25552593
msm_host->saved_tuning_phase = INVALID_TUNING_PHASE;
25562594

2595+
ret = sdhci_msm_gcc_reset(&pdev->dev, host);
2596+
if (ret)
2597+
goto pltfm_free;
2598+
25572599
/* Setup SDCC bus voter clock. */
25582600
msm_host->bus_clk = devm_clk_get(&pdev->dev, "bus");
25592601
if (!IS_ERR(msm_host->bus_clk)) {

0 commit comments

Comments
 (0)