码迷,mamicode.com
首页 > Windows程序 > 详细

[Wind] MT6750 眼图 host 测试代码修改点

时间:2017-10-09 13:07:52      阅读:411      评论:0      收藏:0      [点我收藏+]

标签:sse   count   int   exp   bsp   active   class   action   asi   

眼图相关知识请查看 https://wenku.baidu.com/view/03272d48cc17552706220820.html

MT6750 平台需要修改两个地方:

1、kernel-3.18/drivers/misc/mediatek/mu3phy/mt6755/mtk-phy-asic.c

PHY_INT32 phy_init_soc(struct u3phy_info *info)
{
        PHY_INT32 ret;
        os_printk(K_INFO, "%s+\n", __func__);
        ... ...
        U3PhyWriteField32((phys_addr_t) (uintptr_t) U3D_USBPHYACR1, RG_USB20_VRT_VREF_SEL_OFST, RG_USB20_VRT_VREF_SEL, 7);      // 新加
        U3PhyWriteField32((phys_addr_t) (uintptr_t) U3D_USBPHYACR1, RG_USB20_TERM_VREF_SEL_OFST, RG_USB20_TERM_VREF_SEL, 7);    // 新加
        
        /*Wait 800 usec */
        udelay(800);
        
        U3PhyWriteField32((phys_addr_t) (uintptr_t) U3D_U2PHYDTM1, FORCE_VBUSVALID_OFST, FORCE_VBUSVALID, 1);
        U3PhyWriteField32((phys_addr_t) (uintptr_t) U3D_U2PHYDTM1, FORCE_AVALID_OFST, FORCE_AVALID, 1);
        U3PhyWriteField32((phys_addr_t) (uintptr_t) U3D_U2PHYDTM1, FORCE_SESSEND_OFST, FORCE_SESSEND, 1);
        
        /* USB PLL Force settings */
        usb20_pll_settings(false, false);
        os_printk(K_DEBUG, "%s-\n", __func__);
        return PHY_TRUE;
}

2、kernel-3.18/drivers/misc/mediatek/xhci/xhci-mtk-driver.c

void mtk_xhci_mode_switch(struct work_struct *work)
{
        static bool is_load;
        static bool is_pwoff;
        int ret = 0;
        
        mtk_xhci_mtk_printk(K_DEBUG, "mtk_xhci_mode_switch\n");

        if (musb_check_ipo_state() == true)
        {
                enable_irq(mtk_idpin_irqnum); /* prevent from disable irq twice*/
                return;
        }
        if (mtk_idpin_cur_stat == IDPIN_OUT)
        {
                is_load = false;
                /* expect next isr is for id-pin out action */
                mtk_idpin_cur_stat = (mtk_is_charger_4_vol()) ? IDPIN_IN_DEVICE : IDPIN_IN_HOST;
                /* make id pin to detect the plug-out */
                mtk_set_iddig_out_detect();
                if (mtk_idpin_cur_stat == IDPIN_IN_DEVICE)
                        goto done;
                U3PhyWriteField32((phys_addr_t) (uintptr_t) U3D_USBPHYACR1, RG_USB20_VRT_VREF_SEL_OFST, RG_USB20_VRT_VREF_SEL, 4);      // 新加
                U3PhyWriteField32((phys_addr_t) (uintptr_t) U3D_USBPHYACR1, RG_USB20_TERM_VREF_SEL_OFST, RG_USB20_TERM_VREF_SEL, 4);    // 新加
                ret = mtk_xhci_driver_load();
                if (!ret) 
                {
                        is_load = true;
                        mtk_xhci_wakelock_lock();
#ifndef CONFIG_USBIF_COMPLIANCE
                        switch_set_state(&mtk_otg_state, 1);
#endif
                }
        }
        else 
        {       /* IDPIN_OUT */
                if (is_load) 
                {
                        if (!is_pwoff)
                                mtk_xhci_disPortPower();
                        /* prevent hang here */
                        /* if(mtk_is_hub_active())
                        {
                                is_pwoff = true;
                                schedule_delayed_work_on(0, &mtk_xhci_delaywork, msecs_to_jiffies(mtk_iddig_debounce));
                                mtk_xhci_mtk_printk(K_DEBUG, "wait, hub is still active, ep cnt %d !!!\n", mtk_ep_count);
                                return;
                        } */
                        /* USB PLL Force settings */
#ifdef CONFIG_PROJECT_PHY
                        usb20_pll_settings(true, false);
#endif
                        U3PhyWriteField32((phys_addr_t) (uintptr_t) U3D_USBPHYACR1, RG_USB20_VRT_VREF_SEL_OFST, RG_USB20_VRT_VREF_SEL, 7);      // 新加
                        U3PhyWriteField32((phys_addr_t) (uintptr_t) U3D_USBPHYACR1, RG_USB20_TERM_VREF_SEL_OFST, RG_USB20_TERM_VREF_SEL, 7);    // 新加
                        mtk_xhci_driver_unload();
                        is_pwoff = false;
                        is_load = false;
#ifndef CONFIG_USBIF_COMPLIANCE
                        switch_set_state(&mtk_otg_state, 0);
#endif
                        mtk_xhci_wakelock_unlock();
                }
                /* expect next isr is for id-pin in action */
                mtk_idpin_cur_stat = IDPIN_OUT;
                /* make id pin to detect the plug-in */
                mtk_set_iddig_in_detect();
        }
done:
        mtk_xhci_mtk_printk(K_ALET, "current mode is %s, ret(%d), switch(%d)\n", (mtk_idpin_cur_stat == IDPIN_IN_HOST) ? "host" : (mtk_idpin_cur_stat == IDPIN_IN_DEVICE) ? "id_device" : "device", ret, mtk_otg_state.state);
}

 

[Wind] MT6750 眼图 host 测试代码修改点

标签:sse   count   int   exp   bsp   active   class   action   asi   

原文地址:http://www.cnblogs.com/mz8023yt/p/7640467.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!