summaryrefslogtreecommitdiff
path: root/target/linux/ramips/files/drivers/usb/host/xhci-mtk-scheduler.h
blob: c55dfb10da84665c720aae5c2abf7217ea33585e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
#ifndef _XHCI_MTK_SCHEDULER_H
#define _XHCI_MTK_SCHEDULER_H

#define MTK_SCH_NEW		1

#define SCH_SUCCESS		1
#define SCH_FAIL		0

#define MAX_EP_NUM		64
#define SS_BW_BOUND		51000
#define HS_BW_BOUND		6144

#define USB_EP_CONTROL		0
#define USB_EP_ISOC		1
#define USB_EP_BULK		2
#define USB_EP_INT		3

#define USB_SPEED_LOW		1
#define USB_SPEED_FULL		2
#define USB_SPEED_HIGH		3
#define USB_SPEED_SUPER		5

/* mtk scheduler bitmasks */
#define BPKTS(p)		((p) & 0x3f)
#define BCSCOUNT(p)		(((p) & 0x7) << 8)
#define BBM(p)			((p) << 11)
#define BOFFSET(p)		((p) & 0x3fff)
#define BREPEAT(p)		(((p) & 0x7fff) << 16)


#if 1
typedef unsigned int mtk_u32;
typedef unsigned long long mtk_u64;
#endif

#define NULL ((void *)0)

struct mtk_xhci_ep_ctx {
	mtk_u32	ep_info;
	mtk_u32	ep_info2;
	mtk_u64	deq;
	mtk_u32	tx_info;
	/* offset 0x14 - 0x1f reserved for HC internal use */
	mtk_u32	reserved[3];
};


struct sch_ep
{
	//device info
	int dev_speed;
	int isTT;
	//ep info
	int is_in;
	int ep_type;
	int maxp;
	int interval;
	int burst;
	int mult;
	//scheduling info
	int offset;
	int repeat;
	int pkts;
	int cs_count;
	int burst_mode;
	//other
	int bw_cost;	//bandwidth cost in each repeat; including overhead
	mtk_u32 *ep;		//address of usb_endpoint pointer
};

int mtk_xhci_scheduler_init(void);
int mtk_xhci_scheduler_add_ep(int dev_speed, int is_in, int isTT, int ep_type, int maxp, int interval, int burst
	, int mult, mtk_u32 *ep, mtk_u32 *ep_ctx, struct sch_ep *sch_ep);
struct sch_ep * mtk_xhci_scheduler_remove_ep(int dev_speed, int is_in, int isTT, int ep_type, mtk_u32 *ep);


#endif