[U-Boot,v3,6/9] usb: rockchip: be quiet on serial port while transferring data

Message ID 1531393559-28958-7-git-send-email-alberto@amarulasolutions.com
State Changes Requested
Delegated to: Philipp Tomsich
Headers show
Series
  • Improve rockusb support in U-Boot
Related show

Commit Message

Alberto Panizzo July 12, 2018, 11:05 a.m.
While downloading or uploading megabytes of data we had thousands of
printf in console like:

transfer 0x10000 bytes done
OR
Uploading 0x1000 bytes

This because transfers are chunked and there is no way on target
side to know the overall transfer size (to print one string per
overall transfer).

All these prints on serial console do slow down significantly the
transfer and does not offer a significant information to the
developer: rkdeveloptool and Rockchip original tool do use small
chunks read/writes on big transfers. This allows on workstation
to print percentage of transfer complete and as well offers to
developer the information about: transfer is running OK.
On error, either the percentage will stop or an error will be shown
on workstation console.

Signed-off-by: Alberto Panizzo <alberto@amarulasolutions.com>
---
 drivers/usb/gadget/f_rockusb.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Philipp Tomsich July 20, 2018, 4:48 p.m. | #1
> While downloading or uploading megabytes of data we had thousands of
> printf in console like:
> 
> transfer 0x10000 bytes done
> OR
> Uploading 0x1000 bytes
> 
> This because transfers are chunked and there is no way on target
> side to know the overall transfer size (to print one string per
> overall transfer).
> 
> All these prints on serial console do slow down significantly the
> transfer and does not offer a significant information to the
> developer: rkdeveloptool and Rockchip original tool do use small
> chunks read/writes on big transfers. This allows on workstation
> to print percentage of transfer complete and as well offers to
> developer the information about: transfer is running OK.
> On error, either the percentage will stop or an error will be shown
> on workstation console.
> 
> Signed-off-by: Alberto Panizzo <alberto@amarulasolutions.com>
> ---
>  drivers/usb/gadget/f_rockusb.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 

Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>

Patch

diff --git a/drivers/usb/gadget/f_rockusb.c b/drivers/usb/gadget/f_rockusb.c
index bcdc2ba..0959b8c 100644
--- a/drivers/usb/gadget/f_rockusb.c
+++ b/drivers/usb/gadget/f_rockusb.c
@@ -474,7 +474,7 @@  static void tx_handler_ul_image(struct usb_ep *ep, struct usb_request *req)
 	memcpy(in_req->buf, rbuffer, transfer_size);
 	in_req->length = transfer_size;
 	in_req->complete = tx_handler_ul_image;
-	printf("Uploading 0x%x bytes\n", transfer_size);
+	debug("Uploading 0x%x bytes\n", transfer_size);
 	usb_ep_dequeue(rockusb_func->in_ep, in_req);
 	ret = usb_ep_queue(rockusb_func->in_ep, in_req, 0);
 	if (ret)
@@ -536,7 +536,7 @@  static void rx_handler_dl_image(struct usb_ep *ep, struct usb_request *req)
 		req->complete = rx_handler_command;
 		req->length = EP_BUFFER_SIZE;
 		f_rkusb->buf = f_rkusb->buf_head;
-		printf("transfer 0x%x bytes done\n", f_rkusb->dl_size);
+		debug("transfer 0x%x bytes done\n", f_rkusb->dl_size);
 		f_rkusb->dl_size = 0;
 		rockusb_tx_write_csw(f_rkusb->tag, 0, CSW_GOOD,
 				     USB_BULK_CS_WRAP_LEN);