mirror of
				https://github.com/smaeul/u-boot.git
				synced 2025-11-04 05:50:17 +00:00 
			
		
		
		
	Merge tag 'u-boot-dfu-next-20231124' of https://source.denx.de/u-boot/custodians/u-boot-dfu into next
u-boot-dfu-next-20231124 - Make dfu entity name size configurable in KConfig - Implement start-stop for UMS (graceful shutdown via eject) - Improve help messages for cmd/bind - Improve help message for udc bind failures
This commit is contained in:
		
						commit
						129d6a0d87
					
				@ -977,7 +977,7 @@ config CMD_BCB
 | 
			
		||||
config CMD_BIND
 | 
			
		||||
	bool "bind/unbind - Bind or unbind a device to/from a driver"
 | 
			
		||||
	depends on DM
 | 
			
		||||
	default y if USB_ETHER
 | 
			
		||||
	imply CMD_DM
 | 
			
		||||
	help
 | 
			
		||||
	  Bind or unbind a device to/from a driver from the command line.
 | 
			
		||||
	  This is useful in situations where a device may be handled by several
 | 
			
		||||
 | 
			
		||||
@ -246,6 +246,8 @@ U_BOOT_CMD(
 | 
			
		||||
	"Bind a device to a driver",
 | 
			
		||||
	"<node path> <driver>\n"
 | 
			
		||||
	"bind <class> <index> <driver>\n"
 | 
			
		||||
	"Use 'dm tree' to list all devices registered in the driver model,\n"
 | 
			
		||||
	"their path, class, index and current driver.\n"
 | 
			
		||||
);
 | 
			
		||||
 | 
			
		||||
U_BOOT_CMD(
 | 
			
		||||
@ -254,4 +256,6 @@ U_BOOT_CMD(
 | 
			
		||||
	"<node path>\n"
 | 
			
		||||
	"unbind <class> <index>\n"
 | 
			
		||||
	"unbind <class> <index> <driver>\n"
 | 
			
		||||
	"Use 'dm tree' to list all devices registered in the driver model,\n"
 | 
			
		||||
	"their path, class, index and current driver.\n"
 | 
			
		||||
);
 | 
			
		||||
 | 
			
		||||
@ -112,5 +112,14 @@ config SYS_DFU_MAX_FILE_SIZE
 | 
			
		||||
	  the buffer once we've been given the whole file.  Define
 | 
			
		||||
	  this to the maximum filesize (in bytes) for the buffer.
 | 
			
		||||
	  If undefined it defaults to the CONFIG_SYS_DFU_DATA_BUF_SIZE.
 | 
			
		||||
 | 
			
		||||
config DFU_NAME_MAX_SIZE
 | 
			
		||||
	int "Size of the name to be added in dfu entity"
 | 
			
		||||
	default 32
 | 
			
		||||
	depends on DFU
 | 
			
		||||
	help
 | 
			
		||||
	  This value is used to maximum size. If name is longer than default size,
 | 
			
		||||
	  we need to change the proper maximum size.
 | 
			
		||||
 | 
			
		||||
endif
 | 
			
		||||
endmenu
 | 
			
		||||
 | 
			
		||||
@ -17,6 +17,7 @@ menuconfig USB_GADGET
 | 
			
		||||
	bool "USB Gadget Support"
 | 
			
		||||
	depends on DM
 | 
			
		||||
	select DM_USB
 | 
			
		||||
	imply CMD_BIND
 | 
			
		||||
	help
 | 
			
		||||
	   USB is a master/slave protocol, organized with one master
 | 
			
		||||
	   host (such as a PC) controlling up to 127 peripheral devices.
 | 
			
		||||
 | 
			
		||||
@ -327,6 +327,7 @@ struct fsg_common {
 | 
			
		||||
	unsigned int		short_packet_received:1;
 | 
			
		||||
	unsigned int		bad_lun_okay:1;
 | 
			
		||||
	unsigned int		running:1;
 | 
			
		||||
	unsigned int		eject:1;
 | 
			
		||||
 | 
			
		||||
	int			thread_wakeup_needed;
 | 
			
		||||
	struct completion	thread_notifier;
 | 
			
		||||
@ -669,6 +670,10 @@ static int sleep_thread(struct fsg_common *common)
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		if (k == 10) {
 | 
			
		||||
			/* Handle START-STOP UNIT */
 | 
			
		||||
			if (common->eject)
 | 
			
		||||
				return -EPIPE;
 | 
			
		||||
 | 
			
		||||
			/* Handle CTRL+C */
 | 
			
		||||
			if (ctrlc())
 | 
			
		||||
				return -EPIPE;
 | 
			
		||||
@ -1325,6 +1330,8 @@ static int do_start_stop(struct fsg_common *common)
 | 
			
		||||
		return -EINVAL;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	common->eject = 1;
 | 
			
		||||
 | 
			
		||||
	return 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -323,6 +323,7 @@ err1:
 | 
			
		||||
int usb_gadget_probe_driver(struct usb_gadget_driver *driver)
 | 
			
		||||
{
 | 
			
		||||
	struct usb_udc		*udc = NULL;
 | 
			
		||||
	unsigned int		udc_count = 0;
 | 
			
		||||
	int			ret;
 | 
			
		||||
 | 
			
		||||
	if (!driver || !driver->bind || !driver->setup)
 | 
			
		||||
@ -330,12 +331,22 @@ int usb_gadget_probe_driver(struct usb_gadget_driver *driver)
 | 
			
		||||
 | 
			
		||||
	mutex_lock(&udc_lock);
 | 
			
		||||
	list_for_each_entry(udc, &udc_list, list) {
 | 
			
		||||
		udc_count++;
 | 
			
		||||
 | 
			
		||||
		/* For now we take the first one */
 | 
			
		||||
		if (!udc->driver)
 | 
			
		||||
			goto found;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	printf("couldn't find an available UDC\n");
 | 
			
		||||
	if (!udc_count)
 | 
			
		||||
		printf("No UDC available in the system\n");
 | 
			
		||||
	else
 | 
			
		||||
		/* When this happens, users should 'unbind <class> <index>'
 | 
			
		||||
		 * using the output of 'dm tree' and looking at the line right
 | 
			
		||||
		 * after the USB peripheral/device controller.
 | 
			
		||||
		 */
 | 
			
		||||
		printf("All UDCs in use (%d available), use the unbind command\n",
 | 
			
		||||
		       udc_count);
 | 
			
		||||
	mutex_unlock(&udc_lock);
 | 
			
		||||
	return -ENODEV;
 | 
			
		||||
found:
 | 
			
		||||
 | 
			
		||||
@ -98,7 +98,12 @@ struct virt_internal_data {
 | 
			
		||||
	int dev_num;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#if defined(CONFIG_DFU_NAME_MAX_SIZE)
 | 
			
		||||
#define DFU_NAME_SIZE			CONFIG_DFU_NAME_MAX_SIZE
 | 
			
		||||
#else
 | 
			
		||||
#define DFU_NAME_SIZE			32
 | 
			
		||||
#endif
 | 
			
		||||
#ifndef DFU_DEFAULT_POLL_TIMEOUT
 | 
			
		||||
#define DFU_DEFAULT_POLL_TIMEOUT 0
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user