From 2ad3a7470537d70671c7a23b4b9f8b1604f34264 Mon Sep 17 00:00:00 2001 From: Peter Chen Date: Mon, 22 Oct 2018 16:20:02 +0800 Subject: [PATCH] MLK-20011-2 usb: chipidea: delete DP pullup for secondary charger detection Since the DP pullup can be finished at glue layer, we can delete it at common code, but we still need to keep DP pulldown operation since the DP may have already pulled up before. Reviewed-by: Jun Li Signed-off-by: Peter Chen --- drivers/usb/chipidea/core.c | 5 ++++- drivers/usb/chipidea/udc.c | 12 ------------ include/linux/usb/chipidea.h | 2 -- 3 files changed, 4 insertions(+), 15 deletions(-) diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c index 7d8002d92249..67f6e3b44669 100644 --- a/drivers/usb/chipidea/core.c +++ b/drivers/usb/chipidea/core.c @@ -1095,8 +1095,11 @@ static int ci_hdrc_probe(struct platform_device *pdev) ci->role = ci_get_role(ci); /* only update vbus status for peripheral */ - if (ci->role == CI_ROLE_GADGET) + if (ci->role == CI_ROLE_GADGET) { + /* Let DP pull down if it isn't currently */ + hw_write(ci, OP_USBCMD, USBCMD_RS, 0); ci_handle_vbus_connected(ci); + } if (!ci_otg_is_fsm_mode(ci)) { ret = ci_role_start(ci, ci->role); diff --git a/drivers/usb/chipidea/udc.c b/drivers/usb/chipidea/udc.c index 0a54bed64ee3..dd44f594dca1 100644 --- a/drivers/usb/chipidea/udc.c +++ b/drivers/usb/chipidea/udc.c @@ -2023,20 +2023,8 @@ int ci_usb_charger_connect(struct ci_hdrc *ci, int is_active) usb_phy_set_charger_state(ci->usb_phy, is_active ? USB_CHARGER_PRESENT : USB_CHARGER_ABSENT); } else if (ci->platdata->notify_event) { - if (is_active) - hw_write(ci, OP_USBCMD, USBCMD_RS, 0); - ret = ci->platdata->notify_event(ci, CI_HDRC_CONTROLLER_VBUS_EVENT); - if (ret == CI_HDRC_NOTIFY_RET_DEFER_EVENT) { - hw_device_reset(ci); - /* Pull up dp */ - hw_write(ci, OP_USBCMD, USBCMD_RS, USBCMD_RS); - ci->platdata->notify_event(ci, - CI_HDRC_CONTROLLER_CHARGER_POST_EVENT); - /* Pull down dp */ - hw_write(ci, OP_USBCMD, USBCMD_RS, 0); - } schedule_work(&ci->usb_phy->chg_work); } out: diff --git a/include/linux/usb/chipidea.h b/include/linux/usb/chipidea.h index ba2c49047434..f572e1e01c63 100644 --- a/include/linux/usb/chipidea.h +++ b/include/linux/usb/chipidea.h @@ -70,8 +70,6 @@ struct ci_hdrc_platform_data { #define CI_HDRC_CONTROLLER_RESET_EVENT 0 #define CI_HDRC_CONTROLLER_STOPPED_EVENT 1 #define CI_HDRC_CONTROLLER_VBUS_EVENT 2 -#define CI_HDRC_NOTIFY_RET_DEFER_EVENT 3 -#define CI_HDRC_CONTROLLER_CHARGER_POST_EVENT 4 #define CI_HDRC_IMX_HSIC_ACTIVE_EVENT 5 #define CI_HDRC_IMX_HSIC_SUSPEND_EVENT 6 #define CI_HDRC_IMX_TERM_SELECT_OVERRIDE_FS 7