blob: 9d30cb9735c4a53362277cf22790c18427b06768 [file] [log] [blame]
Duy Truong790f06d2013-02-13 16:38:12 -08001/* Copyright (c) 2009, The Linux Foundation. All rights reserved.
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002 *
3 * This software is licensed under the terms of the GNU General Public
4 * License version 2, as published by the Free Software Foundation, and
5 * may be copied, distributed, and modified under those terms.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 *
12 */
13
14#ifndef __ARCH_ARM_MACH_MSM_OTG_H
15#define __ARCH_ARM_MACH_MSM_OTG_H
16
17#include <linux/workqueue.h>
18#include <linux/wakelock.h>
19
20/*
21 * The otg driver needs to interact with both device side and host side
22 * usb controllers. it decides which controller is active at a given
23 * moment, using the transceiver, ID signal.
24 */
25
26struct msm_otg_transceiver {
27 struct device *dev;
28 struct clk *clk;
29 struct clk *pclk;
30 int in_lpm;
31 struct msm_otg_ops *dcd_ops;
32 struct msm_otg_ops *hcd_ops;
33 int irq;
34 int flags;
35 int state;
36 int active;
37 void __iomem *regs; /* device memory/io */
38 struct work_struct work;
39 spinlock_t lock;
40 struct wake_lock wlock;
41
42 /* bind/unbind the host controller */
43 int (*set_host)(struct msm_otg_transceiver *otg,
44 struct msm_otg_ops *hcd_ops);
45
46 /* bind/unbind the peripheral controller */
47 int (*set_peripheral)(struct msm_otg_transceiver *otg,
48 struct msm_otg_ops *dcd_ops);
49 int (*set_suspend)(struct msm_otg_transceiver *otg,
50 int suspend);
51
52};
53
54struct msm_otg_ops {
55 void (*request)(void *, int);
56 void *handle;
57};
58
59/* for usb host and peripheral controller drivers */
60#ifdef CONFIG_USB_MSM_OTG
61
62extern struct msm_otg_transceiver *msm_otg_get_transceiver(void);
63extern void msm_otg_put_transceiver(struct msm_otg_transceiver *xceiv);
64
65#else
66
67static inline struct msm_otg_transceiver *msm_otg_get_transceiver(void)
68{
69 return NULL;
70}
71
72static inline void msm_otg_put_transceiver(struct msm_otg_transceiver *xceiv)
73{
74}
75
76#endif /*CONFIG_USB_MSM_OTG*/
77
78#endif