Esempio n. 1
0
static long errhandler_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
{
	int rv = 0;
	int ret;

	if (hidden_reset_enable)
		return 0;

	switch(cmd) {
	case ERRHANDLER_IOCTL_LEVEL2 : 
		if (BLUE_ERROR_HANDLER_LEVEL <= 1) {
			break;
		}
	case ERRHANDLER_IOCTL_LEVEL1 :	
		memset(android_buf,0,sizeof(android_buf));
		if (copy_from_user(android_buf, (void __user *)arg, sizeof(android_buf))) {
	    	rv = -EFAULT;
		    goto err1;
		}
		ret = LGE_ErrorHandler_Main(ANDROID_CRASH, (char *)android_buf);
		smsm_reset_modem(ret);
		while(1)
			;
		break;

	default:
		rv = -EINVAL;
		break;
	}


err1:
	return rv;
}
Esempio n. 2
0
static int modem_shutdown(const struct subsys_desc *subsys)
{
	struct modem_data *drv;

	drv = container_of(subsys, struct modem_data, subsys_desc);
	/*
	 * If the modem didn't already crash, setting SMSM_RESET here will help
	 * flush caches etc. The ignore_smsm_ack flag is set to ignore the
	 * SMSM_RESET notification that is generated due to the modem settings
	 * its own SMSM_RESET bit in response to the apps setting the apps
	 * SMSM_RESET bit.
	 */
	if (!(smsm_get_state(SMSM_MODEM_STATE) & SMSM_RESET)) {
		drv->ignore_smsm_ack = 1;
		smsm_reset_modem(SMSM_RESET);
	}

	/* Disable the modem watchdog to allow clean modem bootup */
	writel_relaxed(0x0, drv->wdog + 0x8);
	/*
	 * The write above needs to go through before the modem is powered up
	 * again.
	 */
	mb();
	/* Wait here to allow the modem to clean up caches, etc. */
	msleep(20);

	pil_shutdown(&drv->pil_desc);
	disable_irq_nosync(drv->irq);

	return 0;
}
Esempio n. 3
0
void modem_crash_shutdown(const struct subsys_desc *subsys)
{
	struct q6v4_modem *drv = desc_to_modem(subsys);

	drv->crash_shutdown = 1;
	smsm_reset_modem(SMSM_RESET);
}
Esempio n. 4
0
static void modem_crash_shutdown(const struct subsys_desc *subsys)
{
	struct modem_data *drv;

	/* If modem hasn't already crashed, send SMSM_RESET. */
	drv = container_of(subsys, struct modem_data, subsys_desc);
	if (!(smsm_get_state(SMSM_MODEM_STATE) & SMSM_RESET)) {
		modem_unregister_notifier(&drv->notifier);
		smsm_reset_modem(SMSM_RESET);
	}

	/* Wait to allow the modem to clean up caches etc. */
	mdelay(5);
}
Esempio n. 5
0
static int modem_shutdown(const struct subsys_data *subsys)
{
	void __iomem *q6_fw_wdog_addr;
	void __iomem *q6_sw_wdog_addr;
	int smsm_notif_unregistered = 0;

	if (!(smsm_get_state(SMSM_MODEM_STATE) & SMSM_RESET)) {
		smsm_state_cb_deregister(SMSM_MODEM_STATE, SMSM_RESET,
			smsm_state_cb, 0);
		smsm_notif_unregistered = 1;
		smsm_reset_modem(SMSM_RESET);
	}

	/*
	 * Cancel any pending wdog_check work items, since we're shutting
	 * down anyway.
	 */
	cancel_delayed_work(&modem_wdog_check_work);

	/*
	 * Disable the modem watchdog since it keeps running even after the
	 * modem is shutdown.
	 */
	q6_fw_wdog_addr = ioremap_nocache(Q6_FW_WDOG_ENABLE, 4);
	if (!q6_fw_wdog_addr)
		return -ENOMEM;

	q6_sw_wdog_addr = ioremap_nocache(Q6_SW_WDOG_ENABLE, 4);
	if (!q6_sw_wdog_addr) {
		iounmap(q6_fw_wdog_addr);
		return -ENOMEM;
	}

	writel_relaxed(0x0, q6_fw_wdog_addr);
	writel_relaxed(0x0, q6_sw_wdog_addr);
	mb();
	iounmap(q6_sw_wdog_addr);
	iounmap(q6_fw_wdog_addr);

	pil_force_shutdown("modem");
	pil_force_shutdown("modem_fw");
	disable_irq_nosync(Q6FW_WDOG_EXPIRED_IRQ);
	disable_irq_nosync(Q6SW_WDOG_EXPIRED_IRQ);

	if (smsm_notif_unregistered)
		smsm_state_cb_register(SMSM_MODEM_STATE, SMSM_RESET,
			smsm_state_cb, 0);

	return 0;
}
Esempio n. 6
0
static void modem_crash_shutdown(const struct subsys_desc *subsys)
{
	struct modem_data *drv;

	
	drv = container_of(subsys, struct modem_data, subsys_desc);
	if (!(smsm_get_state(SMSM_MODEM_STATE) & SMSM_RESET)) {
		modem_unregister_notifier(&drv->notifier);
		smsm_reset_modem(SMSM_RESET);
	}

	
	mdelay(5);
}
int subsys_q6_shutdown(const char * const crashed_subsys)
{
    void __iomem *q6_wdog_addr =
        ioremap_nocache(Q6SS_WDOG_ENABLE, 8);

    send_q6_nmi();
    writel_relaxed(0x0, q6_wdog_addr);
    /* The write needs to go through before the q6 is shutdown. */
    mb();
    iounmap(q6_wdog_addr);

    pil_force_shutdown("q6");
    disable_irq_nosync(LPASS_Q6SS_WDOG_EXPIRED);

    if (get_restart_level() == RESET_SUBSYS_MIXED)
        smsm_reset_modem(SMSM_RESET);

    return 0;
}
Esempio n. 8
0
static int modem_shutdown(const struct subsys_desc *subsys)
{
	struct modem_data *drv;

	drv = container_of(subsys, struct modem_data, subsys_desc);
	if (!(smsm_get_state(SMSM_MODEM_STATE) & SMSM_RESET)) {
		drv->ignore_smsm_ack = 1;
		smsm_reset_modem(SMSM_RESET);
	}

	
	writel_relaxed(0x0, drv->wdog + 0x8);
	mb();
	
	msleep(20);

	pil_shutdown(&drv->pil_desc);
	disable_irq_nosync(drv->irq);

	return 0;
}
Esempio n. 9
0
void gss_crash_shutdown(const struct subsys_data *subsys)
{
	crash_shutdown = 1;
	smsm_reset_modem(SMSM_RESET);
}
Esempio n. 10
0
static ssize_t reset_modem_write(struct file *fp, const char __user *buf,
			 size_t count, loff_t *pos)
{
	unsigned char cmd[64];
	int len;
	int time;
	int zero = 0;
	int r;

	if (count < 1)
		return 0;

	len = count > 63 ? 63 : count;

	if (copy_from_user(cmd, buf, len))
		return -EFAULT;

	cmd[len] = 0;

	
	if (cmd[len-1] == '\n') {
		cmd[len-1] = 0;
		len--;
	}

	if (!strncmp(cmd, "wait", 4)) {
		D(KERN_ERR "INFO:%s:%i:%s: "
		       "MODEM RESTART: WAIT\n",
		       __FILE__,
		       __LINE__,
		       __func__);
		smsm_reset_modem(SMSM_MODEM_WAIT);
	} else if (!strncmp(cmd, "continue", 8)) {
		D(KERN_ERR "INFO:%s:%i:%s: "
		       "MODEM RESTART: CONTINUE\n",
		       __FILE__,
		       __LINE__,
		       __func__);
		smsm_reset_modem_cont();
	} else if (!strncmp(cmd, "download", 8)) {
		D(KERN_ERR "INFO:%s:%i:%s: "
		       "MODEM RESTART: DOWNLOAD\n",
		       __FILE__,
		       __LINE__,
		       __func__);
		smsm_reset_modem(SMSM_SYSTEM_DOWNLOAD);
	} else if (sscanf(cmd, "deferred reset %i", &time) == 1) {
		D(KERN_ERR "INFO:%s:%i:%s: "
		       "MODEM RESTART: DEFERRED RESET %ims\n",
		       __FILE__,
		       __LINE__,
		       __func__,
		       time);
		if (time == 0) {
			r = 0;
			msm_proc_comm_reset_modem_now();
		} else {
			r = msm_proc_comm(PCOM_RESET_MODEM, &time, &zero);
		}
		if (r < 0)
			return r;
	} else if (!strncmp(cmd, "deferred reset", 14)) {
		D(KERN_ERR "INFO:%s:%i:%s: "
		       "MODEM RESTART: DEFERRED RESET 0ms\n",
		       __FILE__,
		       __LINE__,
		       __func__);
		r = 0;
		msm_proc_comm_reset_modem_now();
		if (r < 0)
			return r;
	} else if (!strncmp(cmd, "reset chip now", 14)) {
		uint param1 = 0x0;
		uint param2 = 0x0;

		D(KERN_ERR "INFO:%s:%i:%s: "
		  "MODEM RESTART: CHIP RESET IMMEDIATE\n",
		  __FILE__,
		  __LINE__,
		  __func__);

		r = msm_proc_comm(PCOM_RESET_CHIP_IMM, &param1, &param2);

		if (r < 0)
			return r;
	} else if (!strncmp(cmd, "reset chip", 10)) {

		uint param1 = 0x0;
		uint param2 = 0x0;

		D(KERN_ERR "INFO:%s:%i:%s: "
		  "MODEM RESTART: CHIP RESET \n",
		  __FILE__,
		  __LINE__,
		  __func__);

		r = msm_proc_comm(PCOM_RESET_CHIP, &param1, &param2);

		if (r < 0)
			return r;
	} else if (!strncmp(cmd, "reset", 5)) {
		printk(KERN_ERR "INFO:%s:%i:%s: "
		       "MODEM RESTART: RESET\n",
		       __FILE__,
		       __LINE__,
		       __func__);
		smsm_reset_modem(SMSM_RESET);
	} else
		return -EINVAL;

	return count;
}
int msm_proc_comm(unsigned cmd, unsigned *data1, unsigned *data2)
{
	unsigned base = (unsigned)MSM_SHARED_RAM_BASE;
	unsigned long flags;
	int ret;

	spin_lock_irqsave(&proc_comm_lock, flags);
#ifdef CONFIG_LGE_BLUE_ERROR_HANDLER
	if (proc_comm_wait_for(base + MDM_STATUS, PCOM_READY))
		goto crash;
#else

	if (msm_proc_comm_disable) {
		ret = -EIO;
		goto end;
	}


again:
	if (proc_comm_wait_for(base + MDM_STATUS, PCOM_READY))
		goto again;
#endif
	writel(cmd, base + APP_COMMAND);
	writel(data1 ? *data1 : 0, base + APP_DATA1);
	writel(data2 ? *data2 : 0, base + APP_DATA2);

	/* Make sure the writes complete before notifying the other side */
	dsb();

	notify_other_proc_comm();

	if (proc_comm_wait_for(base + APP_COMMAND, PCOM_CMD_DONE))
#ifdef CONFIG_LGE_BLUE_ERROR_HANDLER
		goto crash;
#else
		goto again;
#endif

	if (readl(base + APP_STATUS) == PCOM_CMD_SUCCESS) {
		if (data1)
			*data1 = readl(base + APP_DATA1);
		if (data2)
			*data2 = readl(base + APP_DATA2);
		ret = 0;
	} else {
		ret = -EIO;
	}

	writel(PCOM_CMD_IDLE, base + APP_COMMAND);

	switch (cmd) {
	case PCOM_RESET_CHIP:
	case PCOM_RESET_CHIP_IMM:
	case PCOM_RESET_APPS:
		msm_proc_comm_disable = 1;
		printk(KERN_ERR "msm: proc_comm: proc comm disabled\n");
		break;
	}
end:
	/* Make sure the writes complete before returning */
	dsb();

	spin_unlock_irqrestore(&proc_comm_lock, flags);
	return ret;
#ifdef CONFIG_LGE_BLUE_ERROR_HANDLER
/* LGE_CHANGE_S [[email protected]] 2009-07-06 <For Error Handler > */
crash:
	{
		extern char * error_modem_message ;
		extern int LG_ErrorHandler_enable;
	//	extern int get_status_hidden_reset();
		int ret;
		spin_unlock_irqrestore(&proc_comm_lock, flags);
	
		if (LG_ErrorHandler_enable) // check using proc_comm after arm9 crash 
			return 0;
		
	//	if(get_status_hidden_reset()==0 ) {
			ret = LGE_ErrorHandler_Main(MODEM_CRASH, error_modem_message);
			smsm_reset_modem(ret);
	//	} else {
	//		smsm_reset_modem(SMSM_SYSTEM_REBOOT);
	//	}
		while(1) 
			;
	}
/* LGE_CHANGE_E [[email protected]] 2009-07-06 <For Error Handler > */
#endif
}
void modem_crash_shutdown(const struct subsys_desc *subsys)
{
	crash_shutdown = 1;
	smsm_reset_modem(SMSM_RESET);
}
Esempio n. 13
0
int msm_proc_comm(unsigned cmd, unsigned *data1, unsigned *data2)
{
	unsigned base = (unsigned)MSM_SHARED_RAM_BASE;
	unsigned long flags;
	int ret;

	spin_lock_irqsave(&proc_comm_lock, flags);
	//LGE_CHANGE_S [[email protected]] 2009-04-01 <For Error Handler> 
/* again :*/
	if (proc_comm_wait_for(base + MDM_STATUS, PCOM_READY)) {
			goto crash;
	}
	//LGE_CHANGE_E [[email protected]] 2009-04-01 <For Error Handler> 
	writel(cmd, base + APP_COMMAND);
	writel(data1 ? *data1 : 0, base + APP_DATA1);
	writel(data2 ? *data2 : 0, base + APP_DATA2);

	notify_other_proc_comm();
	
	//LGE_CHANGE_S [[email protected]] 2009-04-01 <For Error Handler> 
		if (proc_comm_wait_for(base + APP_COMMAND, PCOM_CMD_DONE)) {
			goto crash;

	}
	//LGE_CHANGE_E [[email protected]] 2009-04-01 <For Error Handler> 
	if (readl(base + APP_STATUS) == PCOM_CMD_SUCCESS) {
		if (data1)
			*data1 = readl(base + APP_DATA1);
		if (data2)
			*data2 = readl(base + APP_DATA2);
		ret = 0;
	} else {
		ret = -EIO;
	}

	writel(PCOM_CMD_IDLE, base + APP_COMMAND);

	spin_unlock_irqrestore(&proc_comm_lock, flags);
	return ret;
/* LGE_CHANGE_S [[email protected]] 2009-07-06 <For Error Handler > */
crash:
	{
		extern char * error_modem_message ;
		extern int LG_ErrorHandler_enable;
	//	extern int get_status_hidden_reset();
		int ret;
		spin_unlock_irqrestore(&proc_comm_lock, flags);
	
		if (LG_ErrorHandler_enable) // check using proc_comm after arm9 crash 
			return 0;
		
	//	if(get_status_hidden_reset()==0 ) {
			ret = LGE_ErrorHandler_Main(MODEM_CRASH, error_modem_message);
			smsm_reset_modem(ret);
	//	} else {
	//		smsm_reset_modem(SMSM_SYSTEM_REBOOT);
	//	}
		while(1) 
			;
	}
/* LGE_CHANGE_E [[email protected]] 2009-07-06 <For Error Handler > */
}
Esempio n. 14
0
static ssize_t reset_modem_write(struct file *fp, const char __user *buf,
			 size_t count, loff_t *pos)
{
	unsigned char cmd[64];
	int len;
	int time;
	int zero = 0;
	int r;

	if (count < 1)
		return 0;

	len = count > 63 ? 63 : count;

	if (copy_from_user(cmd, buf, len))
		return -EFAULT;

	cmd[len] = 0;

	/* lazy */
	if (cmd[len-1] == '\n') {
		cmd[len-1] = 0;
		len--;
	}

	if (!strncmp(cmd, "wait", 4)) {
		D(KERN_ERR "INFO:%s:%i:%s: "
		       "MODEM RESTART: WAIT\n",
		       __FILE__,
		       __LINE__,
		       __func__);
		smsm_reset_modem(SMSM_MODEM_WAIT);
	} else if (!strncmp(cmd, "continue", 8)) {
		D(KERN_ERR "INFO:%s:%i:%s: "
		       "MODEM RESTART: CONTINUE\n",
		       __FILE__,
		       __LINE__,
		       __func__);
		smsm_reset_modem_cont();
	} else if (!strncmp(cmd, "download", 8)) {
		D(KERN_ERR "INFO:%s:%i:%s: "
		       "MODEM RESTART: DOWNLOAD\n",
		       __FILE__,
		       __LINE__,
		       __func__);
		smsm_reset_modem(SMSM_SYSTEM_DOWNLOAD);
	} else if (sscanf(cmd, "deferred reset %i", &time) == 1) {
		D(KERN_ERR "INFO:%s:%i:%s: "
		       "MODEM RESTART: DEFERRED RESET %ims\n",
		       __FILE__,
		       __LINE__,
		       __func__,
		       time);
		if (time == 0) {
			r = 0;
			msm_proc_comm_reset_modem_now();
		} else {
			r = msm_proc_comm(PCOM_RESET_MODEM, &time, &zero);
		}
		if (r < 0)
			return r;
	} else if (!strncmp(cmd, "deferred reset", 14)) {
		D(KERN_ERR "INFO:%s:%i:%s: "
		       "MODEM RESTART: DEFERRED RESET 0ms\n",
		       __FILE__,
		       __LINE__,
		       __func__);
		r = 0;
		msm_proc_comm_reset_modem_now();
		if (r < 0)
			return r;
	} else if (!strncmp(cmd, "reset chip now", 14)) {
#ifndef CONFIG_SW_RESET
		uint param1 = 0x0;
		uint param2 = 0x0;
#endif
		D(KERN_ERR "INFO:%s:%i:%s: "
		  "MODEM RESTART: CHIP RESET IMMEDIATE\n",
		  __FILE__,
		  __LINE__,
		  __func__);

#if defined(CONFIG_SW_RESET)
		r = sky_sys_rst_UserReset_imm(NULL);
#else
		r = msm_proc_comm(PCOM_RESET_CHIP_IMM, &param1, &param2);
#endif

		if (r < 0)
			return r;
	} else if (!strncmp(cmd, "reset chip", 10)) {
#ifndef CONFIG_SW_RESET		
		uint param1 = 0x0;
		uint param2 = 0x0;
#endif
		D(KERN_ERR "INFO:%s:%i:%s: "
		  "MODEM RESTART: CHIP RESET \n",
		  __FILE__,
		  __LINE__,
		  __func__);

#if defined(CONFIG_SW_RESET)
		r = sky_sys_rst_UserReset(NULL);
#else
		r = msm_proc_comm(PCOM_RESET_CHIP, &param1, &param2);
#endif

		if (r < 0)
			return r;
#if defined(CONFIG_SW_RESET)
	} else if (!strncmp(cmd, "reset sw now", 12)) {

		D(KERN_ERR "INFO:%s:%i:%s: "
		  "MODEM SW RESTART: CHIP RESET IMMEDIATE\n",
		  __FILE__,
		  __LINE__,
		  __func__);

		r = sky_sys_rst_SwReset_imm(NULL);

		if (r < 0)
		{
			D(KERN_ERR "ERROR: sky_sys_rst_SwReset_imm failed: %d\n", r);
			return r;
		}
	} else if (!strncmp(cmd, "reset sw exception", 8)) {

		D(KERN_ERR "INFO:%s:%i:%s: "
		  "MODEM SW RESTART: CHIP EXCEPTION \n",
		  __FILE__,
		  __LINE__,
		  __func__);

		BUG();
		return 0;

#endif
	} else if (!strncmp(cmd, "reset", 5)) {
		printk(KERN_ERR "INFO:%s:%i:%s: "
		       "MODEM RESTART: RESET\n",
		       __FILE__,
		       __LINE__,
		       __func__);
		smsm_reset_modem(SMSM_RESET);
	} 
#ifdef FEATURE_SKY_CHG_LOGO
	else if(!strncmp(cmd,"powerdown",9)) {

		printk(KERN_ERR "INFO:%s:%i:%s: "
		       "MODEM POWER DOWN: OFF\n",
		       __FILE__,
		       __LINE__,
		       __func__);
		
		r = msm_proc_comm(PCOM_POWER_DOWN, 0,0);

		if (r < 0)
			return r;

		for(;;)
			;
	}
#endif
	else
		return -EINVAL;

	return count;
}
Esempio n. 15
0
 int LGE_ErrorHandler_Main( int crash_side, char * message)
 {

    ram_console_setpanic();

	if (hidden_reset_enable) {
		if (crash_side == MODEM_CRASH) {
			unsigned *temp;

			printk(KERN_INFO"%s: arm9 has crashed...\n",__func__);
			printk(KERN_INFO"%s\n", message);
		
			atomic_notifier_call_chain(&panic_notifier_list, 0, "arm9 has crashed...\n");
			
			temp = lge_get_fb_copy_virt_addr();
			*temp = 0x12345678;
			printk(KERN_INFO"%s: hidden magic  %x\n",__func__, temp[0]);

			return SMSM_SYSTEM_REBOOT;
		}

		return 0;
	}

  	if(BLUE_ERROR_HANDLER_LEVEL != 0) {
		
		if (get_suspend_state() != PM_SUSPEND_ON) {
		
			lcd_suspend = 0;
		}
		
		switch(crash_side) {
			case MODEM_CRASH:
			case APPL_CRASH:
			case ANDROID_CRASH:
				if(!LG_ErrorHandler_enable) {
					LG_ErrorHandler_enable	= 1;
					raw_local_irq_enable();
					if (message != NULL)
						display_info_LCD(crash_side, message);
				}
				break;
			case ANDROID_DISPLAY_INFO :
				if (message != NULL)
					display_info_LCD(crash_side, message);
				return 0;

			default : 
				break;
				
		}
  	}

	raw_local_irq_disable();
	preempt_disable();

	smsm_reset_modem(SMSM_APPS_SHUTDOWN); 

  	if(BLUE_ERROR_HANDLER_LEVEL == 0) {		
		mdelay(100);
		return SMSM_SYSTEM_REBOOT;
  	}

	while(1)
	{
		gpio_set_value(36,0);
		gpio_set_value(32,1);
		gpio_set_value(33,1);
		
		if(gpio_get_value(38)==0) {
			printk("Pressed Volume up key\n");
			return SMSM_SYSTEM_DOWNLOAD; 
		} else if(gpio_get_value(37) ==0 ) {
			printk("Pressed Volume down key\n");
			return SMSM_SYSTEM_REBOOT; 
		}

		mdelay(200);
	
	
		;
	}

 }