2 |
- |
1 |
/* override default macros from ../port/usb.h */
|
|
|
2 |
#undef dprint
|
|
|
3 |
#undef ddprint
|
|
|
4 |
#undef deprint
|
|
|
5 |
#undef ddeprint
|
|
|
6 |
#define dprint if(ehcidebug)print
|
|
|
7 |
#define ddprint if(ehcidebug>1)print
|
|
|
8 |
#define deprint if(ehcidebug || ep->debug)print
|
|
|
9 |
#define ddeprint if(ehcidebug>1 || ep->debug>1)print
|
|
|
10 |
|
|
|
11 |
typedef struct Ctlr Ctlr;
|
|
|
12 |
typedef struct Eopio Eopio;
|
|
|
13 |
typedef struct Isoio Isoio;
|
|
|
14 |
typedef struct Poll Poll;
|
|
|
15 |
typedef struct Qh Qh;
|
|
|
16 |
typedef struct Qtree Qtree;
|
|
|
17 |
|
|
|
18 |
#pragma incomplete Ctlr;
|
|
|
19 |
#pragma incomplete Eopio;
|
|
|
20 |
#pragma incomplete Isoio;
|
|
|
21 |
#pragma incomplete Poll;
|
|
|
22 |
#pragma incomplete Qh;
|
|
|
23 |
#pragma incomplete Qtree;
|
|
|
24 |
|
|
|
25 |
struct Poll
|
|
|
26 |
{
|
|
|
27 |
Lock;
|
|
|
28 |
Rendez;
|
|
|
29 |
int must;
|
|
|
30 |
int does;
|
|
|
31 |
};
|
|
|
32 |
|
|
|
33 |
struct Ctlr
|
|
|
34 |
{
|
|
|
35 |
Rendez; /* for waiting to async advance doorbell */
|
|
|
36 |
Lock; /* for ilock. qh lists and basic ctlr I/O */
|
|
|
37 |
QLock portlck; /* for port resets/enable... (and doorbell) */
|
|
|
38 |
int active; /* in use or not */
|
|
|
39 |
Ecapio* capio; /* Capability i/o regs */
|
|
|
40 |
Eopio* opio; /* Operational i/o regs */
|
|
|
41 |
|
|
|
42 |
int nframes; /* 1024, 512, or 256 frames in the list */
|
|
|
43 |
ulong* frames; /* periodic frame list (hw) */
|
|
|
44 |
Qh* qhs; /* async Qh circular list for bulk/ctl */
|
|
|
45 |
Qtree* tree; /* tree of Qhs for the periodic list */
|
|
|
46 |
int ntree; /* number of dummy qhs in tree */
|
|
|
47 |
Qh* intrqhs; /* list of (not dummy) qhs in tree */
|
|
|
48 |
Isoio* iso; /* list of active Iso I/O */
|
|
|
49 |
ulong load;
|
|
|
50 |
ulong isoload;
|
|
|
51 |
int nintr; /* number of interrupts attended */
|
|
|
52 |
int ntdintr; /* number of intrs. with something to do */
|
|
|
53 |
int nqhintr; /* number of async td intrs. */
|
|
|
54 |
int nisointr; /* number of periodic td intrs. */
|
|
|
55 |
int nreqs;
|
|
|
56 |
Poll poll;
|
|
|
57 |
};
|
|
|
58 |
|
|
|
59 |
/*
|
|
|
60 |
* Operational registers (hw)
|
|
|
61 |
*/
|
|
|
62 |
struct Eopio
|
|
|
63 |
{
|
|
|
64 |
ulong cmd; /* 00 command */
|
|
|
65 |
ulong sts; /* 04 status */
|
|
|
66 |
ulong intr; /* 08 interrupt enable */
|
|
|
67 |
ulong frno; /* 0c frame index */
|
|
|
68 |
ulong seg; /* 10 bits 63:32 of EHCI datastructs (unused) */
|
|
|
69 |
ulong frbase; /* 14 frame list base addr, 4096-byte boundary */
|
|
|
70 |
ulong link; /* 18 link for async list */
|
|
|
71 |
uchar d2c[0x40-0x1c]; /* 1c dummy */
|
|
|
72 |
ulong config; /* 40 1: all ports default-routed to this HC */
|
|
|
73 |
ulong portsc[3]; /* 44 Port status and control, one per port */
|
|
|
74 |
|
|
|
75 |
/* defined for omap35 ehci at least */
|
|
|
76 |
uchar _pad0[0x80 - 0x50];
|
|
|
77 |
ulong insn[6]; /* implementation-specific */
|
|
|
78 |
};
|
|
|
79 |
|
|
|
80 |
typedef struct Uhh Uhh;
|
|
|
81 |
struct Uhh {
|
|
|
82 |
ulong revision; /* ro */
|
|
|
83 |
uchar _pad0[0x10-0x4];
|
|
|
84 |
ulong sysconfig;
|
|
|
85 |
ulong sysstatus; /* ro */
|
|
|
86 |
|
|
|
87 |
uchar _pad1[0x40-0x18];
|
|
|
88 |
ulong hostconfig;
|
|
|
89 |
ulong debug_csr;
|
|
|
90 |
};
|
|
|
91 |
|
|
|
92 |
enum {
|
|
|
93 |
/* hostconfig bits */
|
|
|
94 |
P1ulpi_bypass = 1<<0, /* utmi if set; else ulpi */
|
|
|
95 |
};
|
|
|
96 |
|
|
|
97 |
extern Ecapio *ehcidebugcapio;
|
|
|
98 |
extern int ehcidebugport;
|
|
|
99 |
|
|
|
100 |
extern int ehcidebug;
|
|
|
101 |
|
|
|
102 |
void ehcilinkage(Hci *hp);
|
|
|
103 |
void ehcimeminit(Ctlr *ctlr);
|
|
|
104 |
void ehcirun(Ctlr *ctlr, int on);
|