blob: b49a362fb9faa0907124bb3cac1506c1fc09efff [file] [log] [blame]
Bryan Wu0c6a8812008-12-02 21:33:44 +02001/*
2 * Copyright (C) 2007 by Analog Devices, Inc.
3 *
4 * The Inventra Controller Driver for Linux is free software; you
5 * can redistribute it and/or modify it under the terms of the GNU
6 * General Public License version 2 as published by the Free Software
7 * Foundation.
8 */
9
10#ifndef __MUSB_BLACKFIN_H__
11#define __MUSB_BLACKFIN_H__
12
13/*
14 * Blackfin specific definitions
15 */
16
Sonic Zhangdaf58222009-11-16 19:13:08 +053017/* Anomalies notes:
18 *
19 * 05000450 - USB DMA Mode 1 Short Packet Data Corruption:
20 * MUSB driver is designed to transfer buffer of N * maxpacket size
21 * in DMA mode 1 and leave the rest of the data to the next
22 * transfer in DMA mode 0, so we never transmit a short packet in
23 * DMA mode 1.
24 *
25 * 05000463 - This anomaly doesn't affect this driver since it
26 * never uses L1 or L2 memory as data destination.
27 *
28 * 05000464 - This anomaly doesn't affect this driver since it
29 * never uses L1 or L2 memory as data source.
30 *
31 * 05000465 - The anomaly can be seen when SCLK is over 100 MHz, and there is
32 * no way to workaround for bulk endpoints. Since the wMaxPackSize
33 * of bulk is less than or equal to 512, while the fifo size of
34 * endpoint 5, 6, 7 is 1024, the double buffer mode is enabled
35 * automatically when these endpoints are used for bulk OUT.
36 *
37 * 05000466 - This anomaly doesn't affect this driver since it never mixes
38 * concurrent DMA and core accesses to the TX endpoint FIFOs.
39 *
40 * 05000467 - The workaround for this anomaly will introduce another
41 * anomaly - 05000465.
42 */
43
Bryan Wu0c6a8812008-12-02 21:33:44 +020044#undef DUMP_FIFO_DATA
45#ifdef DUMP_FIFO_DATA
46static void dump_fifo_data(u8 *buf, u16 len)
47{
48 u8 *tmp = buf;
49 int i;
50
51 for (i = 0; i < len; i++) {
52 if (!(i % 16) && i)
53 pr_debug("\n");
54 pr_debug("%02x ", *tmp++);
55 }
56 pr_debug("\n");
57}
58#else
59#define dump_fifo_data(buf, len) do {} while (0)
60#endif
61
62#ifdef CONFIG_BF52x
63
64#define USB_DMA_BASE USB_DMA_INTERRUPT
65#define USB_DMAx_CTRL 0x04
66#define USB_DMAx_ADDR_LOW 0x08
67#define USB_DMAx_ADDR_HIGH 0x0C
68#define USB_DMAx_COUNT_LOW 0x10
69#define USB_DMAx_COUNT_HIGH 0x14
70
71#define USB_DMA_REG(ep, reg) (USB_DMA_BASE + 0x20 * ep + reg)
72#endif
73
74/* Almost 1 second */
75#define TIMER_DELAY (1 * HZ)
76
77static struct timer_list musb_conn_timer;
78
79#endif /* __MUSB_BLACKFIN_H__ */