aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/misc/modem_if_u1/modem_link_device_hsic.h
blob: 604b06784e2242e11db3e80ae523378681f4cd64 (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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
/*
 * Copyright (C) 2010 Google, Inc.
 * Copyright (C) 2010 Samsung Electronics.
 *
 * This software is licensed under the terms of the GNU General Public
 * License version 2, as published by the Free Software Foundation, and
 * may be copied, distributed, and modified under those terms.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 */

#ifndef __MODEM_LINK_DEVICE_USB_H__
#define __MODEM_LINK_DEVICE_USB_H__


enum {
	IF_USB_BOOT_EP = 0,
	IF_USB_FMT_EP = 0,
	IF_USB_RAW_EP,
	IF_USB_RFS_EP,
	IF_USB_CMD_EP,
	IF_USB_DEVNUM_MAX,
};

/* each pipe has 2 ep for in/out */
#define LINKPM_DEV_NUM	(IF_USB_DEVNUM_MAX * 2)
/******************/
/* xmm6260 specific */

#define IOCTL_LINK_CONTROL_ENABLE	_IO('o', 0x30)
#define IOCTL_LINK_CONTROL_ACTIVE	_IO('o', 0x31)
#define IOCTL_LINK_GET_HOSTWAKE		_IO('o', 0x32)
#define IOCTL_LINK_CONNECTED		_IO('o', 0x33)
#define IOCTL_LINK_SET_BIAS_CLEAR	_IO('o', 0x34)
#define IOCTL_LINK_GET_PHONEACTIVE	_IO('o', 0x35)

/* VID,PID for IMC - XMM6260, XMM6262*/
#define IMC_BOOT_VID		0x058b
#define IMC_BOOT_PID		0x0041
#define IMC_MAIN_VID		0x1519
#define IMC_MAIN_PID		0x0020
/* VID,PID for STE - M7400 */
#define STE_BOOT_VID		0x04cc
#define STE_BOOT_PID		0x7400
#define STE_MAIN_VID		0x04cc
#define STE_MAIN_PID		0x2333

enum {
	BOOT_DOWN = 0,
	IPC_CHANNEL
};

enum ch_state {
	STATE_SUSPENDED,
	STATE_RESUMED,
};

#define HOSTWAKE_TRIGLEVEL	0
/******************/

struct link_pm_info {
	struct usb_link_device *usb_ld;
};

struct usb_id_info {
	int intf_id;
	struct usb_link_device *usb_ld;
};

struct link_pm_data {
	struct miscdevice miscdev;
	struct usb_link_device *usb_ld;
	unsigned irq_link_hostwake;
	int (*link_ldo_enable)(bool);
	unsigned gpio_link_enable;
	unsigned gpio_link_active;
	unsigned gpio_link_hostwake;
	unsigned gpio_link_slavewake;
	int (*link_reconnect)(void);
	int link_reconnect_cnt;

	struct workqueue_struct *wq;
	struct completion active_done;
	struct delayed_work link_pm_work;
	struct delayed_work link_pm_start;
	struct delayed_work link_reconnect_work;
	bool resume_requested;
	bool link_pm_active;
	int resume_retry_cnt;

	struct wake_lock l2_wake;
	struct wake_lock boot_wake;
	struct wake_lock rpm_wake;
	struct wake_lock tx_async_wake;
	struct notifier_block pm_notifier;
	bool dpm_suspending;

	/* Host wakeup toggle debugging */
	unsigned ipc_debug_cnt;
	unsigned long tx_cnt;
	unsigned long rx_cnt;

	void (*ehci_reg_dump)(struct device *);
};

struct if_usb_devdata {
	struct usb_interface *data_intf;
	struct usb_link_device *usb_ld;
	struct usb_device *usbdev;
	unsigned int tx_pipe;
	unsigned int rx_pipe;
	u8 disconnected;

	int format;
	struct urb *urb;
	void *rx_buf;
	unsigned int rx_buf_size;
	enum ch_state state;
};

struct usb_link_device {
	/*COMMON LINK DEVICE*/
	struct link_device ld;

	/*USB SPECIFIC LINK DEVICE*/
	struct usb_device	*usbdev;
	struct if_usb_devdata	devdata[IF_USB_DEVNUM_MAX];
	unsigned int		dev_count;
	unsigned int		suspended;
	int if_usb_connected;

	bool if_usb_is_main; /* boot,down(false) or main(true) */

	/* LINK PM DEVICE DATA */
	struct link_pm_data *link_pm_data;

	/*RX retry work by -ENOMEM*/
	struct delayed_work rx_retry_work;
	struct urb *retry_urb;
	unsigned rx_retry_cnt;
};
/* converts from struct link_device* to struct xxx_link_device* */
#define to_usb_link_device(linkdev) \
			container_of(linkdev, struct usb_link_device, ld)


#ifdef FOR_TEGRA
extern void tegra_ehci_txfilltuning(void);
#endif

#endif