build/patch/kernel/archive/rockchip-4.4/135_tinker_boot_fix.patch.disabled

117 lines
3.1 KiB
Plaintext
Raw Normal View History

diff --git a/drivers/mmc/host/dw_mmc-rockchip.c b/drivers/mmc/host/dw_mmc-rockchip.c
index 7f35aa4..3fc65f4 100644
--- a/drivers/mmc/host/dw_mmc-rockchip.c
+++ b/drivers/mmc/host/dw_mmc-rockchip.c
@@ -19,6 +19,7 @@
#include "dw_mmc.h"
#include "dw_mmc-pltfm.h"
+#include "../core/core.h"
#define RK3288_CLKGEN_DIV 2
@@ -293,13 +294,17 @@ static void dw_mci_rockchip_platfm_shutdown(struct platform_device *pdev)
struct mmc_host *mmc = host->cur_slot->mmc;
int ret;
- mdelay(20);
+ if(of_machine_is_compatible("rockchip,rk3288-miniarm")){
+ mmc_power_off(mmc);
- if (!IS_ERR(mmc->supply.vmmc))
- ret = regulator_enable(mmc->supply.vmmc);
+ mdelay(20);
- if (!IS_ERR(mmc->supply.vqmmc))
- regulator_set_voltage(mmc->supply.vqmmc, 3000000, 3300000);
+ 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
diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c
index 3f5ece5..6d29e1e 100644
--- a/drivers/mmc/host/dw_mmc.c
+++ b/drivers/mmc/host/dw_mmc.c
@@ -38,8 +38,10 @@
#include <linux/of.h>
#include <linux/of_gpio.h>
#include <linux/mmc/slot-gpio.h>
+#include <linux/reboot.h>
#include "dw_mmc.h"
+#include "../core/core.h"
/* Common flag combinations */
#define DW_MCI_DATA_ERROR_FLAGS (SDMMC_INT_DRTO | SDMMC_INT_DCRC | \
@@ -2567,6 +2569,31 @@ static void dw_mci_slot_of_parse(struct dw_mci_slot *slot)
}
#endif /* CONFIG_OF */
+struct dw_mci *mSdhost;
+
+void setmmcEmergency() {
+
+ struct mmc_host *mmc = mSdhost->cur_slot->mmc;
+ int ret;
+
+ if(of_machine_is_compatible("rockchip,rk3288-miniarm")){
+
+ mmc_power_off(mmc);
+
+ 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);
+ }
+
+}
+
+EXPORT_SYMBOL(setmmcEmergency);
+
static int dw_mci_init_slot(struct dw_mci *host, unsigned int id)
{
struct mmc_host *mmc;
@@ -2595,7 +2622,8 @@ static int dw_mci_init_slot(struct dw_mci *host, unsigned int id)
mmc->f_min = freq[0];
mmc->f_max = freq[1];
}
-
+ if (of_find_property(host->dev->of_node, "supports-sd", NULL))
+ mSdhost = host;
/*if there are external regulators, get them*/
ret = mmc_regulator_get_supply(mmc);
if (ret == -EPROBE_DEFER)
diff --git a/include/linux/reboot.h b/include/linux/reboot.h
index a7ff409..e045bc2 100644
--- a/include/linux/reboot.h
+++ b/include/linux/reboot.h
@@ -73,6 +73,7 @@ extern char poweroff_cmd[POWEROFF_CMD_PATH_LEN];
extern void orderly_poweroff(bool force);
extern void orderly_reboot(void);
+extern void setmmcEmergency(void);
/*
* Emergency restart, callable from an interrupt handler.
*/
diff --git a/kernel/reboot.c b/kernel/reboot.c
index bd30a97..9f99488 100644
--- a/kernel/reboot.c
+++ b/kernel/reboot.c
@@ -61,6 +61,7 @@ void (*pm_power_off_prepare)(void);
void emergency_restart(void)
{
kmsg_dump(KMSG_DUMP_EMERG);
+ setmmcEmergency();
machine_emergency_restart();
}
EXPORT_SYMBOL_GPL(emergency_restart);