<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">From 9b899afd231b7dde6084092cf46dd15c05ed8a5c Mon Sep 17 00:00:00 2001
From: Phil Elwell &lt;phil@raspberrypi.com&gt;
Date: Tue, 27 Oct 2020 12:11:56 +0000
Subject: [PATCH] dwc_otg: Fix more build warnings

Signed-off-by: Phil Elwell &lt;phil@raspberrypi.com&gt;
---
 drivers/usb/host/dwc_otg/dwc_otg_fiq_fsm.c  | 10 +++++----
 drivers/usb/host/dwc_otg/dwc_otg_hcd.c      | 23 ++++++++++++++-------
 drivers/usb/host/dwc_otg/dwc_otg_hcd_ddma.c |  3 ++-
 drivers/usb/host/dwc_otg/dwc_otg_hcd_intr.c |  8 +++----
 4 files changed, 27 insertions(+), 17 deletions(-)

--- a/drivers/usb/host/dwc_otg/dwc_otg_fiq_fsm.c
+++ b/drivers/usb/host/dwc_otg/dwc_otg_fiq_fsm.c
@@ -240,7 +240,8 @@ static int notrace fiq_increment_dma_buf
 	hcdma_data_t hcdma;
 	int i = st-&gt;channel[n].dma_info.index;
 	int len;
-	struct fiq_dma_blob *blob = (struct fiq_dma_blob *) st-&gt;dma_base;
+	struct fiq_dma_blob *blob =
+		(struct fiq_dma_blob *)(uintptr_t)st-&gt;dma_base;
 
 	len = fiq_get_xfer_len(st, n);
 	fiq_print(FIQDBG_INT, st, "LEN: %03d", len);
@@ -249,7 +250,7 @@ static int notrace fiq_increment_dma_buf
 	if (i &gt; 6)
 		BUG();
 
-	hcdma.d32 = (dma_addr_t) &amp;blob-&gt;channel[n].index[i].buf[0];
+	hcdma.d32 = (u32)(uintptr_t)&amp;blob-&gt;channel[n].index[i].buf[0];
 	FIQ_WRITE(st-&gt;dwc_regs_base + HC_START + (HC_OFFSET * n) + HC_DMA, hcdma.d32);
 	st-&gt;channel[n].dma_info.index = i;
 	return 0;
@@ -289,7 +290,8 @@ static int notrace fiq_iso_out_advance(s
 	hcsplt_data_t hcsplt;
 	hctsiz_data_t hctsiz;
 	hcdma_data_t hcdma;
-	struct fiq_dma_blob *blob = (struct fiq_dma_blob *) st-&gt;dma_base;
+	struct fiq_dma_blob *blob =
+		(struct fiq_dma_blob *)(uintptr_t)st-&gt;dma_base;
 	int last = 0;
 	int i = st-&gt;channel[n].dma_info.index;
 
@@ -301,7 +303,7 @@ static int notrace fiq_iso_out_advance(s
 		last = 1;
 
 	/* New DMA address - address of bounce buffer referred to in index */
-	hcdma.d32 = (dma_addr_t) blob-&gt;channel[n].index[i].buf;
+	hcdma.d32 = (u32)(uintptr_t)blob-&gt;channel[n].index[i].buf;
 	//hcdma.d32 = FIQ_READ(st-&gt;dwc_regs_base + HC_START + (HC_OFFSET * n) + HC_DMA);
 	//hcdma.d32 += st-&gt;channel[n].dma_info.slot_len[i];
 	fiq_print(FIQDBG_INT, st, "LAST: %01d ", last);
--- a/drivers/usb/host/dwc_otg/dwc_otg_hcd.c
+++ b/drivers/usb/host/dwc_otg/dwc_otg_hcd.c
@@ -1268,7 +1268,8 @@ static void assign_and_init_hc(dwc_otg_h
 	hc-&gt;multi_count = 1;
 
 	if (hcd-&gt;core_if-&gt;dma_enable) {
-		hc-&gt;xfer_buff = (uint8_t *) urb-&gt;dma + urb-&gt;actual_length;
+		hc-&gt;xfer_buff =
+		    (uint8_t *)(uintptr_t)urb-&gt;dma + urb-&gt;actual_length;
 
 		/* For non-dword aligned case */
 		if (((unsigned long)hc-&gt;xfer_buff &amp; 0x3)
@@ -1312,7 +1313,8 @@ static void assign_and_init_hc(dwc_otg_h
 			hc-&gt;ep_is_in = 0;
 			hc-&gt;data_pid_start = DWC_OTG_HC_PID_SETUP;
 			if (hcd-&gt;core_if-&gt;dma_enable) {
-				hc-&gt;xfer_buff = (uint8_t *) urb-&gt;setup_dma;
+				hc-&gt;xfer_buff =
+					(uint8_t *)(uintptr_t)urb-&gt;setup_dma;
 			} else {
 				hc-&gt;xfer_buff = (uint8_t *) urb-&gt;setup_packet;
 			}
@@ -1360,7 +1362,8 @@ static void assign_and_init_hc(dwc_otg_h
 
 			hc-&gt;xfer_len = 0;
 			if (hcd-&gt;core_if-&gt;dma_enable) {
-				hc-&gt;xfer_buff = (uint8_t *) hcd-&gt;status_buf_dma;
+				hc-&gt;xfer_buff = (uint8_t *)
+					(uintptr_t)hcd-&gt;status_buf_dma;
 			} else {
 				hc-&gt;xfer_buff = (uint8_t *) hcd-&gt;status_buf;
 			}
@@ -1388,7 +1391,7 @@ static void assign_and_init_hc(dwc_otg_h
 			frame_desc-&gt;status = 0;
 
 			if (hcd-&gt;core_if-&gt;dma_enable) {
-				hc-&gt;xfer_buff = (uint8_t *) urb-&gt;dma;
+				hc-&gt;xfer_buff = (uint8_t *)(uintptr_t)urb-&gt;dma;
 			} else {
 				hc-&gt;xfer_buff = (uint8_t *) urb-&gt;buf;
 			}
@@ -1569,8 +1572,10 @@ int fiq_fsm_setup_periodic_dma(dwc_otg_h
 		 * Pointer arithmetic on hcd-&gt;fiq_state-&gt;dma_base (a dma_addr_t)
 		 * to point it to the correct offset in the allocated buffers.
 		 */
-		blob = (struct fiq_dma_blob *) hcd-&gt;fiq_state-&gt;dma_base;
-		st-&gt;hcdma_copy.d32 = (dma_addr_t) blob-&gt;channel[hc-&gt;hc_num].index[0].buf;
+		blob = (struct fiq_dma_blob *)
+			(uintptr_t)hcd-&gt;fiq_state-&gt;dma_base;
+		st-&gt;hcdma_copy.d32 =(u32)(uintptr_t)
+			blob-&gt;channel[hc-&gt;hc_num].index[0].buf;
 
 		/* Calculate the max number of CSPLITS such that the FIQ can time out
 		 * a transaction if it fails.
@@ -1625,8 +1630,10 @@ int fiq_fsm_setup_periodic_dma(dwc_otg_h
 			 * dma_addr_t) to point it to the correct offset in the
 			 * allocated buffers.
 			 */
-			blob = (struct fiq_dma_blob *) hcd-&gt;fiq_state-&gt;dma_base;
-			st-&gt;hcdma_copy.d32 = (dma_addr_t) blob-&gt;channel[hc-&gt;hc_num].index[0].buf;
+			blob = (struct fiq_dma_blob *)
+				(uintptr_t)hcd-&gt;fiq_state-&gt;dma_base;
+			st-&gt;hcdma_copy.d32 = (u32)(uintptr_t)
+				blob-&gt;channel[hc-&gt;hc_num].index[0].buf;
 
 			/* fixup xfersize to the actual packet size */
 			st-&gt;hctsiz_copy.b.pid = 0;
--- a/drivers/usb/host/dwc_otg/dwc_otg_hcd_ddma.c
+++ b/drivers/usb/host/dwc_otg/dwc_otg_hcd_ddma.c
@@ -620,7 +620,8 @@ static void init_non_isoc_dma_desc(dwc_o
 
 		if (n_desc) {
 			/* SG request - more than 1 QTDs */
-			hc-&gt;xfer_buff = (uint8_t *)qtd-&gt;urb-&gt;dma + qtd-&gt;urb-&gt;actual_length;
+			hc-&gt;xfer_buff = (uint8_t *)(uintptr_t)qtd-&gt;urb-&gt;dma +
+					qtd-&gt;urb-&gt;actual_length;
 			hc-&gt;xfer_len = qtd-&gt;urb-&gt;length - qtd-&gt;urb-&gt;actual_length;
 		}
 
--- a/drivers/usb/host/dwc_otg/dwc_otg_hcd_intr.c
+++ b/drivers/usb/host/dwc_otg/dwc_otg_hcd_intr.c
@@ -1857,10 +1857,10 @@ static int32_t handle_hc_ahberr_intr(dwc
 	DWC_ERROR("  Max packet size: %d\n",
 		  dwc_otg_hcd_get_mps(&amp;urb-&gt;pipe_info));
 	DWC_ERROR("  Data buffer length: %d\n", urb-&gt;length);
-	DWC_ERROR("  Transfer buffer: %p, Transfer DMA: %p\n",
-		  urb-&gt;buf, (void *)urb-&gt;dma);
-	DWC_ERROR("  Setup buffer: %p, Setup DMA: %p\n",
-		  urb-&gt;setup_packet, (void *)urb-&gt;setup_dma);
+	DWC_ERROR("  Transfer buffer: %p, Transfer DMA: %pad\n",
+		  urb-&gt;buf, &amp;urb-&gt;dma);
+	DWC_ERROR("  Setup buffer: %p, Setup DMA: %pad\n",
+		  urb-&gt;setup_packet, &amp;urb-&gt;setup_dma);
 	DWC_ERROR("  Interval: %d\n", urb-&gt;interval);
 
 	/* Core haltes the channel for Descriptor DMA mode */
</pre></body></html>