mirror of
				https://github.com/smaeul/u-boot.git
				synced 2025-11-04 05:50:17 +00:00 
			
		
		
		
	usb: xhci: convert to readx_poll_sleep_timeout()
Use readx_poll_sleep_timeout() to poll the register status Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
This commit is contained in:
		
							parent
							
								
									23a54ccfb6
								
							
						
					
					
						commit
						a6837a0370
					
				@ -33,6 +33,7 @@
 | 
				
			|||||||
#include <linux/bug.h>
 | 
					#include <linux/bug.h>
 | 
				
			||||||
#include <linux/delay.h>
 | 
					#include <linux/delay.h>
 | 
				
			||||||
#include <linux/errno.h>
 | 
					#include <linux/errno.h>
 | 
				
			||||||
 | 
					#include <linux/iopoll.h>
 | 
				
			||||||
#include <usb/xhci.h>
 | 
					#include <usb/xhci.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifndef CONFIG_USB_MAX_CONTROLLER_COUNT
 | 
					#ifndef CONFIG_USB_MAX_CONTROLLER_COUNT
 | 
				
			||||||
@ -143,23 +144,19 @@ struct xhci_ctrl *xhci_get_ctrl(struct usb_device *udev)
 | 
				
			|||||||
 * @param usec	time to wait till
 | 
					 * @param usec	time to wait till
 | 
				
			||||||
 * @return 0 if handshake is success else < 0 on failure
 | 
					 * @return 0 if handshake is success else < 0 on failure
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
static int handshake(uint32_t volatile *ptr, uint32_t mask,
 | 
					static int
 | 
				
			||||||
					uint32_t done, int usec)
 | 
					handshake(uint32_t volatile *ptr, uint32_t mask, uint32_t done, int usec)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	uint32_t result;
 | 
						uint32_t result;
 | 
				
			||||||
 | 
						int ret;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	do {
 | 
						ret = readx_poll_sleep_timeout(xhci_readl, ptr, result,
 | 
				
			||||||
		result = xhci_readl(ptr);
 | 
									 (result & mask) == done || result == U32_MAX,
 | 
				
			||||||
		if (result == ~(uint32_t)0)
 | 
									 1, usec);
 | 
				
			||||||
			return -ENODEV;
 | 
						if (result == U32_MAX)		/* card removed */
 | 
				
			||||||
		result &= mask;
 | 
							return -ENODEV;
 | 
				
			||||||
		if (result == done)
 | 
					 | 
				
			||||||
			return 0;
 | 
					 | 
				
			||||||
		usec--;
 | 
					 | 
				
			||||||
		udelay(1);
 | 
					 | 
				
			||||||
	} while (usec > 0);
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return -ETIMEDOUT;
 | 
						return ret;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user