aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/musb/blackfin.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb/musb/blackfin.c')
-rw-r--r--drivers/usb/musb/blackfin.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/drivers/usb/musb/blackfin.c b/drivers/usb/musb/blackfin.c
index 52312e8af213..8e2a1ff8a35a 100644
--- a/drivers/usb/musb/blackfin.c
+++ b/drivers/usb/musb/blackfin.c
@@ -21,6 +21,7 @@
21#include <asm/cacheflush.h> 21#include <asm/cacheflush.h>
22 22
23#include "musb_core.h" 23#include "musb_core.h"
24#include "musbhsdma.h"
24#include "blackfin.h" 25#include "blackfin.h"
25 26
26struct bfin_glue { 27struct bfin_glue {
@@ -332,6 +333,27 @@ static int bfin_musb_set_mode(struct musb *musb, u8 musb_mode)
332 return -EIO; 333 return -EIO;
333} 334}
334 335
336static int bfin_musb_adjust_channel_params(struct dma_channel *channel,
337 u16 packet_sz, u8 *mode,
338 dma_addr_t *dma_addr, u32 *len)
339{
340 struct musb_dma_channel *musb_channel = channel->private_data;
341
342 /*
343 * Anomaly 05000450 might cause data corruption when using DMA
344 * MODE 1 transmits with short packet. So to work around this,
345 * we truncate all MODE 1 transfers down to a multiple of the
346 * max packet size, and then do the last short packet transfer
347 * (if there is any) using MODE 0.
348 */
349 if (ANOMALY_05000450) {
350 if (musb_channel->transmit && *mode == 1)
351 *len = *len - (*len % packet_sz);
352 }
353
354 return 0;
355}
356
335static void bfin_musb_reg_init(struct musb *musb) 357static void bfin_musb_reg_init(struct musb *musb)
336{ 358{
337 if (ANOMALY_05000346) { 359 if (ANOMALY_05000346) {
@@ -430,6 +452,8 @@ static const struct musb_platform_ops bfin_ops = {
430 452
431 .vbus_status = bfin_musb_vbus_status, 453 .vbus_status = bfin_musb_vbus_status,
432 .set_vbus = bfin_musb_set_vbus, 454 .set_vbus = bfin_musb_set_vbus,
455
456 .adjust_channel_params = bfin_musb_adjust_channel_params,
433}; 457};
434 458
435static u64 bfin_dmamask = DMA_BIT_MASK(32); 459static u64 bfin_dmamask = DMA_BIT_MASK(32);