1 #ifndef __LINUX_FUSBH200_H
2 #define __LINUX_FUSBH200_H
4 #include <linux/usb/ehci-dbgp.h>
6 /* definitions used for the EHCI driver */
9 * __hc32 and __hc16 are "Host Controller" types, they may be equivalent to
10 * __leXX (normally) or __beXX (given FUSBH200_BIG_ENDIAN_DESC), depending on
11 * the host controller implementation.
13 * To facilitate the strongest possible byte-order checking from "sparse"
14 * and so on, we use __leXX unless that's not practical.
19 /* statistics can be kept for tuning/monitoring */
20 struct fusbh200_stats {
25 unsigned long lost_iaa;
27 /* termination of urbs from core */
28 unsigned long complete;
32 /* fusbh200_hcd->lock guards shared data against other CPUs:
33 * fusbh200_hcd: async, unlink, periodic (and shadow), ...
34 * usb_host_endpoint: hcpriv
35 * fusbh200_qh: qh_next, qtd_list
36 * fusbh200_qtd: qtd_list
38 * Also, hold this lock when talking to HC registers or
39 * when updating hw_* fields in shared qh/qtd/... structures.
42 #define FUSBH200_MAX_ROOT_PORTS 1 /* see HCS_N_PORTS */
45 * fusbh200_rh_state values of FUSBH200_RH_RUNNING or above mean that the
46 * controller may be doing DMA. Lower values mean there's no DMA.
48 enum fusbh200_rh_state {
50 FUSBH200_RH_SUSPENDED,
56 * Timer events, ordered by increasing delay length.
57 * Always update event_delays_ns[] and event_handlers[] (defined in
58 * ehci-timer.c) in parallel with this list.
60 enum fusbh200_hrtimer_event {
61 FUSBH200_HRTIMER_POLL_ASS, /* Poll for async schedule off */
62 FUSBH200_HRTIMER_POLL_PSS, /* Poll for periodic schedule off */
63 FUSBH200_HRTIMER_POLL_DEAD, /* Wait for dead controller to stop */
64 FUSBH200_HRTIMER_UNLINK_INTR, /* Wait for interrupt QH unlink */
65 FUSBH200_HRTIMER_FREE_ITDS, /* Wait for unused iTDs and siTDs */
66 FUSBH200_HRTIMER_ASYNC_UNLINKS, /* Unlink empty async QHs */
67 FUSBH200_HRTIMER_IAA_WATCHDOG, /* Handle lost IAA interrupts */
68 FUSBH200_HRTIMER_DISABLE_PERIODIC, /* Wait to disable periodic sched */
69 FUSBH200_HRTIMER_DISABLE_ASYNC, /* Wait to disable async sched */
70 FUSBH200_HRTIMER_IO_WATCHDOG, /* Check for missing IRQs */
71 FUSBH200_HRTIMER_NUM_EVENTS /* Must come last */
73 #define FUSBH200_HRTIMER_NO_EVENT 99
75 struct fusbh200_hcd { /* one per controller */
77 enum fusbh200_hrtimer_event next_hrtimer_event;
78 unsigned enabled_hrtimer_events;
79 ktime_t hr_timeouts[FUSBH200_HRTIMER_NUM_EVENTS];
80 struct hrtimer hrtimer;
86 /* glue to PCI and HCD framework */
87 struct fusbh200_caps __iomem *caps;
88 struct fusbh200_regs __iomem *regs;
89 struct fusbh200_dbg_port __iomem *debug;
91 __u32 hcs_params; /* cached register copy */
93 enum fusbh200_rh_state rh_state;
95 /* general schedule support */
98 bool intr_unlinking:1;
99 bool async_unlinking:1;
101 struct fusbh200_qh *qh_scan_next;
103 /* async schedule support */
104 struct fusbh200_qh *async;
105 struct fusbh200_qh *dummy; /* For AMD quirk use */
106 struct fusbh200_qh *async_unlink;
107 struct fusbh200_qh *async_unlink_last;
108 struct fusbh200_qh *async_iaa;
109 unsigned async_unlink_cycle;
110 unsigned async_count; /* async activity count */
112 /* periodic schedule support */
113 #define DEFAULT_I_TDPS 1024 /* some HCs can do less */
114 unsigned periodic_size;
115 __hc32 *periodic; /* hw periodic table */
116 dma_addr_t periodic_dma;
117 struct list_head intr_qh_list;
118 unsigned i_thresh; /* uframes HC might cache */
120 union fusbh200_shadow *pshadow; /* mirror hw periodic table */
121 struct fusbh200_qh *intr_unlink;
122 struct fusbh200_qh *intr_unlink_last;
123 unsigned intr_unlink_cycle;
124 unsigned now_frame; /* frame from HC hardware */
125 unsigned next_frame; /* scan periodic, start here */
126 unsigned intr_count; /* intr activity count */
127 unsigned isoc_count; /* isoc activity count */
128 unsigned periodic_count; /* periodic activity count */
129 unsigned uframe_periodic_max; /* max periodic time per uframe */
132 /* list of itds completed while now_frame was still active */
133 struct list_head cached_itd_list;
134 struct fusbh200_itd *last_itd_to_free;
136 /* per root hub port */
137 unsigned long reset_done [FUSBH200_MAX_ROOT_PORTS];
139 /* bit vectors (one bit per port) */
140 unsigned long bus_suspended; /* which ports were
141 already suspended at the start of a bus suspend */
142 unsigned long companion_ports; /* which ports are
143 dedicated to the companion controller */
144 unsigned long owned_ports; /* which ports are
145 owned by the companion during a bus suspend */
146 unsigned long port_c_suspend; /* which ports have
147 the change-suspend feature turned on */
148 unsigned long suspended_ports; /* which ports are
150 unsigned long resuming_ports; /* which ports have
153 /* per-HC memory pools (could be per-bus, but ...) */
154 struct dma_pool *qh_pool; /* qh per active urb */
155 struct dma_pool *qtd_pool; /* one or more per qh */
156 struct dma_pool *itd_pool; /* itd per iso urb */
158 unsigned random_frame;
159 unsigned long next_statechange;
160 ktime_t last_periodic_enable;
164 unsigned need_io_watchdog:1;
165 unsigned fs_i_thresh:1; /* Intel iso scheduling */
167 u8 sbrn; /* packed release number */
170 struct fusbh200_stats stats;
171 # define COUNT(x) do { (x)++; } while (0)
174 struct dentry *debug_dir;
177 /* convert between an HCD pointer and the corresponding FUSBH200_HCD */
178 static inline struct fusbh200_hcd *hcd_to_fusbh200 (struct usb_hcd *hcd)
180 return (struct fusbh200_hcd *) (hcd->hcd_priv);
182 static inline struct usb_hcd *fusbh200_to_hcd (struct fusbh200_hcd *fusbh200)
184 return container_of ((void *) fusbh200, struct usb_hcd, hcd_priv);
187 /*-------------------------------------------------------------------------*/
189 /* EHCI register interface, corresponds to EHCI Revision 0.95 specification */
191 /* Section 2.2 Host Controller Capability Registers */
192 struct fusbh200_caps {
193 /* these fields are specified as 8 and 16 bit registers,
194 * but some hosts can't perform 8 or 16 bit PCI accesses.
195 * some hosts treat caplength and hciversion as parts of a 32-bit
196 * register, others treat them as two separate registers, this
197 * affects the memory map for big endian controllers.
200 #define HC_LENGTH(fusbh200, p) (0x00ff&((p) >> /* bits 7:0 / offset 00h */ \
201 (fusbh200_big_endian_capbase(fusbh200) ? 24 : 0)))
202 #define HC_VERSION(fusbh200, p) (0xffff&((p) >> /* bits 31:16 / offset 02h */ \
203 (fusbh200_big_endian_capbase(fusbh200) ? 0 : 16)))
204 u32 hcs_params; /* HCSPARAMS - offset 0x4 */
205 #define HCS_N_PORTS(p) (((p)>>0)&0xf) /* bits 3:0, ports on HC */
207 u32 hcc_params; /* HCCPARAMS - offset 0x8 */
208 #define HCC_CANPARK(p) ((p)&(1 << 2)) /* true: can park on async qh */
209 #define HCC_PGM_FRAMELISTLEN(p) ((p)&(1 << 1)) /* true: periodic_size changes*/
210 u8 portroute[8]; /* nibbles for routing - offset 0xC */
214 /* Section 2.3 Host Controller Operational Registers */
215 struct fusbh200_regs {
217 /* USBCMD: offset 0x00 */
220 /* EHCI 1.1 addendum */
221 /* 23:16 is r/w intr rate, in microframes; default "8" == 1/msec */
222 #define CMD_PARK (1<<11) /* enable "park" on async qh */
223 #define CMD_PARK_CNT(c) (((c)>>8)&3) /* how many transfers to park for */
224 #define CMD_IAAD (1<<6) /* "doorbell" interrupt async advance */
225 #define CMD_ASE (1<<5) /* async schedule enable */
226 #define CMD_PSE (1<<4) /* periodic schedule enable */
227 /* 3:2 is periodic frame list size */
228 #define CMD_RESET (1<<1) /* reset HC not bus */
229 #define CMD_RUN (1<<0) /* start/stop HC */
231 /* USBSTS: offset 0x04 */
233 #define STS_ASS (1<<15) /* Async Schedule Status */
234 #define STS_PSS (1<<14) /* Periodic Schedule Status */
235 #define STS_RECL (1<<13) /* Reclamation */
236 #define STS_HALT (1<<12) /* Not running (any reason) */
237 /* some bits reserved */
238 /* these STS_* flags are also intr_enable bits (USBINTR) */
239 #define STS_IAA (1<<5) /* Interrupted on async advance */
240 #define STS_FATAL (1<<4) /* such as some PCI access errors */
241 #define STS_FLR (1<<3) /* frame list rolled over */
242 #define STS_PCD (1<<2) /* port change detect */
243 #define STS_ERR (1<<1) /* "error" completion (overflow, ...) */
244 #define STS_INT (1<<0) /* "normal" completion (short, ...) */
246 /* USBINTR: offset 0x08 */
249 /* FRINDEX: offset 0x0C */
250 u32 frame_index; /* current microframe number */
251 /* CTRLDSSEGMENT: offset 0x10 */
252 u32 segment; /* address bits 63:32 if needed */
253 /* PERIODICLISTBASE: offset 0x14 */
254 u32 frame_list; /* points to periodic list */
255 /* ASYNCLISTADDR: offset 0x18 */
256 u32 async_next; /* address of next async queue head */
259 /* PORTSC: offset 0x20 */
262 #define PORT_USB11(x) (((x)&(3<<10)) == (1<<10)) /* USB 1.1 device */
263 #define PORT_RESET (1<<8) /* reset port */
264 #define PORT_SUSPEND (1<<7) /* suspend port */
265 #define PORT_RESUME (1<<6) /* resume it */
266 #define PORT_PEC (1<<3) /* port enable change */
267 #define PORT_PE (1<<2) /* port enable */
268 #define PORT_CSC (1<<1) /* connect status change */
269 #define PORT_CONNECT (1<<0) /* device connected */
270 #define PORT_RWC_BITS (PORT_CSC | PORT_PEC)
274 /* BMCSR: offset 0x30 */
275 u32 bmcsr; /* Bus Moniter Control/Status Register */
276 #define BMCSR_HOST_SPD_TYP (3<<9)
277 #define BMCSR_VBUS_OFF (1<<4)
278 #define BMCSR_INT_POLARITY (1<<3)
280 /* BMISR: offset 0x34 */
281 u32 bmisr; /* Bus Moniter Interrupt Status Register*/
282 #define BMISR_OVC (1<<1)
284 /* BMIER: offset 0x38 */
285 u32 bmier; /* Bus Moniter Interrupt Enable Register */
286 #define BMIER_OVC_EN (1<<1)
287 #define BMIER_VBUS_ERR_EN (1<<0)
290 /* Appendix C, Debug port ... intended for use with special "debug devices"
291 * that can help if there's no serial console. (nonstandard enumeration.)
293 struct fusbh200_dbg_port {
301 /*-------------------------------------------------------------------------*/
303 #define QTD_NEXT(fusbh200, dma) cpu_to_hc32(fusbh200, (u32)dma)
306 * EHCI Specification 0.95 Section 3.5
307 * QTD: describe data transfer components (buffer, direction, ...)
308 * See Fig 3-6 "Queue Element Transfer Descriptor Block Diagram".
310 * These are associated only with "QH" (Queue Head) structures,
311 * used with control, bulk, and interrupt transfers.
313 struct fusbh200_qtd {
314 /* first part defined by EHCI spec */
315 __hc32 hw_next; /* see EHCI 3.5.1 */
316 __hc32 hw_alt_next; /* see EHCI 3.5.2 */
317 __hc32 hw_token; /* see EHCI 3.5.3 */
318 #define QTD_TOGGLE (1 << 31) /* data toggle */
319 #define QTD_LENGTH(tok) (((tok)>>16) & 0x7fff)
320 #define QTD_IOC (1 << 15) /* interrupt on complete */
321 #define QTD_CERR(tok) (((tok)>>10) & 0x3)
322 #define QTD_PID(tok) (((tok)>>8) & 0x3)
323 #define QTD_STS_ACTIVE (1 << 7) /* HC may execute this */
324 #define QTD_STS_HALT (1 << 6) /* halted on error */
325 #define QTD_STS_DBE (1 << 5) /* data buffer error (in HC) */
326 #define QTD_STS_BABBLE (1 << 4) /* device was babbling (qtd halted) */
327 #define QTD_STS_XACT (1 << 3) /* device gave illegal response */
328 #define QTD_STS_MMF (1 << 2) /* incomplete split transaction */
329 #define QTD_STS_STS (1 << 1) /* split transaction state */
330 #define QTD_STS_PING (1 << 0) /* issue PING? */
332 #define ACTIVE_BIT(fusbh200) cpu_to_hc32(fusbh200, QTD_STS_ACTIVE)
333 #define HALT_BIT(fusbh200) cpu_to_hc32(fusbh200, QTD_STS_HALT)
334 #define STATUS_BIT(fusbh200) cpu_to_hc32(fusbh200, QTD_STS_STS)
336 __hc32 hw_buf [5]; /* see EHCI 3.5.4 */
337 __hc32 hw_buf_hi [5]; /* Appendix B */
339 /* the rest is HCD-private */
340 dma_addr_t qtd_dma; /* qtd address */
341 struct list_head qtd_list; /* sw qtd list */
342 struct urb *urb; /* qtd's urb */
343 size_t length; /* length of buffer */
344 } __attribute__ ((aligned (32)));
346 /* mask NakCnt+T in qh->hw_alt_next */
347 #define QTD_MASK(fusbh200) cpu_to_hc32 (fusbh200, ~0x1f)
349 #define IS_SHORT_READ(token) (QTD_LENGTH (token) != 0 && QTD_PID (token) == 1)
351 /*-------------------------------------------------------------------------*/
353 /* type tag from {qh,itd,fstn}->hw_next */
354 #define Q_NEXT_TYPE(fusbh200,dma) ((dma) & cpu_to_hc32(fusbh200, 3 << 1))
357 * Now the following defines are not converted using the
358 * cpu_to_le32() macro anymore, since we have to support
359 * "dynamic" switching between be and le support, so that the driver
360 * can be used on one system with SoC EHCI controller using big-endian
361 * descriptors as well as a normal little-endian PCI EHCI controller.
363 /* values for that type tag */
364 #define Q_TYPE_ITD (0 << 1)
365 #define Q_TYPE_QH (1 << 1)
366 #define Q_TYPE_SITD (2 << 1)
367 #define Q_TYPE_FSTN (3 << 1)
369 /* next async queue entry, or pointer to interrupt/periodic QH */
370 #define QH_NEXT(fusbh200,dma) (cpu_to_hc32(fusbh200, (((u32)dma)&~0x01f)|Q_TYPE_QH))
372 /* for periodic/async schedules and qtd lists, mark end of list */
373 #define FUSBH200_LIST_END(fusbh200) cpu_to_hc32(fusbh200, 1) /* "null pointer" to hw */
376 * Entries in periodic shadow table are pointers to one of four kinds
377 * of data structure. That's dictated by the hardware; a type tag is
378 * encoded in the low bits of the hardware's periodic schedule. Use
379 * Q_NEXT_TYPE to get the tag.
381 * For entries in the async schedule, the type tag always says "qh".
383 union fusbh200_shadow {
384 struct fusbh200_qh *qh; /* Q_TYPE_QH */
385 struct fusbh200_itd *itd; /* Q_TYPE_ITD */
386 struct fusbh200_fstn *fstn; /* Q_TYPE_FSTN */
387 __hc32 *hw_next; /* (all types) */
391 /*-------------------------------------------------------------------------*/
394 * EHCI Specification 0.95 Section 3.6
395 * QH: describes control/bulk/interrupt endpoints
396 * See Fig 3-7 "Queue Head Structure Layout".
398 * These appear in both the async and (for interrupt) periodic schedules.
401 /* first part defined by EHCI spec */
402 struct fusbh200_qh_hw {
403 __hc32 hw_next; /* see EHCI 3.6.1 */
404 __hc32 hw_info1; /* see EHCI 3.6.2 */
405 #define QH_CONTROL_EP (1 << 27) /* FS/LS control endpoint */
406 #define QH_HEAD (1 << 15) /* Head of async reclamation list */
407 #define QH_TOGGLE_CTL (1 << 14) /* Data toggle control */
408 #define QH_HIGH_SPEED (2 << 12) /* Endpoint speed */
409 #define QH_LOW_SPEED (1 << 12)
410 #define QH_FULL_SPEED (0 << 12)
411 #define QH_INACTIVATE (1 << 7) /* Inactivate on next transaction */
412 __hc32 hw_info2; /* see EHCI 3.6.2 */
413 #define QH_SMASK 0x000000ff
414 #define QH_CMASK 0x0000ff00
415 #define QH_HUBADDR 0x007f0000
416 #define QH_HUBPORT 0x3f800000
417 #define QH_MULT 0xc0000000
418 __hc32 hw_current; /* qtd list - see EHCI 3.6.4 */
420 /* qtd overlay (hardware parts of a struct fusbh200_qtd) */
425 __hc32 hw_buf_hi [5];
426 } __attribute__ ((aligned(32)));
429 struct fusbh200_qh_hw *hw; /* Must come first */
430 /* the rest is HCD-private */
431 dma_addr_t qh_dma; /* address of qh */
432 union fusbh200_shadow qh_next; /* ptr to qh; or periodic */
433 struct list_head qtd_list; /* sw qtd list */
434 struct list_head intr_node; /* list of intr QHs */
435 struct fusbh200_qtd *dummy;
436 struct fusbh200_qh *unlink_next; /* next on unlink list */
438 unsigned unlink_cycle;
440 u8 needs_rescan; /* Dequeue during giveback */
442 #define QH_STATE_LINKED 1 /* HC sees this */
443 #define QH_STATE_UNLINK 2 /* HC may still see this */
444 #define QH_STATE_IDLE 3 /* HC doesn't see this */
445 #define QH_STATE_UNLINK_WAIT 4 /* LINKED and on unlink q */
446 #define QH_STATE_COMPLETING 5 /* don't touch token.HALT */
448 u8 xacterrs; /* XactErr retry counter */
449 #define QH_XACTERR_MAX 32 /* XactErr retry limit */
451 /* periodic schedule info */
452 u8 usecs; /* intr bandwidth */
453 u8 gap_uf; /* uframes split/csplit gap */
454 u8 c_usecs; /* ... split completion bw */
455 u16 tt_usecs; /* tt downstream bandwidth */
456 unsigned short period; /* polling interval */
457 unsigned short start; /* where polling starts */
458 #define NO_FRAME ((unsigned short)~0) /* pick new start */
460 struct usb_device *dev; /* access to TT */
461 unsigned is_out:1; /* bulk or intr OUT */
462 unsigned clearing_tt:1; /* Clear-TT-Buf in progress */
465 /*-------------------------------------------------------------------------*/
467 /* description of one iso transaction (up to 3 KB data if highspeed) */
468 struct fusbh200_iso_packet {
469 /* These will be copied to iTD when scheduling */
470 u64 bufp; /* itd->hw_bufp{,_hi}[pg] |= */
471 __hc32 transaction; /* itd->hw_transaction[i] |= */
472 u8 cross; /* buf crosses pages */
473 /* for full speed OUT splits */
477 /* temporary schedule data for packets from iso urbs (both speeds)
478 * each packet is one logical usb transaction to the device (not TT),
479 * beginning at stream->next_uframe
481 struct fusbh200_iso_sched {
482 struct list_head td_list;
484 struct fusbh200_iso_packet packet [0];
488 * fusbh200_iso_stream - groups all (s)itds for this endpoint.
489 * acts like a qh would, if EHCI had them for ISO.
491 struct fusbh200_iso_stream {
492 /* first field matches fusbh200_hq, but is NULL */
493 struct fusbh200_qh_hw *hw;
497 struct list_head td_list; /* queued itds */
498 struct list_head free_list; /* list of unused itds */
499 struct usb_device *udev;
500 struct usb_host_endpoint *ep;
502 /* output of (re)scheduling */
506 /* the rest is derived from the endpoint descriptor,
507 * trusting urb->interval == f(epdesc->bInterval) and
508 * including the extra info for hw_bufp[0..2]
517 /* This is used to initialize iTD's hw_bufp fields */
522 /* this is used to initialize sITD's tt info */
526 /*-------------------------------------------------------------------------*/
529 * EHCI Specification 0.95 Section 3.3
530 * Fig 3-4 "Isochronous Transaction Descriptor (iTD)"
532 * Schedule records for high speed iso xfers
534 struct fusbh200_itd {
535 /* first part defined by EHCI spec */
536 __hc32 hw_next; /* see EHCI 3.3.1 */
537 __hc32 hw_transaction [8]; /* see EHCI 3.3.2 */
538 #define FUSBH200_ISOC_ACTIVE (1<<31) /* activate transfer this slot */
539 #define FUSBH200_ISOC_BUF_ERR (1<<30) /* Data buffer error */
540 #define FUSBH200_ISOC_BABBLE (1<<29) /* babble detected */
541 #define FUSBH200_ISOC_XACTERR (1<<28) /* XactErr - transaction error */
542 #define FUSBH200_ITD_LENGTH(tok) (((tok)>>16) & 0x0fff)
543 #define FUSBH200_ITD_IOC (1 << 15) /* interrupt on complete */
545 #define ITD_ACTIVE(fusbh200) cpu_to_hc32(fusbh200, FUSBH200_ISOC_ACTIVE)
547 __hc32 hw_bufp [7]; /* see EHCI 3.3.3 */
548 __hc32 hw_bufp_hi [7]; /* Appendix B */
550 /* the rest is HCD-private */
551 dma_addr_t itd_dma; /* for this itd */
552 union fusbh200_shadow itd_next; /* ptr to periodic q entry */
555 struct fusbh200_iso_stream *stream; /* endpoint's queue */
556 struct list_head itd_list; /* list of stream's itds */
558 /* any/all hw_transactions here may be used by that urb */
559 unsigned frame; /* where scheduled */
561 unsigned index[8]; /* in urb->iso_frame_desc */
562 } __attribute__ ((aligned (32)));
564 /*-------------------------------------------------------------------------*/
567 * EHCI Specification 0.96 Section 3.7
568 * Periodic Frame Span Traversal Node (FSTN)
570 * Manages split interrupt transactions (using TT) that span frame boundaries
571 * into uframes 0/1; see 4.12.2.2. In those uframes, a "save place" FSTN
572 * makes the HC jump (back) to a QH to scan for fs/ls QH completions until
573 * it hits a "restore" FSTN; then it returns to finish other uframe 0/1 work.
575 struct fusbh200_fstn {
576 __hc32 hw_next; /* any periodic q entry */
577 __hc32 hw_prev; /* qh or FUSBH200_LIST_END */
579 /* the rest is HCD-private */
581 union fusbh200_shadow fstn_next; /* ptr to periodic q entry */
582 } __attribute__ ((aligned (32)));
584 /*-------------------------------------------------------------------------*/
586 /* Prepare the PORTSC wakeup flags during controller suspend/resume */
588 #define fusbh200_prepare_ports_for_controller_suspend(fusbh200, do_wakeup) \
589 fusbh200_adjust_port_wakeup_flags(fusbh200, true, do_wakeup);
591 #define fusbh200_prepare_ports_for_controller_resume(fusbh200) \
592 fusbh200_adjust_port_wakeup_flags(fusbh200, false, false);
594 /*-------------------------------------------------------------------------*/
597 * Some EHCI controllers have a Transaction Translator built into the
598 * root hub. This is a non-standard feature. Each controller will need
599 * to add code to the following inline functions, and call them as
600 * needed (mostly in root hub code).
603 static inline unsigned int
604 fusbh200_get_speed(struct fusbh200_hcd *fusbh200, unsigned int portsc)
606 return (readl(&fusbh200->regs->bmcsr)
607 & BMCSR_HOST_SPD_TYP) >> 9;
610 /* Returns the speed of a device attached to a port on the root hub. */
611 static inline unsigned int
612 fusbh200_port_speed(struct fusbh200_hcd *fusbh200, unsigned int portsc)
614 switch (fusbh200_get_speed(fusbh200, portsc)) {
618 return USB_PORT_STAT_LOW_SPEED;
621 return USB_PORT_STAT_HIGH_SPEED;
625 /*-------------------------------------------------------------------------*/
627 #define fusbh200_has_fsl_portno_bug(e) (0)
630 * While most USB host controllers implement their registers in
631 * little-endian format, a minority (celleb companion chip) implement
632 * them in big endian format.
634 * This attempts to support either format at compile time without a
635 * runtime penalty, or both formats with the additional overhead
636 * of checking a flag bit.
640 #define fusbh200_big_endian_mmio(e) 0
641 #define fusbh200_big_endian_capbase(e) 0
643 static inline unsigned int fusbh200_readl(const struct fusbh200_hcd *fusbh200,
644 __u32 __iomem * regs)
649 static inline void fusbh200_writel(const struct fusbh200_hcd *fusbh200,
650 const unsigned int val, __u32 __iomem *regs)
655 /* cpu to fusbh200 */
656 static inline __hc32 cpu_to_hc32 (const struct fusbh200_hcd *fusbh200, const u32 x)
658 return cpu_to_le32(x);
661 /* fusbh200 to cpu */
662 static inline u32 hc32_to_cpu (const struct fusbh200_hcd *fusbh200, const __hc32 x)
664 return le32_to_cpu(x);
667 static inline u32 hc32_to_cpup (const struct fusbh200_hcd *fusbh200, const __hc32 *x)
669 return le32_to_cpup(x);
672 /*-------------------------------------------------------------------------*/
674 static inline unsigned fusbh200_read_frame_index(struct fusbh200_hcd *fusbh200)
676 return fusbh200_readl(fusbh200, &fusbh200->regs->frame_index);
679 #define fusbh200_itdlen(urb, desc, t) ({ \
680 usb_pipein((urb)->pipe) ? \
681 (desc)->length - FUSBH200_ITD_LENGTH(t) : \
682 FUSBH200_ITD_LENGTH(t); \
684 /*-------------------------------------------------------------------------*/
686 #endif /* __LINUX_FUSBH200_H */