xref: /linux/drivers/usb/host/fhci.h (revision 27729aadd31dafddaaf64c24f8ef6d0ff750f3aa)
1236dd4d1SAnton Vorontsov /*
2236dd4d1SAnton Vorontsov  * Freescale QUICC Engine USB Host Controller Driver
3236dd4d1SAnton Vorontsov  *
4236dd4d1SAnton Vorontsov  * Copyright (c) Freescale Semicondutor, Inc. 2006.
5236dd4d1SAnton Vorontsov  *               Shlomi Gridish <gridish@freescale.com>
6236dd4d1SAnton Vorontsov  *               Jerry Huang <Chang-Ming.Huang@freescale.com>
7236dd4d1SAnton Vorontsov  * Copyright (c) Logic Product Development, Inc. 2007
8236dd4d1SAnton Vorontsov  *               Peter Barada <peterb@logicpd.com>
9236dd4d1SAnton Vorontsov  * Copyright (c) MontaVista Software, Inc. 2008.
10236dd4d1SAnton Vorontsov  *               Anton Vorontsov <avorontsov@ru.mvista.com>
11236dd4d1SAnton Vorontsov  *
12236dd4d1SAnton Vorontsov  * This program is free software; you can redistribute  it and/or modify it
13236dd4d1SAnton Vorontsov  * under  the terms of  the GNU General  Public License as published by the
14236dd4d1SAnton Vorontsov  * Free Software Foundation;  either version 2 of the  License, or (at your
15236dd4d1SAnton Vorontsov  * option) any later version.
16236dd4d1SAnton Vorontsov  */
17236dd4d1SAnton Vorontsov 
18236dd4d1SAnton Vorontsov #ifndef __FHCI_H
19236dd4d1SAnton Vorontsov #define __FHCI_H
20236dd4d1SAnton Vorontsov 
21236dd4d1SAnton Vorontsov #include <linux/kernel.h>
22236dd4d1SAnton Vorontsov #include <linux/types.h>
23236dd4d1SAnton Vorontsov #include <linux/spinlock.h>
24236dd4d1SAnton Vorontsov #include <linux/interrupt.h>
25236dd4d1SAnton Vorontsov #include <linux/kfifo.h>
26236dd4d1SAnton Vorontsov #include <linux/io.h>
27236dd4d1SAnton Vorontsov #include <linux/usb.h>
28*27729aadSEric Lescouet #include <linux/usb/hcd.h>
29236dd4d1SAnton Vorontsov #include <asm/qe.h>
30236dd4d1SAnton Vorontsov 
31236dd4d1SAnton Vorontsov #define USB_CLOCK	48000000
32236dd4d1SAnton Vorontsov 
33236dd4d1SAnton Vorontsov #define FHCI_PRAM_SIZE 0x100
34236dd4d1SAnton Vorontsov 
35236dd4d1SAnton Vorontsov #define MAX_EDS		32
36236dd4d1SAnton Vorontsov #define MAX_TDS		32
37236dd4d1SAnton Vorontsov 
38236dd4d1SAnton Vorontsov 
39236dd4d1SAnton Vorontsov /* CRC16 field size */
40236dd4d1SAnton Vorontsov #define CRC_SIZE 2
41236dd4d1SAnton Vorontsov 
42236dd4d1SAnton Vorontsov /* USB protocol overhead for each frame transmitted from the host */
43236dd4d1SAnton Vorontsov #define PROTOCOL_OVERHEAD 7
44236dd4d1SAnton Vorontsov 
45236dd4d1SAnton Vorontsov /* Packet structure, info field */
46236dd4d1SAnton Vorontsov #define PKT_PID_DATA0		0x80000000 /* PID - Data toggle zero */
47236dd4d1SAnton Vorontsov #define PKT_PID_DATA1		0x40000000 /* PID - Data toggle one  */
48236dd4d1SAnton Vorontsov #define PKT_PID_SETUP		0x20000000 /* PID - Setup bit */
49236dd4d1SAnton Vorontsov #define PKT_SETUP_STATUS	0x10000000 /* Setup status bit */
50236dd4d1SAnton Vorontsov #define PKT_SETADDR_STATUS	0x08000000 /* Set address status bit */
51236dd4d1SAnton Vorontsov #define PKT_SET_HOST_LAST	0x04000000 /* Last data packet */
52236dd4d1SAnton Vorontsov #define PKT_HOST_DATA		0x02000000 /* Data packet */
53236dd4d1SAnton Vorontsov #define PKT_FIRST_IN_FRAME	0x01000000 /* First packet in the frame */
54236dd4d1SAnton Vorontsov #define PKT_TOKEN_FRAME		0x00800000 /* Token packet */
55236dd4d1SAnton Vorontsov #define PKT_ZLP			0x00400000 /* Zero length packet */
56236dd4d1SAnton Vorontsov #define PKT_IN_TOKEN_FRAME	0x00200000 /* IN token packet */
57236dd4d1SAnton Vorontsov #define PKT_OUT_TOKEN_FRAME	0x00100000 /* OUT token packet */
58236dd4d1SAnton Vorontsov #define PKT_SETUP_TOKEN_FRAME	0x00080000 /* SETUP token packet */
59236dd4d1SAnton Vorontsov #define PKT_STALL_FRAME		0x00040000 /* STALL packet */
60236dd4d1SAnton Vorontsov #define PKT_NACK_FRAME		0x00020000 /* NACK packet */
61236dd4d1SAnton Vorontsov #define PKT_NO_PID		0x00010000 /* No PID */
62236dd4d1SAnton Vorontsov #define PKT_NO_CRC		0x00008000 /* don't append CRC */
63236dd4d1SAnton Vorontsov #define PKT_HOST_COMMAND	0x00004000 /* Host command packet */
64236dd4d1SAnton Vorontsov #define PKT_DUMMY_PACKET	0x00002000 /* Dummy packet, used for mmm */
65236dd4d1SAnton Vorontsov #define PKT_LOW_SPEED_PACKET	0x00001000 /* Low-Speed packet */
66236dd4d1SAnton Vorontsov 
67236dd4d1SAnton Vorontsov #define TRANS_OK		(0)
68236dd4d1SAnton Vorontsov #define TRANS_INPROGRESS	(-1)
69236dd4d1SAnton Vorontsov #define TRANS_DISCARD		(-2)
70236dd4d1SAnton Vorontsov #define TRANS_FAIL		(-3)
71236dd4d1SAnton Vorontsov 
72236dd4d1SAnton Vorontsov #define PS_INT		0
73236dd4d1SAnton Vorontsov #define PS_DISCONNECTED	1
74236dd4d1SAnton Vorontsov #define PS_CONNECTED	2
75236dd4d1SAnton Vorontsov #define PS_READY	3
76236dd4d1SAnton Vorontsov #define PS_MISSING	4
77236dd4d1SAnton Vorontsov 
78236dd4d1SAnton Vorontsov /* Transfer Descriptor status field */
79236dd4d1SAnton Vorontsov #define USB_TD_OK		0x00000000 /* TD transmited or received ok */
80236dd4d1SAnton Vorontsov #define USB_TD_INPROGRESS	0x80000000 /* TD is being transmitted */
81236dd4d1SAnton Vorontsov #define USB_TD_RX_ER_NONOCT	0x40000000 /* Tx Non Octet Aligned Packet */
82236dd4d1SAnton Vorontsov #define USB_TD_RX_ER_BITSTUFF	0x20000000 /* Frame Aborted-Received pkt */
83236dd4d1SAnton Vorontsov #define USB_TD_RX_ER_CRC	0x10000000 /* CRC error */
84236dd4d1SAnton Vorontsov #define USB_TD_RX_ER_OVERUN	0x08000000 /* Over - run occured */
85236dd4d1SAnton Vorontsov #define USB_TD_RX_ER_PID	0x04000000 /* wrong PID received */
86236dd4d1SAnton Vorontsov #define USB_TD_RX_DATA_UNDERUN	0x02000000 /* shorter than expected */
87236dd4d1SAnton Vorontsov #define USB_TD_RX_DATA_OVERUN	0x01000000 /* longer than expected */
88236dd4d1SAnton Vorontsov #define USB_TD_TX_ER_NAK	0x00800000 /* NAK handshake */
89236dd4d1SAnton Vorontsov #define USB_TD_TX_ER_STALL	0x00400000 /* STALL handshake */
90236dd4d1SAnton Vorontsov #define USB_TD_TX_ER_TIMEOUT	0x00200000 /* transmit time out */
91236dd4d1SAnton Vorontsov #define USB_TD_TX_ER_UNDERUN	0x00100000 /* transmit underrun */
92236dd4d1SAnton Vorontsov 
93236dd4d1SAnton Vorontsov #define USB_TD_ERROR (USB_TD_RX_ER_NONOCT | USB_TD_RX_ER_BITSTUFF | \
94236dd4d1SAnton Vorontsov 		USB_TD_RX_ER_CRC | USB_TD_RX_ER_OVERUN | USB_TD_RX_ER_PID | \
95236dd4d1SAnton Vorontsov 		USB_TD_RX_DATA_UNDERUN | USB_TD_RX_DATA_OVERUN | \
96236dd4d1SAnton Vorontsov 		USB_TD_TX_ER_NAK | USB_TD_TX_ER_STALL | \
97236dd4d1SAnton Vorontsov 		USB_TD_TX_ER_TIMEOUT | USB_TD_TX_ER_UNDERUN)
98236dd4d1SAnton Vorontsov 
99236dd4d1SAnton Vorontsov /* Transfer Descriptor toggle field */
100236dd4d1SAnton Vorontsov #define USB_TD_TOGGLE_DATA0	0
101236dd4d1SAnton Vorontsov #define USB_TD_TOGGLE_DATA1	1
102236dd4d1SAnton Vorontsov #define USB_TD_TOGGLE_CARRY	2
103236dd4d1SAnton Vorontsov 
104236dd4d1SAnton Vorontsov /* #define MULTI_DATA_BUS */
105236dd4d1SAnton Vorontsov 
106236dd4d1SAnton Vorontsov /* Bus mode register RBMR/TBMR */
107236dd4d1SAnton Vorontsov #define BUS_MODE_GBL	0x20	/* Global snooping */
108236dd4d1SAnton Vorontsov #define BUS_MODE_BO	0x18	/* Byte ordering */
109236dd4d1SAnton Vorontsov #define BUS_MODE_BO_BE	0x10	/* Byte ordering - Big-endian */
110236dd4d1SAnton Vorontsov #define BUS_MODE_DTB	0x02	/* Data bus */
111236dd4d1SAnton Vorontsov 
112236dd4d1SAnton Vorontsov /* FHCI QE USB Register Description */
113236dd4d1SAnton Vorontsov 
114236dd4d1SAnton Vorontsov /* USB Mode Register bit define */
115236dd4d1SAnton Vorontsov #define USB_MODE_EN		0x01
116236dd4d1SAnton Vorontsov #define USB_MODE_HOST		0x02
117236dd4d1SAnton Vorontsov #define USB_MODE_TEST		0x04
118236dd4d1SAnton Vorontsov #define USB_MODE_SFTE		0x08
119236dd4d1SAnton Vorontsov #define USB_MODE_RESUME		0x40
120236dd4d1SAnton Vorontsov #define USB_MODE_LSS		0x80
121236dd4d1SAnton Vorontsov 
122236dd4d1SAnton Vorontsov /* USB Slave Address Register Mask */
123236dd4d1SAnton Vorontsov #define USB_SLVADDR_MASK	0x7F
124236dd4d1SAnton Vorontsov 
125236dd4d1SAnton Vorontsov /* USB Endpoint register define */
126236dd4d1SAnton Vorontsov #define USB_EPNUM_MASK		0xF000
127236dd4d1SAnton Vorontsov #define USB_EPNUM_SHIFT		12
128236dd4d1SAnton Vorontsov 
129236dd4d1SAnton Vorontsov #define USB_TRANS_MODE_SHIFT	8
130236dd4d1SAnton Vorontsov #define USB_TRANS_CTR		0x0000
131236dd4d1SAnton Vorontsov #define USB_TRANS_INT		0x0100
132236dd4d1SAnton Vorontsov #define USB_TRANS_BULK		0x0200
133236dd4d1SAnton Vorontsov #define USB_TRANS_ISO		0x0300
134236dd4d1SAnton Vorontsov 
135236dd4d1SAnton Vorontsov #define USB_EP_MF		0x0020
136236dd4d1SAnton Vorontsov #define USB_EP_RTE		0x0010
137236dd4d1SAnton Vorontsov 
138236dd4d1SAnton Vorontsov #define USB_THS_SHIFT		2
139236dd4d1SAnton Vorontsov #define USB_THS_MASK		0x000c
140236dd4d1SAnton Vorontsov #define USB_THS_NORMAL		0x0
141236dd4d1SAnton Vorontsov #define USB_THS_IGNORE_IN	0x0004
142236dd4d1SAnton Vorontsov #define USB_THS_NACK		0x0008
143236dd4d1SAnton Vorontsov #define USB_THS_STALL		0x000c
144236dd4d1SAnton Vorontsov 
145236dd4d1SAnton Vorontsov #define USB_RHS_SHIFT   	0
146236dd4d1SAnton Vorontsov #define USB_RHS_MASK		0x0003
147236dd4d1SAnton Vorontsov #define USB_RHS_NORMAL  	0x0
148236dd4d1SAnton Vorontsov #define USB_RHS_IGNORE_OUT	0x0001
149236dd4d1SAnton Vorontsov #define USB_RHS_NACK		0x0002
150236dd4d1SAnton Vorontsov #define USB_RHS_STALL		0x0003
151236dd4d1SAnton Vorontsov 
152236dd4d1SAnton Vorontsov #define USB_RTHS_MASK		0x000f
153236dd4d1SAnton Vorontsov 
154236dd4d1SAnton Vorontsov /* USB Command Register define */
155236dd4d1SAnton Vorontsov #define USB_CMD_STR_FIFO	0x80
156236dd4d1SAnton Vorontsov #define USB_CMD_FLUSH_FIFO	0x40
157236dd4d1SAnton Vorontsov #define USB_CMD_ISFT		0x20
158236dd4d1SAnton Vorontsov #define USB_CMD_DSFT		0x10
159236dd4d1SAnton Vorontsov #define USB_CMD_EP_MASK		0x03
160236dd4d1SAnton Vorontsov 
161236dd4d1SAnton Vorontsov /* USB Event and Mask Register define */
162236dd4d1SAnton Vorontsov #define USB_E_MSF_MASK		0x0800
163236dd4d1SAnton Vorontsov #define USB_E_SFT_MASK		0x0400
164236dd4d1SAnton Vorontsov #define USB_E_RESET_MASK	0x0200
165236dd4d1SAnton Vorontsov #define USB_E_IDLE_MASK		0x0100
166236dd4d1SAnton Vorontsov #define USB_E_TXE4_MASK		0x0080
167236dd4d1SAnton Vorontsov #define USB_E_TXE3_MASK		0x0040
168236dd4d1SAnton Vorontsov #define USB_E_TXE2_MASK		0x0020
169236dd4d1SAnton Vorontsov #define USB_E_TXE1_MASK		0x0010
170236dd4d1SAnton Vorontsov #define USB_E_SOF_MASK		0x0008
171236dd4d1SAnton Vorontsov #define USB_E_BSY_MASK		0x0004
172236dd4d1SAnton Vorontsov #define USB_E_TXB_MASK		0x0002
173236dd4d1SAnton Vorontsov #define USB_E_RXB_MASK		0x0001
174236dd4d1SAnton Vorontsov 
175236dd4d1SAnton Vorontsov /* Freescale USB Host controller registers */
176236dd4d1SAnton Vorontsov struct fhci_regs {
177236dd4d1SAnton Vorontsov 	u8 usb_mod;		/* mode register */
178236dd4d1SAnton Vorontsov 	u8 usb_addr;		/* address register */
179236dd4d1SAnton Vorontsov 	u8 usb_comm;		/* command register */
180236dd4d1SAnton Vorontsov 	u8 reserved1[1];
181236dd4d1SAnton Vorontsov 	__be16 usb_ep[4];	/* endpoint register */
182236dd4d1SAnton Vorontsov 	u8 reserved2[4];
183236dd4d1SAnton Vorontsov 	__be16 usb_event;	/* event register */
184236dd4d1SAnton Vorontsov 	u8 reserved3[2];
185236dd4d1SAnton Vorontsov 	__be16 usb_mask;	/* mask register */
186236dd4d1SAnton Vorontsov 	u8 reserved4[1];
187236dd4d1SAnton Vorontsov 	u8 usb_status;		/* status register */
188236dd4d1SAnton Vorontsov 	__be16 usb_sof_tmr;	/* Start Of Frame timer */
189236dd4d1SAnton Vorontsov 	u8 reserved5[2];
190236dd4d1SAnton Vorontsov 	__be16 usb_frame_num;	/* frame number register */
191236dd4d1SAnton Vorontsov 	u8 reserved6[1];
192236dd4d1SAnton Vorontsov };
193236dd4d1SAnton Vorontsov 
194236dd4d1SAnton Vorontsov /* Freescale USB HOST */
195236dd4d1SAnton Vorontsov struct fhci_pram {
196236dd4d1SAnton Vorontsov 	__be16 ep_ptr[4];	/* Endpoint porter reg */
197236dd4d1SAnton Vorontsov 	__be32 rx_state;	/* Rx internal state */
198236dd4d1SAnton Vorontsov 	__be32 rx_ptr;		/* Rx internal data pointer */
199236dd4d1SAnton Vorontsov 	__be16 frame_num;	/* Frame number */
200236dd4d1SAnton Vorontsov 	__be16 rx_cnt;		/* Rx byte count */
201236dd4d1SAnton Vorontsov 	__be32 rx_temp;		/* Rx temp */
202236dd4d1SAnton Vorontsov 	__be32 rx_data_temp;	/* Rx data temp */
203236dd4d1SAnton Vorontsov 	__be16 rx_u_ptr;	/* Rx microcode return address temp */
204236dd4d1SAnton Vorontsov 	u8 reserved1[2];	/* reserved area */
205236dd4d1SAnton Vorontsov 	__be32 sof_tbl;		/* SOF lookup table pointer */
206236dd4d1SAnton Vorontsov 	u8 sof_u_crc_temp;	/* SOF micorcode CRC5 temp reg */
207236dd4d1SAnton Vorontsov 	u8 reserved2[0xdb];
208236dd4d1SAnton Vorontsov };
209236dd4d1SAnton Vorontsov 
210236dd4d1SAnton Vorontsov /* Freescale USB Endpoint*/
211236dd4d1SAnton Vorontsov struct fhci_ep_pram {
212236dd4d1SAnton Vorontsov 	__be16 rx_base;		/* Rx BD base address */
213236dd4d1SAnton Vorontsov 	__be16 tx_base;		/* Tx BD base address */
214236dd4d1SAnton Vorontsov 	u8 rx_func_code;	/* Rx function code */
215236dd4d1SAnton Vorontsov 	u8 tx_func_code;	/* Tx function code */
216236dd4d1SAnton Vorontsov 	__be16 rx_buff_len;	/* Rx buffer length */
217236dd4d1SAnton Vorontsov 	__be16 rx_bd_ptr;	/* Rx BD pointer */
218236dd4d1SAnton Vorontsov 	__be16 tx_bd_ptr;	/* Tx BD pointer */
219236dd4d1SAnton Vorontsov 	__be32 tx_state;	/* Tx internal state */
220236dd4d1SAnton Vorontsov 	__be32 tx_ptr;		/* Tx internal data pointer */
221236dd4d1SAnton Vorontsov 	__be16 tx_crc;		/* temp transmit CRC */
222236dd4d1SAnton Vorontsov 	__be16 tx_cnt;		/* Tx byte count */
223236dd4d1SAnton Vorontsov 	__be32 tx_temp;		/* Tx temp */
224236dd4d1SAnton Vorontsov 	__be16 tx_u_ptr;	/* Tx microcode return address temp */
225236dd4d1SAnton Vorontsov 	__be16 reserved;
226236dd4d1SAnton Vorontsov };
227236dd4d1SAnton Vorontsov 
228236dd4d1SAnton Vorontsov struct fhci_controller_list {
229236dd4d1SAnton Vorontsov 	struct list_head ctrl_list;	/* control endpoints */
230236dd4d1SAnton Vorontsov 	struct list_head bulk_list;	/* bulk endpoints */
231236dd4d1SAnton Vorontsov 	struct list_head iso_list;	/* isochronous endpoints */
232236dd4d1SAnton Vorontsov 	struct list_head intr_list;	/* interruput endpoints */
233236dd4d1SAnton Vorontsov 	struct list_head done_list;	/* done transfers */
234236dd4d1SAnton Vorontsov };
235236dd4d1SAnton Vorontsov 
236236dd4d1SAnton Vorontsov struct virtual_root_hub {
237236dd4d1SAnton Vorontsov 	int dev_num;	/* USB address of the root hub */
238236dd4d1SAnton Vorontsov 	u32 feature;	/* indicates what feature has been set */
239236dd4d1SAnton Vorontsov 	struct usb_hub_status hub;
240236dd4d1SAnton Vorontsov 	struct usb_port_status port;
241236dd4d1SAnton Vorontsov };
242236dd4d1SAnton Vorontsov 
243236dd4d1SAnton Vorontsov enum fhci_gpios {
244236dd4d1SAnton Vorontsov 	GPIO_USBOE = 0,
245236dd4d1SAnton Vorontsov 	GPIO_USBTP,
246236dd4d1SAnton Vorontsov 	GPIO_USBTN,
247236dd4d1SAnton Vorontsov 	GPIO_USBRP,
248236dd4d1SAnton Vorontsov 	GPIO_USBRN,
249236dd4d1SAnton Vorontsov 	/* these are optional */
250236dd4d1SAnton Vorontsov 	GPIO_SPEED,
251236dd4d1SAnton Vorontsov 	GPIO_POWER,
252236dd4d1SAnton Vorontsov 	NUM_GPIOS,
253236dd4d1SAnton Vorontsov };
254236dd4d1SAnton Vorontsov 
255236dd4d1SAnton Vorontsov enum fhci_pins {
256236dd4d1SAnton Vorontsov 	PIN_USBOE = 0,
257236dd4d1SAnton Vorontsov 	PIN_USBTP,
258236dd4d1SAnton Vorontsov 	PIN_USBTN,
259236dd4d1SAnton Vorontsov 	NUM_PINS,
260236dd4d1SAnton Vorontsov };
261236dd4d1SAnton Vorontsov 
262236dd4d1SAnton Vorontsov struct fhci_hcd {
263236dd4d1SAnton Vorontsov 	enum qe_clock fullspeed_clk;
264236dd4d1SAnton Vorontsov 	enum qe_clock lowspeed_clk;
265236dd4d1SAnton Vorontsov 	struct qe_pin *pins[NUM_PINS];
266236dd4d1SAnton Vorontsov 	int gpios[NUM_GPIOS];
267236dd4d1SAnton Vorontsov 	bool alow_gpios[NUM_GPIOS];
268236dd4d1SAnton Vorontsov 
269236dd4d1SAnton Vorontsov 	struct fhci_regs __iomem *regs;	/* I/O memory used to communicate */
270236dd4d1SAnton Vorontsov 	struct fhci_pram __iomem *pram;	/* Parameter RAM */
271236dd4d1SAnton Vorontsov 	struct gtm_timer *timer;
272236dd4d1SAnton Vorontsov 
273236dd4d1SAnton Vorontsov 	spinlock_t lock;
274236dd4d1SAnton Vorontsov 	struct fhci_usb *usb_lld; /* Low-level driver */
275236dd4d1SAnton Vorontsov 	struct virtual_root_hub *vroot_hub; /* the virtual root hub */
276236dd4d1SAnton Vorontsov 	int active_urbs;
277236dd4d1SAnton Vorontsov 	struct fhci_controller_list *hc_list;
278236dd4d1SAnton Vorontsov 	struct tasklet_struct *process_done_task; /* tasklet for done list */
279236dd4d1SAnton Vorontsov 
280236dd4d1SAnton Vorontsov 	struct list_head empty_eds;
281236dd4d1SAnton Vorontsov 	struct list_head empty_tds;
282236dd4d1SAnton Vorontsov 
283236dd4d1SAnton Vorontsov #ifdef CONFIG_FHCI_DEBUG
284236dd4d1SAnton Vorontsov 	int usb_irq_stat[13];
285236dd4d1SAnton Vorontsov 	struct dentry *dfs_root;
286236dd4d1SAnton Vorontsov 	struct dentry *dfs_regs;
287236dd4d1SAnton Vorontsov 	struct dentry *dfs_irq_stat;
288236dd4d1SAnton Vorontsov #endif
289236dd4d1SAnton Vorontsov };
290236dd4d1SAnton Vorontsov 
291236dd4d1SAnton Vorontsov #define USB_FRAME_USAGE 90
292236dd4d1SAnton Vorontsov #define FRAME_TIME_USAGE (USB_FRAME_USAGE*10)	/* frame time usage */
293236dd4d1SAnton Vorontsov #define SW_FIX_TIME_BETWEEN_TRANSACTION 150	/* SW */
294236dd4d1SAnton Vorontsov #define MAX_BYTES_PER_FRAME (USB_FRAME_USAGE*15)
295236dd4d1SAnton Vorontsov #define MAX_PERIODIC_FRAME_USAGE 90
296236dd4d1SAnton Vorontsov 
297236dd4d1SAnton Vorontsov /* transaction type */
298236dd4d1SAnton Vorontsov enum fhci_ta_type {
299236dd4d1SAnton Vorontsov 	FHCI_TA_IN = 0,	/* input transaction */
300236dd4d1SAnton Vorontsov 	FHCI_TA_OUT,	/* output transaction */
301236dd4d1SAnton Vorontsov 	FHCI_TA_SETUP,	/* setup transaction */
302236dd4d1SAnton Vorontsov };
303236dd4d1SAnton Vorontsov 
304236dd4d1SAnton Vorontsov /* transfer mode */
305236dd4d1SAnton Vorontsov enum fhci_tf_mode {
306236dd4d1SAnton Vorontsov 	FHCI_TF_CTRL = 0,
307236dd4d1SAnton Vorontsov 	FHCI_TF_ISO,
308236dd4d1SAnton Vorontsov 	FHCI_TF_BULK,
309236dd4d1SAnton Vorontsov 	FHCI_TF_INTR,
310236dd4d1SAnton Vorontsov };
311236dd4d1SAnton Vorontsov 
312236dd4d1SAnton Vorontsov enum fhci_speed {
313236dd4d1SAnton Vorontsov 	FHCI_FULL_SPEED,
314236dd4d1SAnton Vorontsov 	FHCI_LOW_SPEED,
315236dd4d1SAnton Vorontsov };
316236dd4d1SAnton Vorontsov 
317236dd4d1SAnton Vorontsov /* endpoint state */
318236dd4d1SAnton Vorontsov enum fhci_ed_state {
319236dd4d1SAnton Vorontsov 	FHCI_ED_NEW = 0, /* pipe is new */
320236dd4d1SAnton Vorontsov 	FHCI_ED_OPER,    /* pipe is operating */
321236dd4d1SAnton Vorontsov 	FHCI_ED_URB_DEL, /* pipe is in hold because urb is being deleted */
322236dd4d1SAnton Vorontsov 	FHCI_ED_SKIP,    /* skip this pipe */
323236dd4d1SAnton Vorontsov 	FHCI_ED_HALTED,  /* pipe is halted */
324236dd4d1SAnton Vorontsov };
325236dd4d1SAnton Vorontsov 
326236dd4d1SAnton Vorontsov enum fhci_port_status {
327236dd4d1SAnton Vorontsov 	FHCI_PORT_POWER_OFF = 0,
328236dd4d1SAnton Vorontsov 	FHCI_PORT_DISABLED,
329236dd4d1SAnton Vorontsov 	FHCI_PORT_DISCONNECTING,
330236dd4d1SAnton Vorontsov 	FHCI_PORT_WAITING,	/* waiting for connection */
331236dd4d1SAnton Vorontsov 	FHCI_PORT_FULL,		/* full speed connected */
332236dd4d1SAnton Vorontsov 	FHCI_PORT_LOW,		/* low speed connected */
333236dd4d1SAnton Vorontsov };
334236dd4d1SAnton Vorontsov 
335236dd4d1SAnton Vorontsov enum fhci_mem_alloc {
336236dd4d1SAnton Vorontsov 	MEM_CACHABLE_SYS = 0x00000001,	/* primary DDR,cachable */
337236dd4d1SAnton Vorontsov 	MEM_NOCACHE_SYS = 0x00000004,	/* primary DDR,non-cachable */
338236dd4d1SAnton Vorontsov 	MEM_SECONDARY = 0x00000002,	/* either secondary DDR or SDRAM */
339236dd4d1SAnton Vorontsov 	MEM_PRAM = 0x00000008,		/* multi-user RAM identifier */
340236dd4d1SAnton Vorontsov };
341236dd4d1SAnton Vorontsov 
342236dd4d1SAnton Vorontsov /* USB default parameters*/
343236dd4d1SAnton Vorontsov #define DEFAULT_RING_LEN	8
344236dd4d1SAnton Vorontsov #define DEFAULT_DATA_MEM	MEM_CACHABLE_SYS
345236dd4d1SAnton Vorontsov 
346236dd4d1SAnton Vorontsov struct ed {
347236dd4d1SAnton Vorontsov 	u8 dev_addr;		/* device address */
348236dd4d1SAnton Vorontsov 	u8 ep_addr;		/* endpoint address */
349236dd4d1SAnton Vorontsov 	enum fhci_tf_mode mode;	/* USB transfer mode */
350236dd4d1SAnton Vorontsov 	enum fhci_speed speed;
351236dd4d1SAnton Vorontsov 	unsigned int max_pkt_size;
352236dd4d1SAnton Vorontsov 	enum fhci_ed_state state;
353236dd4d1SAnton Vorontsov 	struct list_head td_list; /* a list of all queued TD to this pipe */
354236dd4d1SAnton Vorontsov 	struct list_head node;
355236dd4d1SAnton Vorontsov 
356236dd4d1SAnton Vorontsov 	/* read only parameters, should be cleared upon initialization */
357236dd4d1SAnton Vorontsov 	u8 toggle_carry;	/* toggle carry from the last TD submitted */
358236dd4d1SAnton Vorontsov 	u32 last_iso;		/* time stamp of last queued ISO transfer */
359236dd4d1SAnton Vorontsov 	struct td *td_head;	/* a pointer to the current TD handled */
360236dd4d1SAnton Vorontsov };
361236dd4d1SAnton Vorontsov 
362236dd4d1SAnton Vorontsov struct td {
363236dd4d1SAnton Vorontsov 	void *data;		 /* a pointer to the data buffer */
364236dd4d1SAnton Vorontsov 	unsigned int len;	 /* length of the data to be submitted */
365236dd4d1SAnton Vorontsov 	unsigned int actual_len; /* actual bytes transfered on this td */
366236dd4d1SAnton Vorontsov 	enum fhci_ta_type type;	 /* transaction type */
367236dd4d1SAnton Vorontsov 	u8 toggle;		 /* toggle for next trans. within this TD */
368236dd4d1SAnton Vorontsov 	u16 iso_index;		 /* ISO transaction index */
369236dd4d1SAnton Vorontsov 	u16 start_frame;	 /* start frame time stamp */
370236dd4d1SAnton Vorontsov 	u16 interval;		 /* interval between trans. (for ISO/Intr) */
371236dd4d1SAnton Vorontsov 	u32 status;		 /* status of the TD */
372236dd4d1SAnton Vorontsov 	struct ed *ed;		 /* a handle to the corresponding ED */
373236dd4d1SAnton Vorontsov 	struct urb *urb;	 /* a handle to the corresponding URB */
374236dd4d1SAnton Vorontsov 	bool ioc;		 /* Inform On Completion */
375236dd4d1SAnton Vorontsov 	struct list_head node;
376236dd4d1SAnton Vorontsov 
377236dd4d1SAnton Vorontsov 	/* read only parameters should be cleared upon initialization */
378236dd4d1SAnton Vorontsov 	struct packet *pkt;
379236dd4d1SAnton Vorontsov 	int nak_cnt;
380236dd4d1SAnton Vorontsov 	int error_cnt;
381236dd4d1SAnton Vorontsov 	struct list_head frame_lh;
382236dd4d1SAnton Vorontsov };
383236dd4d1SAnton Vorontsov 
384236dd4d1SAnton Vorontsov struct packet {
385236dd4d1SAnton Vorontsov 	u8 *data;	/* packet data */
386236dd4d1SAnton Vorontsov 	u32 len;	/* packet length */
387236dd4d1SAnton Vorontsov 	u32 status;	/* status of the packet - equivalent to the status
388236dd4d1SAnton Vorontsov 			 * field for the corresponding structure td */
389236dd4d1SAnton Vorontsov 	u32 info;	/* packet information */
390236dd4d1SAnton Vorontsov 	void __iomem *priv_data; /* private data of the driver (TDs or BDs) */
391236dd4d1SAnton Vorontsov };
392236dd4d1SAnton Vorontsov 
393236dd4d1SAnton Vorontsov /* struct for each URB */
394236dd4d1SAnton Vorontsov #define URB_INPROGRESS	0
395236dd4d1SAnton Vorontsov #define URB_DEL		1
396236dd4d1SAnton Vorontsov 
397236dd4d1SAnton Vorontsov /* URB states (state field) */
398236dd4d1SAnton Vorontsov #define US_BULK		0
399236dd4d1SAnton Vorontsov #define US_BULK0	1
400236dd4d1SAnton Vorontsov 
401236dd4d1SAnton Vorontsov /* three setup states */
402236dd4d1SAnton Vorontsov #define US_CTRL_SETUP	2
403236dd4d1SAnton Vorontsov #define US_CTRL_DATA	1
404236dd4d1SAnton Vorontsov #define US_CTRL_ACK	0
405236dd4d1SAnton Vorontsov 
406236dd4d1SAnton Vorontsov #define EP_ZERO	0
407236dd4d1SAnton Vorontsov 
408236dd4d1SAnton Vorontsov struct urb_priv {
409236dd4d1SAnton Vorontsov 	int num_of_tds;
410236dd4d1SAnton Vorontsov 	int tds_cnt;
411236dd4d1SAnton Vorontsov 	int state;
412236dd4d1SAnton Vorontsov 
413236dd4d1SAnton Vorontsov 	struct td **tds;
414236dd4d1SAnton Vorontsov 	struct ed *ed;
415236dd4d1SAnton Vorontsov 	struct timer_list time_out;
416236dd4d1SAnton Vorontsov };
417236dd4d1SAnton Vorontsov 
418236dd4d1SAnton Vorontsov struct endpoint {
419236dd4d1SAnton Vorontsov 	/* Pointer to ep parameter RAM */
420236dd4d1SAnton Vorontsov 	struct fhci_ep_pram __iomem *ep_pram_ptr;
421236dd4d1SAnton Vorontsov 
422236dd4d1SAnton Vorontsov 	/* Host transactions */
423236dd4d1SAnton Vorontsov 	struct usb_td __iomem *td_base; /* first TD in the ring */
424236dd4d1SAnton Vorontsov 	struct usb_td __iomem *conf_td; /* next TD for confirm after transac */
425236dd4d1SAnton Vorontsov 	struct usb_td __iomem *empty_td;/* next TD for new transaction req. */
42645465487SStefani Seibold 	struct kfifo empty_frame_Q;  /* Empty frames list to use */
42745465487SStefani Seibold 	struct kfifo conf_frame_Q;   /* frames passed to TDs,waiting for tx */
42845465487SStefani Seibold 	struct kfifo dummy_packets_Q;/* dummy packets for the CRC overun */
429236dd4d1SAnton Vorontsov 
430236dd4d1SAnton Vorontsov 	bool already_pushed_dummy_bd;
431236dd4d1SAnton Vorontsov };
432236dd4d1SAnton Vorontsov 
433236dd4d1SAnton Vorontsov /* struct for each 1mSec frame time */
434236dd4d1SAnton Vorontsov #define FRAME_IS_TRANSMITTED		0x00
435236dd4d1SAnton Vorontsov #define FRAME_TIMER_END_TRANSMISSION	0x01
436236dd4d1SAnton Vorontsov #define FRAME_DATA_END_TRANSMISSION	0x02
437236dd4d1SAnton Vorontsov #define FRAME_END_TRANSMISSION		0x03
438236dd4d1SAnton Vorontsov #define FRAME_IS_PREPARED		0x04
439236dd4d1SAnton Vorontsov 
440236dd4d1SAnton Vorontsov struct fhci_time_frame {
441236dd4d1SAnton Vorontsov 	u16 frame_num;	 /* frame number */
442236dd4d1SAnton Vorontsov 	u16 total_bytes; /* total bytes submitted within this frame */
443236dd4d1SAnton Vorontsov 	u8 frame_status; /* flag that indicates to stop fill this frame */
444236dd4d1SAnton Vorontsov 	struct list_head tds_list; /* all tds of this frame */
445236dd4d1SAnton Vorontsov };
446236dd4d1SAnton Vorontsov 
447236dd4d1SAnton Vorontsov /* internal driver structure*/
448236dd4d1SAnton Vorontsov struct fhci_usb {
449236dd4d1SAnton Vorontsov 	u16 saved_msk;		 /* saving of the USB mask register */
450236dd4d1SAnton Vorontsov 	struct endpoint *ep0;	 /* pointer for endpoint0 structure */
451236dd4d1SAnton Vorontsov 	int intr_nesting_cnt;	 /* interrupt nesting counter */
452236dd4d1SAnton Vorontsov 	u16 max_frame_usage;	 /* max frame time usage,in micro-sec */
453236dd4d1SAnton Vorontsov 	u16 max_bytes_per_frame; /* max byte can be tx in one time frame */
454236dd4d1SAnton Vorontsov 	u32 sw_transaction_time; /* sw complete trans time,in micro-sec */
455236dd4d1SAnton Vorontsov 	struct fhci_time_frame *actual_frame;
456236dd4d1SAnton Vorontsov 	struct fhci_controller_list *hc_list;	/* main structure for hc */
457236dd4d1SAnton Vorontsov 	struct virtual_root_hub *vroot_hub;
458236dd4d1SAnton Vorontsov 	enum fhci_port_status port_status;	/* v_rh port status */
459236dd4d1SAnton Vorontsov 
460236dd4d1SAnton Vorontsov 	u32 (*transfer_confirm)(struct fhci_hcd *fhci);
461236dd4d1SAnton Vorontsov 
462236dd4d1SAnton Vorontsov 	struct fhci_hcd *fhci;
463236dd4d1SAnton Vorontsov };
464236dd4d1SAnton Vorontsov 
465236dd4d1SAnton Vorontsov /*
466236dd4d1SAnton Vorontsov  * Various helpers and prototypes below.
467236dd4d1SAnton Vorontsov  */
468236dd4d1SAnton Vorontsov 
469236dd4d1SAnton Vorontsov static inline u16 get_frame_num(struct fhci_hcd *fhci)
470236dd4d1SAnton Vorontsov {
471236dd4d1SAnton Vorontsov 	return in_be16(&fhci->pram->frame_num) & 0x07ff;
472236dd4d1SAnton Vorontsov }
473236dd4d1SAnton Vorontsov 
474236dd4d1SAnton Vorontsov #define fhci_dbg(fhci, fmt, args...) \
475236dd4d1SAnton Vorontsov 		dev_dbg(fhci_to_hcd(fhci)->self.controller, fmt, ##args)
476236dd4d1SAnton Vorontsov #define fhci_vdbg(fhci, fmt, args...) \
477236dd4d1SAnton Vorontsov 		dev_vdbg(fhci_to_hcd(fhci)->self.controller, fmt, ##args)
478236dd4d1SAnton Vorontsov #define fhci_err(fhci, fmt, args...) \
479236dd4d1SAnton Vorontsov 		dev_err(fhci_to_hcd(fhci)->self.controller, fmt, ##args)
480236dd4d1SAnton Vorontsov #define fhci_info(fhci, fmt, args...) \
481236dd4d1SAnton Vorontsov 		dev_info(fhci_to_hcd(fhci)->self.controller, fmt, ##args)
482236dd4d1SAnton Vorontsov #define fhci_warn(fhci, fmt, args...) \
483236dd4d1SAnton Vorontsov 		dev_warn(fhci_to_hcd(fhci)->self.controller, fmt, ##args)
484236dd4d1SAnton Vorontsov 
485236dd4d1SAnton Vorontsov static inline struct fhci_hcd *hcd_to_fhci(struct usb_hcd *hcd)
486236dd4d1SAnton Vorontsov {
487236dd4d1SAnton Vorontsov 	return (struct fhci_hcd *)hcd->hcd_priv;
488236dd4d1SAnton Vorontsov }
489236dd4d1SAnton Vorontsov 
490236dd4d1SAnton Vorontsov static inline struct usb_hcd *fhci_to_hcd(struct fhci_hcd *fhci)
491236dd4d1SAnton Vorontsov {
492236dd4d1SAnton Vorontsov 	return container_of((void *)fhci, struct usb_hcd, hcd_priv);
493236dd4d1SAnton Vorontsov }
494236dd4d1SAnton Vorontsov 
495236dd4d1SAnton Vorontsov /* fifo of pointers */
49645465487SStefani Seibold static inline int cq_new(struct kfifo *fifo, int size)
497236dd4d1SAnton Vorontsov {
498c1e13f25SStefani Seibold 	return kfifo_alloc(fifo, size * sizeof(void *), GFP_KERNEL);
499236dd4d1SAnton Vorontsov }
500236dd4d1SAnton Vorontsov 
501236dd4d1SAnton Vorontsov static inline void cq_delete(struct kfifo *kfifo)
502236dd4d1SAnton Vorontsov {
503236dd4d1SAnton Vorontsov 	kfifo_free(kfifo);
504236dd4d1SAnton Vorontsov }
505236dd4d1SAnton Vorontsov 
506236dd4d1SAnton Vorontsov static inline unsigned int cq_howmany(struct kfifo *kfifo)
507236dd4d1SAnton Vorontsov {
508e64c026dSStefani Seibold 	return kfifo_len(kfifo) / sizeof(void *);
509236dd4d1SAnton Vorontsov }
510236dd4d1SAnton Vorontsov 
511236dd4d1SAnton Vorontsov static inline int cq_put(struct kfifo *kfifo, void *p)
512236dd4d1SAnton Vorontsov {
5137acd72ebSStefani Seibold 	return kfifo_in(kfifo, (void *)&p, sizeof(p));
514236dd4d1SAnton Vorontsov }
515236dd4d1SAnton Vorontsov 
516236dd4d1SAnton Vorontsov static inline void *cq_get(struct kfifo *kfifo)
517236dd4d1SAnton Vorontsov {
518236dd4d1SAnton Vorontsov 	void *p = NULL;
519236dd4d1SAnton Vorontsov 
5207acd72ebSStefani Seibold 	kfifo_out(kfifo, (void *)&p, sizeof(p));
521236dd4d1SAnton Vorontsov 	return p;
522236dd4d1SAnton Vorontsov }
523236dd4d1SAnton Vorontsov 
524236dd4d1SAnton Vorontsov /* fhci-hcd.c */
525236dd4d1SAnton Vorontsov void fhci_start_sof_timer(struct fhci_hcd *fhci);
526236dd4d1SAnton Vorontsov void fhci_stop_sof_timer(struct fhci_hcd *fhci);
527236dd4d1SAnton Vorontsov u16 fhci_get_sof_timer_count(struct fhci_usb *usb);
528236dd4d1SAnton Vorontsov void fhci_usb_enable_interrupt(struct fhci_usb *usb);
529236dd4d1SAnton Vorontsov void fhci_usb_disable_interrupt(struct fhci_usb *usb);
530236dd4d1SAnton Vorontsov int fhci_ioports_check_bus_state(struct fhci_hcd *fhci);
531236dd4d1SAnton Vorontsov 
532236dd4d1SAnton Vorontsov /* fhci-mem.c */
533236dd4d1SAnton Vorontsov void fhci_recycle_empty_td(struct fhci_hcd *fhci, struct td *td);
534236dd4d1SAnton Vorontsov void fhci_recycle_empty_ed(struct fhci_hcd *fhci, struct ed *ed);
535236dd4d1SAnton Vorontsov struct ed *fhci_get_empty_ed(struct fhci_hcd *fhci);
536236dd4d1SAnton Vorontsov struct td *fhci_td_fill(struct fhci_hcd *fhci, struct urb *urb,
537236dd4d1SAnton Vorontsov 			struct urb_priv *urb_priv, struct ed *ed, u16 index,
538236dd4d1SAnton Vorontsov 			enum fhci_ta_type type, int toggle, u8 *data, u32 len,
539236dd4d1SAnton Vorontsov 			u16 interval, u16 start_frame, bool ioc);
540236dd4d1SAnton Vorontsov void fhci_add_tds_to_ed(struct ed *ed, struct td **td_list, int number);
541236dd4d1SAnton Vorontsov 
542236dd4d1SAnton Vorontsov /* fhci-hub.c */
543236dd4d1SAnton Vorontsov void fhci_config_transceiver(struct fhci_hcd *fhci,
544236dd4d1SAnton Vorontsov 			enum fhci_port_status status);
545236dd4d1SAnton Vorontsov void fhci_port_disable(struct fhci_hcd *fhci);
546236dd4d1SAnton Vorontsov void fhci_port_enable(void *lld);
547236dd4d1SAnton Vorontsov void fhci_io_port_generate_reset(struct fhci_hcd *fhci);
548236dd4d1SAnton Vorontsov void fhci_port_reset(void *lld);
549236dd4d1SAnton Vorontsov int fhci_hub_status_data(struct usb_hcd *hcd, char *buf);
550236dd4d1SAnton Vorontsov int fhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,
551236dd4d1SAnton Vorontsov 		     u16 wIndex, char *buf, u16 wLength);
552236dd4d1SAnton Vorontsov 
553236dd4d1SAnton Vorontsov /* fhci-tds.c */
554236dd4d1SAnton Vorontsov void fhci_flush_bds(struct fhci_usb *usb);
555236dd4d1SAnton Vorontsov void fhci_flush_actual_frame(struct fhci_usb *usb);
556236dd4d1SAnton Vorontsov u32 fhci_host_transaction(struct fhci_usb *usb, struct packet *pkt,
557236dd4d1SAnton Vorontsov 			  enum fhci_ta_type trans_type, u8 dest_addr,
558236dd4d1SAnton Vorontsov 			  u8 dest_ep, enum fhci_tf_mode trans_mode,
559236dd4d1SAnton Vorontsov 			  enum fhci_speed dest_speed, u8 data_toggle);
560236dd4d1SAnton Vorontsov void fhci_host_transmit_actual_frame(struct fhci_usb *usb);
561236dd4d1SAnton Vorontsov void fhci_tx_conf_interrupt(struct fhci_usb *usb);
562236dd4d1SAnton Vorontsov void fhci_push_dummy_bd(struct endpoint *ep);
563236dd4d1SAnton Vorontsov u32 fhci_create_ep(struct fhci_usb *usb, enum fhci_mem_alloc data_mem,
564236dd4d1SAnton Vorontsov 		   u32 ring_len);
565236dd4d1SAnton Vorontsov void fhci_init_ep_registers(struct fhci_usb *usb,
566236dd4d1SAnton Vorontsov 			    struct endpoint *ep,
567236dd4d1SAnton Vorontsov 			    enum fhci_mem_alloc data_mem);
568236dd4d1SAnton Vorontsov void fhci_ep0_free(struct fhci_usb *usb);
569236dd4d1SAnton Vorontsov 
570236dd4d1SAnton Vorontsov /* fhci-sched.c */
571236dd4d1SAnton Vorontsov extern struct tasklet_struct fhci_tasklet;
572236dd4d1SAnton Vorontsov void fhci_transaction_confirm(struct fhci_usb *usb, struct packet *pkt);
573236dd4d1SAnton Vorontsov void fhci_flush_all_transmissions(struct fhci_usb *usb);
574236dd4d1SAnton Vorontsov void fhci_schedule_transactions(struct fhci_usb *usb);
575236dd4d1SAnton Vorontsov void fhci_device_connected_interrupt(struct fhci_hcd *fhci);
576236dd4d1SAnton Vorontsov void fhci_device_disconnected_interrupt(struct fhci_hcd *fhci);
577236dd4d1SAnton Vorontsov void fhci_queue_urb(struct fhci_hcd *fhci, struct urb *urb);
578236dd4d1SAnton Vorontsov u32 fhci_transfer_confirm_callback(struct fhci_hcd *fhci);
579236dd4d1SAnton Vorontsov irqreturn_t fhci_irq(struct usb_hcd *hcd);
580236dd4d1SAnton Vorontsov irqreturn_t fhci_frame_limit_timer_irq(int irq, void *_hcd);
581236dd4d1SAnton Vorontsov 
582236dd4d1SAnton Vorontsov /* fhci-q.h */
583236dd4d1SAnton Vorontsov void fhci_urb_complete_free(struct fhci_hcd *fhci, struct urb *urb);
584236dd4d1SAnton Vorontsov struct td *fhci_remove_td_from_ed(struct ed *ed);
585236dd4d1SAnton Vorontsov struct td *fhci_remove_td_from_frame(struct fhci_time_frame *frame);
586236dd4d1SAnton Vorontsov void fhci_move_td_from_ed_to_done_list(struct fhci_usb *usb, struct ed *ed);
587236dd4d1SAnton Vorontsov struct td *fhci_peek_td_from_frame(struct fhci_time_frame *frame);
588236dd4d1SAnton Vorontsov void fhci_add_td_to_frame(struct fhci_time_frame *frame, struct td *td);
589236dd4d1SAnton Vorontsov struct td *fhci_remove_td_from_done_list(struct fhci_controller_list *p_list);
590236dd4d1SAnton Vorontsov void fhci_done_td(struct urb *urb, struct td *td);
591236dd4d1SAnton Vorontsov void fhci_del_ed_list(struct fhci_hcd *fhci, struct ed *ed);
592236dd4d1SAnton Vorontsov 
593236dd4d1SAnton Vorontsov #ifdef CONFIG_FHCI_DEBUG
594236dd4d1SAnton Vorontsov 
595236dd4d1SAnton Vorontsov void fhci_dbg_isr(struct fhci_hcd *fhci, int usb_er);
596236dd4d1SAnton Vorontsov void fhci_dfs_destroy(struct fhci_hcd *fhci);
597236dd4d1SAnton Vorontsov void fhci_dfs_create(struct fhci_hcd *fhci);
598236dd4d1SAnton Vorontsov 
599236dd4d1SAnton Vorontsov #else
600236dd4d1SAnton Vorontsov 
601236dd4d1SAnton Vorontsov static inline void fhci_dbg_isr(struct fhci_hcd *fhci, int usb_er) {}
602236dd4d1SAnton Vorontsov static inline void fhci_dfs_destroy(struct fhci_hcd *fhci) {}
603236dd4d1SAnton Vorontsov static inline void fhci_dfs_create(struct fhci_hcd *fhci) {}
604236dd4d1SAnton Vorontsov 
605236dd4d1SAnton Vorontsov #endif /* CONFIG_FHCI_DEBUG */
606236dd4d1SAnton Vorontsov 
607236dd4d1SAnton Vorontsov #endif /* __FHCI_H */
608