浏览代码

usb: musb: Add pre and post root port reset end callbacks

The sunxi otg phy has a bug where it wrongly detects a high speed squelch
when reset on the root port gets de-asserted with a lo-speed device.

The workaround for this is to disable squelch detect before de-asserting
reset, and re-enabling it after the reset de-assert is done.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Hans de Goede 10 年之前
父节点
当前提交
591fa9dd3f
共有 2 个文件被更改,包括 18 次插入0 次删除
  1. 16 0
      drivers/usb/musb/musb_core.h
  2. 2 0
      drivers/usb/musb/musb_virthub.c

+ 16 - 0
drivers/usb/musb/musb_core.h

@@ -167,6 +167,8 @@ struct musb_io;
  * @vbus_status: returns vbus status if possible
  * @vbus_status: returns vbus status if possible
  * @set_vbus:	forces vbus status
  * @set_vbus:	forces vbus status
  * @adjust_channel_params: pre check for standard dma channel_program func
  * @adjust_channel_params: pre check for standard dma channel_program func
+ * @pre_root_reset_end: called before the root usb port reset flag gets cleared
+ * @post_root_reset_end: called after the root usb port reset flag gets cleared
  */
  */
 struct musb_platform_ops {
 struct musb_platform_ops {
 
 
@@ -210,6 +212,8 @@ struct musb_platform_ops {
 	int	(*adjust_channel_params)(struct dma_channel *channel,
 	int	(*adjust_channel_params)(struct dma_channel *channel,
 				u16 packet_sz, u8 *mode,
 				u16 packet_sz, u8 *mode,
 				dma_addr_t *dma_addr, u32 *len);
 				dma_addr_t *dma_addr, u32 *len);
+	void	(*pre_root_reset_end)(struct musb *musb);
+	void	(*post_root_reset_end)(struct musb *musb);
 };
 };
 
 
 /*
 /*
@@ -595,4 +599,16 @@ static inline int musb_platform_exit(struct musb *musb)
 	return musb->ops->exit(musb);
 	return musb->ops->exit(musb);
 }
 }
 
 
+static inline void musb_platform_pre_root_reset_end(struct musb *musb)
+{
+	if (musb->ops->pre_root_reset_end)
+		musb->ops->pre_root_reset_end(musb);
+}
+
+static inline void musb_platform_post_root_reset_end(struct musb *musb)
+{
+	if (musb->ops->post_root_reset_end)
+		musb->ops->post_root_reset_end(musb);
+}
+
 #endif	/* __MUSB_CORE_H__ */
 #endif	/* __MUSB_CORE_H__ */

+ 2 - 0
drivers/usb/musb/musb_virthub.c

@@ -195,8 +195,10 @@ void musb_port_reset(struct musb *musb, bool do_reset)
 				      msecs_to_jiffies(50));
 				      msecs_to_jiffies(50));
 	} else {
 	} else {
 		dev_dbg(musb->controller, "root port reset stopped\n");
 		dev_dbg(musb->controller, "root port reset stopped\n");
+		musb_platform_pre_root_reset_end(musb);
 		musb_writeb(mbase, MUSB_POWER,
 		musb_writeb(mbase, MUSB_POWER,
 				power & ~MUSB_POWER_RESET);
 				power & ~MUSB_POWER_RESET);
+		musb_platform_post_root_reset_end(musb);
 
 
 		power = musb_readb(mbase, MUSB_POWER);
 		power = musb_readb(mbase, MUSB_POWER);
 		if (power & MUSB_POWER_HSMODE) {
 		if (power & MUSB_POWER_HSMODE) {