diff mbox series

[v2] eth: mtk-eth: aarch64: fix build warnings on ethernet-driver

Message ID 20200128123555.12729-1-frank-w@public-files.de
State New
Headers show
Series [v2] eth: mtk-eth: aarch64: fix build warnings on ethernet-driver | expand

Commit Message

Frank Wunderlich Jan. 28, 2020, 12:35 p.m. UTC
building mtk ethernet driver for aarch64 (mt7622) results in warnings

drivers/net/mtk_eth.c: In function 'mtk_eth_fifo_init':
drivers/net/mtk_eth.c:856:21: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast]
flush_dcache_range((u32)pkt_base, (u32)(pkt_base + TOTAL_PKT_BUF_SIZE));
^
drivers/net/mtk_eth.c:856:36: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast]
^
drivers/net/mtk_eth.c: In function 'mtk_eth_send':
drivers/net/mtk_eth.c:968:21: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast]
flush_dcache_range((u32)pkt_base, (u32)pkt_base +
drivers/net/mtk_eth.c:968:36: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast]
drivers/net/mtk_eth.c: In function 'mtk_eth_recv':
drivers/net/mtk_eth.c:994:26: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast]
invalidate_dcache_range((u32)pkt_base, (u32)pkt_base +
^
drivers/net/mtk_eth.c:994:41: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast]
^
drivers/net/mtk_eth.c: In function 'mtk_eth_probe':
drivers/net/mtk_eth.c:1026:18: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
priv->fe_base = (void *)iobase;
^
drivers/net/mtk_eth.c:1029:20: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
priv->gmac_base = (void *)(iobase + GMAC_BASE);

Fixes: 23f17164d9 ("ethernet: MediaTek: add ethernet driver for MediaTek ARM-based SoCs")

Signed-off-by: Frank Wunderlich <frank-w at public-files.de>
---
changes since v1: fixing missing unsigned declaration
---
 drivers/net/mtk_eth.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

Comments

Tom Rini Jan. 30, 2020, 6:29 p.m. UTC | #1
On Tue, Jan 28, 2020 at 01:35:55PM +0100, Frank Wunderlich wrote:

> building mtk ethernet driver for aarch64 (mt7622) results in warnings
> 
> drivers/net/mtk_eth.c: In function 'mtk_eth_fifo_init':
> drivers/net/mtk_eth.c:856:21: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast]
> flush_dcache_range((u32)pkt_base, (u32)(pkt_base + TOTAL_PKT_BUF_SIZE));
> ^
> drivers/net/mtk_eth.c:856:36: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast]
> ^
> drivers/net/mtk_eth.c: In function 'mtk_eth_send':
> drivers/net/mtk_eth.c:968:21: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast]
> flush_dcache_range((u32)pkt_base, (u32)pkt_base +
> drivers/net/mtk_eth.c:968:36: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast]
> drivers/net/mtk_eth.c: In function 'mtk_eth_recv':
> drivers/net/mtk_eth.c:994:26: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast]
> invalidate_dcache_range((u32)pkt_base, (u32)pkt_base +
> ^
> drivers/net/mtk_eth.c:994:41: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast]
> ^
> drivers/net/mtk_eth.c: In function 'mtk_eth_probe':
> drivers/net/mtk_eth.c:1026:18: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
> priv->fe_base = (void *)iobase;
> ^
> drivers/net/mtk_eth.c:1029:20: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
> priv->gmac_base = (void *)(iobase + GMAC_BASE);
> 
> Fixes: 23f17164d9 ("ethernet: MediaTek: add ethernet driver for MediaTek ARM-based SoCs")
> 
> Signed-off-by: Frank Wunderlich <frank-w at public-files.de>

This is still a problem with the rest of the ethernet series applied,
please re-test and resubmit, thanks.
Frank Wunderlich Jan. 31, 2020, 9:07 a.m. UTC | #2
arg, seems i had used wrong config...sorry

i guess ulong should be the right one for both platforms...will do some more tests and post v3

regards Frank


> Gesendet: Donnerstag, 30. Januar 2020 um 19:29 Uhr
> Von: "Tom Rini" <trini at konsulko.com>

> This is still a problem with the rest of the ethernet series applied,
> please re-test and resubmit, thanks.
diff mbox series

Patch

diff --git a/drivers/net/mtk_eth.c b/drivers/net/mtk_eth.c
index 6cffc3f32a..82e9d0040c 100644
--- a/drivers/net/mtk_eth.c
+++ b/drivers/net/mtk_eth.c
@@ -853,7 +853,8 @@  static void mtk_eth_fifo_init(struct mtk_eth_priv *priv)
 	memset(priv->rx_ring_noc, 0, NUM_RX_DESC * sizeof(struct pdma_rxdesc));
 	memset(priv->pkt_pool, 0, TOTAL_PKT_BUF_SIZE);
 
-	flush_dcache_range((u32)pkt_base, (u32)(pkt_base + TOTAL_PKT_BUF_SIZE));
+	flush_dcache_range((unsigned int)pkt_base,
+			   (unsigned int)(pkt_base + TOTAL_PKT_BUF_SIZE));
 
 	priv->rx_dma_owner_idx0 = 0;
 	priv->tx_cpu_owner_idx0 = 0;
@@ -965,7 +966,7 @@  static int mtk_eth_send(struct udevice *dev, void *packet, int length)
 
 	pkt_base = (void *)phys_to_virt(priv->tx_ring_noc[idx].txd_info1.SDP0);
 	memcpy(pkt_base, packet, length);
-	flush_dcache_range((u32)pkt_base, (u32)pkt_base +
+	flush_dcache_range((unsigned int)pkt_base, (unsigned int)pkt_base +
 			   roundup(length, ARCH_DMA_MINALIGN));
 
 	priv->tx_ring_noc[idx].txd_info2.SDL0 = length;
@@ -991,8 +992,9 @@  static int mtk_eth_recv(struct udevice *dev, int flags, uchar **packetp)
 
 	length = priv->rx_ring_noc[idx].rxd_info2.PLEN0;
 	pkt_base = (void *)phys_to_virt(priv->rx_ring_noc[idx].rxd_info1.PDP0);
-	invalidate_dcache_range((u32)pkt_base, (u32)pkt_base +
-				roundup(length, ARCH_DMA_MINALIGN));
+	invalidate_dcache_range((unsigned int)pkt_base,
+				(unsigned int)(pkt_base +
+				roundup(length, ARCH_DMA_MINALIGN)));
 
 	if (packetp)
 		*packetp = pkt_base;
@@ -1019,7 +1021,7 @@  static int mtk_eth_probe(struct udevice *dev)
 {
 	struct eth_pdata *pdata = dev_get_platdata(dev);
 	struct mtk_eth_priv *priv = dev_get_priv(dev);
-	u32 iobase = pdata->iobase;
+	unsigned int iobase = pdata->iobase;
 	int ret;
 
 	/* Frame Engine Register Base */