From: lyz Date: Mon, 17 Dec 2012 08:00:21 +0000 (+0800) Subject: rk2928: usb: fix rk2928/2926 usb phy non-driving err X-Git-Tag: firefly_0821_release~8099^2~7 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=6bd8d00fbbdee80cd190b1c07a37255c32c3b283;p=firefly-linux-kernel-4.4.55.git rk2928: usb: fix rk2928/2926 usb phy non-driving err --- diff --git a/arch/arm/mach-rk2928/common.c b/arch/arm/mach-rk2928/common.c index 7fd56af79725..2e33b601ef7c 100755 --- a/arch/arm/mach-rk2928/common.c +++ b/arch/arm/mach-rk2928/common.c @@ -129,8 +129,16 @@ void __init rk2928_map_io(void) rk2928_map_common_io(); #ifdef DEBUG_UART_BASE #ifdef CONFIG_RK_USB_UART - writel_relaxed(0x007f0051, RK2928_GRF_BASE + GRF_UOC0_CON5); - writel_relaxed(0x34003000, RK2928_GRF_BASE + GRF_UOC1_CON4); + if(!(readl_relaxed(RK2928_GRF_BASE + 0x014c) & (1<<7)))//detect vbus + { + writel_relaxed(0x10001000, RK2928_GRF_BASE + GRF_UOC0_CON0); + writel_relaxed(0x007f0055, RK2928_GRF_BASE + GRF_UOC0_CON5); + writel_relaxed(0x34003000, RK2928_GRF_BASE + GRF_UOC1_CON4); + } + else + { + writel_relaxed(0x34000000, RK2928_GRF_BASE + GRF_UOC1_CON4); + } #else writel_relaxed(0x34000000, RK2928_GRF_BASE + GRF_UOC1_CON4); #endif diff --git a/drivers/usb/dwc_otg/usbdev_rk2928.c b/drivers/usb/dwc_otg/usbdev_rk2928.c index 6f70546cb0a0..452001c7cd1c 100755 --- a/drivers/usb/dwc_otg/usbdev_rk2928.c +++ b/drivers/usb/dwc_otg/usbdev_rk2928.c @@ -114,11 +114,14 @@ void usb20otg_phy_suspend(void* pdata, int suspend) { struct dwc_otg_platform_data *usbpdata=pdata; unsigned int * otg_phy_con1 = (unsigned int*)(USBGRF_UOC0_CON5); + unsigned int * otg_phy_con2 = (unsigned int*)(USBGRF_UOC0_CON0); if(suspend){ + *otg_phy_con2 = (1<<12 | 1<<(12+16));//otg io set to High-Z state *otg_phy_con1 = 0x55 |(0x7f<<16); // enter suspend. usbpdata->phy_status = 1; } else{ + *otg_phy_con2 = 1<<(12+16); *otg_phy_con1 = (0x01<<16); // exit suspend. usbpdata->phy_status = 0; } @@ -268,11 +271,14 @@ void usb20host_phy_suspend(void* pdata, int suspend) { struct dwc_otg_platform_data *usbpdata=pdata; unsigned int * otg_phy_con1 = (unsigned int*)(USBGRF_UOC1_CON5); + unsigned int * otg_phy_con2 = (unsigned int*)(USBGRF_UOC1_CON0); if(suspend){ + *otg_phy_con2 = (1 << 12 | 1 << (12+16));//host io set to High-Z state *otg_phy_con1 = 0x1D5 |(0x1ff<<16); // enter suspend. usbpdata->phy_status = 1; } else{ + *otg_phy_con2 = (1 << 12+16);//host io exit High-Z state *otg_phy_con1 = (0x01<<16); // exit suspend. usbpdata->phy_status = 0; }