Commit 716662bd194f72cdf9bf05e0f57d9f6944dc953a

Authored by Lukasz Majewski
Committed by Marek Vasut
1 parent 16b7a29fc6

usb:udc:samsung: Remove redundant cache operation from Samsung UDC driver

A set of cache operations (both invalidation and flush) were redundant
in the S3C HS OTG Samsung driver:

1. s3c_udc_ep0_zlp - to transmit EP0's ZLP packets one don't need to flush
the cache (since it is the zero length transmission)

2. s3c_udc_pre_setup and s3c_ep0_complete_out - cache invalidation is not
needed when the buffer for OUT EP0 transmission is setup, since no data
has yet arrived.

Cache cleanups presented above don't contribute much to transmission speed
up, hence shall be regarded as cosmetic changes.

3. setdma_rx - here the s3c UDC driver's internal buffers were invalidated.
This call is not needed anymore since we reuse the buffers passed from
gadgets. This is a key contribution to transmission speed improvement.

Test condition
- test HW + measurement: Trats - Exynos4210 rev.1
- test HW Trats2 - Exynos4412 rev.1
400 MiB compressed rootfs image download with `thor 0 mmc 0`

Measurements:

Base values (without improvement):
Transmission speed: 9.51 MiB/s

After the change:
Transmission speed: 10.15 MiB/s

Signed-off-by: Lukasz Majewski <l.majewski@samsung.com>
Cc: Marek Vasut <marex@denx.de>

Showing 1 changed file with 0 additions and 17 deletions Side-by-side Diff

drivers/usb/gadget/s3c_udc_otg_xfer_dma.c
... ... @@ -29,10 +29,6 @@
29 29 {
30 30 u32 ep_ctrl;
31 31  
32   - flush_dcache_range((unsigned long) usb_ctrl_dma_addr,
33   - (unsigned long) usb_ctrl_dma_addr
34   - + DMA_BUFFER_SIZE);
35   -
36 32 writel(usb_ctrl_dma_addr, &reg->in_endp[EP0_CON].diepdma);
37 33 writel(DIEPT_SIZ_PKT_CNT(1), &reg->in_endp[EP0_CON].dieptsiz);
38 34  
... ... @@ -52,10 +48,6 @@
52 48 debug_cond(DEBUG_IN_EP,
53 49 "%s : Prepare Setup packets.\n", __func__);
54 50  
55   - invalidate_dcache_range((unsigned long) usb_ctrl_dma_addr,
56   - (unsigned long) usb_ctrl_dma_addr
57   - + DMA_BUFFER_SIZE);
58   -
59 51 writel(DOEPT_SIZ_PKT_CNT(1) | sizeof(struct usb_ctrlrequest),
60 52 &reg->out_endp[EP0_CON].doeptsiz);
61 53 writel(usb_ctrl_dma_addr, &reg->out_endp[EP0_CON].doepdma);
... ... @@ -82,10 +74,6 @@
82 74 debug_cond(DEBUG_IN_EP,
83 75 "%s : Prepare Complete Out packet.\n", __func__);
84 76  
85   - invalidate_dcache_range((unsigned long) usb_ctrl_dma_addr,
86   - (unsigned long) usb_ctrl_dma_addr
87   - + DMA_BUFFER_SIZE);
88   -
89 77 writel(DOEPT_SIZ_PKT_CNT(1) | sizeof(struct usb_ctrlrequest),
90 78 &reg->out_endp[EP0_CON].doeptsiz);
91 79 writel(usb_ctrl_dma_addr, &reg->out_endp[EP0_CON].doepdma);
... ... @@ -114,11 +102,6 @@
114 102  
115 103 ep->len = length;
116 104 ep->dma_buf = buf;
117   -
118   - invalidate_dcache_range((unsigned long) ep->dev->dma_buf[ep_num],
119   - (unsigned long) ep->dev->dma_buf[ep_num]
120   - + ROUND(ep->ep.maxpacket,
121   - CONFIG_SYS_CACHELINE_SIZE));
122 105  
123 106 if (length == 0)
124 107 pktcnt = 1;