Skip to contentSkip to conversation

net/designware: add explicit reset of {tx|rx}_currdescnum

PATCH In review Alexey Brodkin 2 participants 2 messages Jan 13, 2014 – Feb 7, 2014 Network drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net/designware: add explicit reset of {tx|rx}_currdescnum

Driver "init" function might be called multiple times.
On every "init" Tx/Rx buffer descriptors are initialized: "descs_init" -> "{tx|rx}_descs_init".

In its turn those init functions set MAC's "{tx|rx}desclistaddr" to point on the first buffer descriptor in the list.

So CPU to start operation from the first buffer descriptor as well after every "init" we have to reset "{tx|rx}_currdescnum".

Cc Joe Hershberger <[email protected]>
Cc Vipin Kumar <[email protected]>
Cc Stefan Roese <[email protected]>
Cc Mischa Jonker <[email protected]>
---
 drivers/net/designware.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/net/designware.c +2 -0
index 53a95bf..d1cc25b 100644
@@ -57,6 +57,7 @@ static void tx_descs_init(struct eth_device *dev)
 			   sizeof(priv->tx_mac_descrtable));
 
 	writel((ulong)&desc_table_p[0], &dma_p->txdesclistaddr);
+	priv->tx_currdescnum = 0;
 }
 
 static void rx_descs_init(struct eth_device *dev)
@@ -98,6 +99,7 @@ static void rx_descs_init(struct eth_device *dev)
 			   sizeof(priv->rx_mac_descrtable));
 
 	writel((ulong)&desc_table_p[0], &dma_p->rxdesclistaddr);
+	priv->rx_currdescnum = 0;
 }
 
 static void descs_init(struct eth_device *dev)
Signature · 1 line
1.8.4.2
#1 lore raw
Quoted 10 lines · Alexey Brodkin

Driver "init" function might be called multiple times.
On every "init" Tx/Rx buffer descriptors are initialized: "descs_init" -> "{tx|rx}_descs_init".

In its turn those init functions set MAC's "{tx|rx}desclistaddr" to point on the first buffer descriptor in the list.

So CPU to start operation from the first buffer descriptor as well after every "init" we have to reset "{tx|rx}_currdescnum".

Quoted 6 lines
Cc Joe Hershberger <[email protected]>
Cc Vipin Kumar <[email protected]>
Cc Stefan Roese <[email protected]>
Cc Mischa Jonker <[email protected]>

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20140207/08826a81/attachment.pgp>