net: axi_ethernet: Add driver to u-boot v2
Subsystems (2)
PATCH v2 1/2 net: axi_ethernet: Add driver to u-boot v2
Add the first axi_ethernet driver for little-endian Microblaze.
---
v2:
- Fix return addreses
- Fix NULL pointer defer for priv structure
--- .../xilinx/microblaze-generic/microblaze-generic.c | 4 + drivers/net/Makefile | 1 + drivers/net/xilinx_axi_emac.c | 535 ++++++++++++++++++++ include/configs/microblaze-generic.h | 3 + 4 files changed, 543 insertions(+), 0 deletions(-) create mode 100644 drivers/net/xilinx_axi_emac.c
board/xilinx/microblaze-generic/microblaze-generic.c +4 -0
@@ -73,6 +73,10 @@ int board_eth_init(bd_t *bis) {int ret =0 ; +#ifdef CONFIG_XILINX_AXIEMAC + ret |=xilinx_axiemac_initialize (bis,XILINX_AXIEMAC_BASEADDR , +XILINX_AXIDMA_BASEADDR ); +#endif #ifdef CONFIG_XILINX_EMACLITE ret |=xilinx_emaclite_initialize (bis,XILINX_EMACLITE_BASEADDR );#endif
drivers/net/Makefile +1 -0
@@ -83,6 +83,7 @@ COBJS-$(CONFIG_TSEC_ENET) += tsec.o COBJS-$(CONFIG_TSI108_ETH) += tsi108_eth.o COBJS-$(CONFIG_ULI526X) += uli526x.o COBJS-$(CONFIG_VSC7385_ENET) += vsc7385.o +COBJS-$(CONFIG_XILINX_AXIEMAC) += xilinx_axi_emac.o COBJS-$(CONFIG_XILINX_EMACLITE) += xilinx_emaclite.o COBJS := $(sort $(COBJS-y))
drivers/net/xilinx_axi_emac.c new file +535 -0
535 lines not on this page · raw message
include/configs/microblaze-generic.h +3 -0
@@ -67,6 +67,9 @@#elif XILINX_LLTEMAC_BASEADDR # define CONFIG_XILINX_LL_TEMAC 1# define CONFIG_SYS_ENET +#elif defined(XILINX_AXIEMAC_BASEADDR ) +# define CONFIG_XILINX_AXIEMAC 1 +# define CONFIG_SYS_ENET #endif #undef ET_DEBUG
Signature · 1 line
1.5.5.6
PATCH 2/2 net: xilinx emaclite: Fix return values
Fix return values for initialize/init/recv/send functions
--- drivers/net/xilinx_emaclite.c | 14 +++++++------- 1 files changed, 7 insertions(+), 7 deletions(-)
drivers/net/xilinx_emaclite.c +7 -7
@@ -226,7 +226,7 @@ static int emaclite_send (struct eth_device *dev, volatile void *ptr, int len)out_be32 (emaclite.baseaddress +XEL_TSR_OFFSET +XEL_BUFFER_OFFSET ,0 );#endif -return 0 ; +return -1 ; }/* Determine the expected TX buffer address */
@@ -252,7 +252,7 @@ static int emaclite_send (struct eth_device *dev, volatile void *ptr, int len) reg |=XEL_TSR_XMIT_ACTIVE_MASK ; }out_be32 (baseaddress +XEL_TSR_OFFSET , reg); -return 1 ; +return 0 ; }#ifdef CONFIG_XILINX_EMACLITE_TX_PING_PONG /* Switch to second buffer */
@@ -273,11 +273,11 @@ static int emaclite_send (struct eth_device *dev, volatile void *ptr, int len) reg |= XEL_TSR_XMIT_ACTIVE_MASK; }out_be32 (baseaddress +XEL_TSR_OFFSET , reg); -return 1 ; +return 0 ; }#endif puts ("Error while sending frame\n" ); -return 0 ; +return -1 ; }static int emaclite_recv (struct eth_device *dev)
@@ -337,7 +337,7 @@ static int emaclite_recv(struct eth_device *dev)debug ("Packet receive from 0x%x, length %dB\n" , baseaddress, length);NetReceive ((uchar *) etherrxbuff, length); -return 1 ; +return length; }
@@ -347,7 +347,7 @@ int xilinx_emaclite_initialize (bd_t *bis, int base_addr) dev =malloc (sizeof (*dev));if (dev ==NULL ) -hang (); +return -1 ;memset (dev,0 ,sizeof (*dev));sprintf (dev->name,"Xilinx_Emaclite" );
@@ -361,5 +361,5 @@ int xilinx_emaclite_initialize (bd_t *bis, int base_addr)eth_register (dev); -return 0 ; +return 1 ; }
Signature · 1 line
1.5.5.6
Wolfgang Denk
AppliedPATCH 2/2 net: xilinx emaclite: Fix return values
Dear Michal Simek,
Quoted 6 lines · In message <[email protected]> you wrote:
Fix return values for initialize/init/recv/send functions
Signed-off-by Michal Simek <[email protected]>--- drivers/net/xilinx_emaclite.c | 14 +++++++------- 1 files changed, 7 insertions(+), 7 deletions(-)
Applied, thanks.
Best regards,
Wolfgang Denk
Signature · 4 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de Were there fewer fools, knaves would starve. - Anonymous
PATCH v2 1/2 net: axi_ethernet: Add driver to u-boot v2
In reply to Michal Simekdrivers/net/xilinx_axi_emac.c line 519
Quoted 12 lines · On Tuesday, March 08, 2011 09:25:52 Michal Simek wrote:
drivers/net/xilinx_axi_emac.c new file +12
-0+int xilinx_axiemac_initialize (bd_t *bis,int base_addr,int dma_addr) +{ +struct eth_device *dev; +struct axidma_priv *dma; + + dev =calloc (1 ,sizeof (struct eth_device )); +if (dev ==NULL ) +return -1 ; + + dev->priv =calloc (1 ,sizeof (struct axidma_priv )); +if (dev->priv ==NULL ) +return -1 ;
this 2nd error checker should call free(dev). the rest is copacetic. -mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20110309/9452524c/attachment.pgp