libpayload: Add zero length packet support to UDC framework

Hardware / Coreboot - Patrick Georgi [google.com] - 18 April 2015 01:40 UTC

Some IN transfers must be terminated by an empty packet because otherwise the host wouldn't know.

The zlp() function determines this requirement in accordance to USB rules: If the transfer's size is aligned to the maximum packet size, and the host expects a larger transfer, add the empty packet as a hint.

BRANCH=none BUG=none TEST=USB device mode still works

Change-Id: Ia69f3d017f72a3a0e0b21bac72fe97be184c7daa

ea0bdf2 libpayload: Add zero length packet support to UDC framework
payloads/libpayload/drivers/udc/chipidea.c | 9 +++++++++
payloads/libpayload/drivers/udc/udc.c | 28 ++++++++++++++++++++++++----
payloads/libpayload/include/udc/udc.h | 2 ++
3 files changed, 35 insertions(+), 4 deletions(-)

Upstream: review.coreboot.org


  • Share