void bsp_abb_tv201_init_later(u32 offset)
{
    u32 i = 0;
    u32 value = 0;

    bsp_abb_read(ABB_VERSION_ADDR + offset, &value);
    if ((offset) && (value != COMSTARTV201)) {
        bsp_trace(BSP_LOG_LEVEL_ERROR, BSP_MODU_ABB, "there may be only one ComStar TV201\n");
        return;
    }

    bsp_abb_tv201_tcxo_init();

    /* reset VREF*/
    bsp_abb_write(0x08C + offset, 0x02);
    udelay(1);
    bsp_abb_write(0x08C + offset, 0x00);

    /* start ABB calibration */
    bsp_abb_write(0x08C + offset, 0x00);
    bsp_abb_write(0x08C + offset, 0x01);
    do {
        bsp_abb_read(0x09E + offset, &value);
    }while (!(value & 0x10));

    bsp_abb_read(0x09F + offset, &value);
    bsp_abb_write(0x386 + offset, value);
    bsp_abb_write(0x586 + offset, value);
    bsp_abb_write(0x786 + offset, value);

    for (i = 0; i < sizeof(g_abb_cfg_tv201) / sizeof(g_abb_cfg_tv201[0]); i++)
        bsp_abb_write(g_abb_cfg_tv201[i].addr + offset, g_abb_cfg_tv201[i].value);

    /*  rxadc_op1_offset  */
    bsp_abb_tv201_init_rxadc_op1_offset(offset);

    //open scpll and gpll
    bsp_abb_write(0x089 + offset, 0x06);
    bsp_abb_write(0x0A5 + offset, 0x15);
}
/*****************************************************************************
* 函 数 名  : bsp_smalloc_dbg
*
* 功能描述  : BSP 动态内存分配(加spin lock保护,多核场景使用)(Debug接口)
*
* 输入参数  : u32Size: 分配的大小(byte)
*             enFlags: 内存属性(暂不使用,预留)
*             pFileName: 使用的源文件
*             u32Line:   所在文件的行号
* 输出参数  : 无
* 返 回 值  : 成功/失败
*****************************************************************************/
void* bsp_smalloc_dbg(u32 u32Size, MEM_POOL_TYPE enFlags, u8* pFileName, u32 u32Line)
{
    u8 *pItem;
    if(0 == *g_mem_init_mark)
    {
        return NULL;
    }

#ifdef __BSP_MEM_DEBUG__
    if ((u32)enFlags >= MEM_POOL_MAX)
    {
        bsp_trace(BSP_LOG_LEVEL_ERROR, BSP_MODU_MEM,
                  "invalid mem enFlags:%d, line:%d\n", (u32)enFlags, __LINE__);
        return NULL;
    }
#endif

    /* 分配内存 */
    pItem = bsp_memory_alloc((u32)enFlags, u32Size);

    return (void*)pItem;
}
void hardtimer_test(void)
{
    s32 ret;
    ret = k3_hardtimer_test_case01();
    if (OK == ret)
        bsp_trace(BSP_LOG_LEVEL_ERROR,BSP_MODU_HARDTIMER,"hardtimer_test_case01 pass\n");
    else
        bsp_trace(BSP_LOG_LEVEL_ERROR,BSP_MODU_HARDTIMER,"hardtimer_test_case01 fail\n");
    ret = k3_hardtimer_test_case02();
    if (OK == ret)
        bsp_trace(BSP_LOG_LEVEL_ERROR,BSP_MODU_HARDTIMER,"hardtimer_test_case02 pass\n");
    else
        bsp_trace(BSP_LOG_LEVEL_ERROR,BSP_MODU_HARDTIMER,"hardtimer_test_case02 fail\n");
    ret =k3_hardtimer_test_case03();
    if (OK == ret)
        bsp_trace(BSP_LOG_LEVEL_ERROR,BSP_MODU_HARDTIMER,"hardtimer_test_case03 pass\n");
    else
        bsp_trace(BSP_LOG_LEVEL_ERROR,BSP_MODU_HARDTIMER,"hardtimer_test_case03 fail\n");
    ret = k3_hardtimer_test_case04();
    if (OK == ret)
        bsp_trace(BSP_LOG_LEVEL_ERROR,BSP_MODU_HARDTIMER,"hardtimer_test_case04 pass\n");
    else
        bsp_trace(BSP_LOG_LEVEL_ERROR,BSP_MODU_HARDTIMER,"hardtimer_test_case04 fail\n");
}
Example #4
0
/**************************************************************************
  接口实现
**************************************************************************/
s32 bsp_mem_init(void)
{
    u32 u32PoolType = 0;
    u32 u32MaxInitNum = 0;

    memset((void *)SHM_MEMMGR_FLAG_ADDR, 0, SHM_MEMMGR_FLAG_SIZE);

    g_mem_init_mark = (u32* )MEM_CTX_ADDR;
    sg_pAllocSizeTbl = (u32*)(MEM_CTX_ADDR + MEM_CTX_RESERVED);
    sg_pIccAllocInfo = (MEM_ALLOC_INFO*)(MEM_CTX_ADDR + sizeof(sg_AllocListSize) + MEM_CTX_RESERVED);

    memset((void*)sg_pIccAllocInfo, 0, (sizeof(MEM_ALLOC_INFO)));
    memcpy(sg_pAllocSizeTbl, sg_AllocListSize, sizeof(sg_AllocListSize));
    mb();

    u32MaxInitNum = MEM_POOL_MAX;
    if (bsp_usr_init() != OK)
    {
        printk("bsp_usr_init call fail, line:%d\n", __LINE__);
    }

    for (u32PoolType = (u32)MEM_NORM_DDR_POOL; u32PoolType < (u32)u32MaxInitNum; u32PoolType++)
    {
        /* 分配内存池 */
        if (OK != bsp_init_poll(u32PoolType))
        {
            return ERROR;
        }

        (void)bsp_set_most_used_size(512, u32PoolType);
        mb();
    }
    bsp_trace(BSP_LOG_LEVEL_ERROR, BSP_MODU_MEM, "[mem]: <bsp_mem_init> memory init OK!\r\n");
    /*初始化成功标示*/
    *g_mem_init_mark = 1;
    mb();
    return OK;
}
/*
 * 发送消息 BSP_ERROR 发送失败;BSP_OK 发送成功
 */
int balong_cpufreq_icc_send(struct cpufreq_msg *msg)
{
	u32 channel_id = ICC_CHN_MCORE_CCORE << 16 | MCU_CCORE_CPUFREQ;
	s32 ret = 0;
	u32 time_value = 0;
	u32 msg_len = sizeof(struct cpufreq_msg);
	if (!g_cpufreq_lock_status_flag)
	{
		return BSP_ERROR;
	}
	ret = balong_check_msg(msg);
	if (BSP_ERROR == ret)
	{
		bsp_trace(BSP_LOG_LEVEL_DEBUG, BSP_MUDU_CPUFREQ,"msg is: msg_type:%d source:%d content:%d profile:%d\n",
																								msg->msg_type, msg->source, msg->content, msg->profile);
		return BSP_OK;
	}
	if(g_lowpower_shared_addr)
	{
		time_value=  bsp_get_slice_value();
		writel(time_value, g_lowpower_shared_addr + 0x210);
	}
	debug_msg.msg_type = msg->msg_type;
	debug_msg.source = msg->source;
	debug_msg.content = msg->content;
	debug_msg.profile = msg->profile;
	cpufreq_pm_om_log(msg);
	
	ret = bsp_icc_send(ICC_CPU_MCU, channel_id, (u8 *)msg, msg_len);

	if((ret < 0) && (ret != BSP_ERR_ICC_CCORE_RESETTING))
	{
		cpufreq_err("mcore return an ERROR please check m3 %d\n", ret);
		return BSP_ERROR;
	}

    return BSP_OK;
}
void bsp_abb_deassert_reset(void)
{
    struct device_node *dev = NULL;
    const char *name = "hisilicon,abb_balong_mdm_for_sysc";
    static u32 addr = 0;
    static u32 offset = 0;

    if (!g_abb_inited) {
        dev = of_find_compatible_node(NULL, NULL, name);
        if(NULL == dev) {
             bsp_trace(BSP_LOG_LEVEL_ERROR, BSP_MODU_ABB, "ABB device node not found\n");
             return;
        }
        of_property_read_u32_index(dev, "abb_srst_dis", 0, &addr);
        of_property_read_u32_index(dev, "abb_srst_dis", 1, &offset);

        if (addr)
            addr = (u32)bsp_sysctrl_addr_get((void *)addr);
    }

    if (addr)
        writel(0x01U << offset, addr);
}
Example #7
0
OSL_IRQ_FUNC(irqreturn_t,ipc_int_handler,irq,dev_id)
{
	u32 i = 0;
	u32 u32IntStat = 0,begin = 0,end = 0;
	u32 u32Date = 0x1;
	u32 u32BitValue = 0;
	u32IntStat=readl((const volatile void *)(ipc_ctrl.ipc_base + BSP_IPC_CPU_INT_STAT(ipc_ctrl.core_num)));
	/*清中断*/
	writel(u32IntStat,(volatile void *)(ipc_ctrl.ipc_base + BSP_IPC_CPU_INT_CLR(ipc_ctrl.core_num)));
	/* 遍历32个中断 */
	for (i = 0; i < INTSRC_NUM; i++)
	{
		if(0!=i)
		{
			u32Date <<= 1;   
		} 
		u32BitValue = u32IntStat & u32Date;
		/* 如果有中断 ,则调用对应中断处理函数 */
		if (0 != u32BitValue)
		{  
			/*调用注册的中断处理函数*/
			if (NULL !=  ipc_ctrl.ipc_int_table[i].routine)
			{
				begin = bsp_get_slice_value();
				ipc_ctrl.ipc_int_table[i].routine(ipc_ctrl.ipc_int_table[i].arg);
				end = bsp_get_slice_value();
				ipc_debug.u32IntTimeDelta[i] = get_timer_slice_delta(begin,end);
			}
			else
			{
				bsp_trace(BSP_LOG_LEVEL_ERROR,BSP_MODU_IPC,"BSP_DRV_IpcIntHandler:No IntConnect,ERROR!.int num =%d\n",i);
			}
			ipc_debug.u32IntHandleTimes[i]++;
		}
	}
	return IRQ_HANDLED;
}
/*****************************************************************************
 函 数 名  : bsp_start_mode_get
 功能描述  : 用于C核获取开机模式,通过核间调用, 启动的时候不允许获取
 输入参数  :
 输出参数  : 无
 返 回 值  :
 调用函数  :
 被调函数  :
*****************************************************************************/
int  bsp_start_mode_get( void )
{
    int rt = 0;
    u32 channel_id = ICC_CHN_IFC << 16 | IFC_RECV_FUNC_ONOFF;
    DRV_START_MODE start_mode = DRV_START_MODE_NORMAL;
    stCtrlMsg msg = g_pwrctrl.curr;

    if(!g_pwrctrl.is_init)
        return start_mode;

    if (g_start_mode != (int)DRV_START_MODE_BUILT)
        return g_start_mode;

    msg.pwr_type = E_POWER_ON_MODE_GET;
    msg.mode = DRV_START_MODE_NORMAL;

    osl_sem_down(&(g_pwrctrl.pwr_sem));

    rt = bsp_icc_send(ICC_CPU_APP, channel_id, (u8*)&msg,
        sizeof(stCtrlMsg)); //lint !e40
    if(rt != (int)sizeof(stCtrlMsg))
    {
        osl_sem_up(&(g_pwrctrl.pwr_sem));
        bsp_trace(BSP_LOG_LEVEL_ERROR, BSP_MODU_ONOFF,"[onoff]onoff icc send error, rt=0x%x\n", rt);
        return start_mode;
    }

    /*coverity[lock] */
    osl_sem_down(&g_sem_mode);

    start_mode = (DRV_START_MODE)g_start_mode;

    osl_sem_up(&(g_pwrctrl.pwr_sem));

    /*coverity[missing_unlock] */
    return start_mode;
}
STATIC void bsp_memory_free(u32 u32PoolType, void* pMem, u32 u32Size)
{
    u32 cnt;
    u32 u32MostUsedItem;
    MEM_ALLOC_INFO* pAllocInfo = MEM_GET_ALLOC_INFO(u32PoolType);

    u32MostUsedItem = pAllocInfo->mostUsedItem;
    /* 先查找AllocList中是否有可用的内存节点 */
    MEM_FIND_RIGHT_ITEM(cnt, u32Size, u32MostUsedItem);
#ifdef __BSP_MEM_DEBUG__
    /* 判断该节点是否有效 */
    if (cnt >= MEM_ALLOC_LIST_NUM)
    {
        bsp_trace(BSP_LOG_LEVEL_ERROR, BSP_MODU_MEM,
                  "memPoolAlloc Fail, size:%d, line:%d\n", u32Size, __LINE__);
        return;
    }
#endif

    MEM_LOCK_BY_TYPE(u32PoolType);/*lint !e713*/

    /* 将item挂回到链表 */
    MEM_ITEM_NEXT(pMem) = (u32)pAllocInfo->allocList[cnt];
    pAllocInfo->allocList[cnt] = pMem;

#ifdef __BSP_MEM_DEBUG__
    pAllocInfo->allocUsedInfoList[cnt].u32CurNum--;
    pAllocInfo->allocUsedInfoList[cnt].u32TotalFreeNum++;
    MEM_ITEM_STATUS(pMem) = MEM_FREE;
#endif
    /* Flush Cache */
    MEM_FLUSH_CACHE_BY_TYPE(MEM_GET_ALLOC_ADDR(pMem), MEM_MGR_SIZE_FOR_CACHE, u32PoolType);

    MEM_UNLOCK_BY_TYPE(u32PoolType);
    return;
}
void bsp_abb_init(void)
{
    int ret = 0;

    u32 abb_version = 0;
    u32 is_supported = 0;

    bsp_abb_deassert_reset();

    if (!g_abb_inited) {
        g_abb_base_addr = bsp_bbp_part_addr_get(BBP_ABB);

        ret = (int)bsp_nvm_read(NV_ID_DRV_NV_PWC_SWITCH, (u8*)&g_abb_pm_switch, sizeof(g_abb_pm_switch));
        if (ret) {
            (void)memset_s((void *)&g_abb_pm_switch, sizeof(g_abb_pm_switch), 0, sizeof(g_abb_pm_switch));
            bsp_trace(BSP_LOG_LEVEL_ERROR, BSP_MODU_ABB, "ABB read nv fail, ret = %d\n", ret);
        }
    }

    if (!g_abb_base_addr) {
        bsp_trace(BSP_LOG_LEVEL_ERROR, BSP_MODU_ABB, "fail to get abb base address\n");
        return;
    }

    (void)bsp_abb_read(ABB_VERSION_ADDR, &abb_version);

extern int bsp_abb_tv201_init(u32 abb_version, u32 *is_supported);
    ret |= bsp_abb_tv201_init(abb_version, &is_supported);

extern int bsp_abb_tv210_init(u32 abb_version, u32 *is_supported);
    ret |= bsp_abb_tv210_init(abb_version, &is_supported);

extern int bsp_abb_tv220_init(u32 abb_version, u32 *is_supported);
    ret |= bsp_abb_tv220_init(abb_version, &is_supported);

extern int bsp_abb_tv230_init(u32 abb_version, u32 *is_supported);
    ret |= bsp_abb_tv230_init(abb_version, &is_supported);

extern int bsp_abb_tv260_init(u32 abb_version, u32 *is_supported);
    ret |= bsp_abb_tv260_init(abb_version, &is_supported);

extern int bsp_abb_tv300_init(u32 abb_version, u32 *is_supported);
    ret |= bsp_abb_tv300_init(abb_version, &is_supported);

extern int bsp_abb_tv310_init(u32 abb_version, u32 *is_supported);
    ret |= bsp_abb_tv310_init(abb_version, &is_supported);

    if (bsp_rsracc_support()) {
        ret |= bsp_rsracc_register(&g_abb_rsracc_device, 1);
    } else {
#ifdef CONFIG_CCORE_PM
        if (!g_abb_inited) {
            ret |= bsp_device_pm_add(&g_abb_dpm_device);
            if (ret) {
                bsp_trace(BSP_LOG_LEVEL_ERROR, BSP_MODU_ABB, "fail to add abb dpm device\r\n");
                return;
            }
        }
#endif
    }

    if (ret) {
        bsp_trace(BSP_LOG_LEVEL_ERROR, BSP_MODU_ABB, "ABB init fail\n");
        return;
    }

    if (!is_supported) {
        bsp_trace(BSP_LOG_LEVEL_ERROR, BSP_MODU_ABB, "don't support this ABB version: 0x%x\n", abb_version);
        return;
    }

    if (!g_abb_inited) {
        g_abb_inited = 1;
        g_abb_ops.abb_om = (struct abb_om_info*)bsp_pm_dump_get(PM_OM_ABB, sizeof(struct abb_om_info));
        if (!g_abb_ops.abb_om)
            g_abb_ops.abb_om = &g_abb_om_info;

        (void)memset_s((void *)(g_abb_ops.abb_om), sizeof(struct abb_om_info), 0, sizeof(struct abb_om_info));

        bsp_trace(BSP_LOG_LEVEL_ERROR, BSP_MODU_ABB, "ABB init ok, version: 0x%x\n", abb_version);
    }
}
s32 bsp_reset_cb_func_register(const char *name, pdrv_reset_cbfun func, int user_data, int prior)
{
	bsp_trace(BSP_LOG_LEVEL_ERROR, BSP_MODU_RESET, "[reset]: <%s> is stub\n", __FUNCTION__);
	return 0;
}
s32 bsp_icc_init(void)
{
	bsp_trace(BSP_LOG_LEVEL_ERROR, BSP_MODU_ICC, "[icc]: <%s> is stub\n", __FUNCTION__);
	return ICC_OK;
}
void bsp_icc_release(void)
{
	bsp_trace(BSP_LOG_LEVEL_ERROR, BSP_MODU_ICC, "[icc]: <%s> is stub\n", __FUNCTION__);
	return;
}
s32 bsp_icc_event_register(u32 channel_id, read_cb_func read_cb, void *read_context,
                                              write_cb_func write_cb, void *write_context)
{
	bsp_trace(BSP_LOG_LEVEL_ERROR, BSP_MODU_ICC, "[icc]: <%s> is stub\n", __FUNCTION__);
	return ICC_OK;
}
s32 bsp_icc_event_unregister(u32 channel_id)
{
	bsp_trace(BSP_LOG_LEVEL_ERROR, BSP_MODU_ICC, "[icc]: <%s> is stub\n", __FUNCTION__);
	return ICC_OK;
}
s32 bsp_icc_send_sync(u32 cpuid,u32 channel_id,u8 * data,u32 data_len,long timeout)
{
	bsp_trace(BSP_LOG_LEVEL_ERROR, BSP_MODU_ICC, "[icc]: <%s> is stub\n", __FUNCTION__);
	return data_len;	
}
BSP_S32 BSP_ICC_Open(BSP_U32 u32ChanId, ICC_CHAN_ATTR_S *pChanAttr)
{
	bsp_trace(BSP_LOG_LEVEL_ERROR, BSP_MODU_ICC, "[icc]: <%s> is stub\n", __FUNCTION__);
	return ICC_OK;
}
STATIC s32 bsp_mem_dump_block(u32 u32Addr)
{
    BSP_BOOL bBlockInvalid = FALSE;
    bBlockInvalid = bBlockInvalid;

    if (NULL == (void *)u32Addr)
    {
        bsp_trace(BSP_LOG_LEVEL_ERROR, BSP_MODU_MEM,"can't dump the block, the input ptr is NULL\n");
        return BSP_ERROR;
    }

    if (MEM_MAGIC_NUM != MEM_ITEM_MAGIC(u32Addr))
    {
        bBlockInvalid = TRUE;
        bsp_trace(BSP_LOG_LEVEL_ERROR, BSP_MODU_MEM,"The Block:0x%x may Invalid!\n", u32Addr);
    }

    /* 为确保正确,统一刷下Cache */
    MEM_INVALID_CACHE(MEM_GET_ALLOC_ADDR(u32Addr), MEM_MGR_SIZE_FOR_CACHE);

    bsp_trace(BSP_LOG_LEVEL_ERROR, BSP_MODU_MEM,"================================\n");
    bsp_trace(BSP_LOG_LEVEL_ERROR, BSP_MODU_MEM,"dump mem block info:\n");
    bsp_trace(BSP_LOG_LEVEL_ERROR, BSP_MODU_MEM,"================================\n");
    bsp_trace(BSP_LOG_LEVEL_ERROR, BSP_MODU_MEM,"usr ptr:            0x%x\n",    u32Addr);
    bsp_trace(BSP_LOG_LEVEL_ERROR, BSP_MODU_MEM,"alloc ptr:          0x%x\n",    (u32)MEM_GET_ALLOC_ADDR(u32Addr));
    bsp_trace(BSP_LOG_LEVEL_ERROR, BSP_MODU_MEM,"magic num:          0x%x\n",    MEM_ITEM_MAGIC(u32Addr));
    bsp_trace(BSP_LOG_LEVEL_ERROR, BSP_MODU_MEM,"block size:         %d\n",      MEM_ITEM_SIZE(u32Addr));
    bsp_trace(BSP_LOG_LEVEL_ERROR, BSP_MODU_MEM,"mem flags:          0x%x\n",    MEM_ITEM_FLAGS(u32Addr));
    bsp_trace(BSP_LOG_LEVEL_ERROR, BSP_MODU_MEM,"mem item next:      0x%x\n",    MEM_ITEM_NEXT(u32Addr));
#ifdef __BSP_MEM_DEBUG__
    bsp_trace(BSP_LOG_LEVEL_ERROR, BSP_MODU_MEM,"used file name:     %s\n",      (bBlockInvalid) ? ("invalid") : (BSP_CHAR*)MEM_ITEM_FILE_NAME(u32Addr));
    bsp_trace(BSP_LOG_LEVEL_ERROR, BSP_MODU_MEM,"used line:          %d\n",      MEM_ITEM_LINE(u32Addr));
    bsp_trace(BSP_LOG_LEVEL_ERROR, BSP_MODU_MEM,"mem status:         %s\n",      (MEM_ITEM_STATUS(u32Addr)) ? ("ALLOC") : ("FREE"));
#endif
    bsp_trace(BSP_LOG_LEVEL_ERROR, BSP_MODU_MEM,"================================\n");
    return BSP_OK;
}
void bsp_modem_power_on(void)
{
	bsp_trace(BSP_LOG_LEVEL_ERROR, BSP_MODU_RESET, "[reset]: <%s> is stub\n", __FUNCTION__);
	return;
}
int bsp_cp_reset(void)
{
	bsp_trace(BSP_LOG_LEVEL_ERROR, BSP_MODU_RESET, "[reset]: <%s> is stub\n", __FUNCTION__);
	return -1;
}
BSP_S32 BSP_ICC_Read(BSP_U32 u32ChanId, BSP_U8* pData, BSP_S32 s32Size)
{
	bsp_trace(BSP_LOG_LEVEL_ERROR, BSP_MODU_ICC, "[icc]: <%s> is stub\n", __FUNCTION__);
	return s32Size;
}
BSP_S32 BSP_ICC_Close(BSP_U32 u32ChanId)
{
	bsp_trace(BSP_LOG_LEVEL_ERROR, BSP_MODU_ICC, "[icc]: <%s> is stub\n", __FUNCTION__);
	return ICC_OK;
}
void bsp_cross_mipi_init(void)
{
    u32 i = 0;
    int ret = 0;

    static NV_CROSS_MIPI_MEM cross_mipi_mem;
    static NV_CROSS_MIPI_CTRL cross_mipi_ctrl;

    if (!g_is_cross_mipi_inited) {
        (void)memset_s((void*)&cross_mipi_mem, sizeof(cross_mipi_mem), 0, sizeof(cross_mipi_mem));
        (void)memset_s((void*)&cross_mipi_ctrl, sizeof(cross_mipi_ctrl), 0, sizeof(cross_mipi_ctrl));

        ret = (int)bsp_nvm_read(NV_GU_RF_CROSS_MIPI_MEM_ID, (u8*)&cross_mipi_mem, sizeof(cross_mipi_mem));
        if (ret) {
            bsp_trace(BSP_LOG_LEVEL_ERROR, BSP_MODU_CROSS_MIPI, "fail to read cross mipi nv, id: %d\n", NV_GU_RF_CROSS_MIPI_MEM_ID);
            return;
        }

        ret = (int)bsp_nvm_read(NV_GU_RF_CROSS_MIPI_CTRL_ID, (u8*)&cross_mipi_ctrl, sizeof(cross_mipi_ctrl));
        if (ret) {
            bsp_trace(BSP_LOG_LEVEL_ERROR, BSP_MODU_CROSS_MIPI, "fail to read cross mipi nv, id: %d\n", NV_GU_RF_CROSS_MIPI_CTRL_ID);
            return;
        }

        g_cross_mipi_ctu_base_addr = (u32)bsp_bbp_part_addr_get(BBP_CTU);
        g_cross_mipi_mem_base_addr = (u32)bsp_bbp_part_addr_get(BBP_CROSS_MIPI_MEM);
        g_cross_mipi_ctrl_base_addr = (u32)bsp_bbp_part_addr_get(BBP_CROSS_MIPI_CTRL);

#ifdef CONFIG_CCORE_PM
        ret = bsp_device_pm_add(&g_cross_mipi_dpm_device);
        if (ret) {
            bsp_trace(BSP_LOG_LEVEL_ERROR, BSP_MODU_CROSS_MIPI, "fail to add cross_mipi dpm device\r\n");
            return;
        }
#endif
    }

    if (cross_mipi_ctrl.tuner_en) {
        writel(cross_mipi_ctrl.tuner_en, g_cross_mipi_ctrl_base_addr + CROSS_MIPI_EN_OFFSET);
        writel(cross_mipi_ctrl.tuner_req_en, g_cross_mipi_ctrl_base_addr + CROSS_MIPI_REQ_EN_OFFSET);

        writel(~cross_mipi_ctrl.reg.tuner_mipi_mask, g_cross_mipi_ctu_base_addr + CROSS_MIPI_MASK_OFFSET);
        writel(~cross_mipi_ctrl.reg.gpio_primary_en, g_cross_mipi_ctu_base_addr + CROSS_MIPI_M0_LINE_P_MASK_OFFSET);
        writel(~cross_mipi_ctrl.reg.gpio_secondary_en, g_cross_mipi_ctu_base_addr + CROSS_MIPI_M0_LINE_S_MASK_OFFSET);
        writel(~cross_mipi_ctrl.reg.gpio_modem1_en, g_cross_mipi_ctu_base_addr + CROSS_MIPI_M1_LINE_MASK_OFFSET);

        for (i = 0; i < sizeof(cross_mipi_mem.gpio_buffer)/sizeof(cross_mipi_mem.gpio_buffer[0][0]); i++)
            writel(cross_mipi_mem.gpio_buffer[0][i], g_cross_mipi_mem_base_addr + CROSS_MIPI_GPIO_MEM_OFFSET + i*4);

        for (i = 0; i < sizeof(cross_mipi_mem.mipi_buffer)/sizeof(cross_mipi_mem.mipi_buffer[0][0]); i++)
            writel(cross_mipi_mem.mipi_buffer[0][i], g_cross_mipi_mem_base_addr + CROSS_MIPI_MIPI_MEM_OFFSET + i*4);
        writel(0x7,   g_cross_mipi_ctu_base_addr + CROSS_MIPI_FORCE_OUTPUT_OFFSET);
        writel(0x700, g_cross_mipi_ctu_base_addr + CROSS_MIPI_OUTPUT_VALUE_OFFSET);
        udelay(1);

        writel(0x0,   g_cross_mipi_ctu_base_addr + CROSS_MIPI_OUTPUT_VALUE_OFFSET);
        writel(0x0,   g_cross_mipi_ctu_base_addr + CROSS_MIPI_FORCE_OUTPUT_OFFSET);
    }

    if (!g_is_cross_mipi_inited) {
        g_is_cross_mipi_inited = 1;
        bsp_trace(BSP_LOG_LEVEL_ERROR, BSP_MODU_CROSS_MIPI, "cross mipi init ok\n");
    }
}
s32 bsp_icc_read(u32 channel_id,u8 * buf,u32 buf_len)
{
	bsp_trace(BSP_LOG_LEVEL_ERROR, BSP_MODU_ICC, "[icc]: <%s> is stub\n", __FUNCTION__);
	return buf_len;	
}
BSP_S32 BSP_ICC_Ioctl(BSP_U32 u32ChanId, BSP_U32 cmd, BSP_VOID *param)
{
	bsp_trace(BSP_LOG_LEVEL_ERROR, BSP_MODU_ICC, "[icc]: <%s> is stub\n", __FUNCTION__);
	return ICC_OK;
}
u32 bsp_reset_is_connect_ril(void)
{
	bsp_trace(BSP_LOG_LEVEL_ERROR, BSP_MODU_RESET, "[reset]: <%s> is stub\n", __FUNCTION__);
	return 0;
}
s32 bsp_mem_info(u32 u32MemType)
{
    u32 u32Item;
    MEM_ALLOC_INFO* pAllocInfo;

    if (u32MemType >= MEM_POOL_MAX)
    {
        bsp_trace(BSP_LOG_LEVEL_ERROR, BSP_MODU_MEM,"invalid pool type:%d\n", u32MemType);
        return BSP_ERROR;
    }

    //for (u32MemType = MEM_NORM_DDR_POOL; u32MemType < MEM_POOL_MAX; u32MemType++)
    {
        pAllocInfo = MEM_GET_ALLOC_INFO(u32MemType);
        bsp_trace(BSP_LOG_LEVEL_ERROR, BSP_MODU_MEM,"Dump Mem (%s):\n", g_memPoolName[u32MemType]);
        bsp_trace(BSP_LOG_LEVEL_ERROR, BSP_MODU_MEM,"================================\n");
        bsp_trace(BSP_LOG_LEVEL_ERROR, BSP_MODU_MEM,"mem pool info:\n");
        bsp_trace(BSP_LOG_LEVEL_ERROR, BSP_MODU_MEM,"--------------------------------\n");
        bsp_trace(BSP_LOG_LEVEL_ERROR, BSP_MODU_MEM,"Base Addr:          0x%x\n", pAllocInfo->memPoolInfo.u32BaseAddr);
        bsp_trace(BSP_LOG_LEVEL_ERROR, BSP_MODU_MEM,"Total Size:         %d(0x%x)\n", pAllocInfo->memPoolInfo.u32Size, pAllocInfo->memPoolInfo.u32Size);
        bsp_trace(BSP_LOG_LEVEL_ERROR, BSP_MODU_MEM,"Left Size:          %d(0x%x)\n", pAllocInfo->memPoolInfo.u32Left, pAllocInfo->memPoolInfo.u32Left);
        bsp_trace(BSP_LOG_LEVEL_ERROR, BSP_MODU_MEM,"Cur Pos Addr:       0x%x\n", pAllocInfo->memPoolInfo.u32CurPosAddr);
        bsp_trace(BSP_LOG_LEVEL_ERROR, BSP_MODU_MEM,"Mgr Size:           %d\n", pAllocInfo->memPoolInfo.u32MgrSize);
        bsp_trace(BSP_LOG_LEVEL_ERROR, BSP_MODU_MEM,"Most Used Item:     %d\n", pAllocInfo->mostUsedItem);
        bsp_trace(BSP_LOG_LEVEL_ERROR, BSP_MODU_MEM,"Alloc Fail Count:   %d\n", pAllocInfo->u32AllocFailCnt);
        bsp_trace(BSP_LOG_LEVEL_ERROR, BSP_MODU_MEM,"\n");
        bsp_trace(BSP_LOG_LEVEL_ERROR, BSP_MODU_MEM,"================================\n");
        bsp_trace(BSP_LOG_LEVEL_ERROR, BSP_MODU_MEM,"mem list used info:\n");
        bsp_trace(BSP_LOG_LEVEL_ERROR, BSP_MODU_MEM,"--------------------------------\n");
        for (u32Item = 0; u32Item < MEM_ALLOC_LIST_NUM; u32Item++)
        {
            bsp_trace(BSP_LOG_LEVEL_ERROR, BSP_MODU_MEM,"+-- dump size:%d list info:\n", MEM_GET_ALLOC_SIZE(u32Item));
            bsp_trace(BSP_LOG_LEVEL_ERROR, BSP_MODU_MEM,"|-- cur alloc num:  %d\n", pAllocInfo->allocUsedInfoList[u32Item].u32CurNum);
            bsp_trace(BSP_LOG_LEVEL_ERROR, BSP_MODU_MEM,"|-- max alloc num:  %d\n", pAllocInfo->allocUsedInfoList[u32Item].u32MaxNum);
	     if(u32MemType== MEM_ICC_DDR_POOL)
	     {
	         bsp_trace(BSP_LOG_LEVEL_ERROR, BSP_MODU_MEM,"|-- min num line:   %d\n", sg_AllocMinNum[u32Item]);
	         bsp_trace(BSP_LOG_LEVEL_ERROR, BSP_MODU_MEM,"|-- max num line:   %d\n", sg_AllocMaxNum[u32Item]);
	     }
            bsp_trace(BSP_LOG_LEVEL_ERROR, BSP_MODU_MEM,"|-- total alloc num:%d\n", pAllocInfo->allocUsedInfoList[u32Item].u32TotalMallocNum);
            bsp_trace(BSP_LOG_LEVEL_ERROR, BSP_MODU_MEM,"|-- total free num: %d\n", pAllocInfo->allocUsedInfoList[u32Item].u32TotalFreeNum);
            bsp_trace(BSP_LOG_LEVEL_ERROR, BSP_MODU_MEM,"+-- \n");
        }
        bsp_trace(BSP_LOG_LEVEL_ERROR, BSP_MODU_MEM,"================================\n");
    }
    return BSP_OK;
}
BSP_S32 BSP_ICC_Debug_Register(BSP_U32 u32ChanId, FUNCPTR_1 debug_routine, int param)
{
	bsp_trace(BSP_LOG_LEVEL_ERROR, BSP_MODU_ICC, "[icc]: <%s> is stub\n", __FUNCTION__);
	return ICC_OK;
}
STATIC s32 bsp_mem_scan(u32 u32PoolType)
{
    MEM_ALLOC_INFO* pAllocInfo = 0;
    u32 u32CurScan = 0;
    u32 u32EndAddr = 0;
    u32 u32MgrSize = 0;
    s32 s32GetChar = 0;

    pAllocInfo = MEM_GET_ALLOC_INFO(u32PoolType);
    if (u32PoolType >= MEM_POOL_MAX)
    {
        bsp_trace(BSP_LOG_LEVEL_ERROR, BSP_MODU_MEM,"invalid pool type:%d\n", u32PoolType);
        return BSP_ERROR;
    }
    u32CurScan = pAllocInfo->memPoolInfo.u32BaseAddr;
    u32MgrSize = pAllocInfo->memPoolInfo.u32MgrSize;
    u32EndAddr = pAllocInfo->memPoolInfo.u32CurPosAddr;

    bsp_trace(BSP_LOG_LEVEL_ERROR, BSP_MODU_MEM,"Beg Scan Mem (%s):\n", g_memPoolName[u32PoolType]);
    bsp_trace(BSP_LOG_LEVEL_ERROR, BSP_MODU_MEM,"================================\n");
    bsp_trace(BSP_LOG_LEVEL_ERROR, BSP_MODU_MEM,"mem pool info:\n");
    bsp_trace(BSP_LOG_LEVEL_ERROR, BSP_MODU_MEM,"--------------------------------\n");
    bsp_trace(BSP_LOG_LEVEL_ERROR, BSP_MODU_MEM,"Base Addr:          0x%x\n", pAllocInfo->memPoolInfo.u32BaseAddr);
    bsp_trace(BSP_LOG_LEVEL_ERROR, BSP_MODU_MEM,"Total Size:         %d(0x%x)\n", pAllocInfo->memPoolInfo.u32Size, pAllocInfo->memPoolInfo.u32Size);
    bsp_trace(BSP_LOG_LEVEL_ERROR, BSP_MODU_MEM,"Left Size:          %d(0x%x)\n", pAllocInfo->memPoolInfo.u32Left, pAllocInfo->memPoolInfo.u32Left);
    bsp_trace(BSP_LOG_LEVEL_ERROR, BSP_MODU_MEM,"Cur Pos Addr:       0x%x\n", pAllocInfo->memPoolInfo.u32CurPosAddr);
    bsp_trace(BSP_LOG_LEVEL_ERROR, BSP_MODU_MEM,"Mgr Size:           %d\n", pAllocInfo->memPoolInfo.u32MgrSize);
    bsp_trace(BSP_LOG_LEVEL_ERROR, BSP_MODU_MEM,"Most Used Item:     %d\n", pAllocInfo->mostUsedItem);
    bsp_trace(BSP_LOG_LEVEL_ERROR, BSP_MODU_MEM,"\n");

    /* 扫描 MemPool */
    while(u32CurScan < u32EndAddr)
    {
        /* 先拿到usr ptr */
        u32CurScan += u32MgrSize;

        /* 打印当前内存块信息 */
        /*(void)bsp_mem_dump_block(u32CurScan);*/

        /* 移动到下一个内存块 */
        u32CurScan += MEM_ITEM_SIZE(u32CurScan);

        bsp_trace(BSP_LOG_LEVEL_ERROR, BSP_MODU_MEM,"\npress \'Enter\' to continue, press \'q\' to stop scan\n");
        /*lint -save -e666 -e586*/
        /* coverity[returned_null] */
        s32GetChar = getchar();
        /*lint -restore*/
        if(!s32GetChar)
        {
            bsp_trace(BSP_LOG_LEVEL_ERROR, BSP_MODU_MEM,"error! please input a valid char\n");
        }
        if ('q' == s32GetChar)
        {
            break;
        }
    }

    return BSP_OK;
}
s32 bsp_icc_send(u32 cpuid,u32 channel_id,u8 *buffer,u32 data_len)
{
	bsp_trace(BSP_LOG_LEVEL_ERROR, BSP_MODU_ICC, "[icc]: <%s> is stub\n", __FUNCTION__);
	return data_len;
}