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] [PATCH 01/10] usb:udc:s3c: Reduce dcache invalidate range for UDC receive buffer
Date: Fri, 4 Oct 2013 18:18:19 +0200	[thread overview]
Message-ID: <201310041818.19466.marex@denx.de> (raw)
In-Reply-To: <20131004142421.543ee6c0@amdc308.digital.local>

Dear Lukasz Majewski,

> Hi Marek,
> 
> > Dear Lukasz Majewski,
> > 
> > > Hi Marek,
> > > 
> > > > Dear Lukasz Majewski,
> > > > 
> > > > > The s3c udc driver sends data in a max packet size. Therefore
> > > > > the dcache invalidate range shall be equal to max packet, not
> > > > > the entire DMA_BUFFER_SIZE.
> > > > > 
> > > > > Signed-off-by: Lukasz Majewski <l.majewski@samsung.com>
> > > > > Cc: Marek Vasut <marex@denx.de>
> > > > > ---
> > > > > 
> > > > >  drivers/usb/gadget/s3c_udc_otg_xfer_dma.c |    2 +-
> > > > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > > > > 
> > > > > diff --git a/drivers/usb/gadget/s3c_udc_otg_xfer_dma.c
> > > > > b/drivers/usb/gadget/s3c_udc_otg_xfer_dma.c index
> > > > > d7af5e9..5e3ba76 100644 ---
> > > > > a/drivers/usb/gadget/s3c_udc_otg_xfer_dma.c +++
> > > > > b/drivers/usb/gadget/s3c_udc_otg_xfer_dma.c @@ -117,7 +117,7 @@
> > > > > static int setdma_rx(struct s3c_ep *ep, struct s3c_request *req)
> > > > > 
> > > > >  	invalidate_dcache_range((unsigned long)
> > > > > 
> > > > > ep->dev->dma_buf[ep_num], (unsigned long)
> > > > > ep->dev->dma_buf[ep_num]
> > > > > -				+ DMA_BUFFER_SIZE);
> > > > > +				+ ep->ep.maxpacket);
> > > > 
> > > > Is this maxpacket _always_ multiple of cacheline big or will you
> > > > need some ROUND_UP() call here ?
> > > 
> > > The maxpacket value is equal to 64 B for EP0 and 512 B for EP1 and
> > > EP2 (wMaxPacketSize field of the descriptor).
> > > 
> > > Moreover this invalidation is done on already memaligned buffer
> > > (which is 16 KiB). In other words, we are copying data to specially
> > > prepared buffer (per UDC device EP, not usb_request).
> > > 
> > > In my opinion the maxpacket don't need to be rounded up.
> > 
> > So it can never happen that ep maxpacket is unaligned?
> 
> maxpacket can be defined as e.g. 16 Bytes (wMaxPacketSize).
> 
> However the underlying buffer (on which we perform dcache invalidation)
> is already cache line aware (defined with memalign).
> Also we copy the usb request data there (yes I know that this is not
> the best possible solution). Afterwards address of this buffer is a
> starting point for DMA.
> Since we are sending in the HW one packet at a time (with maxpacket
> size), then it should be enough to invalidate only up to 512 B.
> Previously the whole buffer (DMA_BUFFER_SIZE -> 16 KiB) was
> invalidated each time.
> 
> Since we are invalidating cache content corresponding to buffer mapped
> memory, we are safe when D-cache controller invalidates 32B
> (CACHE_LINE_SIZE) instead of 16B.

I get it, but if the size is lower than CACHE_LINE_SIZE, it will not get 
invalidated at all. Thus the roundup might be needed.
 
> > > > Best regards,
> > > > Marek Vasut
> > > 
> > > Since this is Samsung's UDC specific (not THOR download) - would it
> > > be possible to take this patch from this patch series (of course if
> > > my above rationale is acceptable for you)?
> > 
> > You mean for .10 ?
> 
> This patch hasn't introduced regressions for DFU/UMS. It can be applied
> to .10 or to u-boot-usb/next.

If it's not an explicit fix, this will go to -next

Best regards,

  reply	other threads:[~2013-10-04 16:18 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-03 11:47 [U-Boot] [PATCH 00/10] usb: Support for TIZEN's THOR download protocol Lukasz Majewski
2013-10-03 11:47 ` [U-Boot] [PATCH 01/10] usb:udc:s3c: Reduce dcache invalidate range for UDC receive buffer Lukasz Majewski
2013-10-03 15:21   ` Marek Vasut
2013-10-04  7:28     ` Lukasz Majewski
2013-10-04 10:26       ` Marek Vasut
2013-10-04 12:24         ` Lukasz Majewski
2013-10-04 16:18           ` Marek Vasut [this message]
2013-10-04 17:37             ` Lukasz Majewski
2013-10-04 18:01               ` Marek Vasut
2013-10-03 11:47 ` [U-Boot] [PATCH 02/10] dfu:core: Find DFU alt setting number by passing its name Lukasz Majewski
2013-10-03 11:47 ` [U-Boot] [PATCH 03/10] dfu:core: Export dfu_{get|free}_buf functions Lukasz Majewski
2013-10-03 11:47 ` [U-Boot] [PATCH 04/10] usb:g_dnl: Replace static usb_configuration structure with dynamically allocated one Lukasz Majewski
2013-10-03 11:47 ` [U-Boot] [PATCH 05/10] usb:g_dnl: Add name parameter to g_dnl_bind_fixup function Lukasz Majewski
2013-10-03 11:47 ` [U-Boot] [PATCH 06/10] usb:g_dnl:f_thor: USB download function to support TIZEN's THOR protocol Lukasz Majewski
2013-10-03 15:48   ` Marek Vasut
2013-10-04  8:30     ` Lukasz Majewski
2013-10-04 10:28       ` Marek Vasut
2013-10-04 12:05         ` Lukasz Majewski
2013-10-03 11:47 ` [U-Boot] [PATCH 07/10] usb:g_dnl: Support for TIZEN's THOR function at generic download code Lukasz Majewski
2013-10-03 11:47 ` [U-Boot] [PATCH 08/10] cmd:thor: Support for TIZEN's download (thordown) command Lukasz Majewski
2013-10-03 11:47 ` [U-Boot] [PATCH 09/10] samsung:common:thor: Define common Samsung code to handle THOR usb descriptor setup Lukasz Majewski
2013-10-03 11:47 ` [U-Boot] [PATCH 10/10] trats: Update TRATS config to support TIZEN download Lukasz Majewski
2013-10-03 15:51   ` Marek Vasut
2013-10-04  8:32     ` Lukasz Majewski
2013-10-08 12:30 ` [U-Boot] [PATCH v2 00/10] usb: Support for TIZEN's THOR download protocol Lukasz Majewski
2013-10-08 12:30   ` [U-Boot] [PATCH v2 01/10] usb:udc:s3c: Reduce dcache invalidate range for UDC receive buffer Lukasz Majewski
2013-10-08 12:30   ` [U-Boot] [PATCH v2 02/10] dfu:core: Find DFU alt setting number by passing its name Lukasz Majewski
2013-10-08 12:30   ` [U-Boot] [PATCH v2 03/10] dfu:core: Export dfu_{get|free}_buf functions Lukasz Majewski
2013-10-08 12:30   ` [U-Boot] [PATCH v2 04/10] usb:g_dnl: Replace static usb_configuration structure with dynamically allocated one Lukasz Majewski
2013-10-08 12:30   ` [U-Boot] [PATCH v2 05/10] usb:g_dnl: Add name parameter to g_dnl_bind_fixup function Lukasz Majewski
2013-10-08 12:30   ` [U-Boot] [PATCH v2 06/10] usb:g_dnl:f_thor: USB download function to support TIZEN's THOR protocol Lukasz Majewski
2013-10-08 12:30   ` [U-Boot] [PATCH v2 07/10] usb:g_dnl: Support for TIZEN's THOR function in generic download code Lukasz Majewski
2013-10-08 12:30   ` [U-Boot] [PATCH v2 08/10] cmd:thor: Support for TIZEN's download command (thordown) Lukasz Majewski
2013-10-08 12:30   ` [U-Boot] [PATCH v2 09/10] samsung:common:thor: Define common Samsung code to handle THOR usb descriptor setup Lukasz Majewski
2013-10-08 12:30   ` [U-Boot] [PATCH v2 10/10] trats: Update TRATS config to support TIZEN download Lukasz Majewski
2013-10-10  0:41   ` [U-Boot] [PATCH v2 00/10] usb: Support for TIZEN's THOR download protocol 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=201310041818.19466.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.