mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-09 12:17:12 +09:00
rk3026: usb: support for usb-debug
This commit is contained in:
@@ -216,21 +216,25 @@ static void usb_uart_init(void)
|
||||
writel_relaxed(0x03, DEBUG_UART_BASE + 0x0c);
|
||||
#endif //end of CONFIG_ARCH_RK2928
|
||||
#ifdef CONFIG_ARCH_RK3026
|
||||
|
||||
writel_relaxed(0x34000000, RK2928_GRF_BASE + GRF_UOC1_CON0);
|
||||
#ifdef CONFIG_RK_USB_UART
|
||||
if (!(readl_relaxed(RK30_GRF_BASE + GRF_SOC_STATUS0) & (1 << 13))) { //detect id
|
||||
writel_relaxed((0x0300 << 16), RK30_GRF_BASE + GRF_UOC0_CON0);
|
||||
} else {
|
||||
if (!(readl_relaxed(RK30_GRF_BASE + GRF_SOC_STATUS0) & (1 << 10))) { //detect vbus
|
||||
writel_relaxed(((0x01 << 2) | ((0x01 << 2) << 16)), RK30_GRF_BASE + GRF_UOC0_CON2); //software control usb phy enable
|
||||
writel_relaxed((0x2A | (0x3F << 16)), RK30_GRF_BASE + GRF_UOC0_CON3); //usb phy enter suspend
|
||||
writel_relaxed((0x0300 | (0x0300 << 16)), RK30_GRF_BASE + GRF_UOC0_CON0);
|
||||
} else {
|
||||
writel_relaxed((0x0300 << 16), RK30_GRF_BASE + GRF_UOC0_CON0);
|
||||
writel_relaxed(0x34000000, RK2928_GRF_BASE + GRF_UOC1_CON0);
|
||||
|
||||
if((readl_relaxed(RK2928_GRF_BASE + GRF_SOC_STATUS0) & (1<<10)))//detect id
|
||||
{
|
||||
if(!(readl_relaxed(RK2928_GRF_BASE + GRF_SOC_STATUS0) & (1<<7)))//detect vbus
|
||||
{
|
||||
writel_relaxed(0x007f0055, RK2928_GRF_BASE + GRF_UOC0_CON0);
|
||||
writel_relaxed(0x34003000, RK2928_GRF_BASE + GRF_UOC1_CON0);
|
||||
}
|
||||
else
|
||||
{
|
||||
writel_relaxed(0x34000000, RK2928_GRF_BASE + GRF_UOC1_CON0);
|
||||
}
|
||||
}
|
||||
#else
|
||||
writel_relaxed((0x0300 << 16), RK30_GRF_BASE + GRF_UOC0_CON0);
|
||||
#endif //end of CONFIG_RK_USB_UART
|
||||
|
||||
#endif // end of CONFIG_RK_USB_UART
|
||||
#endif //end of CONFIG_ARCH_RK3026
|
||||
#endif //end of DEBUG_UART_BASE
|
||||
}
|
||||
|
||||
@@ -158,9 +158,7 @@ static irqreturn_t otg_id_irq_handler(int irq, void *dev_id)
|
||||
/* clear irq */
|
||||
uoc_con = readl_relaxed(RK2928_GRF_BASE + GRF_UOC_CON);
|
||||
|
||||
#ifdef CONFIG_RK_USB_UART
|
||||
/* to do @lyz*/
|
||||
#endif
|
||||
|
||||
|
||||
if(uoc_con & (1<<1)) //id rise
|
||||
{
|
||||
@@ -168,7 +166,12 @@ static irqreturn_t otg_id_irq_handler(int irq, void *dev_id)
|
||||
}
|
||||
if(uoc_con & (1<<3))//id fall
|
||||
{
|
||||
writel_relaxed((0x3 << 16) | 0x3, RK2928_GRF_BASE + GRF_UOC_CON);;//clear id fall irq pandding
|
||||
#ifdef CONFIG_RK_USB_UART
|
||||
//if(!(readl_relaxed(RK2928_GRF_BASE + 0x014c) & (1<<10))){//id low
|
||||
writel_relaxed(0x04000000, RK2928_GRF_BASE + GRF_UOC1_CON0); //enter usb phy
|
||||
}
|
||||
#endif
|
||||
writel_relaxed((0x3 << 16) | 0x3, RK2928_GRF_BASE + GRF_UOC_CON);//clear id fall irq pandding
|
||||
}
|
||||
rk28_send_wakeup_key();
|
||||
return IRQ_HANDLED;
|
||||
|
||||
@@ -221,13 +221,13 @@ void dwc_otg_uart_mode(void* pdata, int enter_usb_uart_mode)
|
||||
if(1 == enter_usb_uart_mode) //uart mode
|
||||
{
|
||||
*otg_phy_con0 = (0x03 << 12 | (0x03<<(16+12)));//bypass dm
|
||||
//printk("phy enter uart mode USBGRF_UOC1_CON0 = %08x\n",*otg_phy_con1);
|
||||
printk("otg-phy enter uart mode USBGRF_UOC1_CON0 = %08x\n",*otg_phy_con1);
|
||||
|
||||
}
|
||||
if(0 == enter_usb_uart_mode) //usb mode
|
||||
{
|
||||
*otg_phy_con0 = (0x03<<(12+16)); //bypass dm disable
|
||||
//printk("phy enter usb mode USBGRF_UOC1_CON0 = %8x\n",*otg_phy_con1);
|
||||
printk("otg-phy enter usb mode USBGRF_UOC1_CON0 = %8x\n",*otg_phy_con1);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user