[U-Boot] usage of DMA

Marcel korgull at home.nl
Wed Jan 19 22:33:30 CET 2011


Hi Vitaly,

Thanks so much for your reply. I got a little further now.

> Marcel wrote:
> >> Could you enable debug output for ether.c and for your UDC driver and
> >> show the results?
> > 
> > I enabled a lot of extra debugging messages so this is not very short.
> > The output attached below is including start of macb but USB device
> > behave the same when I don't enable that.
> > 
> > [...]
> > 
> > USB network up!
> > ep3 status = 1040c40
> > rx_submit
> > size 1 = 1570
> > size 2 = 2081
> > size 3 = 2048
> > ep2: queue req 77fec8f0, len 2048
> > udc: invalid request
> > NO REQUEST BUF
> > Received ETH pack : 00 00 00 00 00 00 00 00
> > ERROR: rx submit --> -22
> > at ether.c:1289/rx_submit()
> > ### main_loop entered: bootdelay=3
> > 
> > ### main_loop: bootcmd="mtdparts default; nand read 0x71000000 nand0,0;
> > bootm 0x71000000"
> > Hit any key to stop autoboot:  0
> > Sam9g45>
> 
> First, I don't completely understand how do you use the gadget driver.
> You do not run any commands from u-boot prompt and your bootcmd does not
> have any network actions.
> Why your usb gadget driver becomes started?

A good question. I enable it in board_eth_init as you mention below.

> Second, could you add the following debug printout into rx_submit and
> check that NetRxPackets is really initialized?
> 
> @@ -1261,6 +1261,8 @@ static int rx_submit(struct eth_dev *dev
>  	req->length = size;
>  	req->complete = rx_complete;
> 
> +	printf("NetRxPackets[0] = %p !!!\n", NetRxPackets[0]);
> +
>  	retval = usb_ep_queue(dev->out_ep, req, gfp_flags);
> 
>  	if (retval)
> 
> ---

It printed :
NetRxPackets[0] = (null) !!!


> Since NetRxPackets is defined as an array of pointers, it needs to be
> initialized. And NetLoop does this:

So far I figured as well, just not why this didn't happen.

> So I fear that your gadget is started manually. You should not do that!

I fear you where right about that. I don't know for sure what triggered it but 
after I disabled CONFIG_MACB in my config things looked a whole lot different !

> The only thing that you can do with your udc driver during the board
> initialization is the following:
> 
> static struct usba_platform_data usba_pdata = {
> ...
> };
> 
> int board_eth_init(bd_t *bis)
> {
>        int rc = 0;
> #if defined(CONFIG_USB_ETHER) && defined(CONFIG_USB_GADGET_ATMEL_USBA)
>        rc = usba_udc_probe(&usba_pdata);
>        if (!rc)
>                rc = usb_eth_initialize(bis);
> #endif
>         return rc;
> }

This is what I did.

> If you want to autoboot from tftp you should specify bootcmd environment
> variable to something like "tftp uImage; bootm".
> And always use usb gadget only with network commands like tftp, dhcp,
> ping, etc.

I'm quite sure the initialisation was the issue, causing the buffers to be fine. 
I still wonder how it exactly works, but since it's alive now, I can continue 
to find out what really happens.

I do wonder about whether I can use both normal ethernet and USB-gadget (cdc) 
at the same time, other whether it's restricted to using only one.

Thanks so much for your reply. I'm sure I could have stared at this for 
another couple of days and be looking in the wrong places over and over again.

Best regards,
Marcel










More information about the U-Boot mailing list