libpayload: Add clear_feature() function to USB framework
This function will be used by the USB hub driver. Change-Id: I4d1d2e94f4442cbb636ae989e8ffd543181c4357 Signed-off-by: Nico Huber <nico.huber@secunet.com> Reviewed-on: http://review.coreboot.org/1079 Tested-by: build bot (Jenkins) Reviewed-by: Patrick Georgi <patrick@georgi-clan.de>
This commit is contained in:
		
				
					committed by
					
						
						Patrick Georgi
					
				
			
			
				
	
			
			
			
						parent
						
							cefec0ea8c
						
					
				
				
					commit
					5f595cb6eb
				
			@@ -205,22 +205,29 @@ set_configuration (usbdev_t *dev)
 | 
				
			|||||||
	dev->controller->control (dev, OUT, sizeof (dr), &dr, 0, 0);
 | 
						dev->controller->control (dev, OUT, sizeof (dr), &dr, 0, 0);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void
 | 
				
			||||||
 | 
					clear_feature (usbdev_t *dev, int endp, int feature, int rtype)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						dev_req_t dr;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						dr.bmRequestType = rtype;
 | 
				
			||||||
 | 
						dr.data_dir = host_to_device;
 | 
				
			||||||
 | 
						dr.bRequest = CLEAR_FEATURE;
 | 
				
			||||||
 | 
						dr.wValue = feature;
 | 
				
			||||||
 | 
						dr.wIndex = endp;
 | 
				
			||||||
 | 
						dr.wLength = 0;
 | 
				
			||||||
 | 
						dev->controller->control (dev, OUT, sizeof (dr), &dr, 0, 0);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int
 | 
					int
 | 
				
			||||||
clear_stall (endpoint_t *ep)
 | 
					clear_stall (endpoint_t *ep)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	usbdev_t *dev = ep->dev;
 | 
						usbdev_t *dev = ep->dev;
 | 
				
			||||||
	int endp = ep->endpoint;
 | 
						int endp = ep->endpoint;
 | 
				
			||||||
	dev_req_t dr;
 | 
						int rtype = gen_bmRequestType (host_to_device, standard_type,
 | 
				
			||||||
 | 
										endp ? endp_recp : dev_recp);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	dr.bmRequestType = 0;
 | 
						clear_feature (dev, endp, ENDPOINT_HALT, rtype);
 | 
				
			||||||
	if (endp != 0) {
 | 
					 | 
				
			||||||
		dr.req_recp = endp_recp;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	dr.bRequest = CLEAR_FEATURE;
 | 
					 | 
				
			||||||
	dr.wValue = ENDPOINT_HALT;
 | 
					 | 
				
			||||||
	dr.wIndex = endp;
 | 
					 | 
				
			||||||
	dr.wLength = 0;
 | 
					 | 
				
			||||||
	dev->controller->control (dev, OUT, sizeof (dr), &dr, 0, 0);
 | 
					 | 
				
			||||||
	ep->toggle = 0;
 | 
						ep->toggle = 0;
 | 
				
			||||||
	return 0;
 | 
						return 0;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -215,6 +215,7 @@ void init_device_entry (hci_t *controller, int num);
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
void set_feature (usbdev_t *dev, int endp, int feature, int rtype);
 | 
					void set_feature (usbdev_t *dev, int endp, int feature, int rtype);
 | 
				
			||||||
void get_status (usbdev_t *dev, int endp, int rtype, int len, void *data);
 | 
					void get_status (usbdev_t *dev, int endp, int rtype, int len, void *data);
 | 
				
			||||||
 | 
					void clear_feature (usbdev_t *dev, int endp, int feature, int rtype);
 | 
				
			||||||
int clear_stall (endpoint_t *ep);
 | 
					int clear_stall (endpoint_t *ep);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void usb_nop_init (usbdev_t *dev);
 | 
					void usb_nop_init (usbdev_t *dev);
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user