Exemplo n.º 1
0
void USBDL_CLK_ON(kal_bool turn_on)
{
#if defined(DRV_UPLL_V1)
	DRV_Reg(DRVPDN_CON0_CLR) |= DRVPDN_CON0_UPLL;
#elif defined(DRV_UPLL_V2)
	/* hardware issue */
	USB_PDNDisable(USB_PDN_OWNER_UPLL);  
	DRV_Reg(DRVPDN_CON0_CLR) |= DRVPDN_CON0_UPLL;
#elif defined(DRV_UPLL_V3)
	/* select UPLL clock source from PLL */
	DRV_Reg(PLL) |= 0x0040;
#elif defined(DRV_UPLL_V4)
	DRV_Reg(DRVPDN_CON0) &= (~DRVPDN_CON0_PLL2);
	/* disable USB clock from external clock */
	DRV_Reg(CLK_CON) &= ~0x4000;
	DRV_Reg(PLLSEL) |= 0x0008;
#elif defined(DRV_UPLL_V5)
	/* This will be changed in 6238 E2 */
	DRV_Reg(PLL) |= 0x0040;
#elif defined(DRV_USB_UPLL_MT50_SERIES)
	if (SW_SEC_0 == INT_SW_SecVersion()) 
	{
		//DRV_Reg(0xA0010320) |= 0x0800;
		PDN_CLR(PDN_USB_48M);
	}
#endif

#if defined(MT6276)
	DRV_Reg(0x61140280) |= 0x0080; 
#endif
}
void UPLL_Enable(UPLL_OWNER owner)
{
#if  (defined(DRV_UPLL_V1)||defined(DRV_UPLL_V2)||defined(DRV_UPLL_V3)||defined(DRV_UPLL_V4)||defined(DRV_UPLL_V5)||defined(DRV_UPLL_V6)||defined(DRV_UPLL_V7)||defined(DRV_UPLL_V8) || defined(DRV_USB_UPLL_MT50_SERIES))

	kal_uint32 savedMask;

	if(owner >= UPLL_OWNER_MAX)
		EXT_ASSERT(0, (kal_uint32)owner, g_upll_owner, 0);

	savedMask = SaveAndSetIRQMask();   

	if(g_upll_owner == 0)
	{
#if defined(DRV_UPLL_V1)
		USB_DRV_SetBits(DRVPDN_CON0_CLR , DRVPDN_CON0_UPLL);
#elif defined(DRV_UPLL_V2)
		/* hardware issue */
		USB_PDNDisable(USB_PDN_OWNER_UPLL);
		USB_DRV_SetBits(DRVPDN_CON0_CLR , DRVPDN_CON0_UPLL);
#elif defined(DRV_UPLL_V3)
		/* select UPLL clock source from PLL */
		USB_DRV_SetBits(PLL , 0x0040);
#elif defined(DRV_UPLL_V4)
		USB_DRV_ClearBits(DRVPDN_CON0 , DRVPDN_CON0_PLL2);
		/* disable USB clock from external clock */
		USB_DRV_ClearBits(CLK_CON , 0x4000);
		USB_DRV_SetBits(PLLSEL , 0x0008);
#elif defined(DRV_UPLL_V5)
		USB_DRV_SetBits(PLL , 0x0040);
#elif defined(DRV_UPLL_V6)
		USB_DRV_SetBits(PDN_CON , 0x0010);
#elif defined(DRV_UPLL_V7)
		USB_DRV_SetBits(UPLL_CON1, 0x0002);
#elif defined(DRV_UPLL_V8)
		USB_DRV_SetBits(GPLL_CON0, 0x0080);
#elif defined(DRV_USB_UPLL_MT50_SERIES)
	if (SW_SEC_0 == INT_SW_SecVersion()) 
	{
		PDN_CLR(PDN_USB_48M);
	}
#endif

	}
	g_upll_owner |= 1<<(kal_uint32)owner;
	RestoreIRQMask(savedMask);
#endif

}