[U-Boot] usage of DMA

Vitaly Kuzmichev vkuzmichev at mvista.com
Wed Jan 19 10:04:17 CET 2011


Hi Marcel,

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?

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)

---

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

volatile uchar *NetRxPackets[PKTBUFSRX];
...
int
NetLoop(proto_t protocol)
{
        bd_t *bd = gd->bd;
...
        if (!NetTxPacket) {
                int     i;
                /*
                 *      Setup packet buffers, aligned correctly.
                 */
                NetTxPacket = &PktBuf[0] + (PKTALIGN - 1);
                NetTxPacket -= (ulong)NetTxPacket % PKTALIGN;
                for (i = 0; i < PKTBUFSRX; i++) {
                        NetRxPackets[i] = NetTxPacket + (i+1)*PKTSIZE_ALIGN;
                }
        }
...

So I fear that your gadget is started manually. You should not do that!
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;
}

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.


More information about the U-Boot mailing list