Skip to content
Snippets Groups Projects
Commit 5b47d407 authored by Prabhakar Kushwaha's avatar Prabhakar Kushwaha Committed by Tom Rini
Browse files

driver: net: Fix pointer conversion warnings for xilinx_zynqmp_ep


Fix below warnings happening for xilinx_zynqmp_ep_defconfig

drivers/net/zynq_gem.c: In function ‘zynq_gem_init’:
drivers/net/zynq_gem.c:330:7: warning: cast from pointer to integer
of different size [-Wpointer-to-int-cast]
      ((u32)(priv->rxbuffers) +
       ^
In file included from drivers/net/zynq_gem.c:19:0:
drivers/net/zynq_gem.c:336:10: warning: cast from pointer to integer
of different size [-Wpointer-to-int-cast]
   writel((u32)priv->rx_bd, &regs->rxqbase);
          ^
./arch/arm/include/asm/io.h:146:34: note: in definition of macro ‘writel’
 #define writel(v,c) ({ u32 __v = v; __iowmb(); __arch_putl(__v,c); __v; })
                                  ^
drivers/net/zynq_gem.c: In function ‘zynq_gem_send’:
drivers/net/zynq_gem.c:399:9: warning: cast from pointer to integer
of different size [-Wpointer-to-int-cast]
  writel((u32)priv->tx_bd, &regs->txqbase);
         ^
./arch/arm/include/asm/io.h:146:34: note: in definition of macro ‘writel’
 #define writel(v,c) ({ u32 __v = v; __iowmb(); __arch_putl(__v,c); __v; })
                                  ^
drivers/net/zynq_gem.c:404:22: warning: cast from pointer to integer
of different size [-Wpointer-to-int-cast]
  priv->tx_bd->addr = (u32)ptr;
                      ^
drivers/net/zynq_gem.c:409:9: warning: cast from pointer to integer
of different size [-Wpointer-to-int-cast]
  addr = (u32) ptr;
         ^
drivers/net/zynq_gem.c:414:9: warning: cast from pointer to integer
of different size [-Wpointer-to-int-cast]
  addr = (u32)priv->rxbuffers;
         ^
drivers/net/zynq_gem.c: In function ‘zynq_gem_recv’:
drivers/net/zynq_gem.c:454:31: warning: cast to pointer from integer
of different size [-Wint-to-pointer-cast]
   net_process_received_packet((u8 *)addr, frame_len);
                               ^
drivers/net/zynq_gem.c: In function ‘zynq_gem_initialize’:
drivers/net/zynq_gem.c:533:35: warning: cast from pointer to integer
of different size [-Wpointer-to-int-cast]
  priv->rx_bd = (struct emac_bd *)((u32)bd_space + BD_SEPRN_SPACE);
                                   ^
drivers/net/zynq_gem.c:533:16: warning: cast to pointer from integer
of different size [-Wint-to-pointer-cast]
  priv->rx_bd = (struct emac_bd *)((u32)bd_space + BD_SEPRN_SPACE);

Signed-off-by: default avatarPrabhakar Kushwaha <prabhakar@freescale.com>
parent b30dc579
No related branches found
No related tags found
No related merge requests found
...@@ -327,13 +327,13 @@ static int zynq_gem_init(struct eth_device *dev, bd_t * bis) ...@@ -327,13 +327,13 @@ static int zynq_gem_init(struct eth_device *dev, bd_t * bis)
for (i = 0; i < RX_BUF; i++) { for (i = 0; i < RX_BUF; i++) {
priv->rx_bd[i].status = 0xF0000000; priv->rx_bd[i].status = 0xF0000000;
priv->rx_bd[i].addr = priv->rx_bd[i].addr =
((u32)(priv->rxbuffers) + ((ulong)(priv->rxbuffers) +
(i * PKTSIZE_ALIGN)); (i * PKTSIZE_ALIGN));
} }
/* WRAP bit to last BD */ /* WRAP bit to last BD */
priv->rx_bd[--i].addr |= ZYNQ_GEM_RXBUF_WRAP_MASK; priv->rx_bd[--i].addr |= ZYNQ_GEM_RXBUF_WRAP_MASK;
/* Write RxBDs to IP */ /* Write RxBDs to IP */
writel((u32)priv->rx_bd, &regs->rxqbase); writel((ulong)priv->rx_bd, &regs->rxqbase);
/* Setup for DMA Configuration register */ /* Setup for DMA Configuration register */
writel(ZYNQ_GEM_DMACR_INIT, &regs->dmacr); writel(ZYNQ_GEM_DMACR_INIT, &regs->dmacr);
...@@ -396,22 +396,22 @@ static int zynq_gem_send(struct eth_device *dev, void *ptr, int len) ...@@ -396,22 +396,22 @@ static int zynq_gem_send(struct eth_device *dev, void *ptr, int len)
struct zynq_gem_regs *regs = (struct zynq_gem_regs *)dev->iobase; struct zynq_gem_regs *regs = (struct zynq_gem_regs *)dev->iobase;
/* setup BD */ /* setup BD */
writel((u32)priv->tx_bd, &regs->txqbase); writel((ulong)priv->tx_bd, &regs->txqbase);
/* Setup Tx BD */ /* Setup Tx BD */
memset(priv->tx_bd, 0, sizeof(struct emac_bd)); memset(priv->tx_bd, 0, sizeof(struct emac_bd));
priv->tx_bd->addr = (u32)ptr; priv->tx_bd->addr = (ulong)ptr;
priv->tx_bd->status = (len & ZYNQ_GEM_TXBUF_FRMLEN_MASK) | priv->tx_bd->status = (len & ZYNQ_GEM_TXBUF_FRMLEN_MASK) |
ZYNQ_GEM_TXBUF_LAST_MASK | ZYNQ_GEM_TXBUF_LAST_MASK |
ZYNQ_GEM_TXBUF_WRAP_MASK; ZYNQ_GEM_TXBUF_WRAP_MASK;
addr = (u32) ptr; addr = (ulong) ptr;
addr &= ~(ARCH_DMA_MINALIGN - 1); addr &= ~(ARCH_DMA_MINALIGN - 1);
size = roundup(len, ARCH_DMA_MINALIGN); size = roundup(len, ARCH_DMA_MINALIGN);
flush_dcache_range(addr, addr + size); flush_dcache_range(addr, addr + size);
addr = (u32)priv->rxbuffers; addr = (ulong)priv->rxbuffers;
addr &= ~(ARCH_DMA_MINALIGN - 1); addr &= ~(ARCH_DMA_MINALIGN - 1);
size = roundup((RX_BUF * PKTSIZE_ALIGN), ARCH_DMA_MINALIGN); size = roundup((RX_BUF * PKTSIZE_ALIGN), ARCH_DMA_MINALIGN);
flush_dcache_range(addr, addr + size); flush_dcache_range(addr, addr + size);
...@@ -451,7 +451,7 @@ static int zynq_gem_recv(struct eth_device *dev) ...@@ -451,7 +451,7 @@ static int zynq_gem_recv(struct eth_device *dev)
u32 addr = current_bd->addr & ZYNQ_GEM_RXBUF_ADD_MASK; u32 addr = current_bd->addr & ZYNQ_GEM_RXBUF_ADD_MASK;
addr &= ~(ARCH_DMA_MINALIGN - 1); addr &= ~(ARCH_DMA_MINALIGN - 1);
net_process_received_packet((u8 *)addr, frame_len); net_process_received_packet((u8 *)(ulong)addr, frame_len);
if (current_bd->status & ZYNQ_GEM_RXBUF_SOF_MASK) if (current_bd->status & ZYNQ_GEM_RXBUF_SOF_MASK)
priv->rx_first_buf = priv->rxbd_current; priv->rx_first_buf = priv->rxbd_current;
...@@ -530,7 +530,7 @@ int zynq_gem_initialize(bd_t *bis, phys_addr_t base_addr, ...@@ -530,7 +530,7 @@ int zynq_gem_initialize(bd_t *bis, phys_addr_t base_addr,
/* Initialize the bd spaces for tx and rx bd's */ /* Initialize the bd spaces for tx and rx bd's */
priv->tx_bd = (struct emac_bd *)bd_space; priv->tx_bd = (struct emac_bd *)bd_space;
priv->rx_bd = (struct emac_bd *)((u32)bd_space + BD_SEPRN_SPACE); priv->rx_bd = (struct emac_bd *)((ulong)bd_space + BD_SEPRN_SPACE);
priv->phyaddr = phy_addr; priv->phyaddr = phy_addr;
priv->emio = emio; priv->emio = emio;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment