Go to the documentation of this file.
21 #include <linux/kernel.h>
22 #include <linux/types.h>
33 #define USB_CLOCK 48000000
35 #define FHCI_PRAM_SIZE 0x100
45 #define PROTOCOL_OVERHEAD 7
48 #define PKT_PID_DATA0 0x80000000
49 #define PKT_PID_DATA1 0x40000000
50 #define PKT_PID_SETUP 0x20000000
51 #define PKT_SETUP_STATUS 0x10000000
52 #define PKT_SETADDR_STATUS 0x08000000
53 #define PKT_SET_HOST_LAST 0x04000000
54 #define PKT_HOST_DATA 0x02000000
55 #define PKT_FIRST_IN_FRAME 0x01000000
56 #define PKT_TOKEN_FRAME 0x00800000
57 #define PKT_ZLP 0x00400000
58 #define PKT_IN_TOKEN_FRAME 0x00200000
59 #define PKT_OUT_TOKEN_FRAME 0x00100000
60 #define PKT_SETUP_TOKEN_FRAME 0x00080000
61 #define PKT_STALL_FRAME 0x00040000
62 #define PKT_NACK_FRAME 0x00020000
63 #define PKT_NO_PID 0x00010000
64 #define PKT_NO_CRC 0x00008000
65 #define PKT_HOST_COMMAND 0x00004000
66 #define PKT_DUMMY_PACKET 0x00002000
67 #define PKT_LOW_SPEED_PACKET 0x00001000
70 #define TRANS_INPROGRESS (-1)
71 #define TRANS_DISCARD (-2)
72 #define TRANS_FAIL (-3)
75 #define PS_DISCONNECTED 1
76 #define PS_CONNECTED 2
81 #define USB_TD_OK 0x00000000
82 #define USB_TD_INPROGRESS 0x80000000
83 #define USB_TD_RX_ER_NONOCT 0x40000000
84 #define USB_TD_RX_ER_BITSTUFF 0x20000000
85 #define USB_TD_RX_ER_CRC 0x10000000
86 #define USB_TD_RX_ER_OVERUN 0x08000000
87 #define USB_TD_RX_ER_PID 0x04000000
88 #define USB_TD_RX_DATA_UNDERUN 0x02000000
89 #define USB_TD_RX_DATA_OVERUN 0x01000000
90 #define USB_TD_TX_ER_NAK 0x00800000
91 #define USB_TD_TX_ER_STALL 0x00400000
92 #define USB_TD_TX_ER_TIMEOUT 0x00200000
93 #define USB_TD_TX_ER_UNDERUN 0x00100000
95 #define USB_TD_ERROR (USB_TD_RX_ER_NONOCT | USB_TD_RX_ER_BITSTUFF | \
96 USB_TD_RX_ER_CRC | USB_TD_RX_ER_OVERUN | USB_TD_RX_ER_PID | \
97 USB_TD_RX_DATA_UNDERUN | USB_TD_RX_DATA_OVERUN | \
98 USB_TD_TX_ER_NAK | USB_TD_TX_ER_STALL | \
99 USB_TD_TX_ER_TIMEOUT | USB_TD_TX_ER_UNDERUN)
102 #define USB_TD_TOGGLE_DATA0 0
103 #define USB_TD_TOGGLE_DATA1 1
104 #define USB_TD_TOGGLE_CARRY 2
109 #define BUS_MODE_GBL 0x20
110 #define BUS_MODE_BO 0x18
111 #define BUS_MODE_BO_BE 0x10
112 #define BUS_MODE_DTB 0x02
117 #define USB_MODE_EN 0x01
118 #define USB_MODE_HOST 0x02
119 #define USB_MODE_TEST 0x04
120 #define USB_MODE_SFTE 0x08
121 #define USB_MODE_RESUME 0x40
122 #define USB_MODE_LSS 0x80
125 #define USB_SLVADDR_MASK 0x7F
128 #define USB_EPNUM_MASK 0xF000
129 #define USB_EPNUM_SHIFT 12
131 #define USB_TRANS_MODE_SHIFT 8
132 #define USB_TRANS_CTR 0x0000
133 #define USB_TRANS_INT 0x0100
134 #define USB_TRANS_BULK 0x0200
135 #define USB_TRANS_ISO 0x0300
137 #define USB_EP_MF 0x0020
138 #define USB_EP_RTE 0x0010
140 #define USB_THS_SHIFT 2
141 #define USB_THS_MASK 0x000c
142 #define USB_THS_NORMAL 0x0
143 #define USB_THS_IGNORE_IN 0x0004
144 #define USB_THS_NACK 0x0008
145 #define USB_THS_STALL 0x000c
147 #define USB_RHS_SHIFT 0
148 #define USB_RHS_MASK 0x0003
149 #define USB_RHS_NORMAL 0x0
150 #define USB_RHS_IGNORE_OUT 0x0001
151 #define USB_RHS_NACK 0x0002
152 #define USB_RHS_STALL 0x0003
154 #define USB_RTHS_MASK 0x000f
157 #define USB_CMD_STR_FIFO 0x80
158 #define USB_CMD_FLUSH_FIFO 0x40
159 #define USB_CMD_ISFT 0x20
160 #define USB_CMD_DSFT 0x10
161 #define USB_CMD_EP_MASK 0x03
164 #define USB_E_MSF_MASK 0x0800
165 #define USB_E_SFT_MASK 0x0400
166 #define USB_E_RESET_MASK 0x0200
167 #define USB_E_IDLE_MASK 0x0100
168 #define USB_E_TXE4_MASK 0x0080
169 #define USB_E_TXE3_MASK 0x0040
170 #define USB_E_TXE2_MASK 0x0020
171 #define USB_E_TXE1_MASK 0x0010
172 #define USB_E_SOF_MASK 0x0008
173 #define USB_E_BSY_MASK 0x0004
174 #define USB_E_TXB_MASK 0x0002
175 #define USB_E_RXB_MASK 0x0001
266 #ifdef CONFIG_FHCI_DEBUG
267 int usb_irq_stat[13];
270 struct dentry *dfs_irq_stat;
274 #define USB_FRAME_USAGE 90
275 #define FRAME_TIME_USAGE (USB_FRAME_USAGE*10)
276 #define SW_FIX_TIME_BETWEEN_TRANSACTION 150
277 #define MAX_BYTES_PER_FRAME (USB_FRAME_USAGE*15)
278 #define MAX_PERIODIC_FRAME_USAGE 90
326 #define DEFAULT_RING_LEN 8
327 #define DEFAULT_DATA_MEM MEM_CACHABLE_SYS
377 #define URB_INPROGRESS 0
385 #define US_CTRL_SETUP 2
386 #define US_CTRL_DATA 1
387 #define US_CTRL_ACK 0
417 #define FRAME_IS_TRANSMITTED 0x00
418 #define FRAME_TIMER_END_TRANSMISSION 0x01
419 #define FRAME_DATA_END_TRANSMISSION 0x02
420 #define FRAME_END_TRANSMISSION 0x03
421 #define FRAME_IS_PREPARED 0x04
452 static inline u16 get_frame_num(
struct fhci_hcd *fhci)
457 #define fhci_dbg(fhci, fmt, args...) \
458 dev_dbg(fhci_to_hcd(fhci)->self.controller, fmt, ##args)
459 #define fhci_vdbg(fhci, fmt, args...) \
460 dev_vdbg(fhci_to_hcd(fhci)->self.controller, fmt, ##args)
461 #define fhci_err(fhci, fmt, args...) \
462 dev_err(fhci_to_hcd(fhci)->self.controller, fmt, ##args)
463 #define fhci_info(fhci, fmt, args...) \
464 dev_info(fhci_to_hcd(fhci)->self.controller, fmt, ##args)
465 #define fhci_warn(fhci, fmt, args...) \
466 dev_warn(fhci_to_hcd(fhci)->self.controller, fmt, ##args)
468 static inline struct fhci_hcd *hcd_to_fhci(
struct usb_hcd *hcd)
470 return (
struct fhci_hcd *)hcd->hcd_priv;
473 static inline struct usb_hcd *fhci_to_hcd(
struct fhci_hcd *fhci)
475 return container_of((
void *)fhci,
struct usb_hcd, hcd_priv);
479 static inline int cq_new(
struct kfifo *
fifo,
int size)
484 static inline void cq_delete(
struct kfifo *kfifo)
489 static inline unsigned int cq_howmany(
struct kfifo *kfifo)
491 return kfifo_len(kfifo) /
sizeof(
void *);
494 static inline int cq_put(
struct kfifo *kfifo,
void *
p)
496 return kfifo_in(kfifo, (
void *)&p,
sizeof(p));
499 static inline void *cq_get(
struct kfifo *kfifo)
504 sz =
kfifo_out(kfifo, (
void *)&p,
sizeof(p));
580 #ifdef CONFIG_FHCI_DEBUG