public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Vitaly Kuzmichev <vkuzmichev@mvista.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] usage of DMA
Date: Wed, 19 Jan 2011 12:04:17 +0300	[thread overview]
Message-ID: <4D36A911.1070302@mvista.com> (raw)
In-Reply-To: <201101181911.14722.korgull@home.nl>

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.

  reply	other threads:[~2011-01-19  9:04 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-11 21:51 [U-Boot] {Spam?} usage of DMA Marcel
2011-01-16  7:56 ` Albert ARIBAUD
2011-01-17 20:48   ` [U-Boot] " Marcel
2011-01-18 13:36     ` Vitaly Kuzmichev
2011-01-18 14:06       ` Vitaly Kuzmichev
2011-01-18 18:12         ` Marcel
2011-01-18 18:11       ` Marcel
2011-01-19  9:04         ` Vitaly Kuzmichev [this message]
2011-01-19 21:33           ` Marcel
2011-01-19 22:44           ` Marcel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4D36A911.1070302@mvista.com \
    --to=vkuzmichev@mvista.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox