forked from rockchip-linux/kernel
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdw_mmc-rockchip.diff
More file actions
95 lines (85 loc) · 2.65 KB
/
Copy pathdw_mmc-rockchip.diff
File metadata and controls
95 lines (85 loc) · 2.65 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
diff --git a/drivers/mmc/host/dw_mmc-rockchip.c b/drivers/mmc/host/dw_mmc-rockchip.c
old mode 100644
new mode 100755
index 1b4b62c4f91f..c3420990ae24
--- a/drivers/mmc/host/dw_mmc-rockchip.c
+++ b/drivers/mmc/host/dw_mmc-rockchip.c
@@ -13,11 +13,19 @@
#include <linux/mmc/host.h>
#include <linux/mmc/dw_mmc.h>
#include <linux/of_address.h>
+#include <linux/regulator/consumer.h>
#include <linux/slab.h>
+#include <linux/delay.h>
#include "dw_mmc.h"
#include "dw_mmc-pltfm.h"
+#include <dt-bindings/gpio/gpio.h>
+#ifdef CONFIG_OF
+#include <linux/of_gpio.h>
+#endif
+
+
#define RK3288_CLKGEN_DIV 2
struct dw_mci_rockchip_priv_data {
@@ -146,7 +154,7 @@ static int dw_mci_rk3288_execute_tuning(struct dw_mci_slot *slot, u32 opcode)
}
if (range_count == 0) {
- dev_warn_ratelimited(host->dev, "All phases bad!");
+ dev_warn(host->dev, "All phases bad!");
ret = -EIO;
goto free;
}
@@ -230,16 +238,26 @@ static int dw_mci_rk3288_parse_dt(struct dw_mci *host)
static int dw_mci_rockchip_init(struct dw_mci *host)
{
+ struct device_node *np = host->dev->of_node;
+ int gpio;
+ enum of_gpio_flags flags;
+
/* It is slot 8 on Rockchip SoCs */
host->sdio_id0 = 8;
/* It needs this quirk on all Rockchip SoCs */
host->pdata->quirks |= DW_MCI_QUIRK_BROKEN_DTO;
- if (of_device_is_compatible(host->dev->of_node,
- "rockchip,rk3308-dw-mshc"))
- host->pdata->quirks |= DW_MCI_QUIRK_BROKEN_XFER;
+ gpio = of_get_named_gpio_flags(np, "maskrom_gpio", 0, &flags);
+ if (gpio_is_valid(gpio)) {
+ if(!gpio_request(gpio, "maskrom_gpio")) {
+ gpio_direction_output(gpio, (flags==GPIO_ACTIVE_HIGH)?1:0);
+ gpio_free(gpio);
+ mdelay(10);
+ dev_info(host->dev, "set maskrom gpio to enable emmc\n");
+ }
+ }
return 0;
}
@@ -289,6 +307,21 @@ static int dw_mci_rockchip_probe(struct platform_device *pdev)
return dw_mci_pltfm_register(pdev, drv_data);
}
+static void dw_mci_rockchip_platfm_shutdown(struct platform_device *pdev)
+{
+ struct dw_mci *host = platform_get_drvdata(pdev);
+ struct mmc_host *mmc = host->slot[0]->mmc;
+ int ret;
+
+ mdelay(20);
+
+ if (!IS_ERR(mmc->supply.vmmc))
+ ret = regulator_enable(mmc->supply.vmmc);
+
+ if (!IS_ERR(mmc->supply.vqmmc))
+ regulator_set_voltage(mmc->supply.vqmmc, 3000000, 3300000);
+}
+
#ifdef CONFIG_PM_SLEEP
static int dw_mci_rockchip_suspend(struct device *dev)
{
@@ -312,6 +345,7 @@ static SIMPLE_DEV_PM_OPS(dw_mci_rockchip_pmops,
static struct platform_driver dw_mci_rockchip_pltfm_driver = {
.probe = dw_mci_rockchip_probe,
.remove = dw_mci_pltfm_remove,
+ .shutdown = dw_mci_rockchip_platfm_shutdown,
.driver = {
.name = "dwmmc_rockchip",
.of_match_table = dw_mci_rockchip_match,