Skip to content

Commit 1e8970d

Browse files
tom-shen-asuswzyy2
authored andcommitted
MINIARM: Fixed: "echo b > /proc/sysrq-trigger" and then system hang
Change-Id: I711cf402b061216fa72b1fa85cda91f96ccb12a5
1 parent 06c06f4 commit 1e8970d

3 files changed

Lines changed: 25 additions & 0 deletions

File tree

drivers/mmc/host/dw_mmc.c

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,10 @@
3838
#include <linux/of.h>
3939
#include <linux/of_gpio.h>
4040
#include <linux/mmc/slot-gpio.h>
41+
#include <linux/reboot.h>
4142

4243
#include "dw_mmc.h"
44+
#include "../core/core.h"
4345

4446
/* Common flag combinations */
4547
#define DW_MCI_DATA_ERROR_FLAGS (SDMMC_INT_DRTO | SDMMC_INT_DCRC | \
@@ -2588,6 +2590,24 @@ static void dw_mci_slot_of_parse(struct dw_mci_slot *slot)
25882590
}
25892591
#endif /* CONFIG_OF */
25902592

2593+
struct dw_mci *mSdhost;
2594+
void setmmcEmergency() {
2595+
struct mmc_host *mmc = mSdhost->cur_slot->mmc;
2596+
int ret;
2597+
2598+
mmc_power_off(mmc);
2599+
mdelay(20);
2600+
2601+
if (!IS_ERR(mmc->supply.vmmc)) {
2602+
ret = regulator_enable(mmc->supply.vmmc);
2603+
}
2604+
2605+
if (!IS_ERR(mmc->supply.vqmmc))
2606+
regulator_set_voltage(mmc->supply.vqmmc, 3000000, 3300000);
2607+
2608+
}
2609+
EXPORT_SYMBOL(setmmcEmergency);
2610+
25912611
static int dw_mci_init_slot(struct dw_mci *host, unsigned int id)
25922612
{
25932613
struct mmc_host *mmc;
@@ -2619,6 +2639,9 @@ static int dw_mci_init_slot(struct dw_mci *host, unsigned int id)
26192639
mmc->f_max = freq[1];
26202640
}
26212641

2642+
if (of_find_property(host->dev->of_node, "supports-sd", NULL))
2643+
mSdhost = host;
2644+
26222645
/*if there are external regulators, get them*/
26232646
ret = mmc_regulator_get_supply(mmc);
26242647
if (ret == -EPROBE_DEFER)

include/linux/reboot.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ extern char poweroff_cmd[POWEROFF_CMD_PATH_LEN];
7777
extern void orderly_poweroff(bool force);
7878
extern void orderly_reboot(void);
7979

80+
extern void setmmcEmergency(void);
8081
/*
8182
* Emergency restart, callable from an interrupt handler.
8283
*/

kernel/reboot.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ void (*pm_power_off_prepare)(void);
6161
void emergency_restart(void)
6262
{
6363
kmsg_dump(KMSG_DUMP_EMERG);
64+
setmmcEmergency();
6465
machine_emergency_restart();
6566
}
6667
EXPORT_SYMBOL_GPL(emergency_restart);

0 commit comments

Comments
 (0)