[U-Boot] [PATCH] MIPS: Fix compile warning in au1x00_eth.c

Shinya Kuribayashi shinya.kuribayashi at necel.com
Fri Jan 30 01:27:23 CET 2009


Stefan Roese wrote:
>> skuribay at ubuntu:u-boot.git$ mips-linux-gnu-gcc --version
>> mips-linux-gnu-gcc (Sourcery G++ Lite 4.2-177) 4.2.3
>> Copyright (C) 2007 Free Software Foundation, Inc.
>> This is free software; see the source for copying conditions.  There is NO
>> warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
>>
>> skuribay at ubuntu:u-boot.git$
>> skuribay at ubuntu:u-boot.git$ CROSS_COMPILE=mips-linux-gnu- ./MAKEALL
>> dbau1000 Configuring for dbau1x00 board...
>> au1x00_eth.c: In function 'au1x00_send':
>> au1x00_eth.c:158: warning: passing argument 1 of 'virt_to_phys' discards
>> qualifiers from pointer target type au1x00_eth.c: In function
>> 'au1x00_recv':
>> au1x00_eth.c:211: warning: passing argument 1 of 'virt_to_phys' discards
>> qualifiers from pointer target type au1x00_eth.c: In function
>> 'au1x00_init':
>> au1x00_eth.c:252: warning: passing argument 1 of 'virt_to_phys' discards
>> qualifiers from pointer target type au1x00_eth.c: In function
>> 'au1x00_recv':
>> au1x00_eth.c:211: warning: passing argument 1 of 'virt_to_phys' discards
>> qualifiers from pointer target type au1x00_eth.c: In function
>> 'au1x00_init':
>> au1x00_eth.c:252: warning: passing argument 1 of 'virt_to_phys' discards
>> qualifiers from pointer target type au1x00_eth.c: In function
>> 'au1x00_send':
>> au1x00_eth.c:158: warning: passing argument 1 of 'virt_to_phys' discards
>> qualifiers from pointer target type text    data     bss     dec     hex
>> filename
>>  118780    5264   20648  144692   23534 ./u-boot
> 
> Those errors occur twice. Seems that you are compiling this file twice.
> Any idea why?

Probably it's due to the GCC 4.2.x minor version difference.

Googling[1][2] and playing for a while, I finally managed to quiet the
GCC with the following patch.

diff --git a/cpu/mips/au1x00_eth.c b/cpu/mips/au1x00_eth.c
index 6272a3a..c2c76ac 100644
--- a/cpu/mips/au1x00_eth.c
+++ b/cpu/mips/au1x00_eth.c
@@ -155,7 +155,7 @@ static int au1x00_send(struct eth_device* dev, volatile void *packet, int length
 
 	/* tx fifo should always be idle */
 	fifo_tx[next_tx].len = length;
-	fifo_tx[next_tx].addr = (virt_to_phys(packet))|TX_DMA_ENABLE;
+	fifo_tx[next_tx].addr = (virt_to_phys((void *)(unsigned long)packet))|TX_DMA_ENABLE;
 	au_sync();
 
 	udelay(1);
@@ -208,7 +208,7 @@ static int au1x00_recv(struct eth_device* dev){
 			NetReceive(NetRxPackets[next_rx], length - 4);
 		}
 
-		fifo_rx[next_rx].addr = (virt_to_phys(NetRxPackets[next_rx]))|RX_DMA_ENABLE;
+		fifo_rx[next_rx].addr = (virt_to_phys((void *)(unsigned long)NetRxPackets[next_rx]))|RX_DMA_ENABLE;
 
 		next_rx++;
 		if(next_rx>=NO_OF_FIFOS){
@@ -249,7 +249,7 @@ static int au1x00_init(struct eth_device* dev, bd_t * bd){
 	for(i=0;i<NO_OF_FIFOS;i++){
 		fifo_tx[i].len = 0;
 		fifo_tx[i].addr = virt_to_phys(&txbuf[0]);
-		fifo_rx[i].addr = (virt_to_phys(NetRxPackets[i]))|RX_DMA_ENABLE;
+		fifo_rx[i].addr = (virt_to_phys((void *)(unsigned long)NetRxPackets[i]))|RX_DMA_ENABLE;
 	}
 
 	/* Put mac addr in little endian */


Well, what will we do?  Are there any othrer desirable fixes?

[1] http://lists.denx.de/pipermail/u-boot/2008-December/044960.html
    [PATCH 01/11] powerpc: fix io.h build warning with CONFIG_PHYS_64BIT

[2] http://lkml.org/lkml/2009/1/27/67
    Interestingly, this only happens with gcc-4.2; gcc <= 4.1 and gcc-4.3 are OK.

-- 
Shinya Kuribayashi
NEC Electronics


More information about the U-Boot mailing list