Esempio n. 1
0
static int mtk_xhci_driver_load(void)
{
	int ret = 0;

	/* recover clock/power setting and deassert reset bit of mac */
	usb_phy_recover(0);
	ret = mtk_xhci_hcd_init();
	if (ret || !mtk_xhci) {
		ret = -ENXIO;
		goto _err;
	}

	/* for performance, fixed the interrupt moderation from 0xA0(default) to 0x30 */
	mtk_xhci_imod_set(0x30);

#ifdef CONFIG_USBIF_COMPLIANCE
	mtk_enable_pmic_otg_mode();
	enableXhciAllPortPower(mtk_xhci);
#else
#ifdef CONFIG_MTK_OTG_PMIC_BOOST_5V
	mtk_enable_pmic_otg_mode();
#else
	enableXhciAllPortPower(mtk_xhci);
#endif
#endif

	return 0;

_err:
	mtk_xhci_mtk_log("ret(%d), mtk_xhci(0x%p)\n", ret, mtk_xhci);
	usb_phy_savecurrent(1);
	return ret;
}
Esempio n. 2
0
void musb_platform_enable(struct musb *musb)
{
	unsigned long	flags;

	printk("%s, %d, %d\n", __func__, mtk_usb_power, musb->power);

	if (musb->power == true)
		return;

	flags = musb_readl(mtk_musb->mregs,USB_L1INTM);

	// mask ID pin, so "open clock" and "set flag" won't be interrupted. ISR may call clock_disable.
	musb_writel(mtk_musb->mregs,USB_L1INTM,(~IDDIG_INT_STATUS)&flags);

	if (platform_init_first) {
		DBG(0,"usb init first\n\r");
		musb->is_host = true;
	}

	if (!mtk_usb_power) {
		if (down_interruptible(&power_clock_lock))
			xlog_printk(ANDROID_LOG_ERROR, "USB20", "%s: busy, Couldn't get power_clock_lock\n" \
				, __func__);

		#ifndef CONFIG_MT6575T_FPGA
		enable_pll(MT65XX_UPLL, "USB_PLL");

		hwPowerOn(MT65XX_POWER_LDO_VUSB, VOL_3300, "VUSB_LDO");

		printk("%s, enable VUSB and UPLL before connect\n", __func__);
		#endif

		mdelay(10);

		usb_phy_recover();

		mtk_usb_power = true;

		up(&power_clock_lock);
	}
	musb->power = true;

	musb_writel(mtk_musb->mregs,USB_L1INTM,flags);
}