rk: restore file mode
[firefly-linux-kernel-4.4.55.git] / drivers / usb / dwc_otg_310 / usbdev_rk3368.c
index c7521a9cf9c65d3dc87949f914a900aa0a16f1ea..7af3c5488349270ec7143e4e56064becd0783215 100644 (file)
@@ -1,3 +1,4 @@
+#ifdef CONFIG_ARM64
 #include "usbdev_rk.h"
 #include "dwc_otg_regs.h"
 
@@ -22,6 +23,9 @@ 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 625mv */
+       uoc_write(UOC_HIWORD_UPDATE(0x9, 0xf, 11), 0x79c);
+
        /* other haredware init,include:
         * DRV_VBUS GPIO init */
        if (gpio_is_valid(control_usb->otg_gpios->gpio))
@@ -31,10 +35,9 @@ static void usb20otg_hw_init(void)
 static void usb20otg_phy_suspend(void *pdata, int suspend)
 {
        struct dwc_otg_platform_data *usbpdata = pdata;
-
        if (suspend) {
                /* enable soft control */
-               uoc_write(UOC_HIWORD_UPDATE(0x55, 0x7f, 0), 0x700);
+               uoc_write(UOC_HIWORD_UPDATE(0x1d5, 0x1ff, 0), 0x700);
                usbpdata->phy_status = 1;
        } else {
                /* exit suspend */
@@ -76,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;
        }
@@ -174,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);
@@ -206,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 */
@@ -514,3 +528,4 @@ MODULE_ALIAS("platform: dwc_control_usb");
 MODULE_AUTHOR("RockChip Inc.");
 MODULE_DESCRIPTION("RockChip Control Module USB Driver");
 MODULE_LICENSE("GPL v2");
+#endif