mirror of
				https://github.com/torvalds/linux.git
				synced 2025-11-04 02:30:34 +02:00 
			
		
		
		
	usb: mtu3: disable vbus rise/fall interrupts of ltssm
The vbus rise & fall interrupts are used to enable and disable U3 function of device automatically, this cause some issues when class driver is initialized as deactivated, and will skip over software-controlled connect by pullup(), but UDC wants to keep disconnect until usb_gadget_activate() is called which calls pullup() if needed. So we disable vbus rise & fall interrupts and just use pullup() to enable & disable U3 function, and reset mtu3 state when disconnect instead when vbus fall. Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
This commit is contained in:
		
							parent
							
								
									794f97a4b9
								
							
						
					
					
						commit
						adc23f16bc
					
				
					 2 changed files with 16 additions and 10 deletions
				
			
		| 
						 | 
					@ -185,8 +185,8 @@ static void mtu3_intr_enable(struct mtu3 *mtu)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (mtu->is_u3_ip) {
 | 
						if (mtu->is_u3_ip) {
 | 
				
			||||||
		/* Enable U3 LTSSM interrupts */
 | 
							/* Enable U3 LTSSM interrupts */
 | 
				
			||||||
		value = HOT_RST_INTR | WARM_RST_INTR | VBUS_RISE_INTR |
 | 
							value = HOT_RST_INTR | WARM_RST_INTR |
 | 
				
			||||||
		    VBUS_FALL_INTR | ENTER_U3_INTR | EXIT_U3_INTR;
 | 
								ENTER_U3_INTR | EXIT_U3_INTR;
 | 
				
			||||||
		mtu3_writel(mbase, U3D_LTSSM_INTR_ENABLE, value);
 | 
							mtu3_writel(mbase, U3D_LTSSM_INTR_ENABLE, value);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -585,6 +585,17 @@ static const struct usb_gadget_ops mtu3_gadget_ops = {
 | 
				
			||||||
	.udc_stop = mtu3_gadget_stop,
 | 
						.udc_stop = mtu3_gadget_stop,
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					static void mtu3_state_reset(struct mtu3 *mtu)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						mtu->address = 0;
 | 
				
			||||||
 | 
						mtu->ep0_state = MU3D_EP0_STATE_SETUP;
 | 
				
			||||||
 | 
						mtu->may_wakeup = 0;
 | 
				
			||||||
 | 
						mtu->u1_enable = 0;
 | 
				
			||||||
 | 
						mtu->u2_enable = 0;
 | 
				
			||||||
 | 
						mtu->delayed_status = false;
 | 
				
			||||||
 | 
						mtu->test_mode = false;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void init_hw_ep(struct mtu3 *mtu, struct mtu3_ep *mep,
 | 
					static void init_hw_ep(struct mtu3 *mtu, struct mtu3_ep *mep,
 | 
				
			||||||
		u32 epnum, u32 is_in)
 | 
							u32 epnum, u32 is_in)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
| 
						 | 
					@ -702,6 +713,7 @@ void mtu3_gadget_disconnect(struct mtu3 *mtu)
 | 
				
			||||||
		spin_lock(&mtu->lock);
 | 
							spin_lock(&mtu->lock);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						mtu3_state_reset(mtu);
 | 
				
			||||||
	usb_gadget_set_state(&mtu->g, USB_STATE_NOTATTACHED);
 | 
						usb_gadget_set_state(&mtu->g, USB_STATE_NOTATTACHED);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -712,12 +724,6 @@ void mtu3_gadget_reset(struct mtu3 *mtu)
 | 
				
			||||||
	/* report disconnect, if we didn't flush EP state */
 | 
						/* report disconnect, if we didn't flush EP state */
 | 
				
			||||||
	if (mtu->g.speed != USB_SPEED_UNKNOWN)
 | 
						if (mtu->g.speed != USB_SPEED_UNKNOWN)
 | 
				
			||||||
		mtu3_gadget_disconnect(mtu);
 | 
							mtu3_gadget_disconnect(mtu);
 | 
				
			||||||
 | 
						else
 | 
				
			||||||
	mtu->address = 0;
 | 
							mtu3_state_reset(mtu);
 | 
				
			||||||
	mtu->ep0_state = MU3D_EP0_STATE_SETUP;
 | 
					 | 
				
			||||||
	mtu->may_wakeup = 0;
 | 
					 | 
				
			||||||
	mtu->u1_enable = 0;
 | 
					 | 
				
			||||||
	mtu->u2_enable = 0;
 | 
					 | 
				
			||||||
	mtu->delayed_status = false;
 | 
					 | 
				
			||||||
	mtu->test_mode = false;
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue