rk: restore file mode
[firefly-linux-kernel-4.4.55.git] / drivers / usb / dwc_otg_310 / usbdev_rk3368.c
index b73fe08a31b8449babe99d54749660dd019d9b4d..7af3c5488349270ec7143e4e56064becd0783215 100644 (file)
@@ -23,8 +23,8 @@ static void usb20otg_hw_init(void)
        /* Turn off differential receiver in suspend mode */
        uoc_write(UOC_HIWORD_UPDATE(0, 1, 2), 0x798);
 
-       /* Set disconnect detection trigger point to 600mv */
-       uoc_write(UOC_HIWORD_UPDATE(0, 0xf, 11), 0x79c);
+       /* Set disconnect detection trigger point to 625mv */
+       uoc_write(UOC_HIWORD_UPDATE(0x9, 0xf, 11), 0x79c);
 
        /* other haredware init,include:
         * DRV_VBUS GPIO init */
@@ -79,7 +79,16 @@ static void usb20otg_soft_reset(void *pdata, enum rkusb_rst_flag rst_type)
                reset_control_deassert(rst_otg_c);
                reset_control_deassert(rst_otg_h);
                break;
-
+       case RST_CHN_HALT:
+               /* PHY reset */
+               uoc_write(UOC_HIWORD_UPDATE(0x1, 0x3, 0), 0x700);
+               reset_control_assert(rst_otg_p);
+               udelay(15);
+               uoc_write(UOC_HIWORD_UPDATE(0x2, 0x3, 0), 0x700);
+               udelay(1500);
+               reset_control_deassert(rst_otg_p);
+               udelay(2);
+               break;
        default:
                break;
        }
@@ -177,10 +186,12 @@ static void dwc_otg_uart_mode(void *pdata, int enter_usb_uart_mode)
 static void usb20otg_power_enable(int enable)
 {
        if (0 == enable) {
+               rk_battery_charger_detect_cb(USB_OTG_POWER_OFF);
                /* disable otg_drv power */
                if (gpio_is_valid(control_usb->otg_gpios->gpio))
                        gpio_set_value(control_usb->otg_gpios->gpio, 0);
        } else if (1 == enable) {
+               rk_battery_charger_detect_cb(USB_OTG_POWER_ON);
                /* enable otg_drv power */
                if (gpio_is_valid(control_usb->otg_gpios->gpio))
                        gpio_set_value(control_usb->otg_gpios->gpio, 1);
@@ -209,8 +220,8 @@ static void usb20ehci_hw_init(void)
 {
        /* Turn off differential receiver in suspend mode */
        uoc_write(UOC_HIWORD_UPDATE(0, 1, 2), 0x7b8);
-       /* Set disconnect detection trigger point to 600mv */
-       uoc_write(UOC_HIWORD_UPDATE(1, 0xf, 11), 0x7bc);
+       /* Set disconnect detection trigger point to 625mv */
+       uoc_write(UOC_HIWORD_UPDATE(0x9, 0xf, 11), 0x7bc);
 
        /* other haredware init,include:
         * DRV_VBUS GPIO init */