/* SPDX-License-Identifier: GPL-2.0 */1#ifndef __LINUX_FOTG210_H2#define __LINUX_FOTG210_H34#include <linux/usb/ehci-dbgp.h>56/* definitions used for the EHCI driver */78/*9* __hc32 and __hc16 are "Host Controller" types, they may be equivalent to10* __leXX (normally) or __beXX (given FOTG210_BIG_ENDIAN_DESC), depending on11* the host controller implementation.12*13* To facilitate the strongest possible byte-order checking from "sparse"14* and so on, we use __leXX unless that's not practical.15*/16#define __hc32 __le3217#define __hc16 __le161819/* statistics can be kept for tuning/monitoring */20struct fotg210_stats {21/* irq usage */22unsigned long normal;23unsigned long error;24unsigned long iaa;25unsigned long lost_iaa;2627/* termination of urbs from core */28unsigned long complete;29unsigned long unlink;30};3132/* fotg210_hcd->lock guards shared data against other CPUs:33* fotg210_hcd: async, unlink, periodic (and shadow), ...34* usb_host_endpoint: hcpriv35* fotg210_qh: qh_next, qtd_list36* fotg210_qtd: qtd_list37*38* Also, hold this lock when talking to HC registers or39* when updating hw_* fields in shared qh/qtd/... structures.40*/4142#define FOTG210_MAX_ROOT_PORTS 1 /* see HCS_N_PORTS */4344/*45* fotg210_rh_state values of FOTG210_RH_RUNNING or above mean that the46* controller may be doing DMA. Lower values mean there's no DMA.47*/48enum fotg210_rh_state {49FOTG210_RH_HALTED,50FOTG210_RH_SUSPENDED,51FOTG210_RH_RUNNING,52FOTG210_RH_STOPPING53};5455/*56* Timer events, ordered by increasing delay length.57* Always update event_delays_ns[] and event_handlers[] (defined in58* ehci-timer.c) in parallel with this list.59*/60enum fotg210_hrtimer_event {61FOTG210_HRTIMER_POLL_ASS, /* Poll for async schedule off */62FOTG210_HRTIMER_POLL_PSS, /* Poll for periodic schedule off */63FOTG210_HRTIMER_POLL_DEAD, /* Wait for dead controller to stop */64FOTG210_HRTIMER_UNLINK_INTR, /* Wait for interrupt QH unlink */65FOTG210_HRTIMER_FREE_ITDS, /* Wait for unused iTDs and siTDs */66FOTG210_HRTIMER_ASYNC_UNLINKS, /* Unlink empty async QHs */67FOTG210_HRTIMER_IAA_WATCHDOG, /* Handle lost IAA interrupts */68FOTG210_HRTIMER_DISABLE_PERIODIC, /* Wait to disable periodic sched */69FOTG210_HRTIMER_DISABLE_ASYNC, /* Wait to disable async sched */70FOTG210_HRTIMER_IO_WATCHDOG, /* Check for missing IRQs */71FOTG210_HRTIMER_NUM_EVENTS /* Must come last */72};73#define FOTG210_HRTIMER_NO_EVENT 997475struct fotg210_hcd { /* one per controller */76/* timing support */77enum fotg210_hrtimer_event next_hrtimer_event;78unsigned enabled_hrtimer_events;79ktime_t hr_timeouts[FOTG210_HRTIMER_NUM_EVENTS];80struct hrtimer hrtimer;8182int PSS_poll_count;83int ASS_poll_count;84int died_poll_count;8586/* glue to PCI and HCD framework */87struct fotg210_caps __iomem *caps;88struct fotg210_regs __iomem *regs;89struct ehci_dbg_port __iomem *debug;9091__u32 hcs_params; /* cached register copy */92spinlock_t lock;93enum fotg210_rh_state rh_state;9495/* general schedule support */96bool scanning:1;97bool need_rescan:1;98bool intr_unlinking:1;99bool async_unlinking:1;100bool shutdown:1;101struct fotg210_qh *qh_scan_next;102103/* async schedule support */104struct fotg210_qh *async;105struct fotg210_qh *dummy; /* For AMD quirk use */106struct fotg210_qh *async_unlink;107struct fotg210_qh *async_unlink_last;108struct fotg210_qh *async_iaa;109unsigned async_unlink_cycle;110unsigned async_count; /* async activity count */111112/* periodic schedule support */113#define DEFAULT_I_TDPS 1024 /* some HCs can do less */114unsigned periodic_size;115__hc32 *periodic; /* hw periodic table */116dma_addr_t periodic_dma;117struct list_head intr_qh_list;118unsigned i_thresh; /* uframes HC might cache */119120union fotg210_shadow *pshadow; /* mirror hw periodic table */121struct fotg210_qh *intr_unlink;122struct fotg210_qh *intr_unlink_last;123unsigned intr_unlink_cycle;124unsigned now_frame; /* frame from HC hardware */125unsigned next_frame; /* scan periodic, start here */126unsigned intr_count; /* intr activity count */127unsigned isoc_count; /* isoc activity count */128unsigned periodic_count; /* periodic activity count */129/* max periodic time per uframe */130unsigned uframe_periodic_max;131132133/* list of itds completed while now_frame was still active */134struct list_head cached_itd_list;135struct fotg210_itd *last_itd_to_free;136137/* per root hub port */138unsigned long reset_done[FOTG210_MAX_ROOT_PORTS];139140/* bit vectors (one bit per port)141* which ports were already suspended at the start of a bus suspend142*/143unsigned long bus_suspended;144145/* which ports are edicated to the companion controller */146unsigned long companion_ports;147148/* which ports are owned by the companion during a bus suspend */149unsigned long owned_ports;150151/* which ports have the change-suspend feature turned on */152unsigned long port_c_suspend;153154/* which ports are suspended */155unsigned long suspended_ports;156157/* which ports have started to resume */158unsigned long resuming_ports;159160/* per-HC memory pools (could be per-bus, but ...) */161struct dma_pool *qh_pool; /* qh per active urb */162struct dma_pool *qtd_pool; /* one or more per qh */163struct dma_pool *itd_pool; /* itd per iso urb */164165unsigned random_frame;166unsigned long next_statechange;167ktime_t last_periodic_enable;168u32 command;169170/* SILICON QUIRKS */171unsigned need_io_watchdog:1;172unsigned fs_i_thresh:1; /* Intel iso scheduling */173174u8 sbrn; /* packed release number */175176/* irq statistics */177#ifdef FOTG210_STATS178struct fotg210_stats stats;179# define INCR(x) ((x)++)180#else181# define INCR(x) do {} while (0)182#endif183184struct fotg210 *fotg; /* Overarching FOTG210 device */185/* silicon clock */186struct clk *pclk;187};188189/* convert between an HCD pointer and the corresponding FOTG210_HCD */190static inline struct fotg210_hcd *hcd_to_fotg210(struct usb_hcd *hcd)191{192return (struct fotg210_hcd *)(hcd->hcd_priv);193}194static inline struct usb_hcd *fotg210_to_hcd(struct fotg210_hcd *fotg210)195{196return container_of((void *) fotg210, struct usb_hcd, hcd_priv);197}198199/*-------------------------------------------------------------------------*/200201/* EHCI register interface, corresponds to EHCI Revision 0.95 specification */202203/* Section 2.2 Host Controller Capability Registers */204struct fotg210_caps {205/* these fields are specified as 8 and 16 bit registers,206* but some hosts can't perform 8 or 16 bit PCI accesses.207* some hosts treat caplength and hciversion as parts of a 32-bit208* register, others treat them as two separate registers, this209* affects the memory map for big endian controllers.210*/211u32 hc_capbase;212#define HC_LENGTH(fotg210, p) (0x00ff&((p) >> /* bits 7:0 / offset 00h */ \213(fotg210_big_endian_capbase(fotg210) ? 24 : 0)))214#define HC_VERSION(fotg210, p) (0xffff&((p) >> /* bits 31:16 / offset 02h */ \215(fotg210_big_endian_capbase(fotg210) ? 0 : 16)))216u32 hcs_params; /* HCSPARAMS - offset 0x4 */217#define HCS_N_PORTS(p) (((p)>>0)&0xf) /* bits 3:0, ports on HC */218219u32 hcc_params; /* HCCPARAMS - offset 0x8 */220#define HCC_CANPARK(p) ((p)&(1 << 2)) /* true: can park on async qh */221#define HCC_PGM_FRAMELISTLEN(p) ((p)&(1 << 1)) /* true: periodic_size changes*/222u8 portroute[8]; /* nibbles for routing - offset 0xC */223};224225226/* Section 2.3 Host Controller Operational Registers */227struct fotg210_regs {228229/* USBCMD: offset 0x00 */230u32 command;231232/* EHCI 1.1 addendum */233/* 23:16 is r/w intr rate, in microframes; default "8" == 1/msec */234#define CMD_PARK (1<<11) /* enable "park" on async qh */235#define CMD_PARK_CNT(c) (((c)>>8)&3) /* how many transfers to park for */236#define CMD_IAAD (1<<6) /* "doorbell" interrupt async advance */237#define CMD_ASE (1<<5) /* async schedule enable */238#define CMD_PSE (1<<4) /* periodic schedule enable */239/* 3:2 is periodic frame list size */240#define CMD_RESET (1<<1) /* reset HC not bus */241#define CMD_RUN (1<<0) /* start/stop HC */242243/* USBSTS: offset 0x04 */244u32 status;245#define STS_ASS (1<<15) /* Async Schedule Status */246#define STS_PSS (1<<14) /* Periodic Schedule Status */247#define STS_RECL (1<<13) /* Reclamation */248#define STS_HALT (1<<12) /* Not running (any reason) */249/* some bits reserved */250/* these STS_* flags are also intr_enable bits (USBINTR) */251#define STS_IAA (1<<5) /* Interrupted on async advance */252#define STS_FATAL (1<<4) /* such as some PCI access errors */253#define STS_FLR (1<<3) /* frame list rolled over */254#define STS_PCD (1<<2) /* port change detect */255#define STS_ERR (1<<1) /* "error" completion (overflow, ...) */256#define STS_INT (1<<0) /* "normal" completion (short, ...) */257258/* USBINTR: offset 0x08 */259u32 intr_enable;260261/* FRINDEX: offset 0x0C */262u32 frame_index; /* current microframe number */263/* CTRLDSSEGMENT: offset 0x10 */264u32 segment; /* address bits 63:32 if needed */265/* PERIODICLISTBASE: offset 0x14 */266u32 frame_list; /* points to periodic list */267/* ASYNCLISTADDR: offset 0x18 */268u32 async_next; /* address of next async queue head */269270u32 reserved1;271/* PORTSC: offset 0x20 */272u32 port_status;273/* 31:23 reserved */274#define PORT_USB11(x) (((x)&(3<<10)) == (1<<10)) /* USB 1.1 device */275#define PORT_RESET (1<<8) /* reset port */276#define PORT_SUSPEND (1<<7) /* suspend port */277#define PORT_RESUME (1<<6) /* resume it */278#define PORT_PEC (1<<3) /* port enable change */279#define PORT_PE (1<<2) /* port enable */280#define PORT_CSC (1<<1) /* connect status change */281#define PORT_CONNECT (1<<0) /* device connected */282#define PORT_RWC_BITS (PORT_CSC | PORT_PEC)283u32 reserved2[19];284285/* OTGCSR: offet 0x70 */286u32 otgcsr;287#define OTGCSR_HOST_SPD_TYP (3 << 22)288#define OTGCSR_A_BUS_DROP (1 << 5)289#define OTGCSR_A_BUS_REQ (1 << 4)290291/* OTGISR: offset 0x74 */292u32 otgisr;293#define OTGISR_OVC (1 << 10)294295u32 reserved3[15];296297/* GMIR: offset 0xB4 */298u32 gmir;299#define GMIR_INT_POLARITY (1 << 3) /*Active High*/300#define GMIR_MHC_INT (1 << 2)301#define GMIR_MOTG_INT (1 << 1)302#define GMIR_MDEV_INT (1 << 0)303};304305/*-------------------------------------------------------------------------*/306307#define QTD_NEXT(fotg210, dma) cpu_to_hc32(fotg210, (u32)dma)308309/*310* EHCI Specification 0.95 Section 3.5311* QTD: describe data transfer components (buffer, direction, ...)312* See Fig 3-6 "Queue Element Transfer Descriptor Block Diagram".313*314* These are associated only with "QH" (Queue Head) structures,315* used with control, bulk, and interrupt transfers.316*/317struct fotg210_qtd {318/* first part defined by EHCI spec */319__hc32 hw_next; /* see EHCI 3.5.1 */320__hc32 hw_alt_next; /* see EHCI 3.5.2 */321__hc32 hw_token; /* see EHCI 3.5.3 */322#define QTD_TOGGLE (1 << 31) /* data toggle */323#define QTD_LENGTH(tok) (((tok)>>16) & 0x7fff)324#define QTD_IOC (1 << 15) /* interrupt on complete */325#define QTD_CERR(tok) (((tok)>>10) & 0x3)326#define QTD_PID(tok) (((tok)>>8) & 0x3)327#define QTD_STS_ACTIVE (1 << 7) /* HC may execute this */328#define QTD_STS_HALT (1 << 6) /* halted on error */329#define QTD_STS_DBE (1 << 5) /* data buffer error (in HC) */330#define QTD_STS_BABBLE (1 << 4) /* device was babbling (qtd halted) */331#define QTD_STS_XACT (1 << 3) /* device gave illegal response */332#define QTD_STS_MMF (1 << 2) /* incomplete split transaction */333#define QTD_STS_STS (1 << 1) /* split transaction state */334#define QTD_STS_PING (1 << 0) /* issue PING? */335336#define ACTIVE_BIT(fotg210) cpu_to_hc32(fotg210, QTD_STS_ACTIVE)337#define HALT_BIT(fotg210) cpu_to_hc32(fotg210, QTD_STS_HALT)338#define STATUS_BIT(fotg210) cpu_to_hc32(fotg210, QTD_STS_STS)339340__hc32 hw_buf[5]; /* see EHCI 3.5.4 */341__hc32 hw_buf_hi[5]; /* Appendix B */342343/* the rest is HCD-private */344dma_addr_t qtd_dma; /* qtd address */345struct list_head qtd_list; /* sw qtd list */346struct urb *urb; /* qtd's urb */347size_t length; /* length of buffer */348} __aligned(32);349350/* mask NakCnt+T in qh->hw_alt_next */351#define QTD_MASK(fotg210) cpu_to_hc32(fotg210, ~0x1f)352353#define IS_SHORT_READ(token) (QTD_LENGTH(token) != 0 && QTD_PID(token) == 1)354355/*-------------------------------------------------------------------------*/356357/* type tag from {qh,itd,fstn}->hw_next */358#define Q_NEXT_TYPE(fotg210, dma) ((dma) & cpu_to_hc32(fotg210, 3 << 1))359360/*361* Now the following defines are not converted using the362* cpu_to_le32() macro anymore, since we have to support363* "dynamic" switching between be and le support, so that the driver364* can be used on one system with SoC EHCI controller using big-endian365* descriptors as well as a normal little-endian PCI EHCI controller.366*/367/* values for that type tag */368#define Q_TYPE_ITD (0 << 1)369#define Q_TYPE_QH (1 << 1)370#define Q_TYPE_SITD (2 << 1)371#define Q_TYPE_FSTN (3 << 1)372373/* next async queue entry, or pointer to interrupt/periodic QH */374#define QH_NEXT(fotg210, dma) \375(cpu_to_hc32(fotg210, (((u32)dma)&~0x01f)|Q_TYPE_QH))376377/* for periodic/async schedules and qtd lists, mark end of list */378#define FOTG210_LIST_END(fotg210) \379cpu_to_hc32(fotg210, 1) /* "null pointer" to hw */380381/*382* Entries in periodic shadow table are pointers to one of four kinds383* of data structure. That's dictated by the hardware; a type tag is384* encoded in the low bits of the hardware's periodic schedule. Use385* Q_NEXT_TYPE to get the tag.386*387* For entries in the async schedule, the type tag always says "qh".388*/389union fotg210_shadow {390struct fotg210_qh *qh; /* Q_TYPE_QH */391struct fotg210_itd *itd; /* Q_TYPE_ITD */392struct fotg210_fstn *fstn; /* Q_TYPE_FSTN */393__hc32 *hw_next; /* (all types) */394void *ptr;395};396397/*-------------------------------------------------------------------------*/398399/*400* EHCI Specification 0.95 Section 3.6401* QH: describes control/bulk/interrupt endpoints402* See Fig 3-7 "Queue Head Structure Layout".403*404* These appear in both the async and (for interrupt) periodic schedules.405*/406407/* first part defined by EHCI spec */408struct fotg210_qh_hw {409__hc32 hw_next; /* see EHCI 3.6.1 */410__hc32 hw_info1; /* see EHCI 3.6.2 */411#define QH_CONTROL_EP (1 << 27) /* FS/LS control endpoint */412#define QH_HEAD (1 << 15) /* Head of async reclamation list */413#define QH_TOGGLE_CTL (1 << 14) /* Data toggle control */414#define QH_HIGH_SPEED (2 << 12) /* Endpoint speed */415#define QH_LOW_SPEED (1 << 12)416#define QH_FULL_SPEED (0 << 12)417#define QH_INACTIVATE (1 << 7) /* Inactivate on next transaction */418__hc32 hw_info2; /* see EHCI 3.6.2 */419#define QH_SMASK 0x000000ff420#define QH_CMASK 0x0000ff00421#define QH_HUBADDR 0x007f0000422#define QH_HUBPORT 0x3f800000423#define QH_MULT 0xc0000000424__hc32 hw_current; /* qtd list - see EHCI 3.6.4 */425426/* qtd overlay (hardware parts of a struct fotg210_qtd) */427__hc32 hw_qtd_next;428__hc32 hw_alt_next;429__hc32 hw_token;430__hc32 hw_buf[5];431__hc32 hw_buf_hi[5];432} __aligned(32);433434struct fotg210_qh {435struct fotg210_qh_hw *hw; /* Must come first */436/* the rest is HCD-private */437dma_addr_t qh_dma; /* address of qh */438union fotg210_shadow qh_next; /* ptr to qh; or periodic */439struct list_head qtd_list; /* sw qtd list */440struct list_head intr_node; /* list of intr QHs */441struct fotg210_qtd *dummy;442struct fotg210_qh *unlink_next; /* next on unlink list */443444unsigned unlink_cycle;445446u8 needs_rescan; /* Dequeue during giveback */447u8 qh_state;448#define QH_STATE_LINKED 1 /* HC sees this */449#define QH_STATE_UNLINK 2 /* HC may still see this */450#define QH_STATE_IDLE 3 /* HC doesn't see this */451#define QH_STATE_UNLINK_WAIT 4 /* LINKED and on unlink q */452#define QH_STATE_COMPLETING 5 /* don't touch token.HALT */453454u8 xacterrs; /* XactErr retry counter */455#define QH_XACTERR_MAX 32 /* XactErr retry limit */456457/* periodic schedule info */458u8 usecs; /* intr bandwidth */459u8 gap_uf; /* uframes split/csplit gap */460u8 c_usecs; /* ... split completion bw */461u16 tt_usecs; /* tt downstream bandwidth */462unsigned short period; /* polling interval */463unsigned short start; /* where polling starts */464#define NO_FRAME ((unsigned short)~0) /* pick new start */465466struct usb_device *dev; /* access to TT */467unsigned is_out:1; /* bulk or intr OUT */468unsigned clearing_tt:1; /* Clear-TT-Buf in progress */469};470471/*-------------------------------------------------------------------------*/472473/* description of one iso transaction (up to 3 KB data if highspeed) */474struct fotg210_iso_packet {475/* These will be copied to iTD when scheduling */476u64 bufp; /* itd->hw_bufp{,_hi}[pg] |= */477__hc32 transaction; /* itd->hw_transaction[i] |= */478u8 cross; /* buf crosses pages */479/* for full speed OUT splits */480u32 buf1;481};482483/* temporary schedule data for packets from iso urbs (both speeds)484* each packet is one logical usb transaction to the device (not TT),485* beginning at stream->next_uframe486*/487struct fotg210_iso_sched {488struct list_head td_list;489unsigned span;490struct fotg210_iso_packet packet[];491};492493/*494* fotg210_iso_stream - groups all (s)itds for this endpoint.495* acts like a qh would, if EHCI had them for ISO.496*/497struct fotg210_iso_stream {498/* first field matches fotg210_hq, but is NULL */499struct fotg210_qh_hw *hw;500501u8 bEndpointAddress;502u8 highspeed;503struct list_head td_list; /* queued itds */504struct list_head free_list; /* list of unused itds */505struct usb_device *udev;506struct usb_host_endpoint *ep;507508/* output of (re)scheduling */509int next_uframe;510__hc32 splits;511512/* the rest is derived from the endpoint descriptor,513* trusting urb->interval == f(epdesc->bInterval) and514* including the extra info for hw_bufp[0..2]515*/516u8 usecs, c_usecs;517u16 interval;518u16 tt_usecs;519u16 maxp;520u16 raw_mask;521unsigned bandwidth;522523/* This is used to initialize iTD's hw_bufp fields */524__hc32 buf0;525__hc32 buf1;526__hc32 buf2;527528/* this is used to initialize sITD's tt info */529__hc32 address;530};531532/*-------------------------------------------------------------------------*/533534/*535* EHCI Specification 0.95 Section 3.3536* Fig 3-4 "Isochronous Transaction Descriptor (iTD)"537*538* Schedule records for high speed iso xfers539*/540struct fotg210_itd {541/* first part defined by EHCI spec */542__hc32 hw_next; /* see EHCI 3.3.1 */543__hc32 hw_transaction[8]; /* see EHCI 3.3.2 */544#define FOTG210_ISOC_ACTIVE (1<<31) /* activate transfer this slot */545#define FOTG210_ISOC_BUF_ERR (1<<30) /* Data buffer error */546#define FOTG210_ISOC_BABBLE (1<<29) /* babble detected */547#define FOTG210_ISOC_XACTERR (1<<28) /* XactErr - transaction error */548#define FOTG210_ITD_LENGTH(tok) (((tok)>>16) & 0x0fff)549#define FOTG210_ITD_IOC (1 << 15) /* interrupt on complete */550551#define ITD_ACTIVE(fotg210) cpu_to_hc32(fotg210, FOTG210_ISOC_ACTIVE)552553__hc32 hw_bufp[7]; /* see EHCI 3.3.3 */554__hc32 hw_bufp_hi[7]; /* Appendix B */555556/* the rest is HCD-private */557dma_addr_t itd_dma; /* for this itd */558union fotg210_shadow itd_next; /* ptr to periodic q entry */559560struct urb *urb;561struct fotg210_iso_stream *stream; /* endpoint's queue */562struct list_head itd_list; /* list of stream's itds */563564/* any/all hw_transactions here may be used by that urb */565unsigned frame; /* where scheduled */566unsigned pg;567unsigned index[8]; /* in urb->iso_frame_desc */568} __aligned(32);569570/*-------------------------------------------------------------------------*/571572/*573* EHCI Specification 0.96 Section 3.7574* Periodic Frame Span Traversal Node (FSTN)575*576* Manages split interrupt transactions (using TT) that span frame boundaries577* into uframes 0/1; see 4.12.2.2. In those uframes, a "save place" FSTN578* makes the HC jump (back) to a QH to scan for fs/ls QH completions until579* it hits a "restore" FSTN; then it returns to finish other uframe 0/1 work.580*/581struct fotg210_fstn {582__hc32 hw_next; /* any periodic q entry */583__hc32 hw_prev; /* qh or FOTG210_LIST_END */584585/* the rest is HCD-private */586dma_addr_t fstn_dma;587union fotg210_shadow fstn_next; /* ptr to periodic q entry */588} __aligned(32);589590/*-------------------------------------------------------------------------*/591592/* Prepare the PORTSC wakeup flags during controller suspend/resume */593594#define fotg210_prepare_ports_for_controller_suspend(fotg210, do_wakeup) \595fotg210_adjust_port_wakeup_flags(fotg210, true, do_wakeup)596597#define fotg210_prepare_ports_for_controller_resume(fotg210) \598fotg210_adjust_port_wakeup_flags(fotg210, false, false)599600/*-------------------------------------------------------------------------*/601602/*603* Some EHCI controllers have a Transaction Translator built into the604* root hub. This is a non-standard feature. Each controller will need605* to add code to the following inline functions, and call them as606* needed (mostly in root hub code).607*/608609static inline unsigned int610fotg210_get_speed(struct fotg210_hcd *fotg210, unsigned int portsc)611{612return (readl(&fotg210->regs->otgcsr)613& OTGCSR_HOST_SPD_TYP) >> 22;614}615616/* Returns the speed of a device attached to a port on the root hub. */617static inline unsigned int618fotg210_port_speed(struct fotg210_hcd *fotg210, unsigned int portsc)619{620switch (fotg210_get_speed(fotg210, portsc)) {621case 0:622return 0;623case 1:624return USB_PORT_STAT_LOW_SPEED;625case 2:626default:627return USB_PORT_STAT_HIGH_SPEED;628}629}630631/*-------------------------------------------------------------------------*/632633#define fotg210_has_fsl_portno_bug(e) (0)634635/*636* While most USB host controllers implement their registers in637* little-endian format, a minority (celleb companion chip) implement638* them in big endian format.639*640* This attempts to support either format at compile time without a641* runtime penalty, or both formats with the additional overhead642* of checking a flag bit.643*644*/645646#define fotg210_big_endian_mmio(e) 0647#define fotg210_big_endian_capbase(e) 0648649static inline unsigned int fotg210_readl(const struct fotg210_hcd *fotg210,650__u32 __iomem *regs)651{652return readl(regs);653}654655static inline void fotg210_writel(const struct fotg210_hcd *fotg210,656const unsigned int val, __u32 __iomem *regs)657{658writel(val, regs);659}660661/* cpu to fotg210 */662static inline __hc32 cpu_to_hc32(const struct fotg210_hcd *fotg210, const u32 x)663{664return cpu_to_le32(x);665}666667/* fotg210 to cpu */668static inline u32 hc32_to_cpu(const struct fotg210_hcd *fotg210, const __hc32 x)669{670return le32_to_cpu(x);671}672673static inline u32 hc32_to_cpup(const struct fotg210_hcd *fotg210,674const __hc32 *x)675{676return le32_to_cpup(x);677}678679/*-------------------------------------------------------------------------*/680681static inline unsigned fotg210_read_frame_index(struct fotg210_hcd *fotg210)682{683return fotg210_readl(fotg210, &fotg210->regs->frame_index);684}685686/*-------------------------------------------------------------------------*/687688#endif /* __LINUX_FOTG210_H */689690691