void ccpu_start_init(void)
{
	if(bsp_ipc_int_connect(IPC_MCU_INT_SRC_CCPU_START, IntIpcCcpuStartHandler, 0) != OK)
	{
		printk("\r\npm_ipc_init connect acpu error\n");
	}

	if(bsp_ipc_int_enable(IPC_MCU_INT_SRC_CCPU_START) != OK)
	{
		printk("\r\npm_ipc_init enable acpu error\n");
	}
}
s32 bsp_ipc_test_init(void)
{
	s32 ret = 0;
	ret = bsp_ipc_int_connect(IPC_ACPU_INT_SRC_CCPU_TEST_ENABLE,bsp_for_intenable_handler,0);
	if(ret !=OK)
	{
		bsp_trace(BSP_LOG_LEVEL_ERROR,BSP_MODU_IPC,"bsp_ipc_test_init connect error\n");
		return ERROR;
	}
	ret = bsp_ipc_int_enable(IPC_ACPU_INT_SRC_CCPU_TEST_ENABLE);
	if(ret != OK)
	{
		bsp_trace(BSP_LOG_LEVEL_ERROR,BSP_MODU_IPC,"bsp_ipc_test_init enable int  error\n");
		return ERROR;
	}
	bsp_trace(BSP_LOG_LEVEL_ERROR,BSP_MODU_IPC,"bsp_ipc_test_init ok\n");
	return OK;
}
int __init bsp_reset_init(void)
{
	s32 ret = RESET_ERROR;
	struct device_node *np = NULL;

	memset(&(g_modem_reset_ctrl), 0, sizeof(g_modem_reset_ctrl));
	memset(&g_reset_debug, 0, sizeof(g_reset_debug));
	g_reset_debug.print_sw = 1;

	/* NV控制是否打开单独复位功能以及与RIL的对接 */
	if(BSP_OK != bsp_nvm_read(NV_ID_DRV_CCORE_RESET, (u8*)&(g_modem_reset_ctrl.nv_config), sizeof(DRV_CCORE_RESET_STRU)))
	{
		reset_print_err("nv read fail, use default value\n");
	}

	np = of_find_compatible_node(NULL, NULL, "hisilicon,crgctrl");
	g_modem_reset_ctrl.crg_base =  of_iomap(np, 0);
	if (!g_modem_reset_ctrl.crg_base)
	{
		reset_print_err("get crg_base fail!\n");
		return RESET_ERROR;
	}

	bsp_reset_bootflag_set(CCORE_BOOT_NORMAL);

	/* 置上acore与ccore之间通信状态可用标识 */
	g_modem_reset_ctrl.multicore_msg_switch = 1;
	g_modem_reset_ctrl.modem_action = MODEM_NORMAL;

	osl_sem_init(0, &g_modem_reset_ctrl.task_sem);
	osl_sem_init(0, &g_modem_reset_ctrl.wait_mcore_reply_sem);
	osl_sem_init(0, &g_modem_reset_ctrl.wait_mcore_reply_reseting_sem);
	osl_sem_init(0, &g_modem_reset_ctrl.wait_hifi_reply_sem);
	osl_sem_init(0, &g_modem_reset_ctrl.wait_ccore_reset_ok_sem);
	osl_sem_init(0, &g_modem_reset_ctrl.wait_modem_master_in_idle_sem);

	wake_lock_init(&g_modem_reset_ctrl.wake_lock, WAKE_LOCK_SUSPEND, "modem_reset wake");
	spin_lock_init(&g_modem_reset_ctrl.action_lock);

    g_modem_reset_ctrl.task = kthread_run(modem_reset_task,  NULL, "modem_reset");
	if(!g_modem_reset_ctrl.task)
	{
		reset_print_err("create modem_reset thread fail!\n");
		return RESET_ERROR;
	}

	ret = bsp_reset_cb_func_register("drv", drv_reset_cb, 0, DRV_RESET_CB_PIOR_ALL);
	if(ret !=  RESET_OK)
	{
		reset_print_err("register drv reset callback fail!\n");
		return RESET_ERROR;
	}

	ret = DRV_MAILBOX_REGISTERRECVFUNC(MAILBOX_MAILCODE_HIFI_TO_ACPU_CCORE_RESET_ID, (mb_msg_cb)from_hifi_mailbox_readcb, NULL);/*lint !e713 */
	if(MAILBOX_OK != ret)
	{
		reset_print_err("register mailbox callback fail");
		return RESET_ERROR;
	}

	init_completion(&(g_modem_reset_ctrl.suspend_completion));
	g_modem_reset_ctrl.pm_notify.notifier_call = reset_pm_notify;
	register_pm_notifier(&g_modem_reset_ctrl.pm_notify);

	g_modem_reset_ctrl.reset_wq = create_singlethread_workqueue("reset_wq");
    BUG_ON(!g_modem_reset_ctrl.reset_wq); /*lint !e548 */
	INIT_WORK(&(g_modem_reset_ctrl.work_reset), modem_reset_do_work);
	INIT_WORK(&(g_modem_reset_ctrl.work_power_off), modem_power_off_do_work);
	INIT_WORK(&(g_modem_reset_ctrl.work_power_on), modem_power_on_do_work);

	g_modem_reset_ctrl.ipc_recv_irq_idle = IPC_ACPU_INT_SRC_CCPU_RESET_IDLE;
	g_modem_reset_ctrl.ipc_recv_irq_reboot = IPC_ACPU_INT_SRC_CCPU_RESET_SUCC;
	g_modem_reset_ctrl.ipc_send_irq_wakeup_ccore = IPC_CCPU_INT_SRC_ACPU_RESET;
	if (bsp_ipc_int_connect(g_modem_reset_ctrl.ipc_recv_irq_idle, (voidfuncptr)reset_ipc_isr_idle, 0))
	{
		reset_print_err("connect idle ipc fail!\n");
		return RESET_ERROR;
	}
	if (bsp_ipc_int_enable(g_modem_reset_ctrl.ipc_recv_irq_idle))
	{
		reset_print_err("enable idle ipc fail!\n");
		return RESET_ERROR;
	}

	if (bsp_ipc_int_connect(g_modem_reset_ctrl.ipc_recv_irq_reboot, (voidfuncptr)reset_ipc_isr_reboot, 0))
	{
		reset_print_err("connect reboot ipc fail!\n");
		return RESET_ERROR;
	}
	if (bsp_ipc_int_enable(g_modem_reset_ctrl.ipc_recv_irq_reboot))
	{
		reset_print_err("enable reboot ipc fail!\n");
		return RESET_ERROR;
	}

	g_modem_reset_ctrl.state = 1;

	reset_print_err("ok\n");

	return 0;
}
Exemplo n.º 4
0
BSP_S32 BSP_IPC_IntEnable (IPC_INT_LEV_E ulLvl)
{
	return bsp_ipc_int_enable(ulLvl);
}
int mdrv_ipc_int_enable (IPC_INT_LEV_E ulLvl)
{
	return bsp_ipc_int_enable(ulLvl);
}
s32 bsp_ipc_test_from_m(void)
{
	(void)bsp_ipc_int_connect(IPC_ACPU_INT_SRC_MCU_FOR_TEST,bsp_for_test_mcore,31);
	(void)bsp_ipc_int_enable(IPC_ACPU_INT_SRC_MCU_FOR_TEST);
	return OK;
}