linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: eric.y.miao@gmail.com (Eric Miao)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] usb: fsl_udc_core: fix build breakage when building for ARM arch
Date: Fri, 24 Jun 2011 17:58:12 +0800	[thread overview]
Message-ID: <BANLkTik3hwAanro-5wyw+2U9L9LP_SnRzg@mail.gmail.com> (raw)
In-Reply-To: <20110624095630.GE23234@n2100.arm.linux.org.uk>

On Fri, Jun 24, 2011 at 5:56 PM, Russell King - ARM Linux
<linux@arm.linux.org.uk> wrote:
> On Fri, Jun 24, 2011 at 02:03:08AM +0200, Anatolij Gustschin wrote:
>> Commit 09ba0def introduced build breakage on ARM arch.
>> Fix it by setting accessors using a static inline function
>> which is a nop when compiling the driver for ARM arch.
>>
>> Don't use flush_dcache_range(), convert to the DMA API
>> usage instead. USB2.0CV Halt Endpoint Test succeeds on
>> PPC. Tested both on ARM i.MX31 and mpc5121 PPC.
>
> While this may work, if you enable DMA API debugging, you'll get
> complaints. ?Please test your changes on ARM with CONFIG_DMA_API_DEBUG
> enabled.
>
>
> ? ? ? ?/* FIXME: fsl_alloc_request() ignores ep argument */
> ? ? ? ?udc->status_req = container_of(fsl_alloc_request(NULL, GFP_KERNEL),
> ? ? ? ? ? ? ? ? ? ? ? ?struct fsl_req, req);
> ? ? ? ?/* allocate a small amount of memory to get valid address */
> ? ? ? ?udc->status_req->req.buf = kmalloc(8, GFP_KERNEL);
> ? ? ? ?udc->status_req->req.dma = virt_to_phys(udc->status_req->req.buf);
>
> ...
>
> ? ? ? ?/* Borrow the per device status_req */
> ? ? ? ?req = udc->status_req;
> ? ? ? ?/* Fill in the reqest structure */
> ? ? ? ?*((u16 *) req->req.buf) = cpu_to_le16(tmp);
>
> ? ? ? ?/* flush cache for the req buffer */
> ? ? ? ?flush_dcache_range((u32)req->req.buf, (u32)req->req.buf + 8);
>
> ? ? ? ?req->ep = ep;
> ? ? ? ?req->req.length = 2;
> ? ? ? ?req->req.status = -EINPROGRESS;
> ? ? ? ?req->req.actual = 0;
> ? ? ? ?req->req.complete = NULL;
> ? ? ? ?req->dtd_count = 0;
>
> ? ? ? ?/* prime the data phase */
> ? ? ? ?if ((fsl_req_to_dtd(req) == 0))
> ? ? ? ? ? ? ? ?fsl_queue_td(ep, req);
> ...
>
> I've no idea why this driver can't use dma_map_single() before queuing,
> and dma_unmap_single() once the req is complete. ?It looks like done()
> will do the unmap provided we map it correctly and set req->mapped.
>
> So, I think that virt_to_phys can be killed, and a dma_map_single() can
> be done in place of the flush_dcache_range to set req->req.dma, and
> req->mapped needs to be set to cause it to be unmapped.
>

It looks like it's using dma_* API for endpoints other than ep0.

  reply	other threads:[~2011-06-24  9:58 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-24  0:03 [PATCH] usb: fsl_udc_core: fix build breakage when building for ARM arch Anatolij Gustschin
2011-06-24  4:17 ` Eric Miao
2011-06-24  9:56 ` Russell King - ARM Linux
2011-06-24  9:58   ` Eric Miao [this message]
2011-06-25 21:37   ` [PATCH v2] " Anatolij Gustschin

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=BANLkTik3hwAanro-5wyw+2U9L9LP_SnRzg@mail.gmail.com \
    --to=eric.y.miao@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    /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;
as well as URLs for NNTP newsgroup(s).