]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blob - drivers/usb/host/isp1760-hcd.h
44486c86f5f7cf655953b0daf10f1bd5d29d9131
[mirror_ubuntu-bionic-kernel.git] / drivers / usb / host / isp1760-hcd.h
1 #ifndef _ISP1760_HCD_H_
2 #define _ISP1760_HCD_H_
3
4 #include <linux/spinlock.h>
5
6 struct gpio_desc;
7 struct isp1760_qh;
8 struct isp1760_qtd;
9 struct resource;
10 struct usb_hcd;
11
12 /*
13 * 60kb divided in:
14 * - 32 blocks @ 256 bytes
15 * - 20 blocks @ 1024 bytes
16 * - 4 blocks @ 8192 bytes
17 */
18
19 #define BLOCK_1_NUM 32
20 #define BLOCK_2_NUM 20
21 #define BLOCK_3_NUM 4
22
23 #define BLOCK_1_SIZE 256
24 #define BLOCK_2_SIZE 1024
25 #define BLOCK_3_SIZE 8192
26 #define BLOCKS (BLOCK_1_NUM + BLOCK_2_NUM + BLOCK_3_NUM)
27 #define MAX_PAYLOAD_SIZE BLOCK_3_SIZE
28 #define PAYLOAD_AREA_SIZE 0xf000
29
30 /*
31 * Device flags that can vary from board to board. All of these
32 * indicate the most "atypical" case, so that a devflags of 0 is
33 * a sane default configuration.
34 */
35 #define ISP1760_FLAG_BUS_WIDTH_16 0x00000002 /* 16-bit data bus width */
36 #define ISP1760_FLAG_OTG_EN 0x00000004 /* Port 1 supports OTG */
37 #define ISP1760_FLAG_ANALOG_OC 0x00000008 /* Analog overcurrent */
38 #define ISP1760_FLAG_DACK_POL_HIGH 0x00000010 /* DACK active high */
39 #define ISP1760_FLAG_DREQ_POL_HIGH 0x00000020 /* DREQ active high */
40 #define ISP1760_FLAG_ISP1761 0x00000040 /* Chip is ISP1761 */
41 #define ISP1760_FLAG_INTR_POL_HIGH 0x00000080 /* Interrupt polarity active high */
42 #define ISP1760_FLAG_INTR_EDGE_TRIG 0x00000100 /* Interrupt edge triggered */
43
44 struct isp1760_slotinfo {
45 struct isp1760_qh *qh;
46 struct isp1760_qtd *qtd;
47 unsigned long timestamp;
48 };
49
50 /* chip memory management */
51 struct isp1760_memory_chunk {
52 unsigned int start;
53 unsigned int size;
54 unsigned int free;
55 };
56
57 enum isp1760_queue_head_types {
58 QH_CONTROL,
59 QH_BULK,
60 QH_INTERRUPT,
61 QH_END
62 };
63
64 struct isp1760_hcd {
65 struct usb_hcd *hcd;
66
67 u32 hcs_params;
68 spinlock_t lock;
69 struct isp1760_slotinfo atl_slots[32];
70 int atl_done_map;
71 struct isp1760_slotinfo int_slots[32];
72 int int_done_map;
73 struct isp1760_memory_chunk memory_pool[BLOCKS];
74 struct list_head qh_list[QH_END];
75
76 /* periodic schedule support */
77 #define DEFAULT_I_TDPS 1024
78 unsigned periodic_size;
79 unsigned i_thresh;
80 unsigned long reset_done;
81 unsigned long next_statechange;
82 unsigned int devflags;
83
84 struct gpio_desc *rst_gpio;
85 };
86
87 /* exports for if */
88 int isp1760_register(struct resource *mem, int irq, unsigned long irqflags,
89 struct device *dev, unsigned int devflags);
90 void isp1760_unregister(struct device *dev);
91
92 int isp1760_init_kmem_once(void);
93 void isp1760_deinit_kmem_cache(void);
94
95 #endif /* _ISP1760_HCD_H_ */