Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
intel_mid_otg.h
Go to the documentation of this file.
1 /*
2  * Intel MID (Langwell/Penwell) USB OTG Transceiver driver
3  * Copyright (C) 2008 - 2010, Intel Corporation.
4  *
5  * This program is free software; you can redistribute it and/or modify it
6  * under the terms and conditions of the GNU General Public License,
7  * version 2, as published by the Free Software Foundation.
8  *
9  * This program is distributed in the hope it will be useful, but WITHOUT
10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12  * more details.
13  *
14  * You should have received a copy of the GNU General Public License along with
15  * this program; if not, write to the Free Software Foundation, Inc.,
16  * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
17  *
18  */
19 
20 #ifndef __INTEL_MID_OTG_H
21 #define __INTEL_MID_OTG_H
22 
23 #include <linux/pm.h>
24 #include <linux/usb/otg.h>
25 #include <linux/notifier.h>
26 
27 struct intel_mid_otg_xceiv;
28 
29 /* This is a common data structure for Intel MID platform to
30  * save values of the OTG state machine */
31 struct otg_hsm {
32  /* Input */
35  int a_conn;
37  int a_srp_det;
41  int b_conn;
42  int b_se0_srp;
46  int id;
47 /* id values */
48 #define ID_B 0x05
49 #define ID_A 0x04
50 #define ID_ACA_C 0x03
51 #define ID_ACA_B 0x02
52 #define ID_ACA_A 0x01
53  int power_up;
56 
57  /* Internal variables */
62 
63  /* Timeout indicator for timers */
76 
77  /* Informative variables */
79  int a_bus_req;
80  int a_clr_err;
81  int b_bus_req;
84 
85  /* Output */
86  int drv_vbus;
87  int loc_conn;
88  int loc_sof;
89 
90  /* Others */
92 };
93 
94 /* must provide ULPI access function to read/write registers implemented in
95  * ULPI address space */
97  int (*read)(struct intel_mid_otg_xceiv *iotg, u8 reg, u8 *val);
98  int (*write)(struct intel_mid_otg_xceiv *iotg, u8 reg, u8 val);
99 };
100 
101 #define OTG_A_DEVICE 0x0
102 #define OTG_B_DEVICE 0x1
103 
104 /*
105  * the Intel MID (Langwell/Penwell) otg transceiver driver needs to interact
106  * with device and host drivers to implement the USB OTG related feature. More
107  * function members are added based on usb_phy data structure for this
108  * purpose.
109  */
111  struct usb_phy otg;
112  struct otg_hsm hsm;
113 
114  /* base address */
115  void __iomem *base;
116 
117  /* ops to access ulpi */
119 
120  /* atomic notifier for interrupt context */
122 
123  /* start/stop USB Host function */
126 
127  /* start/stop USB Peripheral function */
130 
131  /* start/stop ADP sense/probe function */
133  bool enabled, int dev);
135  bool enabled);
136 
137 #ifdef CONFIG_PM
138  /* suspend/resume USB host function */
139  int (*suspend_host)(struct intel_mid_otg_xceiv *iotg,
141  int (*resume_host)(struct intel_mid_otg_xceiv *iotg);
142 
143  int (*suspend_peripheral)(struct intel_mid_otg_xceiv *iotg,
145  int (*resume_peripheral)(struct intel_mid_otg_xceiv *iotg);
146 #endif
147 
148 };
149 static inline
150 struct intel_mid_otg_xceiv *otg_to_mid_xceiv(struct usb_phy *otg)
151 {
152  return container_of(otg, struct intel_mid_otg_xceiv, otg);
153 }
154 
155 #define MID_OTG_NOTIFY_CONNECT 0x0001
156 #define MID_OTG_NOTIFY_DISCONN 0x0002
157 #define MID_OTG_NOTIFY_HSUSPEND 0x0003
158 #define MID_OTG_NOTIFY_HRESUME 0x0004
159 #define MID_OTG_NOTIFY_CSUSPEND 0x0005
160 #define MID_OTG_NOTIFY_CRESUME 0x0006
161 #define MID_OTG_NOTIFY_HOSTADD 0x0007
162 #define MID_OTG_NOTIFY_HOSTREMOVE 0x0008
163 #define MID_OTG_NOTIFY_CLIENTADD 0x0009
164 #define MID_OTG_NOTIFY_CLIENTREMOVE 0x000a
165 
166 static inline int
167 intel_mid_otg_register_notifier(struct intel_mid_otg_xceiv *iotg,
168  struct notifier_block *nb)
169 {
171 }
172 
173 static inline void
174 intel_mid_otg_unregister_notifier(struct intel_mid_otg_xceiv *iotg,
175  struct notifier_block *nb)
176 {
178 }
179 
180 #endif /* __INTEL_MID_OTG_H */