Merge "platform: msm_shared: Fixed inconsistent cache issue for USB"
diff --git a/platform/msm_shared/hsusb.c b/platform/msm_shared/hsusb.c
index 839f301..0967cd1 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-2014, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2009-2015, 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
@@ -183,6 +183,11 @@
 	ept->next = ept_list;
 	ept_list = ept;
 
+	arch_clean_invalidate_cache_range((addr_t) ept,
+					  sizeof(struct udc_endpoint));
+	arch_clean_invalidate_cache_range((addr_t) ept->head,
+					  sizeof(struct ept_queue_head));
+
 	DBG("ept%d %s @%p/%p max=%d bit=%x\n",
 	    num, in ? "in" : "out", ept, ept->head, max_pkt, ept->bit);
 
@@ -525,6 +530,7 @@
 	DBG("setup_tx %p %d\n", buf, len);
 	memcpy(ep0req->buf, buf, len);
 	ep0req->buf = (void *)PA((addr_t)ep0req->buf);
+	arch_clean_invalidate_cache_range((addr_t)ep0req->buf, len);
 	ep0req->complete = ep0in_complete;
 	ep0req->length = len;
 	udc_request_queue(ep0in, ep0req);
@@ -541,6 +547,7 @@
 	arch_clean_invalidate_cache_range((addr_t) ept->head->setup_data,
 					  sizeof(struct ept_queue_head));
 	memcpy(&s, ept->head->setup_data, sizeof(s));
+	arch_clean_invalidate_cache_range((addr_t)&s, sizeof(s));
 	writel(ept->bit, USB_ENDPTSETUPSTAT);
 
 	DBG("handle_setup type=0x%02x req=0x%02x val=%d idx=%d len=%d (%s)\n",