All of lore.kernel.org
 help / color / mirror / Atom feed
From: Marek Vasut <marex@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] Question: issues for usb keyboard work with OHCI HCD
Date: Fri, 3 May 2013 15:40:51 +0200	[thread overview]
Message-ID: <201305031540.52128.marex@denx.de> (raw)
In-Reply-To: <51832F55.4030409@atmel.com>

Dear Bo Shen,

> Hi All,
>    Now, I test usb host support with Atmel boards, for example,
> at91sam9x5ek board.
> 
>    When test OHCI USB host with usb keyboard. I meet the following issue.
> --->8---
> U-Boot 2013.04-dirty (May 03 2013 - 11:00:34)
> 
> CPU: AT91SAM9G35
> Crystal frequency:       12 MHz
> CPU clock        :      400 MHz
> Master clock     :  133.333 MHz
> DRAM:  128 MiB
> WARNING: Caches not enabled
> NAND:  256 MiB
> MMC:   mci: 0
> In:    serial
> Out:   serial
> Err:   serial
> Net:   macb0
> Hit any key to stop autoboot:  0
> U-Boot> usb start
> (Re)start USB...
> USB0:   scanning bus 0 for devices... 2 USB Device(s) found
>         scanning usb for storage devices... 0 Storage Device(s) found
> U-Boot> setenv stdin usbkbd
> U-Boot> ERROR: sohci_submit_job: ENOMEM
> ERROR: sohci_submit_job failed
> ... ...
> (repeat to print these two error line)

So the USB subsystem is leaking memory? Or do you only have too small MALLOC 
area?

> ---<8---
> 
>    After dig the usb ohci-hcd.c driver, I found every time it call
> submit_int_msg -->
> submit_common_msg --> sohci_submit_job, it will allocate memory for td
> (just call td_alloc),
> however nowhere free the td. So, after allocate 64 times (#define NUM_TD
> 64),
> all the ptd[i].usb_dev is not NULL. So, it will report: ENOMEM.
> 
>    I don't know why in sohci_return_job it call td_submit_job again?
> --->8---
> static inline int sohci_return_job(struct ohci *hc, urb_priv_t *urb)
> {
>      struct ohci_regs *regs = hc->regs;
> 
>      switch (usb_pipetype(urb->pipe)) {
>      case PIPE_INTERRUPT:
>          /* implicitly requeued */
>          if (urb->dev->irq_handle &&
>                  (urb->dev->irq_act_len = urb->actual_length)) {
>              ohci_writel(OHCI_INTR_WDH, &regs->intrenable);
>              ohci_readl(&regs->intrenable); /* PCI posting flush */
>              urb->dev->irq_handle(urb->dev);
>              ohci_writel(OHCI_INTR_WDH, &regs->intrdisable);
>              ohci_readl(&regs->intrdisable); /* PCI posting flush */
>          }
>          urb->actual_length = 0;
>          td_submit_job(
>                  urb->dev,
>                  urb->pipe,
>                  urb->transfer_buffer,
>                  urb->transfer_buffer_length,
>                  NULL,
>                  urb,
>                  urb->interval);
>          break
> ---<8---
> 
>    Add where should we free the allocated td to fix the issue?
> 
>    Thanks.
> 
> Best Regards,
> Bo Shen

Best regards,
Marek Vasut

  reply	other threads:[~2013-05-03 13:40 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-03  3:30 [U-Boot] Question: issues for usb keyboard work with OHCI HCD Bo Shen
2013-05-03 13:40 ` Marek Vasut [this message]
2013-05-06  3:01   ` Bo Shen
2013-05-13  8:52     ` Bo Shen
2013-05-13 15:12       ` Marek Vasut
2013-05-14  1:23         ` Bo Shen
2013-05-14  2:13           ` Marek Vasut
2013-05-14 14:26             ` Benoît Thébaudeau
2013-05-14 15:54               ` Marek Vasut

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=201305031540.52128.marex@denx.de \
    --to=marex@denx.de \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.