[U-Boot] [PATCH 03/17] GRETH: Added extra RESET, this is needed if GRETH was stopped during an ethernet frame reception.

Wolfgang Denk wd at denx.de
Wed May 26 22:44:22 CEST 2010


Dear Daniel Hellstrom,

In message <1274194143-8994-2-git-send-email-daniel at gaisler.com> you wrote:
> 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 a1a88f9..143c773 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(&regs->control, (GRETH_RESET | (greth->gb << 8) |
> +		(greth->sp << 7) | (greth->fd << 4)));
> +
> +	/* Wait for Reset to complete */
> +	while ( GRETH_REGLOAD(&regs->control) & GRETH_RESET) ;
> +
> +	GRETH_REGSAVE(&regs->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));

This...

>  		/* 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)) {

... and these seem to be unrelated bug fixes. These should go into a
separate commit.

Best regards,

Wolfgang Denk

-- 
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
A failure will not appear until a unit has passed final inspection.


More information about the U-Boot mailing list