[U-Boot] 答复: [PATCH 1/2] usb: gadget: s3c_udc_otg: fixed max packet size check for ep_in in high speed

Frank Wang frank.wang at rock-chips.com
Wed Dec 16 03:39:16 CET 2015


Hi Lukasz,

Sorry to reply you so late.

The issue occur at below case, I have also attached some logs.

fastboot_set_alt()--> usb_ep_enable(fs_ep_in) --> s3c_ep_enable()

=> 
=> fastboot 0
s3c_udc_probe: 9ffaf938
0
s3c_alloc_request: ep0-control 9ffb176c
Reseting OTG controller
0
0
Reseting OTG controller
0
0
0
nuke: ep0-control 9ffb176c
pkt = 8006000100004000 
0

*** s3c_queue: ep0-control-in req = 9df7adc0, len = 18, buf = 9df7cd80 empty
= 1, stopped = 0
pkt = 1201000202020040 0722060099990102 0301
0
done: ep0-control 9ffb176c, req = 9df7adc0, stopped = 0
calling complete callback
pkt[18] = 1201000202020040 0722060099990102 0301
callback completed
0
0
Reseting OTG controller
0
0
0
nuke: ep0-control 9ffb176c
pkt = 0005040000000000 
0
0
nuke: ep0-control 9ffb176c
pkt = 8006000100001200 
0

*** s3c_queue: ep0-control-in req = 9df7adc0, len = 18, buf = 9df7cd80 empty
= 1, stopped = 0
pkt = 1201000202020040 0722060099990102 0301
0
done: ep0-control 9ffb176c, req = 9df7adc0, stopped = 0
calling complete callback
pkt[18] = 1201000202020040 0722060099990102 0301
callback completed
0
0
nuke: ep0-control 9ffb176c
pkt = 800600020000ff00 
0

*** s3c_queue: ep0-control-in req = 9df7adc0, len = 32, buf = 9df7cd80 empty
= 1, stopped = 0
pkt = 09022000010102c0 000904000002ff42 0304070581024000 0007050202000200 
0
done: ep0-control 9ffb176c, req = 9df7adc0, stopped = 0
calling complete callback
pkt[32] = 09022000010102c0 000904000002ff42 0304070581024000
0007050202000200 
callback completed
0
0
nuke: ep0-control 9ffb176c
pkt = 800600030000ff00 
0

*** s3c_queue: ep0-control-in req = 9df7adc0, len = 4, buf = 9df7cd80 empty
= 1, stopped = 0
pkt = 04030904
0
done: ep0-control 9ffb176c, req = 9df7adc0, stopped = 0
calling complete callback
pkt[4] = 04030904
callback completed
0
0
nuke: ep0-control 9ffb176c
pkt = 8006000100001200 
0

*** s3c_queue: ep0-control-in req = 9df7adc0, len = 18, buf = 9df7cd80 empty
= 1, stopped = 0
pkt = 1201000202020040 0722060099990102 0301
0
done: ep0-control 9ffb176c, req = 9df7adc0, stopped = 0
calling complete callback
pkt[18] = 1201000202020040 0722060099990102 0301
callback completed
0
0
nuke: ep0-control 9ffb176c
pkt = 8006000100001200 
0

*** s3c_queue: ep0-control-in req = 9df7adc0, len = 18, buf = 9df7cd80 empty
= 1, stopped = 0
pkt = 1201000202020040 0722060099990102 0301
0
done: ep0-control 9ffb176c, req = 9df7adc0, stopped = 0
calling complete callback
pkt[18] = 1201000202020040 0722060099990102 0301
callback completed
0
0
nuke: ep0-control 9ffb176c
pkt = 8006000200000900 
0

*** s3c_queue: ep0-control-in req = 9df7adc0, len = 9, buf = 9df7cd80 empty
= 1, stopped = 0
pkt = 09022000010102c0 00
0
done: ep0-control 9ffb176c, req = 9df7adc0, stopped = 0
calling complete callback
pkt[9] = 09022000010102c0 00
callback completed
0
0
nuke: ep0-control 9ffb176c
pkt = 8006000200002000 
0

*** s3c_queue: ep0-control-in req = 9df7adc0, len = 32, buf = 9df7cd80 empty
= 1, stopped = 0
pkt = 09022000010102c0 000904000002ff42 0304070581024000 0007050202000200 
0
done: ep0-control 9ffb176c, req = 9df7adc0, stopped = 0
calling complete callback
pkt[32] = 09022000010102c0 000904000002ff42 0304070581024000
0007050202000200 
callback completed
0
0
nuke: ep0-control 9ffb176c
pkt = 8000000000000200 
crq->brequest:0x0
0
0
0
nuke: ep0-control 9ffb176c
pkt = 0009010000000000 
fastboot_set_alt: func: f_fastboot intf: 0 alt: 0
s3c_ep_enable: 9ffb1804
s3c_udc_set_nak: ep_num = 2, ep_type = 1
s3c_udc_set_nak: set NAK, DOEPCTL2 = 0x40020000
s3c_udc_set_halt: ep_num = 2, value = 0
0
s3c_udc_ep_clear_stall: ep_num = 2, ep_type = 1
s3c_udc_ep_clear_stall: cleared stall, DOEPCTL2 = 0x40020000
0
s3c_udc_ep_activate: EPCTRL2 = 0x40020000, ep_is_in = 0
s3c_udc_ep_activate: USB Ative EP2, DOEPCTRL2 = 0x400a8200
s3c_udc_ep_activate: DAINTMSK = 0x50001
s3c_ep_enable: enabled ep2out-bulk, stopped = 0, maxpacket = 512
s3c_alloc_request: ep2out-bulk 9ffb1804
s3c_ep_enable: 9ffb17b8
s3c_ep_enable: desc->wMaxPacketSize=64, ep->maxpacket=512
s3c_ep_enable: bad ep1in-bulk maxpacket
failed to enable in ep
s3c_ep_disable: 9ffb1804
0
nuke: ep2out-bulk 9ffb1804
s3c_ep_disable: disabled ep2out-bulk
s3c_ep_disable: 9ffb17b8
s3c_ep_disable: ep1in-bulk not enabled
s3c_free_request: 9ffb1804
s3c_ep_disable: 9ffb1804
s3c_ep_disable: ep2out-bulk not enabled
s3c_ep_disable: 9ffb17b8
s3c_ep_disable: ep1in-bulk not enabled
0
nuke: ep0-control 9ffb176c
pkt = 8006000100001200 
0


BR.
Frank
-----邮件原件-----
发件人: Lukasz Majewski [mailto:l.majewski at samsung.com] 
发送时间: 2015年12月7日 20:58
收件人: Frank Wang
抄送: marex at denx.de; trini at konsulko.com; u-boot at lists.denx.de;
benchan at chromium.org; kmixter at chromium.org; sjg at chromium.org; cf at rock-chips.
com
主题: Re: [PATCH 1/2] usb: gadget: s3c_udc_otg: fixed max packet size check
for ep_in in high speed

Hi Frank,

> In current fastboot frame, both full and high speed use 'fs_ep_in', 
> but fs_ep_in.wMaxPacketSize is configurated 64 bytes as default,

Because 64 bytes is the smallest possible packet size. 

> I do not understand why high speed TX max packet size is also set as
> 64 bytes,

According to struct s3c_udc @ s3c_udc_otg.c only the EP0 has maxpacket set
to 64 bytes. Rest is set to 512B.

Frank could you shed some light on conditions when this error shows up?
Some logs/condition of operation could be helpful.

> so I changed the condition from  '!=' to '>' as a workaround.

Instead of applying workaround, lets focus on your problem.

> 
> Signed-off-by: Frank Wang <frank.wang at rock-chips.com>
> ---
>  drivers/usb/gadget/s3c_udc_otg.c |    4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/usb/gadget/s3c_udc_otg.c
> b/drivers/usb/gadget/s3c_udc_otg.c index 7a2d1e7..b2d3988 100644
> --- a/drivers/usb/gadget/s3c_udc_otg.c
> +++ b/drivers/usb/gadget/s3c_udc_otg.c
> @@ -556,8 +556,8 @@ static int s3c_ep_enable(struct usb_ep *_ep,
>  	}
>  
>  	/* hardware _could_ do smaller, but driver doesn't */
> -	if ((desc->bmAttributes == USB_ENDPOINT_XFER_BULK
> -	     && le16_to_cpu(get_unaligned(&desc->wMaxPacketSize)) !=
> +	if ((desc->bmAttributes == USB_ENDPOINT_XFER_BULK &&
> +	     le16_to_cpu(get_unaligned(&desc->wMaxPacketSize)) >
>  	     ep_maxpacket(ep))
> || !get_unaligned(&desc->wMaxPacketSize)) {
>  		debug("%s: bad %s maxpacket\n", __func__, _ep->name);



-- 
Best regards,

Lukasz Majewski

Samsung R&D Institute Poland (SRPOL) | Linux Platform Group





More information about the U-Boot mailing list