Skip to contentSkip to conversation

net: ll_temac: Add LL TEMAC driver to u-boot

PATCH Superseded Michal Simek 2 participants 3 messages Aug 29, 2011 – Aug 31, 2011

Subsystems (2)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net: ll_temac: Add LL TEMAC driver to u-boot

LL Temac driver can be used by microblaze, xilinx ppc405/440 in sdma and fifo mode. DCR or XPS bus can be used.

The driver uses and requires PHYLIB.

---
 drivers/net/Makefile          |    1 +
 drivers/net/xilinx_ll_temac.c |  686 +++++++++++++++++++++++++++++++++++++++++
 include/netdev.h              |    1 +
 3 files changed, 688 insertions(+), 0 deletions(-)
 create mode 100644 drivers/net/xilinx_ll_temac.c
drivers/net/Makefile +1 -0
index 819b197..4541eaf 100644
@@ -84,6 +84,7 @@ COBJS-$(CONFIG_TSI108_ETH) += tsi108_eth.o
 COBJS-$(CONFIG_ULI526X) += uli526x.o
 COBJS-$(CONFIG_VSC7385_ENET) += vsc7385.o
 COBJS-$(CONFIG_XILINX_EMACLITE) += xilinx_emaclite.o
+COBJS-$(CONFIG_XILINX_LL_TEMAC) += xilinx_ll_temac.o
 
 COBJS	:= $(sort $(COBJS-y))
 SRCS	:= $(COBJS:.o=.c)
drivers/net/xilinx_ll_temac.c new file +686 -0

686 lines not on this page · raw message

include/netdev.h +1 -0
index 5abafbc..a215e0f 100644
@@ -91,6 +91,7 @@ int tsi108_eth_initialize(bd_t *bis);
 int uec_standard_init(bd_t *bis);
 int uli526x_initialize(bd_t *bis);
 int xilinx_emaclite_initialize (bd_t *bis, int base_addr, int txpp, int rxpp);
+int xilinx_ll_temac_initialize(bd_t *bis, int base_addr);
 int sh_eth_initialize(bd_t *bis);
 int dm9000_initialize(bd_t *bis);
 int fecmxc_initialize(bd_t *bis);
Signature · 1 line
1.5.5.6
#1 lore raw

PATCH 1/1 net: ll_temac: Add LL TEMAC driver to u-boot

drivers/net/xilinx_ll_temac.c

Quoted 4 lines · On Monday, August 29, 2011 07:34:12 Michal Simek wrote:
drivers/net/xilinx_ll_temac.c new file +1 -0
 
+#include <asm/processor.h>

what do you need from this header ?

drivers/net/xilinx_ll_temac.c line 170

Quoted 4 lines
drivers/net/xilinx_ll_temac.c new file +4 -0
+#ifdef SDMA_MODE
+static unsigned char tx_buffer[PKTSIZE_ALIGN ] __attribute((aligned(32)));
+#endif
+static unsigned char rx_buffer[PKTSIZE_ALIGN ] __attribute((aligned(32)));

no space before that "]"

drivers/net/xilinx_ll_temac.c line 190

Quoted 9 lines
drivers/net/xilinx_ll_temac.c new file +9 -0
+static inline void temac_out_be32(u32 addr, u32 offset, u32 val)
+{
+	out_be32((u32 *)(addr + offset), val);
+}
+
+static inline u32 temac_in_be32(u32 addr, u32 offset)
+{
+	return in_be32((u32 *)(addr + offset));
+}

write a C struct describing the register layout, then your code can simply do:

	in_be32(&regs->lsw0)

and you don't need these two helpers

drivers/net/xilinx_ll_temac.c line 514

Quoted 13 lines
drivers/net/xilinx_ll_temac.c new file +13 -0
+static int xps_ll_temac_addr_setup(struct eth_device *dev)
+{
+	int val;
+
+	/* set up unicast MAC address filter */
+	val = ((dev->enetaddr[3] << 24) | (dev->enetaddr[2] << 16) |
+		(dev->enetaddr[1] << 8) | (dev->enetaddr[0]));
+	xps_ll_temac_indirect_set(dev, 0, UAW0, val);
+	val = (dev->enetaddr[5] << 8) | dev->enetaddr[4] ;
+	xps_ll_temac_indirect_set(dev, 0, UAW1, val);
+
+	return 0;
+}

this should be set to dev->write_hwaddr in the initialize func

Quoted 1 line

+int xilinx_ll_temac_initialize(bd_t *bis, int base_addr)

the register base address really should be "unsigned long" and not "int" -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/20110829/063fce3d/attachment.pgp

#2 lore raw

PATCH 1/1 net: ll_temac: Add LL TEMAC driver to u-boot

Quoted 7 lines · Mike Frysinger

drivers/net/xilinx_ll_temac.c

Quoted 4 lines · On Monday, August 29, 2011 07:34:12 Michal Simek wrote:
drivers/net/xilinx_ll_temac.c new file +1 -0
 
+#include <asm/processor.h>

what do you need from this header ?

dcr for ppc.

Quoted 7 lines

drivers/net/xilinx_ll_temac.c line 170

Quoted 5 lines
drivers/net/xilinx_ll_temac.c new file +4 -0
+#ifdef SDMA_MODE
+static unsigned char tx_buffer[PKTSIZE_ALIGN ] __attribute((aligned(32)));
+#endif
+static unsigned char rx_buffer[PKTSIZE_ALIGN ] __attribute((aligned(32)));

no space before that "]"

done.

Quoted 12 lines

drivers/net/xilinx_ll_temac.c line 190

Quoted 10 lines
drivers/net/xilinx_ll_temac.c new file +9 -0
+static inline void temac_out_be32(u32 addr, u32 offset, u32 val)
+{
+	out_be32((u32 *)(addr + offset), val);
+}
+
+static inline u32 temac_in_be32(u32 addr, u32 offset)
+{
+	return in_be32((u32 *)(addr + offset));
+}

write a C struct describing the register layout, then your code can simply do:

Quoted 2 lines
	in_be32(&regs->lsw0)

and you don't need these two helpers

Agree that there is elegant way to fix it. Look at my v2.

Quoted 16 lines
Quoted 4 lines
drivers/net/xilinx_ll_temac.c new file +3 -0
+static int xps_ll_temac_addr_setup(struct eth_device *dev)
+{
+	int val;

drivers/net/xilinx_ll_temac.c line 514

Quoted 10 lines
drivers/net/xilinx_ll_temac.c new file +10 -0
+
+	/* set up unicast MAC address filter */
+	val = ((dev->enetaddr[3] << 24) | (dev->enetaddr[2] << 16) |
+		(dev->enetaddr[1] << 8) | (dev->enetaddr[0]));
+	xps_ll_temac_indirect_set(dev, 0, UAW0, val);
+	val = (dev->enetaddr[5] << 8) | dev->enetaddr[4] ;
+	xps_ll_temac_indirect_set(dev, 0, UAW1, val);
+
+	return 0;
+}

this should be set to dev->write_hwaddr in the initialize func

done. Have to look at axi_ethernet version if possible to use it.

Quoted 4 lines
Quoted 2 lines

+int xilinx_ll_temac_initialize(bd_t *bis, int base_addr)

the register base address really should be "unsigned long" and not "int"

Agree. Probably good to fix all network devices too.

Have sent v2 for ll_temac and the first version for axi_emac.

Thanks,
Michal

P.S.: Forget to send it yesterday.

Signature · 4 lines
Michal Simek, Ing. (M.Eng)
w: www.monstr.eu p: +42-0-721842854
Maintainer of Linux kernel 2.6 Microblaze Linux - http://www.monstr.eu/fdt/
Microblaze U-BOOT custodian