Merge "platform: msm_shared: Add more debug information"
diff --git a/app/aboot/fastboot.c b/app/aboot/fastboot.c
index 67bd760..b4e4922 100644
--- a/app/aboot/fastboot.c
+++ b/app/aboot/fastboot.c
@@ -2,7 +2,7 @@
  * Copyright (c) 2009, Google Inc.
  * All rights reserved.
  *
- * Copyright (c) 2013, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2013-2014, The Linux Foundation. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -302,24 +302,38 @@
 static int usb_write(void *buf, unsigned len)
 {
 	int r;
+	uint32_t xfer;
+	unsigned char *_buf = buf;
+	int count = 0;
 
 	if (fastboot_state == STATE_ERROR)
 		goto oops;
 
-	req->buf = PA((addr_t)buf);
-	req->length = len;
-	req->complete = req_complete;
-	r = udc_request_queue(in, req);
-	if (r < 0) {
-		dprintf(INFO, "usb_write() queue failed\n");
-		goto oops;
+	while (len > 0) {
+		xfer = (len > MAX_USBFS_BULK_SIZE) ? MAX_USBFS_BULK_SIZE : len;
+		req->buf = PA((addr_t)_buf);
+		req->length = xfer;
+		req->complete = req_complete;
+		r = udc_request_queue(in, req);
+		if (r < 0) {
+			dprintf(INFO, "usb_write() queue failed\n");
+			goto oops;
+		}
+		event_wait(&txn_done);
+		if (txn_status < 0) {
+			dprintf(INFO, "usb_write() transaction failed\n");
+			goto oops;
+		}
+
+		count += req->length;
+		_buf += req->length;
+		len -= req->length;
+
+		/* short transfer? */
+		if (req->length != xfer) break;
 	}
-	event_wait(&txn_done);
-	if (txn_status < 0) {
-		dprintf(INFO, "usb_write() transaction failed\n");
-		goto oops;
-	}
-	return req->length;
+
+	return count;
 
 oops:
 	fastboot_state = STATE_ERROR;
diff --git a/include/dev/udc.h b/include/dev/udc.h
index 0dd1f86..aa1aadd 100644
--- a/include/dev/udc.h
+++ b/include/dev/udc.h
@@ -34,7 +34,7 @@
 struct udc_request {
 	void *buf;
 	unsigned length;
-	void (*complete)(struct udc_request *req, unsigned actual, int status);
+	void (*complete)();
 	void *context;
 };
 
diff --git a/platform/msm_shared/hsusb.c b/platform/msm_shared/hsusb.c
index 02a15db..a739f9b 100644
--- a/platform/msm_shared/hsusb.c
+++ b/platform/msm_shared/hsusb.c
@@ -2,7 +2,7 @@
  * Copyright (c) 2008, Google Inc.
  * All rights reserved.
  *
- * Copyright (c) 2009-2013, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2009-2014, The Linux Foundation. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are
@@ -476,7 +476,7 @@
 static struct udc_request *ep0req;
 
 static void
-ep0_setup_ack_complete(struct udc_endpoint *ep, struct usb_request *req)
+ep0_setup_ack_complete()
 {
 	uint32_t mode;
 
diff --git a/target/msm8226/init.c b/target/msm8226/init.c
index 2a41004..74baa49 100644
--- a/target/msm8226/init.c
+++ b/target/msm8226/init.c
@@ -357,11 +357,17 @@
 
 void reboot_device(unsigned reboot_reason)
 {
+	int ret = 0;
+
 	writel(reboot_reason, RESTART_REASON_ADDR);
 
 	/* Configure PMIC for warm reset */
 	pm8x41_reset_configure(PON_PSHOLD_WARM_RESET);
 
+	ret = scm_halt_pmic_arbiter();
+	if (ret)
+		dprintf(CRITICAL , "Failed to halt pmic arbiter: %d\n", ret);
+
 	/* Drop PS_HOLD for MSM */
 	writel(0x00, MPM2_MPM_PS_HOLD);