summaryrefslogtreecommitdiff
path: root/arch/arm/mach-msm/include/mach/msm_otg.h
blob: 6ab662921feefdd962b440cca2e51ab638043947 (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
/* Copyright (c) 2009, Code Aurora Forum. All rights reserved.
 *
 * 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 __ARCH_ARM_MACH_MSM_OTG_H
#define __ARCH_ARM_MACH_MSM_OTG_H

/*
 * The otg driver needs to interact with both device side and host side
 * usb controllers.  it decides which controller is active at a given
 * moment, using the transceiver, ID signal.
 */

struct msm_otg_transceiver {
	struct device		*dev;
	struct clk		*clk;
	struct clk		*pclk;
	int			in_lpm;
	struct msm_otg_ops	*dcd_ops;
	struct msm_otg_ops	*hcd_ops;
	int			irq;
	int			flags;
	int			state;
	int			active;
	void __iomem		*regs;		/* device memory/io */
	struct work_struct	work;
	spinlock_t		lock;

	/* bind/unbind the host controller */
	int	(*set_host)(struct msm_otg_transceiver *otg,
				struct msm_otg_ops *hcd_ops);

	/* bind/unbind the peripheral controller */
	int	(*set_peripheral)(struct msm_otg_transceiver *otg,
				struct msm_otg_ops *dcd_ops);
	void    (*set_suspend) (int on);

};

struct msm_otg_ops {
	void		(*status_change)(int);
};

/* for usb host and peripheral controller drivers */
#ifdef CONFIG_USB_MSM_OTG

extern struct msm_otg_transceiver *msm_otg_get_transceiver(void);
extern void msm_otg_put_transceiver(struct msm_otg_transceiver *xceiv);

#else

static inline struct msm_otg_transceiver *msm_otg_get_transceiver(void)
{
	return NULL;
}

static inline void msm_otg_put_transceiver(struct msm_otg_transceiver *xceiv)
{
}

#endif /*CONFIG_USB_MSM_OTG*/

#endif