[U-Boot] [PATCH] Enable high speed support for USB device framework and usbtty

Amit Virdi amit.virdi at st.com
Wed Feb 29 11:03:10 CET 2012


Hello Marek,

+#if defined(CONFIG_USBD_HS)
>> +	int i;
>> +#endif
>>   	switch (event) {
>>   	case DEVICE_RESET:
>>   	case DEVICE_BUS_INACTIVE:
>> @@ -942,6 +967,29 @@ static void usbtty_event_handler (struct
>> usb_device_instance *device, break;
>>
>>   	case DEVICE_ADDRESS_ASSIGNED:
>> +#if defined(CONFIG_USBD_HS)
>> +		/*
>> +		 * is_usbd_high_speed routine needs to be defined by
>> +		 * specific gadget driver
>> +		 * It returns TRUE if device enumerates at High speed
>> +		 * Retuns FALSE otherwise
>> +		 */
>> +		for (i = 1; i<= NUM_ENDPOINTS; i++) {
>
> Start with i = 0 and end with i<  NUM_ENDPOINTS to avoid these i-1 below. Then
> fix those [i] with [i+1], there's less of those.
>

Ok.

>> +			if (((ep_descriptor_ptrs[i - 1]->bmAttributes&
>> +			      USB_ENDPOINT_XFERTYPE_MASK) ==
>> +			      USB_ENDPOINT_XFER_BULK)
>> +			&&  is_usbd_high_speed()) {
>> +
>> +				ep_descriptor_ptrs[i - 1]->wMaxPacketSize =
>> +					CONFIG_USBD_SERIAL_BULK_HS_PKTSIZE;
>> +			}
>> +
>> +			endpoint_instance[i].tx_packetSize =
>> +				ep_descriptor_ptrs[i - 1]->wMaxPacketSize;
>> +			endpoint_instance[i].rcv_packetSize =
>> +				ep_descriptor_ptrs[i - 1]->wMaxPacketSize;
>> +		}
>> +#endif
>>   		usbtty_init_endpoints ();
>>
>>   	default:
>> diff --git a/drivers/serial/usbtty.h b/drivers/serial/usbtty.h
>> index 6731c38..bd3bcbc 100644
>> --- a/drivers/serial/usbtty.h
>> +++ b/drivers/serial/usbtty.h
>> @@ -72,6 +72,10 @@
>>   #define CONFIG_USBD_SERIAL_INT_PKTSIZE	UDC_INT_PACKET_SIZE
>>   #define CONFIG_USBD_SERIAL_BULK_PKTSIZE	UDC_BULK_PACKET_SIZE
>>
>> +#if defined(CONFIG_USBD_HS)
>> +#define CONFIG_USBD_SERIAL_BULK_HS_PKTSIZE	UDC_BULK_HS_PACKET_SIZE
>> +#endif
>> +
>>   #define USBTTY_DEVICE_CLASS	COMMUNICATIONS_DEVICE_CLASS
>>
>>   #define USBTTY_BCD_DEVICE	0x00
>> diff --git a/drivers/usb/gadget/core.c b/drivers/usb/gadget/core.c
>> index 4f2ebab..b2212b4 100644
>> --- a/drivers/usb/gadget/core.c
>> +++ b/drivers/usb/gadget/core.c
>> @@ -212,6 +212,20 @@ struct usb_device_descriptor
>> *usbd_device_device_descriptor (struct usb_device_i return
>> (device->device_descriptor);
>>   }
>>
>> +#if defined(CONFIG_USBD_HS)
>> +/**
>> + * usbd_device_qualifier_descriptor
>> + * @device: which device
>> + * @port: which port
>> + *
>> + * Return the specified qualifier descriptor for the specified device.
>> + */
>> +struct usb_qualifier_descriptor *usbd_device_qualifier_descriptor(
>> +		struct usb_device_instance *device, int port)
>
> Make this static, but do you really need this function at all?
>

Well... usbd_device_qualifier_descriptor can't be static as the function 
is called from another file (ep0.c). However, since it is used only for 
EP0, it can be omitted for the time being keeping in mind we might need 
to define it in future (if the need arises). What do you think?

> Otherwise seems ok
>

Thanks
Amit Virdi



More information about the U-Boot mailing list