Skip to contentSkip to conversation

LL TEMAC V8 refactored

U-Boot New Stephan Linz 3 participants 18 messages Jan 15, 2012 – Jan 17, 2012

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

Back to the discussion from the last three months I have refactored the LL TEMAC driver again. The version V8 is ready to next review and testing. I myself have tested it successfully on an ML605 (TEMAC hard core) and on a SP3ADSP1800 (TEMAC soft core). Thanks to Marek, Wolfgang, Andy and Michal to review V4..7. Special thanks to Ricardo. He has tested the driver on a Xilinx Virtex5 FX (PPC440) platform.

To use the driver on Microblaze, you will need all additional platform patches by Michal Simek and me. All related patches are bundled on patchwork:
- http://patchwork.ozlabs.org/bundle/rexut/net-ll_temac/

@Michal: Please merge the patches into the custodian git tree for final testing.

@Ricardo: Please test the new V8 patch on your PPC440 platform again and post the patches for xilinx/ppc440-generic if you want.

Signature · 8 lines
Best regards,
Stephan Linz
______________________________________________________________________________
MB-Ref: http://www.li-pro.de/xilinx_mb:mbref:start
OpenDCC: http://www.li-pro.net/opendcc.phtml
PC/M: http://www.li-pro.net/pcm.phtml
Sourceforge: http://sourceforge.net/users/slz
Gitorious: https://gitorious.org/~slz
#1 lore raw

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

Xilinx LocalLink Tri-Mode Ether MAC driver can be
used by Xilinx Microblaze or Xilinx ppc405/440 in
SDMA and FIFO mode. DCR or XPS bus can be used.

The driver uses and requires MII and PHYLIB.

CP: 4 warnings: 'Use of volatile is usually wrong' I won't fix this, because it depends on the network driver subsystem.

---
v8: Remove deprecated interface: miiphy_register()
Implement MDIO bus/phy access code as independent part of driver. Make the direct PHY access code accessible for upper layer like the MDIO command.
Define proper device names for TEMAC and MII interfaces. Support of TEMAC0 and TEMAC1 at same time is prepared and should work.

v7: Call udelay() in polling loops to avoid unintended watchdog reset
Define well known timeout values in usec
Handle timeouts as error situations
Reduce duplicated code in SDMA operations
Add a real and plausible PHY detect mask
Remove ETH_HALTING code exclusion
Code cleanup as recommended
Fix typos

v6: Code cleanup with ./tools/checkpatch.pl

v5: Remove more endless loops
Remove useless parenthesis in pointer operations Move phyaddr predefinition on top
Remove supernumerary newlines
Remove parenthesis around numbers (globally)

v4: Separate fifo and sdma code from driver core
Split sdma code into separate DCR and XPS bus access code Add extensive register struct definitions and enumerations Add new callbacks into fifo an sdma code
Prepare CDMAC buffer handling to be unique for every instance Separate Xilinx specific indirect DCR access, so we can move to arch Remove useless 'emac' parameter from indirect access helper functions Correct MDIO clock setup.
Remove endless loops
Common code beautifying

v3: Use helper functions for fifo mode
Use helper functions for indirect accesses
Code cleanup
Add comments for MAGIC values
Simplify code in fifo mode

v2: Remove helper function for access to temac
Remove SDMA/FIFO/DCR macros and configure it in board Setup mac by write_hwaddr

---
 drivers/net/Makefile               |    2 +
 drivers/net/xilinx_ll_temac.c      |  452 ++++++++++++++++++++++++++++++++++++
 drivers/net/xilinx_ll_temac_fifo.c |  105 +++++++++
 drivers/net/xilinx_ll_temac_mdio.c |  164 +++++++++++++
 drivers/net/xilinx_ll_temac_sdma.c |  324 ++++++++++++++++++++++++++
 include/netdev.h                   |    1 +
 include/xilinx_ll_temac.h          |  381 ++++++++++++++++++++++++++++++
 include/xilinx_ll_temac_fifo.h     |  119 ++++++++++
 include/xilinx_ll_temac_mdio.h     |   54 +++++
 include/xilinx_ll_temac_sdma.h     |  289 +++++++++++++++++++++++
 10 files changed, 1891 insertions(+), 0 deletions(-)
 create mode 100644 drivers/net/xilinx_ll_temac.c
 create mode 100644 drivers/net/xilinx_ll_temac_fifo.c
 create mode 100644 drivers/net/xilinx_ll_temac_mdio.c
 create mode 100644 drivers/net/xilinx_ll_temac_sdma.c
 create mode 100644 include/xilinx_ll_temac.h
 create mode 100644 include/xilinx_ll_temac_fifo.h
 create mode 100644 include/xilinx_ll_temac_mdio.h
 create mode 100644 include/xilinx_ll_temac_sdma.h
drivers/net/Makefile +2 -0
index f4f7ea3..430f90c 100644
@@ -77,6 +77,8 @@ 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-$(CONFIG_XILINX_LL_TEMAC) += xilinx_ll_temac.o xilinx_ll_temac_mdio.o \
+		xilinx_ll_temac_fifo.o xilinx_ll_temac_sdma.o
 
 COBJS	:= $(sort $(COBJS-y))
 SRCS	:= $(COBJS:.o=.c)
drivers/net/xilinx_ll_temac.c new file +452 -0

452 lines not on this page · raw message

drivers/net/xilinx_ll_temac_fifo.c new file +105 -0

105 lines not on this page · raw message

drivers/net/xilinx_ll_temac_mdio.c new file +164 -0

164 lines not on this page · raw message

drivers/net/xilinx_ll_temac_sdma.c new file +324 -0

324 lines not on this page · raw message

include/netdev.h +1 -0
index b0c21d5..bf95f88 100644
@@ -102,6 +102,7 @@ int xilinx_axiemac_initialize(bd_t *bis, unsigned long base_addr,
 							unsigned long dma_addr);
 int xilinx_emaclite_initialize(bd_t *bis, unsigned long base_addr,
 							int txpp, int rxpp);
+int xilinx_ll_temac_standard_init(bd_t *bis);
 
 /* Boards with PCI network controllers can call this from their board_eth_init()
  * function to initialize whatever's on board.
include/xilinx_ll_temac.h new file +381 -0

381 lines not on this page · raw message

include/xilinx_ll_temac_fifo.h new file +119 -0

119 lines not on this page · raw message

include/xilinx_ll_temac_mdio.h new file +54 -0

54 lines not on this page · raw message

include/xilinx_ll_temac_sdma.h new file +289 -0

289 lines not on this page · raw message

Signature · 1 line
1.7.0.4
#2 lore raw

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

Quoted 5 lines · On Sunday 15 January 2012 10:46:02 Stephan Linz wrote:
(quoted diff) +2 -0
+/* Data buffer for LL TEMAC Rx and Tx direction */
+static unsigned char rx_buffer[PKTSIZE_ALIGN]

__attribute((aligned(DMAALIGN)));
+static unsigned char tx_buffer[PKTSIZE_ALIGN]
__attribute((aligned(DMAALIGN)));

come code already declares PktBuf ... can't you use that ?

Quoted 1 line

+static struct ll_temac_info ll_temac_info[] = {

this looks like a struct that should get allocated on the fly based on arguments given to the driver's registration func

drivers/net/xilinx_ll_temac.c line 392

Quoted 7 lines
drivers/net/xilinx_ll_temac.c new file +5 -0
+int xilinx_ll_temac_initialize(bd_t *bis, struct ll_temac_info *devinf)
...
+	dev = calloc(1, sizeof(*dev));
...
+	/* Tell u-boot to get the addr from the env */
+	for (i = 0; i < 6; i++)
+		dev->enetaddr[i] = 0;

the memory is already zero-ed by the call to calloc, so this for loop is useless (and if it wasn't, you'd still use memset())
-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/20120115/dea41318/attachment.pgp>

#3 lore raw

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

Am Sonntag, den 15.01.2012, 12:28 -0500 schrieb Mike Frysinger:

Quoted 8 lines · On Sunday 15 January 2012 10:46:02 Stephan Linz wrote:
Quoted 5 lines
(quoted diff) +2 -0
+/* Data buffer for LL TEMAC Rx and Tx direction */
+static unsigned char rx_buffer[PKTSIZE_ALIGN]

__attribute((aligned(DMAALIGN)));
+static unsigned char tx_buffer[PKTSIZE_ALIGN]
__attribute((aligned(DMAALIGN)));

come code already declares PktBuf ... can't you use that ?

Hm, what do you mean exactly here?

These are the two DMA transfer buffers. I have no idea if there are buffers in the upper layer (NET) and how I can use it for DMA transfers. Therfore I create my own rx/tx buffers and copy data. That reduce the performance a little bit, but it's OK. Furthermore I have to use DMA safe buffers here (no cache, 32 byte alignment).

Quoted 5 lines
Quoted 2 lines

+static struct ll_temac_info ll_temac_info[] = {

this looks like a struct that should get allocated on the fly based on arguments given to the driver's registration func

OK, it wast a little bit RAM. We can optimize the code later. I want to see more testing results on differnet Microblaze and PPC platforms.

Quoted 11 lines

drivers/net/xilinx_ll_temac.c line 392

Quoted 8 lines
drivers/net/xilinx_ll_temac.c new file +5 -0
+int xilinx_ll_temac_initialize(bd_t *bis, struct ll_temac_info *devinf)
...
+	dev = calloc(1, sizeof(*dev));
...
+	/* Tell u-boot to get the addr from the env */
+	for (i = 0; i < 6; i++)
+		dev->enetaddr[i] = 0;

the memory is already zero-ed by the call to calloc, so this for loop is useless (and if it wasn't, you'd still use memset())

Sure, we can remove this part in one of the next code optimization.

Signature · 8 lines
Best regards,
Stephan Linz
______________________________________________________________________________
MB-Ref: http://www.li-pro.de/xilinx_mb:mbref:start
OpenDCC: http://www.li-pro.net/opendcc.phtml
PC/M: http://www.li-pro.net/pcm.phtml
Sourceforge: http://sourceforge.net/users/slz
Gitorious: https://gitorious.org/~slz
#4 lore raw

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

Quoted 10 lines · On Sunday 15 January 2012 13:29:26 Stephan Linz wrote:

Am Sonntag, den 15.01.2012, 12:28 -0500 schrieb Mike Frysinger:

Quoted 8 lines · On Sunday 15 January 2012 10:46:02 Stephan Linz wrote:
Quoted 5 lines
(quoted diff) +2 -0
+/* Data buffer for LL TEMAC Rx and Tx direction */
+static unsigned char rx_buffer[PKTSIZE_ALIGN]

__attribute((aligned(DMAALIGN)));
+static unsigned char tx_buffer[PKTSIZE_ALIGN]
__attribute((aligned(DMAALIGN)));

come code already declares PktBuf ... can't you use that ?

Quoted 7 lines

Hm, what do you mean exactly here?

These are the two DMA transfer buffers. I have no idea if there are buffers in the upper layer (NET) and how I can use it for DMA transfers. Therfore I create my own rx/tx buffers and copy data. That reduce the performance a little bit, but it's OK. Furthermore I have to use DMA safe buffers here (no cache, 32 byte alignment).

from doc/README.drivers.eth:
The recv function should process packets as long as the hardware has them readily available before returning. i.e. you should drain the hardware fifo. For each packet you receive, you should call the NetReceive() function on it along with the packet length. The common code sets up packet buffers for you already in the .bss (NetRxPackets), so there should be no need to allocate your own.

so you already have an array of packet buffers declared for you. the first one is &NetRxPackets[0], etc... since you're just DMA-ing to random external memory, i don't think the address matters.

the core code atm however doesn't align things at all, so we'll have to fix that before this driver could use it.

Quoted 7 lines
Quoted 4 lines
Quoted 1 line

+static struct ll_temac_info ll_temac_info[] = {

this looks like a struct that should get allocated on the fly based on arguments given to the driver's registration func

OK, it wast a little bit RAM. We can optimize the code later. I want to see more testing results on differnet Microblaze and PPC platforms.

the point wasn't optimization but to kill off defines influencing how the code behaves. drivers should operate based on on their per-device state (addresses/settings/etc...) which is given to them via their registration func. that way multiple devices can be registered in different modes.

Quoted 11 lines
Quoted 10 lines

drivers/net/xilinx_ll_temac.c line 392

Quoted 7 lines

+int xilinx_ll_temac_initialize(bd_t *bis, struct ll_temac_info *devinf) ...

drivers/net/xilinx_ll_temac.c new file +4 -0
+	dev = calloc(1, sizeof(*dev));
...
+	/* Tell u-boot to get the addr from the env */
+	for (i = 0; i < 6; i++)
+		dev->enetaddr[i] = 0;

the memory is already zero-ed by the call to calloc, so this for loop is useless (and if it wasn't, you'd still use memset())

Quoted 1 line

Sure, we can remove this part in one of the next code optimization.

or do it now and re-submit a v2 ...
-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/20120115/3fd7cd57/attachment.pgp>

#5 lore raw

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

Am Sonntag, den 15.01.2012, 13:47 -0500 schrieb Mike Frysinger:

Quoted 19 lines · On Sunday 15 January 2012 13:29:26 Stephan Linz wrote:
Quoted 10 lines

Am Sonntag, den 15.01.2012, 12:28 -0500 schrieb Mike Frysinger:

Quoted 8 lines · On Sunday 15 January 2012 10:46:02 Stephan Linz wrote:
Quoted 5 lines
(quoted diff) +2 -0
+/* Data buffer for LL TEMAC Rx and Tx direction */
+static unsigned char rx_buffer[PKTSIZE_ALIGN]

__attribute((aligned(DMAALIGN)));
+static unsigned char tx_buffer[PKTSIZE_ALIGN]
__attribute((aligned(DMAALIGN)));

come code already declares PktBuf ... can't you use that ?

Quoted 7 lines

Hm, what do you mean exactly here?

These are the two DMA transfer buffers. I have no idea if there are buffers in the upper layer (NET) and how I can use it for DMA transfers. Therfore I create my own rx/tx buffers and copy data. That reduce the performance a little bit, but it's OK. Furthermore I have to use DMA safe buffers here (no cache, 32 byte alignment).

Quoted 7 lines

from doc/README.drivers.eth:
The recv function should process packets as long as the hardware has them readily available before returning. i.e. you should drain the hardware fifo. For each packet you receive, you should call the NetReceive() function on it along with the packet length. The common code sets up packet buffers for you already in the .bss (NetRxPackets), so there should be no need to allocate your own.

OK, I'll try to change the buffer handling as soon as possible in one of the next optimization stages of this driver. Looks interesting and important to me ...

Quoted 7 lines

so you already have an array of packet buffers declared for you. the first one is &NetRxPackets[0], etc... since you're just DMA-ing to random external memory, i don't think the address matters.

the core code atm however doesn't align things at all, so we'll have to fix that before this driver could use it.

The alignment is essential for the LL TEMAC driver, especially the 32 byte alignment. I look to continue to optimize this part after the patch has been added.

Quoted 25 lines
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

+static struct ll_temac_info ll_temac_info[] = {

this looks like a struct that should get allocated on the fly based on arguments given to the driver's registration func

OK, it wast a little bit RAM. We can optimize the code later. I want to see more testing results on differnet Microblaze and PPC platforms.

the point wasn't optimization but to kill off defines influencing how the code behaves. drivers should operate based on on their per-device state (addresses/settings/etc...) which is given to them via their registration func. that way multiple devices can be registered in different modes.

Quoted 11 lines
Quoted 10 lines

drivers/net/xilinx_ll_temac.c line 392

Quoted 7 lines

+int xilinx_ll_temac_initialize(bd_t *bis, struct ll_temac_info *devinf) ...

drivers/net/xilinx_ll_temac.c new file +4 -0
+	dev = calloc(1, sizeof(*dev));
...
+	/* Tell u-boot to get the addr from the env */
+	for (i = 0; i < 6; i++)
+		dev->enetaddr[i] = 0;

the memory is already zero-ed by the call to calloc, so this for loop is useless (and if it wasn't, you'd still use memset())

Quoted 3 lines
Quoted 1 line

Sure, we can remove this part in one of the next code optimization.

or do it now and re-submit a v2 ...

I have already done. Patch is coming up ... :-)

Signature · 8 lines
Best regards,
Stephan Linz
______________________________________________________________________________
MB-Ref: http://www.li-pro.de/xilinx_mb:mbref:start
OpenDCC: http://www.li-pro.net/opendcc.phtml
PC/M: http://www.li-pro.net/pcm.phtml
Sourceforge: http://sourceforge.net/users/slz
Gitorious: https://gitorious.org/~slz
#6 lore raw

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

Dear Stephan Linz,

Quoted 4 lines · In message <1326656467.18981.225.camel@keto> you wrote:

OK, I'll try to change the buffer handling as soon as possible in one of the next optimization stages of this driver. Looks interesting and important to me ...

...

Quoted 3 lines

The alignment is essential for the LL TEMAC driver, especially the 32 byte alignment. I look to continue to optimize this part after the patch has been added.

No, please do it now. I will not pull the current patch.

Quoted 3 lines
Quoted 1 line

or do it now and re-submit a v2 ...

I have already done. Patch is coming up ... :-)

No, you misunderstant. You submitted an incremental, separate patch.

But we don't want to add code that is known to have problems / shortcomings now and fix / improve it 5 minutes later. We let the patch ripe and add it only when we consider it ready.

So please do not defer weorkign on the review comments.

Best regards,

Wolfgang Denk

Signature · 5 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
"Look! There! Evil!.. pure and simple, total  evil  from  the  Eighth
Dimension!"                                         - Buckaroo Banzai
#7 lore raw

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

In reply to Mike Frysinger

Am Sonntag, den 15.01.2012, 13:47 -0500 schrieb Mike Frysinger:

Quoted 27 lines · On Sunday 15 January 2012 13:29:26 Stephan Linz wrote:
Quoted 10 lines

Am Sonntag, den 15.01.2012, 12:28 -0500 schrieb Mike Frysinger:

Quoted 8 lines · On Sunday 15 January 2012 10:46:02 Stephan Linz wrote:
Quoted 5 lines
(quoted diff) +2 -0
+/* Data buffer for LL TEMAC Rx and Tx direction */
+static unsigned char rx_buffer[PKTSIZE_ALIGN]

__attribute((aligned(DMAALIGN)));
+static unsigned char tx_buffer[PKTSIZE_ALIGN]
__attribute((aligned(DMAALIGN)));

come code already declares PktBuf ... can't you use that ?

Quoted 7 lines

Hm, what do you mean exactly here?

These are the two DMA transfer buffers. I have no idea if there are buffers in the upper layer (NET) and how I can use it for DMA transfers. Therfore I create my own rx/tx buffers and copy data. That reduce the performance a little bit, but it's OK. Furthermore I have to use DMA safe buffers here (no cache, 32 byte alignment).

from doc/README.drivers.eth:
The recv function should process packets as long as the hardware has them readily available before returning. i.e. you should drain the hardware fifo. For each packet you receive, you should call the NetReceive() function on it along with the packet length. The common code sets up packet buffers for you already in the .bss (NetRxPackets), so there should be no need to allocate your own.

Quoted 3 lines

so you already have an array of packet buffers declared for you. the first one is &NetRxPackets[0], etc... since you're just DMA-ing to random external memory, i don't think the address matters.

Hello Mike
and all others,

is there already a simple ETH driver that use these kind of buffer handling? Up to now I've learned from the Freescale TSEC driver, especially the MDIO bus implementation. It seems this driver implement this packet buffer, or not?

Quoted 3 lines

the core code atm however doesn't align things at all, so we'll have to fix that before this driver could use it.

Is the TSEC driver DMA alignment safe (especially the DMA buffer data, not the DMA buffer descriptor)? What do I need to make the internal array of packet buffer DMA secure (cache, alignment)?

Signature · 8 lines
Best regards,
Stephan Linz
______________________________________________________________________________
MB-Ref: http://www.li-pro.de/xilinx_mb:mbref:start
OpenDCC: http://www.li-pro.net/opendcc.phtml
PC/M: http://www.li-pro.net/pcm.phtml
Sourceforge: http://sourceforge.net/users/slz
Gitorious: https://gitorious.org/~slz
#8 lore raw

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

In reply to Stephan Linz

Dear Stephan Linz,

Quoted 7 lines · In message <1326652166.18981.213.camel@keto> you wrote:
Quoted 2 lines

come code already declares PktBuf ... can't you use that ?

Hm, what do you mean exactly here?

These are the two DMA transfer buffers. I have no idea if there are buffers in the upper layer (NET) and how I can use it for DMA transfers.

It's a bad thing not to look at common code, but thnings like that happen too easily.

However, now that this has been pointed out, you cannot simply ignore such a request.

Quoted 3 lines

Therfore I create my own rx/tx buffers and copy data. That reduce the performance a little bit, but it's OK. Furthermore I have to use DMA safe buffers here (no cache, 32 byte alignment).

I could imagine this to be a pretty common requirement.

Quoted 5 lines
Quoted 2 lines

this looks like a struct that should get allocated on the fly based on arguments given to the driver's registration func

OK, it wast a little bit RAM. We can optimize the code later. I want to see more testing results on differnet Microblaze and PPC platforms.

we can fix this now, right?

Quoted 4 lines
Quoted 2 lines

the memory is already zero-ed by the call to calloc, so this for loop is useless (and if it wasn't, you'd still use memset())

Sure, we can remove this part in one of the next code optimization.

No. Please fix this now, and then add a cleaned up driver. This is what the peer review process is all about.

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
Whom the gods would destroy, they first teach BASIC.
#9 lore raw

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

Am Montag, den 16.01.2012, 09:14 +0100 schrieb Wolfgang Denk:

Quoted 1 line

Dear Stephan Linz,

Hi Wolfgang,

you are right in all points. I'll go into the next round and handle all new request.

br,
Stephan

Quoted 42 lines
Quoted 7 lines · In message <1326652166.18981.213.camel@keto> you wrote:
Quoted 2 lines

come code already declares PktBuf ... can't you use that ?

Hm, what do you mean exactly here?

These are the two DMA transfer buffers. I have no idea if there are buffers in the upper layer (NET) and how I can use it for DMA transfers.

It's a bad thing not to look at common code, but thnings like that happen too easily.

However, now that this has been pointed out, you cannot simply ignore such a request.

Quoted 3 lines

Therfore I create my own rx/tx buffers and copy data. That reduce the performance a little bit, but it's OK. Furthermore I have to use DMA safe buffers here (no cache, 32 byte alignment).

I could imagine this to be a pretty common requirement.

Quoted 5 lines
Quoted 2 lines

this looks like a struct that should get allocated on the fly based on arguments given to the driver's registration func

OK, it wast a little bit RAM. We can optimize the code later. I want to see more testing results on differnet Microblaze and PPC platforms.

we can fix this now, right?

Quoted 4 lines
Quoted 2 lines

the memory is already zero-ed by the call to calloc, so this for loop is useless (and if it wasn't, you'd still use memset())

Sure, we can remove this part in one of the next code optimization.

No. Please fix this now, and then add a cleaned up driver. This is what the peer review process is all about.

Best regards,

Wolfgang Denk

#10 lore raw

PATCH 1/1 net: ll_temac: Remove useless memory erasing

In reply to Stephan Linz

In xilinx_ll_temac_initialize() the memory is already zero-ed by the call to calloc, so this loop is useless.

---
 drivers/net/xilinx_ll_temac.c |    4 ----
 1 files changed, 0 insertions(+), 4 deletions(-)
drivers/net/xilinx_ll_temac.c +0 -4
index 8533358..e050250 100644
@@ -387,10 +387,6 @@ int xilinx_ll_temac_initialize(bd_t *bis, struct ll_temac_info *devinf)
 	else
 		ll_temac->phyaddr = devinf->phyaddr;
 
-	/* Tell u-boot to get the addr from the env */
-	for (i = 0; i < 6; i++)
-		dev->enetaddr[i] = 0;
-
 	eth_register(dev);
 
 	/* Try to initialize PHY here, and return */
Signature · 1 line
1.7.0.4
#11 lore raw

PATCH 1/1 net: ll_temac: Remove useless memory erasing

Quoted 2 lines · On Sunday 15 January 2012 14:46:07 Stephan Linz wrote:

In xilinx_ll_temac_initialize() the memory is already zero-ed by the call to calloc, so this loop is useless.

has this driver already been merged ? if not, the process is to update the patch and send the new version to the list as a v2 ...
-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/20120115/225dbe2b/attachment.pgp>

#12 lore raw

PATCH 1/1 net: ll_temac: Remove useless memory erasing

Am Sonntag, den 15.01.2012, 18:44 -0500 schrieb Mike Frysinger:

Quoted 7 lines · On Sunday 15 January 2012 14:46:07 Stephan Linz wrote:
Quoted 2 lines

In xilinx_ll_temac_initialize() the memory is already zero-ed by the call to calloc, so this loop is useless.

has this driver already been merged ? if not, the process is to update the patch and send the new version to the list as a v2 ...
-mike

You are right, I will post a new V9 patch ...

Signature · 8 lines
Best regards,
Stephan Linz
______________________________________________________________________________
MB-Ref: http://www.li-pro.de/xilinx_mb:mbref:start
OpenDCC: http://www.li-pro.net/opendcc.phtml
PC/M: http://www.li-pro.net/pcm.phtml
Sourceforge: http://sourceforge.net/users/slz
Gitorious: https://gitorious.org/~slz
#13 lore raw

PATCH 1/1 net: ll_temac: Remove useless memory erasing

In reply to Stephan Linz

Dear Stephan Linz,

Quoted 7 lines · In message <[email protected]> you wrote:

In xilinx_ll_temac_initialize() the memory is already zero-ed by the call to calloc, so this loop is useless.

---
 drivers/net/xilinx_ll_temac.c |    4 ----
 1 files changed, 0 insertions(+), 4 deletions(-)

Please squash this into the patch that adds the driver.

Best regards,

Wolfgang Denk

Signature · 5 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
"If God had wanted us to use the metric system, Jesus would have  had
10 apostles."
#14 lore raw

PATCH 2/5 microblaze: Enable several ethernet driver compilation

In reply to Stephan Linz

NET_MULTI enables to use several ethernet drivers but microblaze-generic platform config file select only one driver.

---
 include/configs/microblaze-generic.h |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)
include/configs/microblaze-generic.h +6 -4
index 03a6f5a..29a86d1 100644
@@ -65,11 +65,12 @@
 
 /* ethernet */
 #undef CONFIG_SYS_ENET
-#ifdef XILINX_EMACLITE_BASEADDR
-# define CONFIG_XILINX_EMACLITE		1
+#if defined(XILINX_EMACLITE_BASEADDR)
+# define CONFIG_XILINX_EMACLITE	1
 # define CONFIG_SYS_ENET
-#elif XILINX_LLTEMAC_BASEADDR
-# define CONFIG_XILINX_LL_TEMAC		1
+#endif
+#if defined(XILINX_LLTEMAC_BASEADDR) || defined(XILINX_LLTEMAC_BASEADDR1)
+# define CONFIG_XILINX_LL_TEMAC	1
 # define CONFIG_SYS_ENET
 #endif
 #if defined(XILINX_AXIEMAC_BASEADDR)
@@ -312,6 +313,7 @@
 #define	CONFIG_SERVERIP		192.168.0.5
 #define	CONFIG_GATEWAYIP	192.168.0.1
 #define	CONFIG_ETHADDR		00:E0:0C:00:00:FD
+#define	CONFIG_ETH1ADDR		00:E0:0C:00:00:FC
 
 /* architecture dependent code */
 #define	CONFIG_SYS_USR_EXCEP	/* user exception */
Signature · 1 line
1.7.0.4
#15 lore raw

PATCH 3/5 microblaze: Wire up LL_TEMAC driver initialization

In reply to Stephan Linz

Initialize ll_temac driver.

---
 .../xilinx/microblaze-generic/microblaze-generic.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)
board/xilinx/microblaze-generic/microblaze-generic.c +5 -0
index c4c13a6..517b2f1 100644
@@ -90,5 +90,10 @@ int board_eth_init(bd_t *bis)
 	ret |= xilinx_emaclite_initialize(bis, XILINX_EMACLITE_BASEADDR,
 			txpp, rxpp);
 #endif
+
+#ifdef CONFIG_XILINX_LL_TEMAC
+	ret |= xilinx_ll_temac_standard_init(bis);
+#endif
+
 	return ret;
 }
Signature · 1 line
1.7.0.4
#16 lore raw

PATCH 4/5 microblaze: Enable phylib and mii support

In reply to Stephan Linz

From: Michal Simek <[email protected]>

Enable phylib and mii support for LLTEMAC or AXI EMAC ethernet drivers on Microblaze systems.

---
 include/configs/microblaze-generic.h |   21 +++++++++++++++++++++
 1 files changed, 21 insertions(+), 0 deletions(-)
include/configs/microblaze-generic.h +21 -0
index 29a86d1..ec2e49e 100644
@@ -340,4 +340,25 @@
 #define CONFIG_FIT		1
 #define CONFIG_OF_LIBFDT	1
 
+#if defined(CONFIG_XILINX_LL_TEMAC) || defined(CONFIG_XILINX_AXIEMAC)
+# define CONFIG_MII		1
+# define CONFIG_CMD_MII		1
+# define CONFIG_PHY_GIGE	1
+# define CONFIG_SYS_FAULT_ECHO_LINK_DOWN	1
+# define CONFIG_PHYLIB		1
+# define CONFIG_PHY_ATHEROS	1
+# define CONFIG_PHY_BROADCOM	1
+# define CONFIG_PHY_DAVICOM	1
+# define CONFIG_PHY_LXT		1
+# define CONFIG_PHY_MARVELL	1
+# define CONFIG_PHY_MICREL	1
+# define CONFIG_PHY_NATSEMI	1
+# define CONFIG_PHY_REALTEK	1
+# define CONFIG_PHY_VITESSE	1
+#else
+# undef CONFIG_MII
+# undef CONFIG_CMD_MII
+# undef CONFIG_PHYLIB
+#endif
+
 #endif	/* __CONFIG_H */
Signature · 1 line
1.7.0.4
#17 lore raw

PATCH 5/5 microblaze: Add faked LL_TEMAC driver configuration

In reply to Stephan Linz

Expand the specific configuration for the microblaze-generic board in xparameters.h with a faked setup to enable the LL_TEMAC driver.

Note: From now the microblaze-generic board is no longer a valid board configuration for a real piece of hardware. Rather than, we use the file config.mk and xparameters.h as a faked board configuration to force the compilation of all potential driver code for Microblaze systems.

---
 board/xilinx/microblaze-generic/config.mk     |    6 ++++--
 board/xilinx/microblaze-generic/xparameters.h |   12 ++++++++++--
 2 files changed, 14 insertions(+), 4 deletions(-)
board/xilinx/microblaze-generic/config.mk +4 -2
index f8d7e26..9fd1015 100644
@@ -21,8 +21,10 @@
 # Foundation, Inc., 59 Temple Place, Suite 330, Boston,
 # MA 02111-1307 USA
 #
-# CAUTION: This file is automatically generated by libgen.
-# Version: Xilinx EDK 6.3 EDK_Gmm.12.3
+# CAUTION: This file is a faked configuration !!!
+#          There is no real target for the microblaze-generic
+#          configuration. You have to replace this file with
+#          the generated file from your Xilinx design flow.
 #
 
 CONFIG_SYS_TEXT_BASE = 0x29000000
board/xilinx/microblaze-generic/xparameters.h +10 -2
index fae03bf..fcbd55e 100644
@@ -21,8 +21,10 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  * MA 02111-1307 USA
  *
- * CAUTION: This file is automatically generated by libgen.
- * Version: Xilinx EDK 8.2.02 EDK_Im_Sp2.4
+ * CAUTION: This file is a faked configuration !!!
+ *          There is no real target for the microblaze-generic
+ *          configuration. You have to replace this file with
+ *          the generated file from your Xilinx design flow.
  */
 
 #define XILINX_BOARD_NAME	microblaze-generic
@@ -69,3 +71,9 @@
 
 /* Ethernet controller is Ethernet_MAC */
 #define XILINX_EMACLITE_BASEADDR       0x40C00000
+
+/* Ethernet controller is Ethernet_MAC */
+#define XILINX_LLTEMAC_BASEADDR			0x44000000
+#define XILINX_LLTEMAC_SDMA_CTRL_BASEADDR	0x42000180
+#define XILINX_LLTEMAC_BASEADDR1		0x44000040
+#define XILINX_LLTEMAC_SDMA_CTRL_BASEADDR1	0x42000200
Signature · 1 line
1.7.0.4