[U-Boot] [PATCH 03/17] GRETH: Added extra RESET, this is needed if GRETH was stopped during an ethernet frame reception.
Daniel Hellstrom
daniel at gaisler.com
Thu Jan 28 13:16:22 CET 2010
Signed-off-by: Daniel Hellstrom <daniel at gaisler.com>
---
drivers/net/greth.c | 14 ++++++++++++--
1 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/drivers/net/greth.c b/drivers/net/greth.c
index 833915d..383b25c 100644
--- a/drivers/net/greth.c
+++ b/drivers/net/greth.c
@@ -146,13 +146,23 @@ int greth_init(struct eth_device *dev, bd_t * bis)
printf("greth_init\n");
#endif
+ /* Reset core */
+ GRETH_REGSAVE(®s->control, (GRETH_RESET | (greth->gb << 8) |
+ (greth->sp << 7) | (greth->fd << 4)));
+
+ /* Wait for Reset to complete */
+ while ( GRETH_REGLOAD(®s->control) & GRETH_RESET) ;
+
+ GRETH_REGSAVE(®s->control,
+ ((greth->gb << 8) | (greth->sp << 7) | (greth->fd << 4)));
+
if (!greth->rxbd_base) {
/* allocate descriptors */
greth->rxbd_base = (greth_bd *)
memalign(0x1000, GRETH_RXBD_CNT * sizeof(greth_bd));
greth->txbd_base = (greth_bd *)
- memalign(0x1000, GRETH_RXBD_CNT * sizeof(greth_bd));
+ memalign(0x1000, GRETH_TXBD_CNT * sizeof(greth_bd));
/* allocate buffers to all descriptors */
greth->rxbuf_base =
@@ -185,7 +195,7 @@ int greth_init(struct eth_device *dev, bd_t * bis)
for (i = 0; i < GRETH_TXBD_CNT; i++) {
greth->txbd_base[i].addr = 0;
/* enable desciptor & set wrap bit if last descriptor */
- if (i >= (GRETH_RXBD_CNT - 1)) {
+ if (i >= (GRETH_TXBD_CNT - 1)) {
greth->txbd_base[i].stat = GRETH_BD_WR;
} else {
greth->txbd_base[i].stat = 0;
--
1.5.4
More information about the U-Boot
mailing list