| .. | .. |
|---|
| 84 | 84 | DS_STALLED, |
|---|
| 85 | 85 | }; |
|---|
| 86 | 86 | |
|---|
| 87 | | -struct dbc_request { |
|---|
| 88 | | - void *buf; |
|---|
| 89 | | - unsigned int length; |
|---|
| 90 | | - dma_addr_t dma; |
|---|
| 91 | | - void (*complete)(struct xhci_hcd *xhci, |
|---|
| 92 | | - struct dbc_request *req); |
|---|
| 93 | | - struct list_head list_pool; |
|---|
| 94 | | - int status; |
|---|
| 95 | | - unsigned int actual; |
|---|
| 96 | | - |
|---|
| 97 | | - struct dbc_ep *dep; |
|---|
| 98 | | - struct list_head list_pending; |
|---|
| 99 | | - dma_addr_t trb_dma; |
|---|
| 100 | | - union xhci_trb *trb; |
|---|
| 101 | | - unsigned direction:1; |
|---|
| 102 | | -}; |
|---|
| 103 | | - |
|---|
| 104 | 87 | struct dbc_ep { |
|---|
| 105 | 88 | struct xhci_dbc *dbc; |
|---|
| 106 | 89 | struct list_head list_pending; |
|---|
| 107 | 90 | struct xhci_ring *ring; |
|---|
| 108 | | - unsigned direction:1; |
|---|
| 91 | + unsigned int direction:1; |
|---|
| 109 | 92 | }; |
|---|
| 110 | 93 | |
|---|
| 111 | 94 | #define DBC_QUEUE_SIZE 16 |
|---|
| .. | .. |
|---|
| 127 | 110 | struct kfifo write_fifo; |
|---|
| 128 | 111 | |
|---|
| 129 | 112 | bool registered; |
|---|
| 130 | | - struct dbc_ep *in; |
|---|
| 131 | | - struct dbc_ep *out; |
|---|
| 113 | +}; |
|---|
| 114 | + |
|---|
| 115 | +struct dbc_driver { |
|---|
| 116 | + int (*configure)(struct xhci_dbc *dbc); |
|---|
| 117 | + void (*disconnect)(struct xhci_dbc *dbc); |
|---|
| 132 | 118 | }; |
|---|
| 133 | 119 | |
|---|
| 134 | 120 | struct xhci_dbc { |
|---|
| 135 | 121 | spinlock_t lock; /* device access */ |
|---|
| 122 | + struct device *dev; |
|---|
| 136 | 123 | struct xhci_hcd *xhci; |
|---|
| 137 | 124 | struct dbc_regs __iomem *regs; |
|---|
| 138 | 125 | struct xhci_ring *ring_evt; |
|---|
| .. | .. |
|---|
| 150 | 137 | unsigned resume_required:1; |
|---|
| 151 | 138 | struct dbc_ep eps[2]; |
|---|
| 152 | 139 | |
|---|
| 153 | | - struct dbc_port port; |
|---|
| 140 | + const struct dbc_driver *driver; |
|---|
| 141 | + void *priv; |
|---|
| 142 | +}; |
|---|
| 143 | + |
|---|
| 144 | +struct dbc_request { |
|---|
| 145 | + void *buf; |
|---|
| 146 | + unsigned int length; |
|---|
| 147 | + dma_addr_t dma; |
|---|
| 148 | + void (*complete)(struct xhci_dbc *dbc, |
|---|
| 149 | + struct dbc_request *req); |
|---|
| 150 | + struct list_head list_pool; |
|---|
| 151 | + int status; |
|---|
| 152 | + unsigned int actual; |
|---|
| 153 | + |
|---|
| 154 | + struct xhci_dbc *dbc; |
|---|
| 155 | + struct list_head list_pending; |
|---|
| 156 | + dma_addr_t trb_dma; |
|---|
| 157 | + union xhci_trb *trb; |
|---|
| 158 | + unsigned direction:1; |
|---|
| 154 | 159 | }; |
|---|
| 155 | 160 | |
|---|
| 156 | 161 | #define dbc_bulkout_ctx(d) \ |
|---|
| .. | .. |
|---|
| 178 | 183 | EVT_DISC, |
|---|
| 179 | 184 | }; |
|---|
| 180 | 185 | |
|---|
| 181 | | -static inline struct dbc_ep *get_in_ep(struct xhci_hcd *xhci) |
|---|
| 186 | +static inline struct dbc_ep *get_in_ep(struct xhci_dbc *dbc) |
|---|
| 182 | 187 | { |
|---|
| 183 | | - struct xhci_dbc *dbc = xhci->dbc; |
|---|
| 184 | | - |
|---|
| 185 | 188 | return &dbc->eps[BULK_IN]; |
|---|
| 186 | 189 | } |
|---|
| 187 | 190 | |
|---|
| 188 | | -static inline struct dbc_ep *get_out_ep(struct xhci_hcd *xhci) |
|---|
| 191 | +static inline struct dbc_ep *get_out_ep(struct xhci_dbc *dbc) |
|---|
| 189 | 192 | { |
|---|
| 190 | | - struct xhci_dbc *dbc = xhci->dbc; |
|---|
| 191 | | - |
|---|
| 192 | 193 | return &dbc->eps[BULK_OUT]; |
|---|
| 193 | 194 | } |
|---|
| 194 | 195 | |
|---|
| 195 | 196 | #ifdef CONFIG_USB_XHCI_DBGCAP |
|---|
| 196 | 197 | int xhci_dbc_init(struct xhci_hcd *xhci); |
|---|
| 197 | 198 | void xhci_dbc_exit(struct xhci_hcd *xhci); |
|---|
| 198 | | -int xhci_dbc_tty_register_driver(struct xhci_hcd *xhci); |
|---|
| 199 | | -void xhci_dbc_tty_unregister_driver(void); |
|---|
| 200 | | -int xhci_dbc_tty_register_device(struct xhci_hcd *xhci); |
|---|
| 201 | | -void xhci_dbc_tty_unregister_device(struct xhci_hcd *xhci); |
|---|
| 202 | | -struct dbc_request *dbc_alloc_request(struct dbc_ep *dep, gfp_t gfp_flags); |
|---|
| 203 | | -void dbc_free_request(struct dbc_ep *dep, struct dbc_request *req); |
|---|
| 204 | | -int dbc_ep_queue(struct dbc_ep *dep, struct dbc_request *req, gfp_t gfp_flags); |
|---|
| 199 | +int xhci_dbc_tty_probe(struct xhci_hcd *xhci); |
|---|
| 200 | +void xhci_dbc_tty_remove(struct xhci_dbc *dbc); |
|---|
| 201 | +struct dbc_request *dbc_alloc_request(struct xhci_dbc *dbc, |
|---|
| 202 | + unsigned int direction, |
|---|
| 203 | + gfp_t flags); |
|---|
| 204 | +void dbc_free_request(struct dbc_request *req); |
|---|
| 205 | +int dbc_ep_queue(struct dbc_request *req); |
|---|
| 205 | 206 | #ifdef CONFIG_PM |
|---|
| 206 | 207 | int xhci_dbc_suspend(struct xhci_hcd *xhci); |
|---|
| 207 | 208 | int xhci_dbc_resume(struct xhci_hcd *xhci); |
|---|