All of lore.kernel.org
 help / color / mirror / Atom feed
From: Marek Vasut <marex@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] Enable high speed support for USB device framework and usbtty
Date: Wed, 29 Feb 2012 22:24:17 +0100	[thread overview]
Message-ID: <201202292224.17205.marex@denx.de> (raw)
In-Reply-To: <4F4DF7DE.7020804@st.com>

> 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?

What do you mean. If this is called from ep0.c, it has to be exported and that's 
how it is. On the other hand, if ep0.c already has access to the "device", it 
can directly access the device_descriptor field, which is I believe expressive 
enough.

Thanks for your good work so far, keep it up!

M
> 
> > Otherwise seems ok
> 
> Thanks
> Amit Virdi

  reply	other threads:[~2012-02-29 21:24 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-27  9:35 [U-Boot] [PATCH] Enable high speed support for USB device framework and usbtty Amit Virdi
2012-02-27 11:41 ` Marek Vasut
2012-02-29 10:03   ` Amit Virdi
2012-02-29 21:24     ` Marek Vasut [this message]
2012-03-02  5:54       ` Amit Virdi
2012-03-02 10:41         ` Marek Vasut
2012-03-18 22:57           ` Marek Vasut
2012-03-19  9:31             ` Shiraz Hashim
2012-03-19 10:28               ` Marek Vasut
2012-03-26  4:46                 ` Amit Virdi
2012-03-26 10:41                   ` Marek Vasut

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=201202292224.17205.marex@denx.de \
    --to=marex@denx.de \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.