X-Git-Url: http://plrg.eecs.uci.edu/git/?a=blobdiff_plain;f=drivers%2Fusb%2Fdwc_otg_310%2Fdwc_otg_driver.c;h=4463f1bb35d2e393f92dd24cdcb19d67559b0afb;hb=ec42359f2660cfd0afa81c4e38b9e3695a1828a0;hp=961db3f3ed5712129e802d5ba15786c73be04d7e;hpb=e82146650ea5de8205f8890eaf4cb98615c51d9a;p=firefly-linux-kernel-4.4.55.git diff --git a/drivers/usb/dwc_otg_310/dwc_otg_driver.c b/drivers/usb/dwc_otg_310/dwc_otg_driver.c old mode 100755 new mode 100644 index 961db3f3ed57..4463f1bb35d2 --- a/drivers/usb/dwc_otg_310/dwc_otg_driver.c +++ b/drivers/usb/dwc_otg_310/dwc_otg_driver.c @@ -68,6 +68,7 @@ static const char dwc_host20_driver_name[] = "usb20_host"; static const char dwc_otg20_driver_name[] = "usb20_otg"; dwc_otg_device_t *g_otgdev; +void *dwc_otg_dev; extern int pcd_init(struct platform_device *_dev); extern int otg20_hcd_init(struct platform_device *_dev); @@ -351,13 +352,21 @@ extern void dwc_otg_hub_disconnect_device(struct usb_hub *hub); void dwc_otg_force_host(dwc_otg_core_if_t *core_if) { dwc_otg_device_t *otg_dev = core_if->otg_dev; + struct dwc_otg_platform_data *pdata = otg_dev->pldata; dctl_data_t dctl = {.d32 = 0 }; unsigned long flags; if (core_if->op_state == A_HOST) { - printk("dwc_otg_force_host,already in A_HOST mode,everest\n"); + dev_info(pdata->dev, + "dwc_otg_force_host,already in A_HOST mode,everest\n"); + return; + } else if (pdata->get_status(USB_STATUS_BVABLID) && + core_if->pmic_vbus) { + dev_info(pdata->dev, + "Please disconnect the USB cable first, and try again!\n"); return; } + core_if->op_state = A_HOST; cancel_delayed_work(&otg_dev->pcd->check_vbus_work); @@ -385,6 +394,7 @@ void dwc_otg_force_device(dwc_otg_core_if_t *core_if) local_irq_save(flags); if (core_if->op_state == B_PERIPHERAL) { + local_irq_restore(flags); printk ("dwc_otg_force_device,already in B_PERIPHERAL,everest\n"); return; @@ -1310,7 +1320,7 @@ static const struct of_device_id usb20_otg_of_match[] = { #endif #ifdef CONFIG_ARM64 { - .compatible = "rockchip,rk3368_usb20_otg", + .compatible = "rockchip,rk3368-usb", .data = &usb20otg_pdata_rk3368, }, #endif @@ -1419,6 +1429,7 @@ static int otg20_driver_probe(struct platform_device *_dev) */ g_otgdev = dwc_otg_device; + dwc_otg_dev = (struct device *)&_dev->dev; pldata->privdata = dwc_otg_device; dwc_otg_device->pldata = pldata; @@ -1501,6 +1512,10 @@ static int otg20_driver_probe(struct platform_device *_dev) of_property_read_u32(node, "rockchip,usb-mode", &val); dwc_otg_device->core_if->usb_mode = val; + /* Indicate usb vbus get from pmic (e.g. rk81x) */ + dwc_otg_device->core_if->pmic_vbus = of_property_read_bool(node, + "rockchip,usb-pmic-vbus"); + #ifndef DWC_HOST_ONLY /* * Initialize the PCD @@ -1618,10 +1633,14 @@ static struct platform_driver dwc_otg_driver = { void rk_usb_power_up(void) { struct dwc_otg_platform_data *pldata_otg; +#ifdef CONFIG_USB20_HOST struct dwc_otg_platform_data *pldata_host; +#endif +#ifdef CONFIG_USB_EHCI_RK struct rkehci_platform_data *pldata_ehci; +#endif - if (cpu_is_rk3288()) { + if (is_rk3288_usb()) { #ifdef CONFIG_RK_USB_UART /* enable USB bypass UART function */ writel_relaxed(0x00c00000 | usb_to_uart_status, @@ -1672,10 +1691,14 @@ void rk_usb_power_up(void) void rk_usb_power_down(void) { struct dwc_otg_platform_data *pldata_otg; +#ifdef CONFIG_USB20_HOST struct dwc_otg_platform_data *pldata_host; +#endif +#ifdef CONFIG_USB_EHCI_RK struct rkehci_platform_data *pldata_ehci; +#endif - if (cpu_is_rk3288()) { + if (is_rk3288_usb()) { #ifdef CONFIG_RK_USB_UART /* disable USB bypass UART function */ usb_to_uart_status =