public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Lukasz Majewski <lukma@denx.de>
To: u-boot@lists.denx.de
Subject: [PATCH v2 2/7] f_sdp: Add high speed endpoint descriptor
Date: Tue, 18 Aug 2020 13:23:36 +0200	[thread overview]
Message-ID: <20200818132336.0f4e2ad6@jawa> (raw)
In-Reply-To: <20200818101649.16509-3-peng.fan@nxp.com>

On Tue, 18 Aug 2020 18:16:44 +0800
Peng Fan <peng.fan@nxp.com> wrote:

> From: Ye Li <ye.li@nxp.com>
> 
> Add HS endpoint descriptor for SDP. So that we can use high speed
> endpoint, and the SDP device can send packet with 512 byte size.

Do you use uuu for it? On which board do you perform tests?

> 
> Signed-off-by: Ye Li <ye.li@nxp.com>
> Signed-off-by: Peng Fan <peng.fan@nxp.com>
> ---
>  drivers/usb/gadget/f_sdp.c | 30 ++++++++++++++++++++++++++++--
>  1 file changed, 28 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/usb/gadget/f_sdp.c b/drivers/usb/gadget/f_sdp.c
> index f2fe89d2a6..f971ccdeca 100644
> --- a/drivers/usb/gadget/f_sdp.c
> +++ b/drivers/usb/gadget/f_sdp.c
> @@ -159,6 +159,16 @@ static struct usb_endpoint_descriptor in_desc = {
>  	.bInterval =		1,
>  };
>  
> +static struct usb_endpoint_descriptor in_hs_desc = {
> +	.bLength =		USB_DT_ENDPOINT_SIZE,
> +	.bDescriptorType =	USB_DT_ENDPOINT,
> /*USB_DT_CS_ENDPOINT*/ +
> +	.bEndpointAddress =	1 | USB_DIR_IN,
> +	.bmAttributes =	USB_ENDPOINT_XFER_INT,
> +	.wMaxPacketSize =	512,
> +	.bInterval =		1,
> +};
> +
>  static struct usb_descriptor_header *sdp_runtime_descs[] = {
>  	(struct usb_descriptor_header *)&sdp_intf_runtime,
>  	(struct usb_descriptor_header *)&sdp_hid_desc,
> @@ -166,6 +176,13 @@ static struct usb_descriptor_header
> *sdp_runtime_descs[] = { NULL,
>  };
>  
> +static struct usb_descriptor_header *sdp_runtime_hs_descs[] = {
> +	(struct usb_descriptor_header *)&sdp_intf_runtime,
> +	(struct usb_descriptor_header *)&sdp_hid_desc,
> +	(struct usb_descriptor_header *)&in_hs_desc,
> +	NULL,
> +};
> +
>  /* This is synchronized with what the SoC implementation reports */
>  static struct hid_report sdp_hid_report = {
>  	.usage_page = {
> @@ -489,6 +506,11 @@ static int sdp_bind(struct usb_configuration *c,
> struct usb_function *f) goto error;
>  	}
>  
> +	if (gadget_is_dualspeed(gadget)) {
> +		/* Assume endpoint addresses are the same for both
> speeds */
> +		in_hs_desc.bEndpointAddress =
> in_desc.bEndpointAddress;
> +	}
> +
>  	sdp->in_ep = ep; /* Store IN EP for enabling @ setup */
>  
>  	cdev->req->context = sdp;
> @@ -541,11 +563,15 @@ static int sdp_set_alt(struct usb_function *f,
> unsigned intf, unsigned alt) {
>  	struct f_sdp *sdp = func_to_sdp(f);
>  	struct usb_composite_dev *cdev = f->config->cdev;
> +	struct usb_gadget *gadget = cdev->gadget;
>  	int result;
>  
>  	debug("%s: intf: %d alt: %d\n", __func__, intf, alt);
>  
> -	result = usb_ep_enable(sdp->in_ep, &in_desc);
> +	if (gadget_is_dualspeed(gadget) && gadget->speed ==
> USB_SPEED_HIGH)
> +		result = usb_ep_enable(sdp->in_ep, &in_hs_desc);
> +	else
> +		result = usb_ep_enable(sdp->in_ep, &in_desc);
>  	if (result)
>  		return result;
>  	sdp->in_req = sdp_start_ep(sdp->in_ep);
> @@ -591,7 +617,7 @@ static int sdp_bind_config(struct
> usb_configuration *c) memset(sdp_func, 0, sizeof(*sdp_func));
>  
>  	sdp_func->usb_function.name = "sdp";
> -	sdp_func->usb_function.hs_descriptors = sdp_runtime_descs;
> +	sdp_func->usb_function.hs_descriptors = sdp_runtime_hs_descs;
>  	sdp_func->usb_function.descriptors = sdp_runtime_descs;
>  	sdp_func->usb_function.bind = sdp_bind;
>  	sdp_func->usb_function.unbind = sdp_unbind;

Reviewed-by: Lukasz Majewski <lukma@denx.de>


Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma at denx.de
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20200818/60dcc3a6/attachment.sig>

  reply	other threads:[~2020-08-18 11:23 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-18 10:16 [PATCH v2 0/7] f_sdp: fix and update Peng Fan
2020-08-18 10:16 ` [PATCH v2 1/7] sdp: call board_usb_init at spl_sdp_load_image Peng Fan
2020-08-18 11:22   ` Lukasz Majewski
2020-08-18 12:31     ` Peng Fan
2020-08-18 10:16 ` [PATCH v2 2/7] f_sdp: Add high speed endpoint descriptor Peng Fan
2020-08-18 11:23   ` Lukasz Majewski [this message]
2020-08-18 10:16 ` [PATCH v2 3/7] f_sdp: Fix wrong usb request size Peng Fan
2020-08-18 11:24   ` Lukasz Majewski
2020-08-18 10:16 ` [PATCH v2 4/7] f_sdp: Support searching and loading FIT or container image Peng Fan
2020-08-18 11:32   ` Lukasz Majewski
2020-08-18 12:38     ` Peng Fan
2020-08-18 12:42       ` Lukasz Majewski
2020-08-18 10:16 ` [PATCH v2 5/7] spl: add g_dnl_get_board_bcd_device_number Peng Fan
2020-08-18 11:32   ` Lukasz Majewski
2020-08-18 10:16 ` [PATCH v2 6/7] f_sdp: Add EP1_OUT as default data receive pipe in sdp Peng Fan
2020-08-18 10:16 ` [PATCH v2 7/7] f_sdp: Change bInterval of interrupt endpoint to 3 Peng Fan

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=20200818132336.0f4e2ad6@jawa \
    --to=lukma@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox