bpf: Prevent memory disambiguation attack
[linux/fpc-iii.git] / drivers / usb / musb / blackfin.h
blob5b149915b0f8070f3c0ae9f147c2aa14998f3851
1 // SPDX-License-Identifier: GPL-2.0
2 /*
3 * Copyright (C) 2007 by Analog Devices, Inc.
4 */
6 #ifndef __MUSB_BLACKFIN_H__
7 #define __MUSB_BLACKFIN_H__
9 /*
10 * Blackfin specific definitions
13 /* Anomalies notes:
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.
21 * 05000463 - This anomaly doesn't affect this driver since it
22 * never uses L1 or L2 memory as data destination.
24 * 05000464 - This anomaly doesn't affect this driver since it
25 * never uses L1 or L2 memory as data source.
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.
33 * 05000466 - This anomaly doesn't affect this driver since it never mixes
34 * concurrent DMA and core accesses to the TX endpoint FIFOs.
36 * 05000467 - The workaround for this anomaly will introduce another
37 * anomaly - 05000465.
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.
45 #if ANOMALY_05000380 && defined(CONFIG_BF52x) && \
46 !defined(CONFIG_MUSB_PIO_ONLY)
47 # error "Please use PIO mode in MUSB driver on bf52x chip v0.0 and v0.1"
48 #endif
50 #undef DUMP_FIFO_DATA
51 #ifdef DUMP_FIFO_DATA
52 static void dump_fifo_data(u8 *buf, u16 len)
54 u8 *tmp = buf;
55 int i;
57 for (i = 0; i < len; i++) {
58 if (!(i % 16) && i)
59 pr_debug("\n");
60 pr_debug("%02x ", *tmp++);
62 pr_debug("\n");
64 #else
65 #define dump_fifo_data(buf, len) do {} while (0)
66 #endif
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
76 #define USB_DMA_REG(ep, reg) (USB_DMA_BASE + 0x20 * ep + reg)
78 /* Almost 1 second */
79 #define TIMER_DELAY (1 * HZ)
81 #endif /* __MUSB_BLACKFIN_H__ */