]>
Commit | Line | Data |
---|---|---|
5fd54ace | 1 | // SPDX-License-Identifier: GPL-2.0 |
0c6a8818 BW |
2 | /* |
3 | * Copyright (C) 2007 by Analog Devices, Inc. | |
0c6a8818 BW |
4 | */ |
5 | ||
6 | #ifndef __MUSB_BLACKFIN_H__ | |
7 | #define __MUSB_BLACKFIN_H__ | |
8 | ||
9 | /* | |
10 | * Blackfin specific definitions | |
11 | */ | |
12 | ||
daf5822f SZ |
13 | /* Anomalies notes: |
14 | * | |
15 | * 05000450 - USB DMA Mode 1 Short Packet Data Corruption: | |
16 | * MUSB driver is designed to transfer buffer of N * maxpacket size | |
17 | * in DMA mode 1 and leave the rest of the data to the next | |
18 | * transfer in DMA mode 0, so we never transmit a short packet in | |
19 | * DMA mode 1. | |
20 | * | |
21 | * 05000463 - This anomaly doesn't affect this driver since it | |
22 | * never uses L1 or L2 memory as data destination. | |
23 | * | |
24 | * 05000464 - This anomaly doesn't affect this driver since it | |
25 | * never uses L1 or L2 memory as data source. | |
26 | * | |
27 | * 05000465 - The anomaly can be seen when SCLK is over 100 MHz, and there is | |
28 | * no way to workaround for bulk endpoints. Since the wMaxPackSize | |
29 | * of bulk is less than or equal to 512, while the fifo size of | |
30 | * endpoint 5, 6, 7 is 1024, the double buffer mode is enabled | |
31 | * automatically when these endpoints are used for bulk OUT. | |
32 | * | |
33 | * 05000466 - This anomaly doesn't affect this driver since it never mixes | |
34 | * concurrent DMA and core accesses to the TX endpoint FIFOs. | |
35 | * | |
36 | * 05000467 - The workaround for this anomaly will introduce another | |
37 | * anomaly - 05000465. | |
38 | */ | |
39 | ||
0702794c SZ |
40 | /* The Mentor USB DMA engine on BF52x (silicon v0.0 and v0.1) seems to be |
41 | * unstable in host mode. This may be caused by Anomaly 05000380. After | |
42 | * digging out the root cause, we will change this number accordingly. | |
43 | * So, need to either use silicon v0.2+ or disable DMA mode in MUSB. | |
44 | */ | |
45 | #if ANOMALY_05000380 && defined(CONFIG_BF52x) && \ | |
62285963 | 46 | !defined(CONFIG_MUSB_PIO_ONLY) |
0702794c SZ |
47 | # error "Please use PIO mode in MUSB driver on bf52x chip v0.0 and v0.1" |
48 | #endif | |
49 | ||
0c6a8818 BW |
50 | #undef DUMP_FIFO_DATA |
51 | #ifdef DUMP_FIFO_DATA | |
52 | static void dump_fifo_data(u8 *buf, u16 len) | |
53 | { | |
54 | u8 *tmp = buf; | |
55 | int i; | |
56 | ||
57 | for (i = 0; i < len; i++) { | |
58 | if (!(i % 16) && i) | |
59 | pr_debug("\n"); | |
60 | pr_debug("%02x ", *tmp++); | |
61 | } | |
62 | pr_debug("\n"); | |
63 | } | |
64 | #else | |
65 | #define dump_fifo_data(buf, len) do {} while (0) | |
66 | #endif | |
67 | ||
0c6a8818 BW |
68 | |
69 | #define USB_DMA_BASE USB_DMA_INTERRUPT | |
70 | #define USB_DMAx_CTRL 0x04 | |
71 | #define USB_DMAx_ADDR_LOW 0x08 | |
72 | #define USB_DMAx_ADDR_HIGH 0x0C | |
73 | #define USB_DMAx_COUNT_LOW 0x10 | |
74 | #define USB_DMAx_COUNT_HIGH 0x14 | |
75 | ||
76 | #define USB_DMA_REG(ep, reg) (USB_DMA_BASE + 0x20 * ep + reg) | |
0c6a8818 BW |
77 | |
78 | /* Almost 1 second */ | |
79 | #define TIMER_DELAY (1 * HZ) | |
80 | ||
0c6a8818 | 81 | #endif /* __MUSB_BLACKFIN_H__ */ |