File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 4040#include <linux/of.h>
4141#include <linux/of_gpio.h>
4242#include <linux/mmc/slot-gpio.h>
43+ #include <linux/reboot.h>
4344
4445#include "dw_mmc.h"
46+ #include "../core/core.h"
4547
4648/* Common flag combinations */
4749#define DW_MCI_DATA_ERROR_FLAGS (SDMMC_INT_DRTO | SDMMC_INT_DCRC | \
@@ -2746,6 +2748,24 @@ static void dw_mci_slot_of_parse(struct dw_mci_slot *slot)
27462748}
27472749#endif /* CONFIG_OF */
27482750
2751+ struct dw_mci * mSdhost ;
2752+ void setmmcEmergency () {
2753+ struct mmc_host * mmc = mSdhost -> slot [0 ]-> mmc ;
2754+ int ret ;
2755+
2756+ mmc_power_off (mmc );
2757+ mdelay (20 );
2758+
2759+ if (!IS_ERR (mmc -> supply .vmmc )) {
2760+ ret = regulator_enable (mmc -> supply .vmmc );
2761+ }
2762+
2763+ if (!IS_ERR (mmc -> supply .vqmmc ))
2764+ regulator_set_voltage (mmc -> supply .vqmmc , 3000000 , 3300000 );
2765+
2766+ }
2767+ EXPORT_SYMBOL (setmmcEmergency );
2768+
27492769static int dw_mci_init_slot (struct dw_mci * host , unsigned int id )
27502770{
27512771 struct mmc_host * mmc ;
@@ -2777,6 +2797,9 @@ static int dw_mci_init_slot(struct dw_mci *host, unsigned int id)
27772797 mmc -> f_max = freq [1 ];
27782798 }
27792799
2800+ if (of_find_property (host -> dev -> of_node , "supports-sd" , NULL ))
2801+ mSdhost = host ;
2802+
27802803 /*if there are external regulators, get them*/
27812804 ret = mmc_regulator_get_supply (mmc );
27822805 if (ret == - EPROBE_DEFER )
Original file line number Diff line number Diff line change @@ -77,6 +77,7 @@ extern char poweroff_cmd[POWEROFF_CMD_PATH_LEN];
7777extern void orderly_poweroff (bool force );
7878extern void orderly_reboot (void );
7979
80+ extern void setmmcEmergency (void );
8081/*
8182 * Emergency restart, callable from an interrupt handler.
8283 */
Original file line number Diff line number Diff line change @@ -61,6 +61,7 @@ void (*pm_power_off_prepare)(void);
6161void emergency_restart (void )
6262{
6363 kmsg_dump (KMSG_DUMP_EMERG );
64+ setmmcEmergency ();
6465 machine_emergency_restart ();
6566}
6667EXPORT_SYMBOL_GPL (emergency_restart );
You can’t perform that action at this time.
0 commit comments