diff options
author | Dongwoo Lee <dwoo08.lee@samsung.com> | 2020-02-18 17:51:50 +0900 |
---|---|---|
committer | Dongwoo Lee <dwoo08.lee@samsung.com> | 2020-02-18 18:31:43 +0900 |
commit | ed40fe9345b964997aaaaf1618a89b2981c8a706 (patch) | |
tree | f6eeccfcdaad73df5bda12c28940a88fd669ad71 | |
parent | 47c034a5716b3c1ed63de216ef58d4f94a44846b (diff) | |
download | linux-artik7-ed40fe9345b964997aaaaf1618a89b2981c8a706.tar.gz linux-artik7-ed40fe9345b964997aaaaf1618a89b2981c8a706.tar.bz2 linux-artik7-ed40fe9345b964997aaaaf1618a89b2981c8a706.zip |
usb: dwc2: Remove support for usb cable detection
Detection of usb cable is no longer used, thus this eliminates all
relevant codes.
Change-Id: I2dc226bc21dafa486e87e40ccb03b5242af774dc
Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>
-rw-r--r-- | arch/arm/boot/dts/s5p4418-artik530-raptor-common.dtsi | 1 | ||||
-rw-r--r-- | arch/arm64/boot/dts/nexell/s5p6818-artik710-raptor-common.dtsi | 1 | ||||
-rw-r--r-- | drivers/usb/dwc2/core.h | 6 | ||||
-rw-r--r-- | drivers/usb/dwc2/gadget.c | 113 |
4 files changed, 0 insertions, 121 deletions
diff --git a/arch/arm/boot/dts/s5p4418-artik530-raptor-common.dtsi b/arch/arm/boot/dts/s5p4418-artik530-raptor-common.dtsi index 8364778c1fd8..beed5d96ff5f 100644 --- a/arch/arm/boot/dts/s5p4418-artik530-raptor-common.dtsi +++ b/arch/arm/boot/dts/s5p4418-artik530-raptor-common.dtsi @@ -146,7 +146,6 @@ dwc2otg@c0040000 { gpios = <&gpio_a 15 0>; - g-extcon-notify; status = "okay"; }; diff --git a/arch/arm64/boot/dts/nexell/s5p6818-artik710-raptor-common.dtsi b/arch/arm64/boot/dts/nexell/s5p6818-artik710-raptor-common.dtsi index 4575418cf569..70f58f046e33 100644 --- a/arch/arm64/boot/dts/nexell/s5p6818-artik710-raptor-common.dtsi +++ b/arch/arm64/boot/dts/nexell/s5p6818-artik710-raptor-common.dtsi @@ -144,7 +144,6 @@ dwc2otg@c0040000 { gpios = <&gpio_a 15 0>; - g-extcon-notify; status = "okay"; }; diff --git a/drivers/usb/dwc2/core.h b/drivers/usb/dwc2/core.h index e8285ab110c4..dfd7d4c9f0f4 100644 --- a/drivers/usb/dwc2/core.h +++ b/drivers/usb/dwc2/core.h @@ -872,12 +872,6 @@ struct dwc2_hsotg { u32 g_rx_fifo_sz; u32 g_np_g_tx_fifo_sz; u32 g_tx_fifo_sz[MAX_EPS_CHANNELS]; - u32 g_extcon_notify; - -#if IS_ENABLED(CONFIG_EXTCON) - struct extcon_dev *edev; - struct work_struct extcon_work; -#endif /* CONFIG_EXTCON */ #endif /* CONFIG_USB_DWC2_PERIPHERAL || CONFIG_USB_DWC2_DUAL_ROLE */ }; diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c index 1da1792a284f..7b1428cd51a8 100644 --- a/drivers/usb/dwc2/gadget.c +++ b/drivers/usb/dwc2/gadget.c @@ -26,7 +26,6 @@ #include <linux/io.h> #include <linux/slab.h> #include <linux/of_platform.h> -#include <linux/extcon.h> #include <linux/usb/ch9.h> #include <linux/usb/gadget.h> @@ -35,72 +34,6 @@ #include "core.h" #include "hw.h" -#if IS_ENABLED(CONFIG_EXTCON) -static const unsigned int supported_cable[] = { - EXTCON_USB, - EXTCON_NONE, -}; - -static inline void dwc2_gadget_extcon_notify(struct dwc2_hsotg *hsotg) -{ - queue_work(system_power_efficient_wq, &hsotg->extcon_work); -} - -static inline void dwc2_gadget_cancel_extcon_work(struct dwc2_hsotg *hsotg) -{ - cancel_work_sync(&hsotg->extcon_work); -} - -static void dwc2_gadget_extcon_work(struct work_struct *work) -{ - struct dwc2_hsotg *hsotg = container_of(work, struct dwc2_hsotg, - extcon_work); - u32 usb_status = dwc2_readl(hsotg->regs + GOTGCTL); - - if (usb_status & (GOTGCTL_ASESVLD | GOTGCTL_BSESVLD)) - extcon_set_cable_state_(hsotg->edev, EXTCON_USB, true); - else - extcon_set_cable_state_(hsotg->edev, EXTCON_USB, false); -} - -static int dwc2_gadget_extcon_init(struct dwc2_hsotg *hsotg) -{ - struct device *dev = hsotg->dev; - struct extcon_dev *edev; - int ret; - - if (!hsotg->g_extcon_notify) - return 0; - - edev = devm_extcon_dev_allocate(dev, supported_cable); - if (IS_ERR(edev)) - return -ENODEV; - - ret = devm_extcon_dev_register(dev, edev); - if (ret) - return ret; - - hsotg->edev = edev; - - INIT_WORK(&hsotg->extcon_work, dwc2_gadget_extcon_work); - - return 0; -} -#else -static inline void dwc2_gadget_extcon_notify(struct dwc2_hsotg *hsotg) -{ -} - -static inline void dwc2_gadget_cancel_extcon_work(struct dwc2_hsotg *hsotg) -{ -} - -static inline int dwc2_gadget_extcon_init(struct dwc2_hsotg *hsotg) -{ - return 0; -} -#endif /* CONFIG_EXTCON */ - /* conversion functions */ static inline struct dwc2_hsotg_req *our_req(struct usb_request *req) { @@ -2571,31 +2504,12 @@ irq_retry: if (usb_status & GOTGCTL_BSESVLD && connected) dwc2_hsotg_core_init_disconnected(hsotg, true); - - if (hsotg->g_extcon_notify) { - /* - * USBRST interrupt can be generated by not only - * disconnection but also other reason. So, we - * should check the connection state with usb_status. - * Fortunately, GOTGCTL_ASESVLD and GOTGCTL_BSESVLD - * is activated only if the cable is connected. So, - * we can recognize the disconnection situation by - * checking both bits are not set. - */ - u32 flags = GOTGCTL_ASESVLD | GOTGCTL_BSESVLD; - - if (!(usb_status & flags)) - dwc2_gadget_extcon_notify(hsotg); - } } if (gintsts & GINTSTS_ENUMDONE) { dwc2_writel(GINTSTS_ENUMDONE, hsotg->regs + GINTSTS); dwc2_hsotg_irq_enumdone(hsotg); - - if (hsotg->g_extcon_notify) - dwc2_gadget_extcon_notify(hsotg); } if (gintsts & (GINTSTS_OEPINT | GINTSTS_IEPINT)) { @@ -3341,22 +3255,11 @@ static int dwc2_hsotg_pullup(struct usb_gadget *gadget, int is_on) dwc2_hsotg_core_init_disconnected(hsotg, false); dwc2_hsotg_core_connect(hsotg); } else { - /* - * If gadget disconnection makes also PHY pullup - * disconnection, usb controller cannot generate - * interrupt for usb connection and thus extcon - * notification won't be working. In order to prevent - * this situation, we have to keep PHY pullup alive - * when extcon notification is activated. - */ - if (hsotg->g_extcon_notify) - goto skip_change; dwc2_hsotg_core_disconnect(hsotg); dwc2_hsotg_disconnect(hsotg); hsotg->enabled = 0; } -skip_change: hsotg->gadget.speed = USB_SPEED_UNKNOWN; spin_unlock_irqrestore(&hsotg->lock, flags); @@ -3606,10 +3509,6 @@ static void dwc2_hsotg_of_probe(struct dwc2_hsotg *hsotg) /* Enable dma if requested in device tree */ hsotg->g_using_dma = of_property_read_bool(np, "g-use-dma"); -#if IS_ENABLED(CONFIG_EXTCON) - hsotg->g_extcon_notify = of_property_read_bool(np, "g-extcon-notify"); -#endif - /* * Register TX periodic fifo size per endpoint. * EP0 is excluded since it has no fifo configuration. @@ -3680,12 +3579,6 @@ int dwc2_gadget_init(struct dwc2_hsotg *hsotg, int irq) else if (hsotg->dr_mode == USB_DR_MODE_PERIPHERAL) hsotg->op_state = OTG_STATE_B_PERIPHERAL; - ret = dwc2_gadget_extcon_init(hsotg); - if (ret) { - dev_err(dev, "failed to initialize extcon device"); - return ret; - } - /* * Force Device mode before initialization. * This allows correctly configuring fifo for device mode. @@ -3782,9 +3675,6 @@ int dwc2_gadget_init(struct dwc2_hsotg *hsotg, int irq) */ int dwc2_hsotg_remove(struct dwc2_hsotg *hsotg) { - if (hsotg->g_extcon_notify) - dwc2_gadget_cancel_extcon_work(hsotg); - usb_del_gadget_udc(&hsotg->gadget); dwc2_hsotg_ep_free_request(&hsotg->eps_out[0]->ep, hsotg->ctrl_req); @@ -3808,9 +3698,6 @@ int dwc2_hsotg_suspend(struct dwc2_hsotg *hsotg) } } - if (hsotg->g_extcon_notify) - dwc2_gadget_cancel_extcon_work(hsotg); - if (hsotg->driver) { int ep; |